Example #1
0
 @VisitBefore(matchSubclasses = true)
 public void class_Before(Class st) {
   if (isPersistent(st)) {
     Property composite = workspace.getOpaeumLibrary().getEndToComposite(st);
     if (composite != null) {
       if (!isPersistent((Classifier) composite.getType())) {
         getErrorMap().putError(st, CompositionValidationRule.PERSISTENT_CONTAINS_PERSISTENT);
       }
       if (EmfClassifierUtil.isCompositionParticipant(st)) {
         int composites = 0;
         for (Property f : workspace.getOpaeumLibrary().getEffectiveAttributes(st)) {
           if (f instanceof Property) {
             Property p = f;
             if (!EmfPropertyUtil.isDerived(p)
                 && p.getOtherEnd() != null
                 && p.getOtherEnd().isComposite()
                 && !EmfPropertyUtil.isDerived(p.getOtherEnd())) {
               composites++;
             }
           }
         }
         if (composites > 1) {
           getErrorMap()
               .putError(st, CompositionValidationRule.ENTITIES_HAVE_ONE_COMPOSITE_ONLY, "");
         }
       }
     }
   }
 }
 private boolean addDimensions(Classifier cp, DimensionNode detail, Set<DimensionNode> leaves) {
   boolean hasParent = false;
   List<Property> propertiesInScope = EmfPropertyUtil.getEffectiveProperties(cp);
   for (Property p : propertiesInScope) {
     if (EmfPropertyUtil.isDimension(p)) {
       hasParent = true;
       DimensionNode master = new DimensionNode(cp, p);
       if (detail != null) {
         detail = detail.getCopy();
         master.detail = detail;
       }
       boolean masterHasMaster = false;
       if (p.getType() instanceof Class || p.getType() instanceof Enumeration) {
         masterHasMaster = addDimensions((Classifier) p.getType(), master, leaves);
       }
       if (!masterHasMaster) {
         leaves.add(master.linkToInnermostDetail());
       }
     }
   }
   return hasParent;
 }