Пример #1
0
 /**
  * This method validates duplicate problemTypeId and return boolean value.
  *
  * @param problemType
  * @return boolean
  */
 private boolean validateProblemTypeName(OLEProblemType problemType) {
   if (problemType.getProblemTypeName() != null) {
     Map<String, String> criteria = new HashMap<String, String>();
     criteria.put(OLEConstants.OLEProblemType.PRBLM_TYPE_NAME, problemType.getProblemTypeName());
     List<OLEProblemType> oleProblemTypeList =
         (List<OLEProblemType>)
             KRADServiceLocator.getBusinessObjectService()
                 .findMatching(OLEProblemType.class, criteria);
     if ((oleProblemTypeList.size() > 0)) {
       for (OLEProblemType oleProblemType : oleProblemTypeList) {
         String problemTypeId = oleProblemType.getProblemTypeId();
         if (null == problemType.getProblemTypeId()
             || (!problemType.getProblemTypeId().equalsIgnoreCase(problemTypeId))) {
           this.putFieldError(
               OLEConstants.OLEProblemType.PRBLM_TYPE_NAME_FIELD, OLEConstants.DUPLICATE);
           return false;
         }
       }
     }
   }
   return true;
 }