Пример #1
0
 /**
  * Checks if the new neighbor code is unique within the concept including properties.
  *
  * @param newNeighborConfig neighbor configuration entity
  * @return <code>true</code> if the add precondition is satisfied
  */
 protected boolean preAdd(NeighborConfig newNeighborConfig) {
   boolean validation = true;
   String newNeighborCode = newNeighborConfig.getCode();
   if (newNeighborCode != null) {
     for (NeighborConfig neighborConfig : this) {
       if (neighborConfig.getCode().equals(newNeighborCode)) {
         validation = false;
         log.info(newNeighborCode + " neighbor code must be unique within the concept.");
         break;
       }
     }
     for (PropertyConfig propertyConfig : conceptConfig.getPropertiesConfig()) {
       if (propertyConfig.getCode().equals(newNeighborCode)) {
         validation = false;
         log.info(
             newNeighborCode
                 + " neighbor code must be unique within the concept including properties.");
         break;
       }
     }
   } else {
     validation = false;
     log.info("Neighbor code is required.");
   }
   return validation;
 }