コード例 #1
0
ファイル: FIBModelObject.java プロジェクト: bmangez/openflexo
 private static boolean isNameUsedInHierarchy(String aName, FIBModelObject object) {
   if (object.getName() != null && object.getName().equals(aName)) {
     return true;
   }
   if (object.getEmbeddedObjects() != null) {
     for (FIBModelObject o : object.getEmbeddedObjects()) {
       if (isNameUsedInHierarchy(aName, o)) return true;
     }
   }
   return false;
 }
コード例 #2
0
ファイル: FIBModelObject.java プロジェクト: bmangez/openflexo
 private static List<FIBModelObject> retrieveObjectsWithName(
     String aName, FIBModelObject object, List<FIBModelObject> list) {
   if (object.getName() != null && object.getName().equals(aName)) {
     list.add(object);
   }
   if (object.getEmbeddedObjects() != null) {
     for (FIBModelObject o : object.getEmbeddedObjects()) {
       retrieveObjectsWithName(aName, o, list);
     }
   }
   return list;
 }
コード例 #3
0
ファイル: FIBModelObject.java プロジェクト: bmangez/openflexo
 @Override
 public ValidationIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> applyValidation(
     FIBModelObject object) {
   if (StringUtils.isNotEmpty(object.getName())) {
     List<FIBModelObject> allObjectsWithThatName = object.getObjectsWithName(object.getName());
     if (allObjectsWithThatName.size() > 1) {
       allObjectsWithThatName.remove(object);
       GenerateUniqueName fixProposal = new GenerateUniqueName();
       ProblemIssue<FIBModelObjectShouldHaveAUniqueName, FIBModelObject> returned;
       if (object instanceof FIBWidget && ((FIBWidget) object).getManageDynamicModel()) {
         returned =
             new ValidationError<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>(
                 this, object, "object_($object.toString)_has_duplicated_name", fixProposal);
       } else {
         returned =
             new ValidationWarning<FIBModelObjectShouldHaveAUniqueName, FIBModelObject>(
                 this, object, "object_($object.toString)_has_duplicated_name", fixProposal);
       }
       returned.addToRelatedValidableObjects(allObjectsWithThatName);
       return returned;
     }
   }
   return null;
 }