List of usage examples for java.lang Module.ModuleComparator Module.ModuleComparator
Module.ModuleComparator
From source file:org.openwms.core.module.ModuleServiceImpl.java
/** * {@inheritDoc}/*w ww . j a va2 s.c o m*/ * <p> * Additionally the {@code startupOrder} is re-calculated for the new {@link Module}. * * @throws org.ameba.exception.ServiceLayerException when {@code module} is {@literal null} */ @Override public Module save(Module module) { Assert.notNull(module, ExceptionCodes.MODULE_SAVE_NOT_BE_NULL); if (module.isNew()) { List<Module> all = findAll(); if (!all.isEmpty()) { Collections.sort(all, new Module.ModuleComparator()); module.setStartupOrder(all.get(all.size() - 1).getStartupOrder() + 1); } } return moduleDao.save(module); }