setLastModifiedDateYearMonthDay(new YearMonthDay()); setName(name); final int newOrder = order.intValue(); final int oldOrder = getSectionOrder() == null ? Integer.MAX_VALUE : getSectionOrder().intValue(); if (newOrder != oldOrder) { final boolean moveUp = newOrder > oldOrder; for (final Section otherSection : getSite().getAssociatedSectionsSet()) { if (otherSection.getSuperiorSection() == getSuperiorSection()) { if (otherSection != this) { final int otherOrder = otherSection.getSectionOrder().intValue(); if (moveUp) { if (otherOrder > oldOrder && otherOrder <= newOrder) { otherSection.setSectionOrder(Integer.valueOf(otherOrder - 1)); } } else { if (otherOrder >= newOrder && otherOrder < oldOrder) { otherSection.setSectionOrder(Integer.valueOf(otherOrder + 1)); } } } } } setSectionOrder(order); }
setLastModifiedDateYearMonthDay(new YearMonthDay()); setName(name); if (getSectionOrder() == null) { setSectionOrder(Integer.valueOf(Integer.MAX_VALUE)); } final int newOrder = getNewOrder(order); final int oldOrder = getSectionOrder().intValue(); if (newOrder != oldOrder) { final boolean moveUp = newOrder > oldOrder; for (final Section otherSection : getSite().getAssociatedSectionsSet()) { if (otherSection.getSuperiorSection() == getSuperiorSection()) { if (otherSection != this) { final int otherOrder = otherSection.getSectionOrder().intValue(); if (moveUp) { if (otherOrder > oldOrder && otherOrder <= newOrder) { otherSection.setSectionOrder(Integer.valueOf(otherOrder - 1)); } } else { if (otherOrder >= newOrder && otherOrder < oldOrder) { otherSection.setSectionOrder(Integer.valueOf(otherOrder + 1)); } } } } } setSectionOrder(Integer.valueOf(newOrder)); }
    public void edit(final MultiLanguageString name, final Integer order) {        if (name == null || order == null) {            throw new NullPointerException();        }        setLastModifiedDateYearMonthDay(new YearMonthDay());        setName(name);        final int newOrder = order.intValue();        final int oldOrder = getSectionOrder() == null ? Integer.MAX_VALUE : getSectionOrder().intValue();        if (newOrder != oldOrder) {            final boolean moveUp = newOrder > oldOrder;            for (final Section otherSection : getSite().getAssociatedSectionsSet()) {                if (otherSection.getSuperiorSection() == getSuperiorSection()) {                    if (otherSection != this) {                        final int otherOrder = otherSection.getSectionOrder().intValue();                        if (moveUp) {                            if (otherOrder > oldOrder && otherOrder <= newOrder) {                                otherSection.setSectionOrder(Integer.valueOf(otherOrder - 1));                            }                        } else {                            if (otherOrder >= newOrder && otherOrder < oldOrder) {                                otherSection.setSectionOrder(Integer.valueOf(otherOrder + 1));                            }                        }                    }                }            }            setSectionOrder(order);        }    }