Esempio n. 1
0
 /**
  * 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;
 }
Esempio n. 2
0
 /** Saves the label bean into the database */
 static Integer saveSimple(ILabelBean labelBean) {
   TSystemStateBean systemStateBean = (TSystemStateBean) labelBean;
   Integer systemStatusID = systemStateDAO.save(systemStateBean);
   LookupContainer.resetSystemStateMap(systemStateBean.getEntityflag());
   ClusterMarkChangesBL.markDirtySystemStatesListEntryInCluster(
       systemStateBean.getEntityflag(), systemStatusID);
   return systemStatusID;
 }
Esempio n. 3
0
 /**
  * Gets the localized options for an entity
  *
  * @param locale
  * @return
  */
 public static List<TSystemStateBean> getStatusOptions(Integer entityFlag, Locale locale) {
   List<TSystemStateBean> statusOptions = LookupContainer.getSystemStateList(entityFlag);
   if (statusOptions != null) {
     for (TSystemStateBean systemStateBean : statusOptions) {
       systemStateBean.setLabel(
           LocalizeUtil.localizeSystemStateEntry(systemStateBean, entityFlag, locale));
     }
   }
   return statusOptions;
 }
Esempio n. 4
0
 /**
  * Get the stateIDs by entityType an state flags
  *
  * @param entityType
  * @param stateFlag
  * @return
  */
 public static List<TSystemStateBean> getSystemStatesByByEntityAndStateFlags(
     Integer entityType, int[] stateFlagArr) {
   List<TSystemStateBean> systemList = LookupContainer.getSystemStateList(entityType);
   List<TSystemStateBean> systemListByStateFlag = new LinkedList<TSystemStateBean>();
   Set<Integer> stateFlagsSet = GeneralUtils.createSetFromIntArr(stateFlagArr);
   if (systemList != null) {
     for (TSystemStateBean systemStateBean : systemList) {
       Integer stateFlag = systemStateBean.getStateflag();
       if (stateFlagsSet.contains(stateFlag)) {
         systemListByStateFlag.add(systemStateBean);
       }
     }
   }
   return systemListByStateFlag; // systemStateDAO.loadWithStateFlagForEntity(entityType,
                                 // stateFlag);
 }
Esempio n. 5
0
 /**
  * Gets the status flag for an objectID
  *
  * @param statusID
  * @return
  */
 public static Integer getStatusFlagForStatusID(Integer entityType, Integer statusID) {
   List<TSystemStateBean> systemStateList = LookupContainer.getSystemStateList(entityType);
   if (systemStateList != null) {
     for (TSystemStateBean systemStateBean : systemStateList) {
       Integer objectID = systemStateBean.getObjectID();
       if (objectID.equals(statusID)) {
         return systemStateBean.getStateflag();
       }
     }
   }
   TSystemStateBean systemStateBean = systemStateDAO.loadByPrimaryKey(statusID);
   if (systemStateBean != null) {
     return systemStateBean.getStateflag();
   }
   return null;
 }
Esempio n. 6
0
 /**
  * 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);
   }
 }