/**
  * Loads a list of attributeValueBeans from the TAttributeValue table by an array of workItemIDs
  *
  * @param workItemIDs
  * @return
  */
 @Override
 public List<TAttributeValueBean> loadByWorkItemKeys(int[] workItemIDs) {
   List<TAttributeValueBean> attributeValueBeansList = new ArrayList<TAttributeValueBean>();
   List<TAttributeValue> tav = new ArrayList<TAttributeValue>();
   if (workItemIDs == null || workItemIDs.length == 0) {
     return attributeValueBeansList;
   }
   Criteria criteria;
   List<int[]> workItemIDChunksList = GeneralUtils.getListOfChunks(workItemIDs);
   if (workItemIDChunksList == null) {
     return attributeValueBeansList;
   }
   Iterator<int[]> iterator = workItemIDChunksList.iterator();
   while (iterator.hasNext()) {
     int[] workItemIDChunk = iterator.next();
     criteria = new Criteria();
     criteria.addIn(WORKITEM, workItemIDChunk);
     try {
       tav.addAll(doSelect(criteria));
     } catch (Exception e) {
       LOGGER.error(
           "Loading the attributeValueBeans by workItemIDs failed with " + e.getMessage());
     }
   }
   return convertTorqueListToBeanList(tav);
 }
 /**
  * Get the custom option type attributeValueBeans for an array of workItemIDs
  *
  * @param workItemIDs
  * @return
  */
 @Override
 public List<TAttributeValueBean> loadLuceneCustomOptionAttributeValues(int[] workItemIDs) {
   List<TAttributeValueBean> attributeValueBeansList = new ArrayList<TAttributeValueBean>();
   if (workItemIDs == null || workItemIDs.length == 0) {
     return attributeValueBeansList;
   }
   Criteria criteria;
   List<int[]> workItemIDChunksList = GeneralUtils.getListOfChunks(workItemIDs);
   if (workItemIDChunksList == null) {
     return attributeValueBeansList;
   }
   Iterator<int[]> iterator = workItemIDChunksList.iterator();
   while (iterator.hasNext()) {
     int[] workItemIDChunk = iterator.next();
     criteria = new Criteria();
     criteria.addIn(WORKITEM, workItemIDChunk);
     try {
       attributeValueBeansList.addAll(getReportCustomOptionAttributeValues(criteria));
     } catch (Exception e) {
       LOGGER.error(
           "Loading the custom option type attributeValueBeans by workItemIDs failed with "
               + e.getMessage());
     }
   }
   return attributeValueBeansList;
 }
 /**
  * Whether a system option from list appears as custom attribute The reflection does not work
  * because an additional condition should be satisfied (no direct foreign key relationship exists)
  *
  * @param objectIDs
  * @param fieldID
  */
 @Override
 public boolean isSystemOptionAttribute(List<Integer> objectIDs, Integer fieldID) {
   if (objectIDs == null || objectIDs.isEmpty()) {
     return false;
   }
   List attributes = null;
   Criteria selectCriteria;
   List<int[]> chunkList = GeneralUtils.getListOfChunks(objectIDs);
   Iterator<int[]> iterator = chunkList.iterator();
   while (iterator.hasNext()) {
     int[] idChunk = iterator.next();
     selectCriteria = new Criteria();
     selectCriteria.addIn(SYSTEMOPTIONID, idChunk);
     selectCriteria.add(SYSTEMOPTIONTYPE, fieldID);
     selectCriteria.setDistinct();
     try {
       attributes = doSelect(selectCriteria);
     } catch (Exception e) {
       LOGGER.error(
           "Verifiying the dependent "
               + "oldPersonIDs "
               + objectIDs.size()
               + " for the user picker failed with "
               + e.getMessage(),
           e);
     }
     if (attributes != null && !attributes.isEmpty()) {
       return true;
     }
   }
   return false;
 }
 /**
  * Loads a filterCategoryBeans by parentIDs
  *
  * @param parentIDs
  * @return
  */
 @Override
 public List<TReportCategoryBean> loadByParents(List<Integer> parentIDs) {
   List<TReportCategory> categories = new ArrayList<TReportCategory>();
   if (parentIDs == null || parentIDs.isEmpty()) {
     return new ArrayList<TReportCategoryBean>();
   }
   List<int[]> parentIDChunksList = GeneralUtils.getListOfChunks(parentIDs);
   if (parentIDChunksList != null && !parentIDChunksList.isEmpty()) {
     Iterator<int[]> iterator = parentIDChunksList.iterator();
     while (iterator.hasNext()) {
       int[] parentIDsChunk = iterator.next();
       Criteria criteria = new Criteria();
       criteria.addIn(PARENTID, parentIDsChunk);
       criteria.addAscendingOrderByColumn(LABEL);
       try {
         categories.addAll(doSelect(criteria));
       } catch (Exception e) {
         LOGGER.error(
             "Getting the report categories by parents "
                 + parentIDsChunk.length
                 + " failed with "
                 + e.getMessage(),
             e);
       }
     }
   }
   return convertTorqueListToBeanList(categories);
 }
Beispiel #5
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);
 }
 /**
  * Gets the user picker attributes by a list of workItemIDs
  *
  * @param allWorkItemIDs
  * @return
  */
 @Override
 public List<TAttributeValueBean> getUserPickerAttributesByWorkItems(List<Integer> workItemIDs) {
   List<TAttributeValueBean> attributeValueBeans = new LinkedList<TAttributeValueBean>();
   if (workItemIDs == null || workItemIDs.isEmpty()) {
     return attributeValueBeans;
   }
   List<int[]> workItemIDChunksList = GeneralUtils.getListOfChunks(workItemIDs);
   Iterator<int[]> chunkIterator = workItemIDChunksList.iterator();
   while (chunkIterator.hasNext()) {
     int[] workItemIDChunk = chunkIterator.next();
     Criteria crit = new Criteria();
     crit.addIn(WORKITEM, workItemIDChunk);
     crit.add(VALIDVALUE, ValueType.SYSTEMOPTION);
     crit.add(SYSTEMOPTIONTYPE, SystemFields.INTEGER_PERSON);
     try {
       attributeValueBeans.addAll(convertTorqueListToBeanList(doSelect(crit)));
     } catch (TorqueException e) {
       LOGGER.error(
           "Loading the user pickers by workItemIDs failed with failed with " + e.getMessage());
     }
   }
   return attributeValueBeans;
 }
 static void deleteTemplateDef(String mailTemplateIDs) {
   List<Integer> ids = GeneralUtils.createIntegerListFromString(mailTemplateIDs);
   for (Integer id : ids) {
     deleteTemplateDef(id);
   }
 }