/** * Saves a new/modified list entry If sortOrder is not set it will be set to be the next available * sortOrder according to listID and parentID * * @param systemStateBean * @param locale * @return */ static synchronized Integer save(TSystemStateBean systemStateBean, Locale locale) { boolean isNew = systemStateBean.getObjectID() == null; if (systemStateBean.getSortorder() == null) { Integer sortOrder = systemStateDAO.getNextSortOrder(systemStateBean.getEntityflag()); systemStateBean.setSortorder(sortOrder); } Integer objectID = systemStateDAO.save(systemStateBean); if (isNew) { systemStateBean.setObjectID(objectID); } else { // The localization is loaded from localized resources table, and if not found, // from the localized property files, and if not found from the "native" table. // The value should be saved also with the default locale only if it is edited // (new entities have no correspondence in the localized property files) LocalizeBL.saveSystemStateLocalizedResource( systemStateBean.getEntityflag(), systemStateBean.getObjectID(), systemStateBean.getLabel(), locale); } // cache and possible lucene update in other cluster nodes LookupContainer.resetSystemStateMap(systemStateBean.getEntityflag()); ClusterMarkChangesBL.markDirtySystemStatesListEntryInCluster( systemStateBean.getEntityflag(), objectID); return objectID; }
/** * Deletes the severity * * @param objectID */ static void delete(Integer objectID) { if (objectID != null) { TSystemStateBean systemStateBean = systemStateDAO.loadByPrimaryKey(objectID); Integer iconKey = null; if (systemStateBean != null) { iconKey = systemStateBean.getIconKey(); } systemStateDAO.delete(objectID); if (iconKey != null) { BlobBL.delete(iconKey); } // remove localized resource LocalizeBL.removeLocalizedResources( new TSystemStateBean().getKeyPrefix() + systemStateBean.getEntityflag() + ".", objectID); LookupContainer.resetSystemStateMap(systemStateBean.getEntityflag()); ClusterMarkChangesBL.markDirtySystemStatesListEntryInCluster( systemStateBean.getEntityflag(), objectID); } }