svn commit: r15557 - branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml: cognitive i18n kernel profile profile/internal ui ui/explorer ui/explorer/rules uml/cognitive/critics

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-08-13 04:47:36-0700
New Revision: 15557

Added:
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoCriticsToCritic.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java
Modified:
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java
   branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java

Log:
organizing critics in profiles



Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/CompoundCritic.java	2008-08-13 04:47:36-0700
@@ -61,6 +61,12 @@
      */
     private List<Critic> critics = new ArrayList<Critic>();
 
+    /**
+     * The extra design materials to be returned along with 
+     * {@link #getCriticizedDesignMaterials()}
+     */
+    private Set<Object> extraDesignMaterials = new HashSet<Object>();
+    
     ////////////////////////////////////////////////////////////////
     // constructor
 
@@ -306,7 +312,25 @@
         for (Critic cr : this.critics) {
             ret.addAll(cr.getCriticizedDesignMaterials());
         }
+        ret.addAll(extraDesignMaterials);
         return ret;
     }
+
+    /**
+     * Extra criticized design material to be added to the list returned by 
+     * {@link #getCriticizedDesignMaterials()}
+     * 
+     * @param dm extra design material
+     */
+    public void addExtraCriticizedDesignMaterial(Object dm) {
+        this.extraDesignMaterials.add(dm);
+    }
+    
+    /*
+     * @see org.argouml.cognitive.Critic#toString()
+     */
+    public String toString() {
+        return critics.toString(); 
+    }
     
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/cognitive/Critic.java	2008-08-13 04:47:36-0700
@@ -1086,7 +1086,8 @@
      */
     @Override
     public String toString() {
-	return getCriticName();
+	//return getCriticName();
+        return getHeadline();
     }
 
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/misc.properties	2008-08-13 04:47:36-0700
@@ -149,14 +149,18 @@
 misc.primitive.text = Text
 misc.profile.unnamed = Unnamed Profile
 misc.profile.model = Profile->Model
+misc.profile.explorer.critic = Critics
 misc.profileconfiguration.profile = Profile Configuration->Profile
 misc.project.collaboration = Project->Collaboration
 misc.project.diagram = Project->Diagram
 misc.project.model = Project->Model
-misc.project.critic = Project->Critic
+misc.project.critics = Project->Critic
+misc.project.critic = Critics->Critic
 misc.project.profileconfiguration = Project->Profile Configuration
 misc.project.roots = Project->Root Elements
 misc.project.state-machine = Project->State Machine
+misc.profile.explorer.critics = Critics
+misc.profile.explorer.compound = Compound Critic
 misc.properties = Properties
 misc.receives = Receives:
 misc.sends = Sends:

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/kernel/ProjectImpl.java	2008-08-13 04:47:36-0700
@@ -51,6 +51,7 @@
 import org.argouml.persistence.PersistenceManager;
 import org.argouml.profile.Profile;
 import org.argouml.profile.ProfileException;
+import org.argouml.profile.ProfileFacade;
 import org.argouml.uml.CommentEdge;
 import org.argouml.uml.ProjectMemberModel;
 import org.argouml.uml.cognitive.ProjectMemberTodoList;
@@ -1154,7 +1155,9 @@
 
         // there's just one ProfileConfiguration in a project
         // and there's no other way to add another one
-        members.add(pc);        
+        members.add(pc);
+        
+        ProfileFacade.applyConfiguration(pc);
     }
 
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/Profile.java	2008-08-13 04:47:36-0700
@@ -24,11 +24,13 @@
 
 package org.argouml.profile;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Set;
 
 import org.argouml.cognitive.Critic;
+import org.argouml.model.Model;
 
 /**
  * Abstract class representing a Profile. It contains default types and
@@ -127,7 +129,9 @@
      *         profile.
      * @throws ProfileException if failed to get profile.
      */
-    public abstract Collection getProfilePackages() throws ProfileException;
+    public Collection getProfilePackages() throws ProfileException {
+        return new ArrayList();
+    }
 
     /**
      * @return the display name

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileFacade.java	2008-08-13 04:47:36-0700
@@ -24,6 +24,8 @@
 
 package org.argouml.profile;
 
+import org.argouml.kernel.ProfileConfiguration;
+
 /**
  * The <a href="http://en.wikipedia.org/wiki/Facade_pattern">Facade</a> of the 
  * profile subsystem. 
@@ -84,5 +86,14 @@
     public static boolean isInitiated() {
         return manager != null;
     }
+
+    /**
+     * Applies the given ProfileConfiguration to ArgoUML
+     * 
+     * @param pc the profile configuration
+     */
+    public static void applyConfiguration(ProfileConfiguration pc) {
+        getManager().applyConfiguration(pc);
+    }
     
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/ProfileManager.java	2008-08-13 04:47:36-0700
@@ -26,6 +26,8 @@
 
 import java.util.List;
 
+import org.argouml.kernel.ProfileConfiguration;
+
 /**
  * Interface to the manager for the global set of registered profiles.
  * 
@@ -122,4 +124,11 @@
      * @return profile
      */
     Profile lookForRegisteredProfile(String profile);
+
+    /**
+     * Apply the given ProfileConfiguration to ArgoUML
+     * 
+     * @param pc the profile configuration
+     */
+    void applyConfiguration(ProfileConfiguration pc);
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileJava.java	2008-08-13 04:47:36-0700
@@ -41,7 +41,7 @@
 /**
  * This class represents the Java default Profile
  *
- * @author Marcos Aurélio
+ * @author Marcos Aur�lio
  */
 public class ProfileJava extends Profile {
 
@@ -73,6 +73,7 @@
         }
 
         addProfileDependency(uml);
+        addProfileDependency("CodeGeneration");
     }    
     
     ProfileJava() throws ProfileException {

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileManagerImpl.java	2008-08-13 04:47:36-0700
@@ -36,6 +36,7 @@
 import org.argouml.cognitive.Critic;
 import org.argouml.configuration.Configuration;
 import org.argouml.configuration.ConfigurationKey;
+import org.argouml.kernel.ProfileConfiguration;
 import org.argouml.model.Model;
 import org.argouml.model.UmlException;
 import org.argouml.profile.Profile;
@@ -82,7 +83,7 @@
     private Profile profileUML;
     
     private Profile profileJava;
-
+    
     /**
      * Constructor - includes initialization of built-in default profiles.
      */
@@ -369,4 +370,22 @@
         return null;
     }
 
+    /*
+     * @param pc
+     * @see org.argouml.profile.ProfileManager#applyConfiguration(org.argouml.kernel.ProfileConfiguration)
+     */
+    public void applyConfiguration(ProfileConfiguration pc) {
+        for (Profile p : this.profiles) {
+            for (Critic c : p.getCritics()) {
+                c.setEnabled(false);
+            }
+        }
+        
+        for (Profile p : pc.getProfiles()) {
+            for (Critic c : p.getCritics()) {
+                c.setEnabled(true);
+            }
+        }        
+    }
+
 }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ProfileUML.java	2008-08-13 04:47:36-0700
@@ -27,7 +27,11 @@
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
 
+import org.argouml.cognitive.Critic;
+import org.argouml.cognitive.ToDoItem;
 import org.argouml.model.Model;
 import org.argouml.profile.CoreProfileReference;
 import org.argouml.profile.DefaultTypeStrategy;
@@ -37,11 +41,45 @@
 import org.argouml.profile.ProfileModelLoader;
 import org.argouml.profile.ProfileReference;
 import org.argouml.profile.ResourceModelLoader;
+import org.argouml.profile.internal.ocl.CrOCL;
+import org.argouml.profile.internal.ocl.InvalidOclException;
+import org.argouml.uml.cognitive.critics.CrAssocNameConflict;
+import org.argouml.uml.cognitive.critics.CrAttrNameConflict;
+import org.argouml.uml.cognitive.critics.CrCircularAssocClass;
+import org.argouml.uml.cognitive.critics.CrCircularInheritance;
+import org.argouml.uml.cognitive.critics.CrClassMustBeAbstract;
+import org.argouml.uml.cognitive.critics.CrCrossNamespaceAssoc;
+import org.argouml.uml.cognitive.critics.CrDupParamName;
+import org.argouml.uml.cognitive.critics.CrDupRoleNames;
+import org.argouml.uml.cognitive.critics.CrFinalSubclassed;
+import org.argouml.uml.cognitive.critics.CrForkOutgoingTransition;
+import org.argouml.uml.cognitive.critics.CrIllegalGeneralization;
+import org.argouml.uml.cognitive.critics.CrInterfaceAllPublic;
+import org.argouml.uml.cognitive.critics.CrInterfaceOperOnly;
+import org.argouml.uml.cognitive.critics.CrInvalidBranch;
+import org.argouml.uml.cognitive.critics.CrInvalidFork;
+import org.argouml.uml.cognitive.critics.CrInvalidHistory;
+import org.argouml.uml.cognitive.critics.CrInvalidInitial;
+import org.argouml.uml.cognitive.critics.CrInvalidJoin;
+import org.argouml.uml.cognitive.critics.CrInvalidJoinTriggerOrGuard;
+import org.argouml.uml.cognitive.critics.CrInvalidPseudoStateTrigger;
+import org.argouml.uml.cognitive.critics.CrInvalidSynch;
+import org.argouml.uml.cognitive.critics.CrJoinIncomingTransition;
+import org.argouml.uml.cognitive.critics.CrMultiComposite;
+import org.argouml.uml.cognitive.critics.CrMultipleAgg;
+import org.argouml.uml.cognitive.critics.CrMultipleDeepHistoryStates;
+import org.argouml.uml.cognitive.critics.CrMultipleShallowHistoryStates;
+import org.argouml.uml.cognitive.critics.CrNWayAgg;
+import org.argouml.uml.cognitive.critics.CrNameConflict;
+import org.argouml.uml.cognitive.critics.CrNameConflictAC;
+import org.argouml.uml.cognitive.critics.CrNameConfusion;
+import org.argouml.uml.cognitive.critics.CrOppEndConflict;
+import org.argouml.uml.cognitive.critics.CrOppEndVsAttr;
 
 /**
  * This class represents the default UML profile
  *
- * @author Marcos Aurélio
+ * @author maurelio1234
  */
 public class ProfileUML extends Profile {
     
@@ -52,7 +90,7 @@
     private FormatingStrategy formatingStrategy;
     private ProfileModelLoader profileModelLoader;
     private Collection model;
-    
+        
     /**
      * Construct a Profile for UML modeling. 
      * @throws ProfileException 
@@ -73,9 +111,174 @@
         if (model == null) {
             model = new ArrayList();
             model.add(Model.getModelManagementFactory().createModel());
-        }        
+        }
+        
+        loadWellFormednessRules();
     }    
 
+    private void loadWellFormednessRules() {
+        Set<Critic> critics = new HashSet<Critic>();
+        
+        critics.add(new CrAssocNameConflict());
+        critics.add(new CrAttrNameConflict());
+        critics.add(new CrCircularAssocClass());
+        critics.add(new CrCircularInheritance());
+        critics.add(new CrClassMustBeAbstract());
+        critics.add(new CrCrossNamespaceAssoc());
+        critics.add(new CrDupParamName());
+        critics.add(new CrDupRoleNames());
+        critics.add(new CrNameConfusion());
+
+        critics.add(new CrInvalidHistory());
+        critics.add(new CrInvalidSynch());
+        critics.add(new CrInvalidJoinTriggerOrGuard());
+        critics.add(new CrInvalidPseudoStateTrigger());
+        critics.add(new CrInvalidInitial());
+        
+        critics.add(new CrInvalidJoin());
+        critics.add(new CrInvalidFork());
+        critics.add(new CrInvalidBranch());
+
+        critics.add(new CrMultipleDeepHistoryStates());
+        critics.add(new CrMultipleShallowHistoryStates());
+        critics.add(new CrForkOutgoingTransition());
+        critics.add(new CrJoinIncomingTransition());
+
+        critics.add(new CrFinalSubclassed());
+        critics.add(new CrIllegalGeneralization());
+        critics.add(new CrInterfaceAllPublic());
+        critics.add(new CrInterfaceOperOnly());
+        critics.add(new CrMultipleAgg());
+        critics.add(new CrNWayAgg());
+        critics.add(new CrNameConflictAC());
+        
+        critics.add(new CrOppEndConflict());
+        critics.add(new CrMultiComposite());
+        critics.add(new CrNameConflict());
+        critics.add(new CrOppEndVsAttr());
+
+        // Missing WFRs
+        
+        // Association Class
+        // 4.5.3.2 [1]
+        
+        try {
+            critics.add(new CrOCL("context AssociationClass inv:"
+                    + "self.allConnections->"
+                    + "forAll( ar | self.allFeatures->"
+                    + "forAll( f | f.oclIsKindOf(StructuralFeature) "
+                    + "implies ar.name <> f.name ))",
+                    "The names of the AssociationEnds and "
+                            + "the StructuralFeatures do not overlap.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+        
+        // 4.5.3.2 [2]
+        
+        try {
+            critics.add(new CrOCL("context AssociationClass inv:"
+                    + "self.allConnections->"
+                    + "forAll(ar | ar.participant <> self)",
+
+            "An AssociationClass cannot be defined "
+                    + "between itself and something else.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+        
+        // Behavioral Feature
+        // 4.5.3.5 [2]
+
+        // it works, but a bug in namespace.contents prevents it from 
+        // working when the type of the parameter comes from a profile         
+//        try {
+//            Agency.register(new CrOCL("context BehavioralFeature inv:"
+//                    + "self.parameter->"
+//                    + "forAll( p | self.owner.namespace.allContents->"
+//                    + "includes (p.type) )",
+//                    "The type of the Parameters should be "
+//                            + "included in the Namespace of the Classifier.",
+//                    null, ToDoItem.HIGH_PRIORITY, null, null,
+//                    "http://www.uml.org/"));
+//        } catch (InvalidOclException e) {
+//            e.printStackTrace();
+//        }
+        
+        // Classfier
+        // 4.5.3.8 [5]
+        try {
+            critics.add(new CrOCL("context Classifier inv:"
+                    + "self.oppositeAssociationEnds->" 
+                    + "forAll( o | not self.allAttributes->" 
+                    + "union (self.allContents)->" 
+                    + "collect ( q | q.name )->includes (o.name) )",
+            "The name of an opposite AssociationEnd may not be the same "
+          + "as the name of an Attribute or a ModelElement contained "
+          + "in the Classifier.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+
+        // DataType
+        // 4.5.3.12 [1]
+        try {
+            critics.add(new CrOCL("context DataType inv:"
+                    + "self.allFeatures->forAll(f | f.oclIsKindOf(Operation)"
+                    + " and f.oclAsType(Operation).isQuery)",
+                    "A DataType can only contain Operations, "
+                            + "which all must be queries.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+
+        // GeneralizableElement
+        // 4.5.3.20 [1]
+        try {
+            critics.add(new CrOCL("context GeneralizableElement inv:"
+                    + "self.isRoot implies self.generalization->isEmpty",
+                    "A root cannot have any Generalizations.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+
+        // 4.5.3.20 [4]
+        try {
+            critics.add(new CrOCL("context GeneralizableElement inv:"
+                    + "self.generalization->"
+                    + "forAll(g |self.namespace.allContents->"
+                    + "includes(g.parent) )",
+                    "The parent must be included in the Namespace of"
+                            + " the GeneralizableElement.", null,
+                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }
+ 
+        // Namespace
+        // 4.5.3.26 [2]
+        try {
+            critics.add(new CrOCL("context Namespace inv:"
+                    + "self.allContents -> select(oclIsKindOf(Association))->"
+                    + "forAll(a1, a2 |a1.name = a2.name and "
+                    + "a1.connection.participant = a2.connection.participant"
+                    + " implies a1 = a2)",
+                    "All Associations must have a unique combination of name "
+                            + "and associated Classifiers in the Namespace.",
+                    null, ToDoItem.HIGH_PRIORITY, null, null,
+                    "http://www.uml.org/"));
+        } catch (InvalidOclException e) {
+            e.printStackTrace();
+        }        
+        
+        setCritics(critics);
+    }
+
     @Override
     public FormatingStrategy getFormatingStrategy() {
         return formatingStrategy;

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/ProjectSettingsTabProfile.java	2008-08-13 04:47:36-0700
@@ -51,6 +51,7 @@
 import org.argouml.application.api.GUISettingsTabInterface;

 import org.argouml.i18n.Translator;

 import org.argouml.kernel.ProfileConfiguration;

+import org.argouml.kernel.Project;

 import org.argouml.kernel.ProjectManager;

 import org.argouml.kernel.ProjectSettings;

 import org.argouml.profile.Profile;

@@ -420,8 +421,8 @@
 

     public void handleSettingsTabSave() {

         List<Profile> toRemove = new ArrayList<Profile>();

-        ProfileConfiguration pc = ProjectManager.getManager()

-                .getCurrentProject().getProfileConfiguration();

+        Project proj = ProjectManager.getManager().getCurrentProject();

+        ProfileConfiguration pc = proj.getProfileConfiguration();

 

         List<Profile> usedItens = new ArrayList<Profile>();

 

@@ -448,6 +449,7 @@
             }

         }

 

+        proj.setProfileConfiguration(pc);

     }

 

 }


Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/PerspectiveManager.java	2008-08-13 04:47:36-0700
@@ -49,6 +49,7 @@
 import org.argouml.ui.explorer.rules.GoCollaborationToInteraction;
 import org.argouml.ui.explorer.rules.GoComponentToResidentModelElement;
 import org.argouml.ui.explorer.rules.GoCompositeStateToSubvertex;
+import org.argouml.ui.explorer.rules.GoCriticsToCritic;
 import org.argouml.ui.explorer.rules.GoDiagramToEdge;
 import org.argouml.ui.explorer.rules.GoDiagramToNode;
 import org.argouml.ui.explorer.rules.GoElementToMachine;
@@ -334,6 +335,7 @@
         classPerspective.addRule(new GoProfileConfigurationToProfile());
         classPerspective.addRule(new GoProfileToModel());
         classPerspective.addRule(new GoProfileToCritics());
+        classPerspective.addRule(new GoCriticsToCritic());
         classPerspective.addRule(new GoProjectToRoots());
         classPerspective.addRule(new GoNamespaceToClassifierAndPackage());
         classPerspective.addRule(new GoNamespaceToDiagram());
@@ -353,6 +355,7 @@
         packagePerspective.addRule(new GoProfileConfigurationToProfile());
         packagePerspective.addRule(new GoProfileToModel());
         packagePerspective.addRule(new GoProfileToCritics());
+        packagePerspective.addRule(new GoCriticsToCritic());
         packagePerspective.addRule(new GoProjectToRoots());
         packagePerspective.addRule(new GoNamespaceToOwnedElements());
         packagePerspective.addRule(new GoPackageToElementImport());
@@ -402,6 +405,7 @@
         diagramPerspective.addRule(new GoProfileConfigurationToProfile());
         diagramPerspective.addRule(new GoProfileToModel());
         diagramPerspective.addRule(new GoProfileToCritics());
+        diagramPerspective.addRule(new GoCriticsToCritic());
         diagramPerspective.addRule(new GoModelToDiagrams());
         diagramPerspective.addRule(new GoDiagramToNode());
         diagramPerspective.addRule(new GoDiagramToEdge());
@@ -417,6 +421,7 @@
         classPerspective.addRule(new GoProfileConfigurationToProfile());
         classPerspective.addRule(new GoProfileToModel());
         classPerspective.addRule(new GoProfileToCritics());
+        classPerspective.addRule(new GoCriticsToCritic());
         inheritancePerspective.addRule(new GoModelToBaseElements());
         inheritancePerspective
                 .addRule(new GoGeneralizableElementToSpecialized());
@@ -429,6 +434,7 @@
         associationsPerspective.addRule(new GoProfileConfigurationToProfile());
         associationsPerspective.addRule(new GoProfileToModel());
         associationsPerspective.addRule(new GoProfileToCritics());
+        associationsPerspective.addRule(new GoCriticsToCritic());
         associationsPerspective.addRule(new GoNamespaceToDiagram());
         associationsPerspective.addRule(new GoPackageToClass());
         associationsPerspective.addRule(new GoClassToAssociatedClass());
@@ -441,6 +447,7 @@
         residencePerspective.addRule(new GoProfileConfigurationToProfile());
         residencePerspective.addRule(new GoProfileToModel());
         residencePerspective.addRule(new GoProfileToCritics());
+        residencePerspective.addRule(new GoCriticsToCritic());
         residencePerspective.addRule(new GoModelToNode());
         residencePerspective.addRule(new GoNodeToResidentComponent());
         residencePerspective.addRule(new GoComponentToResidentModelElement());
@@ -476,6 +483,7 @@
         compositionPerspective.addRule(new GoProfileConfigurationToProfile());
         compositionPerspective.addRule(new GoProfileToModel());
         compositionPerspective.addRule(new GoProfileToCritics());
+        compositionPerspective.addRule(new GoCriticsToCritic());
         compositionPerspective.addRule(new GoProjectToRoots());
         compositionPerspective.addRule(new GoModelElementToContents());
         compositionPerspective.addRule(new GoModelElementToContainedDiagrams());
@@ -542,6 +550,7 @@
             new GoProfileConfigurationToProfile(),
             new GoProfileToModel(),
             new GoProfileToCritics(),
+            new GoCriticsToCritic(),
             new GoProjectToRoots(),
             new GoSignalToReception(), new GoStateMachineToTop(),
             new GoStatemachineToDiagram(), new GoStateMachineToState(),

Added: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoCriticsToCritic.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoCriticsToCritic.java?view=auto&rev=15557
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoCriticsToCritic.java	2008-08-13 04:47:36-0700
@@ -0,0 +1,102 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.ui.explorer.rules;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Set;
+import java.util.Vector;
+
+import org.argouml.cognitive.CompoundCritic;
+import org.argouml.cognitive.Critic;
+import org.argouml.i18n.Translator;
+import org.argouml.profile.Profile;
+
+/**
+ * Show the critics exported by a Profile
+ * 
+ * @author maurelio1234
+ */
+public class GoCriticsToCritic implements PerspectiveRule {
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getRuleName()
+     */
+    public String getRuleName() {
+        return Translator.localize("misc.profile.critic");
+    }
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getChildren(java.lang.Object)
+     */
+    public Collection getChildren(final Object parent) {
+        if (parent instanceof Vector) {
+            Vector v = (Vector) parent;
+            if (!v.isEmpty()) {
+                if (v.firstElement() instanceof Critic) {
+                    Vector<Object> ret = new Vector<Object>();
+                    for (Object critic : v) {
+                        final Critic fc = (Critic) critic;
+                        if (critic instanceof CompoundCritic) {
+
+                            Object compound = new Vector<Critic>() {
+                                {
+                                    addAll(((CompoundCritic) fc)
+                                            .getCriticList());
+                                }
+
+                                /*
+                                 * @see java.util.Vector#toString()
+                                 */
+                                public String toString() {
+                                    return Translator
+                                            .localize("misc.profile.explorer.compound");
+                                }
+                            };
+
+                            ret.add(compound);
+                        } else {
+                            ret.add(critic);
+                        }
+                    }
+                    return ret;
+                } else {
+                    return (Collection) parent;
+                }
+            } else {
+                return Collections.EMPTY_SET;
+            }
+        }
+        return Collections.EMPTY_SET;
+    }
+
+    /*
+     * @see org.argouml.ui.explorer.rules.PerspectiveRule#getDependencies(java.lang.Object)
+     */
+    public Set getDependencies(Object parent) {
+        // TODO: What?
+        return Collections.EMPTY_SET;
+    }
+}

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/ui/explorer/rules/GoProfileToCritics.java	2008-08-13 04:47:36-0700
@@ -27,7 +27,9 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Set;
+import java.util.Vector;
 
+import org.argouml.cognitive.Critic;
 import org.argouml.i18n.Translator;
 import org.argouml.profile.Profile;
 
@@ -42,15 +44,30 @@
      * @see org.argouml.ui.explorer.rules.PerspectiveRule#getRuleName()
      */
     public String getRuleName() {
-        return Translator.localize("misc.profile.critic");
+        return Translator.localize("misc.profile.critics");
     }
 
     /*
      * @see org.argouml.ui.explorer.rules.PerspectiveRule#getChildren(java.lang.Object)
      */
-    public Collection getChildren(Object parent) {
+    public Collection getChildren(final Object parent) {
         if (parent instanceof Profile) {
-            return ((Profile) parent).getCritics();
+            Object critics = new Vector<Critic>() {
+                {
+                    addAll(((Profile) parent).getCritics());
+                }
+
+                /*
+                 * @see java.util.Vector#toString()
+                 */
+                public String toString() {
+                    return Translator.localize("misc.profile.explorer.critic");
+                }
+            };
+            
+            Vector<Object> ret = new Vector<Object>();
+            ret.add(critics);
+            return ret;
         }
         return Collections.EMPTY_SET;
     }

Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java?view=diff&rev=15557&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java&r1=15556&r2=15557
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java	(original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java	2008-08-13 04:47:36-0700
@@ -30,16 +30,7 @@
 import org.argouml.application.api.AbstractArgoJPanel;
 import org.argouml.application.api.GUISettingsTabInterface;
 import org.argouml.application.api.InitSubsystem;
-import org.argouml.cognitive.Agency;
-import org.argouml.cognitive.CompoundCritic;
-import org.argouml.cognitive.Critic;
-import org.argouml.cognitive.ToDoItem;
-import org.argouml.model.Model;
-import org.argouml.profile.internal.ocl.CrOCL;
-import org.argouml.profile.internal.ocl.InvalidOclException;
-import org.argouml.uml.diagram.deployment.ui.UMLDeploymentDiagram;
-import org.argouml.uml.diagram.ui.FigEdgeModelElement;
-import org.argouml.uml.diagram.ui.UMLDiagram;
+import org.argouml.profile.ProfileFacade;
 
 /**
  * Registers critics for use in ArgoUML.  This class is called at
@@ -51,500 +42,12 @@
  */
 public class InitCognitiveCritics implements InitSubsystem {
 
-    // UML specific
-    private static Critic crAssocNameConflict = new CrAssocNameConflict();
-    
-    private static Critic crAttrNameConflict = new CrAttrNameConflict();
-
-    private static Critic crOperNameConflict = new CrOperNameConflict();
-
-    private static Critic crCircularAssocClass = new CrCircularAssocClass();
-
-    private static Critic crCircularInheritance = new CrCircularInheritance();
-
-    private static Critic crCircularComposition = new CrCircularComposition();
-
-    private static Critic crCrossNamespaceAssoc = new CrCrossNamespaceAssoc();
-
-    private static Critic crDupParamName = new CrDupParamName();
-
-    private static Critic crDupRoleNames = new CrDupRoleNames();
-
-    private static Critic crFinalSubclassed = new CrFinalSubclassed();
-
-    private static Critic crIllegalGeneralization =
-	new CrIllegalGeneralization();
-
-    private static Critic crAlreadyRealizes = new CrAlreadyRealizes();
-
-    private static Critic crInterfaceAllPublic = new CrInterfaceAllPublic();
-
-    private static Critic crInterfaceOperOnly = new CrInterfaceOperOnly();
-
-    private static Critic crMultipleAgg = new CrMultipleAgg();
-
-    private static Critic crNWayAgg = new CrNWayAgg();
-
-    private static Critic crNavFromInterface = new CrNavFromInterface();
-
-    private static Critic crUnnavigableAssoc = new CrUnnavigableAssoc();
-
-    private static Critic crNameConflictAC = new CrNameConflictAC();
-
-    private static Critic crMissingClassName = new CrMissingClassName();
-
-    private static Critic crMissingAttrName = new CrMissingAttrName();
-
-    private static Critic crMissingOperName = new CrMissingOperName();
-
-    private static Critic crMissingStateName = new CrMissingStateName();
-
-    private static Critic crNoInstanceVariables = new CrNoInstanceVariables();
-
-    private static Critic crNoAssociations = new CrNoAssociations();
-
-    private static Critic crNonAggDataType = new CrNonAggDataType();
-
-    private static Critic crOppEndConflict = new CrOppEndConflict();
-
-    private static Critic crUselessAbstract = new CrUselessAbstract();
-
-    private static Critic crUselessInterface = new CrUselessInterface();
-
-    private static Critic crDisambigClassName = new CrDisambigClassName();
-
-    private static Critic crDisambigStateName = new CrDisambigStateName();
-
-//    private static Critic crConflictingComposites =
-//	new CrConflictingComposites();
-
-    private static Critic crTooManyAssoc = new CrTooManyAssoc();
-
-    private static Critic crTooManyAttr = new CrTooManyAttr();
-
-    private static Critic crTooManyOper = new CrTooManyOper();
-
-    private static Critic crTooManyStates = new CrTooManyStates();
-
-    private static Critic crTooManyTransitions = new CrTooManyTransitions();
-
-    private static Critic crTooManyClasses = new CrTooManyClasses();
-
-    private static Critic crNoTransitions = new CrNoTransitions();
-
-    private static Critic crNoIncomingTransitions =
-	new CrNoIncomingTransitions();
-
-    private static Critic crNoOutgoingTransitions =
-	new CrNoOutgoingTransitions();
-
-    private static Critic crMultipleInitialStates =
-	new CrMultipleInitialStates();
-
-    private static Critic crNoInitialState = new CrNoInitialState();
-
-    private static Critic crNoTriggerOrGuard = new CrNoTriggerOrGuard();
-
-    private static Critic crNoGuard = new CrNoGuard();
-
-    private static Critic crInvalidFork = new CrInvalidFork();
-
-    private static Critic crInvalidJoin = new CrInvalidJoin();
-
-    private static Critic crInvalidBranch = new CrInvalidBranch();
-
-    private static Critic crEmptyPackage = new CrEmptyPackage();
-
-    private static Critic crNoOperations = new CrNoOperations();
-
-    private static Critic crConstructorNeeded = new CrConstructorNeeded();
-
-    private static Critic crNameConfusion = new CrNameConfusion();
-
-    private static Critic crMergeClasses = new CrMergeClasses();
-
-    private static Critic crSubclassReference = new CrSubclassReference();
-
-    private static Critic crComponentWithoutNode = new CrComponentWithoutNode();
-
-    private static Critic crCompInstanceWithoutNode =
-	new CrCompInstanceWithoutNode();
-
-    private static Critic crClassWithoutComponent =
-	new CrClassWithoutComponent();
-
-    private static Critic crInterfaceWithoutComponent =
-	new CrInterfaceWithoutComponent();
-
-    private static Critic crObjectWithoutComponent =
-	new CrObjectWithoutComponent();
-
-    private static Critic crNodeInsideElement = new CrNodeInsideElement();
-
-    private static Critic crNodeInstanceInsideElement =
-	new CrNodeInstanceInsideElement();
-
-    private static Critic crWrongLinkEnds = new CrWrongLinkEnds();
-
-    private static Critic crInstanceWithoutClassifier =
-	new CrInstanceWithoutClassifier();
-
-    private static Critic crInvalidHistory =
-        new CrInvalidHistory();
-
-    private static Critic crInvalidSynch =
-        new CrInvalidSynch();
-
-    private static Critic crInvalidJoinTriggerOrGuard =
-        new CrInvalidJoinTriggerOrGuard();
-
-    private static Critic crInvalidForkTriggerOrGuard =
-        new CrInvalidForkTriggerOrGuard();
-
-    private static Critic crInvalidPseudoStateTrigger =
-        new CrInvalidPseudoStateTrigger();
-
-    private static Critic crMultipleDeepHistoryStates =
-        new CrMultipleDeepHistoryStates();
-
-    private static Critic crMultipleShallowHistoryStates =
-        new CrMultipleShallowHistoryStates();
-
-    private static Critic crInvalidInitial =
-        new CrInvalidInitial();
-
-    private static Critic crForkOutgoingTransition =
-        new CrForkOutgoingTransition();
-
-    private static Critic crJoinIncomingTransition =
-        new CrJoinIncomingTransition();
-
-    // private static Critic crCallWithoutReturn = new CrCallWithoutReturn();
-    // private static Critic crReturnWithoutCall = new CrReturnWithoutCall();
-    // private static Critic crSeqInstanceWithoutClassifier =
-	// new CrSeqInstanceWithoutClassifier();
-    // private static Critic crStimulusWithWrongPosition =
-	// new CrStimulusWithWrongPosition();
-
-    // from UML 1.1 Semantics spec
-
-    // common coding conventions
-    private static Critic crUnconventionalOperName = 
-        new CrUnconventionalOperName();
-
-    private static Critic crUnconventionalAttrName = 
-        new CrUnconventionalAttrName();
-
-    private static Critic crUnconventionalClassName = 
-        new CrUnconventionalClassName();
-
-    private static Critic crUnconventionalPackName = 
-        new CrUnconventionalPackName();
-
-    // Java specific
-    private static Critic crClassMustBeAbstract = new CrClassMustBeAbstract();
-
-    private static Critic crReservedName = new CrReservedName();
-
-    // code generation
-    private static Critic crIllegalName = new CrIllegalName();
-
-    // Presentation critics
-    private static Critic crNodesOverlap = new CrNodesOverlap();
-
-    private static Critic crZeroLengthEdge = new CrZeroLengthEdge();
-
-    // Compound critics
-    private static CompoundCritic clsNaming =
-	new CompoundCritic(crMissingClassName, crDisambigClassName);
-
-    private static CompoundCritic noTrans1 =
-	new CompoundCritic(crNoTransitions, crNoIncomingTransitions);
-
-    private static CompoundCritic noTrans2 =
-	new CompoundCritic(crNoTransitions, crNoOutgoingTransitions);
-
-    // only classes with name need a constructor
-    private static CompoundCritic crCompoundConstructorNeeded =
-        new CompoundCritic(crMissingClassName, crConstructorNeeded);
-
     /**
      * static initializer, register all appropriate critics.
      */
     public void init() {
-        registerExtraWFRs();        
-        
-        Object modelCls = Model.getMetaTypes().getModel();
-        Object packageCls = Model.getMetaTypes().getPackage();
-        Object classCls = Model.getMetaTypes().getUMLClass();
-        Object classifierCls = Model.getMetaTypes().getClassifier();
-        Object interfaceCls = Model.getMetaTypes().getInterface();
-        Object attrCls = Model.getMetaTypes().getAttribute();
-        Object paramCls = Model.getMetaTypes().getParameter();
-        Object operCls = Model.getMetaTypes().getOperation();
-        Object assocCls = Model.getMetaTypes().getAssociation();
-        Object assocEndCls = Model.getMetaTypes().getAssociationEnd();
-        Object assocClassCls = Model.getMetaTypes().getAssociationClass();
-        Object namespaceCls = Model.getMetaTypes().getNamespace();
-        Object genElementCls = Model.getMetaTypes().getGeneralizableElement();
-        Object genCls = Model.getMetaTypes().getGeneralization();
-        Object datatypeCls = Model.getMetaTypes().getDataType();
-        Object useCaseCls = Model.getMetaTypes().getUseCase();
-        Object actorCls = Model.getMetaTypes().getActor();
-        Object stateVertexCls = Model.getMetaTypes().getStateVertex();
-        Object stateCls = Model.getMetaTypes().getState();
-        Object compositieStateCls = Model.getMetaTypes().getCompositeState();
-        Object synchStateCls = Model.getMetaTypes().getSynchState();
-	// Class stateDiagramCls   = UMLStateDiagram.class;
-	// Class useCaseDiagramCls = UMLUseCaseDiagram.class;
-        // Class classDiagramCls   = UMLClassDiagram.class;
-
-	// TODO: Agency should allow registration by interface
-	// useful for MAssociation.
-        Agency.register(crAssocNameConflict, namespaceCls);
-	Agency.register(crAttrNameConflict, classifierCls);
-	Agency.register(crOperNameConflict, classifierCls);
-	Agency.register(crCircularAssocClass, assocClassCls);
-	Agency.register(crCircularInheritance, genElementCls);
-	Agency.register(crCircularComposition, classCls);
-	Agency.register(crClassMustBeAbstract, classCls);
-	Agency.register(crCrossNamespaceAssoc, assocCls);
-	Agency.register(crDupParamName, operCls);
-	Agency.register(crDupRoleNames, assocCls);
-	Agency.register(crFinalSubclassed, classCls);
-	Agency.register(crFinalSubclassed, interfaceCls);
-	Agency.register(crIllegalGeneralization, genCls);
-	Agency.register(crAlreadyRealizes, classCls);
-	Agency.register(crInterfaceAllPublic, interfaceCls);
-	Agency.register(crInterfaceOperOnly, interfaceCls);
-	Agency.register(crMultipleAgg, assocCls);
-	Agency.register(crUnnavigableAssoc, assocCls);
-	Agency.register(crNWayAgg, assocCls);
-	Agency.register(crNavFromInterface, assocCls);
-	Agency.register(crNameConflictAC, assocClassCls);
-	Agency.register(clsNaming, classCls);
-        Agency.register(clsNaming, interfaceCls);
-	Agency.register(clsNaming, actorCls);
-	Agency.register(clsNaming, useCaseCls);
-
-	// TODO: should be just CrMissingName with a
-	// customized description
-	Agency.register(crMissingClassName, modelCls);
-	Agency.register(crMissingAttrName, attrCls);
-	Agency.register(crMissingOperName, operCls);
-	Agency.register(crMissingStateName, stateVertexCls);
-	Agency.register(crNoInstanceVariables, classCls);
-	Agency.register(crNoAssociations, classCls);
-	Agency.register(crNoAssociations, actorCls);
-	Agency.register(crNoAssociations, useCaseCls);
-	Agency.register(crNoOperations, classCls);
-        Agency.register(crNoOperations, interfaceCls);
-	Agency.register(crCompoundConstructorNeeded, classCls);
-	Agency.register(crEmptyPackage, packageCls);
-	Agency.register(crNonAggDataType, datatypeCls);
-	Agency.register(crUselessAbstract, classCls);
-	Agency.register(crUselessInterface, interfaceCls);
-	Agency.register(crDisambigStateName, stateCls);
-	Agency.register(crNameConfusion, classifierCls);
-	Agency.register(crNameConfusion, stateCls);
-	Agency.register(crMergeClasses, classCls);
-	Agency.register(crSubclassReference, classCls);
-	Agency.register(crIllegalName, classCls);
-	Agency.register(crIllegalName, interfaceCls);
-	Agency.register(crIllegalName, assocCls);
-	Agency.register(crIllegalName, operCls);
-	Agency.register(crIllegalName, attrCls);
-	Agency.register(crIllegalName, paramCls);
-	Agency.register(crIllegalName, stateCls);
-	Agency.register(crReservedName, classifierCls);
-	Agency.register(crReservedName, operCls);
-	Agency.register(crReservedName, attrCls);
-	Agency.register(crReservedName, stateCls);
-	Agency.register(crReservedName, assocCls);
-	Agency.register(crTooManyAssoc, classCls);
-	Agency.register(crTooManyAttr, classCls);
-	Agency.register(crTooManyOper, classCls);
-	Agency.register(crTooManyTransitions, stateVertexCls);
-	Agency.register(crTooManyStates, compositieStateCls);
-	Agency.register(crTooManyClasses, namespaceCls);
-	Object pseudostateCls = Model.getMetaTypes().getPseudostate();
-	Object transitionCls = Model.getMetaTypes().getTransition();
-	Agency.register(noTrans1, stateVertexCls);
-	Agency.register(noTrans2, stateVertexCls);
-	Agency.register(crMultipleInitialStates, pseudostateCls);
-	Agency.register(crNoInitialState, compositieStateCls);
-	Agency.register(crNoTriggerOrGuard, transitionCls);
-	Agency.register(crInvalidJoin, pseudostateCls);
-	Agency.register(crInvalidFork, pseudostateCls);
-	Agency.register(crInvalidBranch, pseudostateCls);
-	Agency.register(crNoGuard, transitionCls);
-	Agency.register(crUnconventionalOperName, operCls);
-	Agency.register(crUnconventionalAttrName, attrCls);
-	Agency.register(crUnconventionalClassName, classCls);
-	Agency.register(crUnconventionalPackName, packageCls);
-	Class deploymentDiagramCls = UMLDeploymentDiagram.class;
-	Agency.register(crNodeInsideElement, deploymentDiagramCls);
-	Agency.register(crNodeInstanceInsideElement, deploymentDiagramCls);
-	Agency.register(crComponentWithoutNode, deploymentDiagramCls);
-	Agency.register(crCompInstanceWithoutNode, deploymentDiagramCls);
-	Agency.register(crClassWithoutComponent, deploymentDiagramCls);
-	Agency.register(crInterfaceWithoutComponent, deploymentDiagramCls);
-	Agency.register(crObjectWithoutComponent, deploymentDiagramCls);
-	Agency.register(crWrongLinkEnds, deploymentDiagramCls);
-	Agency.register(crInstanceWithoutClassifier, deploymentDiagramCls);
-
-	Agency.register(crMultipleDeepHistoryStates, pseudostateCls);
-	Agency.register(crMultipleShallowHistoryStates, pseudostateCls);
-	Agency.register(crInvalidHistory, pseudostateCls);
-	Agency.register(crInvalidSynch, synchStateCls);
-	Agency.register(crInvalidJoinTriggerOrGuard, transitionCls);
-	Agency.register(crInvalidForkTriggerOrGuard, transitionCls);
-	Agency.register(crInvalidPseudoStateTrigger, transitionCls);
-	Agency.register(crInvalidInitial, pseudostateCls);
-	Agency.register(crForkOutgoingTransition, transitionCls);
-	Agency.register(crJoinIncomingTransition, transitionCls);
-
-	// Class sequenceDiagramCls = UMLSequenceDiagram.class;
-	// Agency.register(crCallWithoutReturn, sequenceDiagramCls);
-	// Agency.register(crReturnWithoutCall, sequenceDiagramCls);
-	// Agency.register(crLinkWithoutStimulus, sequenceDiagramCls);
-	// Agency.register(crSeqInstanceWithoutClassifier, sequenceDiagramCls);
-	// Agency.register(crStimulusWithWrongPosition, sequenceDiagramCls);
-
-	// Class nodeCls           = FigNodeModelElement.class;
-	Class edgeCls           = FigEdgeModelElement.class;
-
-	Class diagramCls        = UMLDiagram.class;
-	Agency.register(crNodesOverlap, diagramCls);
-	Agency.register(crZeroLengthEdge, edgeCls);
-	Agency.register(crOppEndConflict, assocEndCls);
-	Agency.register(new CrMultiComposite(), assocEndCls);
-	Agency.register(new CrNameConflict(), namespaceCls);
-	Agency.register(crAlreadyRealizes, classCls);
-	Agency.register(new CrUtilityViolated(), classifierCls);
-	Agency.register(new CrOppEndVsAttr(), classifierCls);        
-    }
-
-    private void registerExtraWFRs() {
-        // Missing WFRs
-        
-        // Association Class
-        // 4.5.3.2 [1]
-        
-        try {
-            Agency.register(new CrOCL("context AssociationClass inv:"
-                    + "self.allConnections->"
-                    + "forAll( ar | self.allFeatures->"
-                    + "forAll( f | f.oclIsKindOf(StructuralFeature) "
-                    + "implies ar.name <> f.name ))",
-                    "The names of the AssociationEnds and "
-                            + "the StructuralFeatures do not overlap.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-        
-        // 4.5.3.2 [2]
-        
-        try {
-            Agency.register(new CrOCL("context AssociationClass inv:"
-                    + "self.allConnections->"
-                    + "forAll(ar | ar.participant <> self)",
-
-            "An AssociationClass cannot be defined "
-                    + "between itself and something else.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-        
-        // Behavioral Feature
-        // 4.5.3.5 [2]
-
-        // it works, but a bug in namespace.contents prevents it from 
-        // working when the type of the parameter comes from a profile                
-//        try {
-//            Agency.register(new CrOCL("context BehavioralFeature inv:"
-//                    + "self.parameter->"
-//                    + "forAll( p | self.owner.namespace.allContents->"
-//                    + "includes (p.type) )",
-//                    "The type of the Parameters should be "
-//                            + "included in the Namespace of the Classifier.",
-//                    null, ToDoItem.HIGH_PRIORITY, null, null,
-//                    "http://www.uml.org/"));
-//        } catch (InvalidOclException e) {
-//            e.printStackTrace();
-//        }
-        
-        // Classfier
-        // 4.5.3.8 [5]
-        try {
-            Agency.register(new CrOCL("context Classifier inv:"
-                    + "self.oppositeAssociationEnds->" 
-                    + "forAll( o | not self.allAttributes->" 
-                    + "union (self.allContents)->" 
-                    + "collect ( q | q.name )->includes (o.name) )",
-            "The name of an opposite AssociationEnd may not be the same " 
-           +"as the name of an Attribute or a ModelElement contained " 
-           +"in the Classifier.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-
-        // DataType
-        // 4.5.3.12 [1]
-        try {
-            Agency.register(new CrOCL("context DataType inv:"
-                    + "self.allFeatures->forAll(f | f.oclIsKindOf(Operation)"
-                    + " and f.oclAsType(Operation).isQuery)",
-                    "A DataType can only contain Operations, "
-                            + "which all must be queries.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-
-        // GeneralizableElement
-        // 4.5.3.20 [1]
-        try {
-            Agency.register(new CrOCL("context GeneralizableElement inv:"
-                    + "self.isRoot implies self.generalization->isEmpty",
-                    "A root cannot have any Generalizations.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-
-        // 4.5.3.20 [4]
-        try {
-            Agency.register(new CrOCL("context GeneralizableElement inv:"
-                    + "self.generalization->"
-                    + "forAll(g |self.namespace.allContents->"
-                    + "includes(g.parent) )",
-                    "The parent must be included in the Namespace of"
-                            + " the GeneralizableElement.", null,
-                    ToDoItem.HIGH_PRIORITY, null, null, "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
- 
-        // Namespace
-        // 4.5.3.26 [2]
-        try {
-            Agency.register(new CrOCL("context Namespace inv:"
-                    + "self.allContents -> select(oclIsKindOf(Association))->"
-                    + "forAll(a1, a2 |a1.name = a2.name and "
-                    + "a1.connection.participant = a2.connection.participant"
-                    + " implies a1 = a2)",
-                    "All Associations must have a unique combination of name "
-                            + "and associated Classifiers in the Namespace.",
-                    null, ToDoItem.HIGH_PRIORITY, null, null,
-                    "http://www.uml.org/"));
-        } catch (InvalidOclException e) {
-            e.printStackTrace();
-        }
-        
+        ProfileFacade.register(new ProfileGoodPractices());
+        ProfileFacade.register(new ProfileCodeGeneration());
     }
 
     public List<GUISettingsTabInterface> getProjectSettingsTabs() {

Added: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java?view=auto&rev=15557
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileCodeGeneration.java	2008-08-13 04:47:36-0700
@@ -0,0 +1,129 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.cognitive.critics;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.argouml.cognitive.CompoundCritic;
+import org.argouml.cognitive.Critic;
+import org.argouml.profile.Profile;
+
+/**
+ * Profile which contains the critics that define stricter good practices for
+ * UML models targeted for code generation
+ * 
+ * @author maurelio1234
+ */
+public class ProfileCodeGeneration extends Profile {
+
+    private Set<Critic>  critics = new HashSet<Critic>();
+
+    private static Critic crMissingClassName = new CrMissingClassName();
+
+    private static Critic crDisambigClassName = new CrDisambigClassName();
+
+    private static Critic crNoTransitions = new CrNoTransitions();
+
+    private static Critic crNoIncomingTransitions =
+        new CrNoIncomingTransitions();
+
+    private static Critic crNoOutgoingTransitions =
+        new CrNoOutgoingTransitions();
+        
+    // Compound critics
+
+    // only classes with name need a constructor
+    private static CompoundCritic crCompoundConstructorNeeded =
+        new CompoundCritic(crMissingClassName, new CrConstructorNeeded());
+
+    private static CompoundCritic clsNaming =
+        new CompoundCritic(crMissingClassName, crDisambigClassName);
+        
+    private static CompoundCritic noTrans1 =
+        new CompoundCritic(crNoTransitions, crNoIncomingTransitions);
+
+    private static CompoundCritic noTrans2 =
+        new CompoundCritic(crNoTransitions, crNoOutgoingTransitions);
+    
+    /**
+     * Default Constructor 
+     */
+    public ProfileCodeGeneration() {
+        
+        critics.add(crCompoundConstructorNeeded);
+        
+        // code generation
+        critics.add(clsNaming);
+        critics.add(new CrDisambigStateName());
+        critics.add(crDisambigClassName);
+        critics.add(new CrIllegalName());
+        critics.add(new CrReservedName());
+        critics.add(new CrNoInitialState());
+        critics.add(new CrNoTriggerOrGuard());
+        critics.add(new CrNoGuard());
+                   
+        critics.add(new CrOperNameConflict());
+        critics.add(new CrNoInstanceVariables());
+        critics.add(new CrNoAssociations());
+        critics.add(new CrNoOperations());
+        critics.add(new CrUselessAbstract());
+        critics.add(new CrUselessInterface());
+        critics.add(new CrNavFromInterface());
+        critics.add(new CrUnnavigableAssoc());
+        critics.add(new CrAlreadyRealizes());
+        critics.add(new CrMultipleInitialStates());
+        critics.add(new CrUnconventionalOperName());
+        critics.add(new CrUnconventionalAttrName());
+        critics.add(new CrUnconventionalClassName());
+        critics.add(new CrUnconventionalPackName());
+        critics.add(new CrNodeInsideElement());
+        critics.add(new CrNodeInstanceInsideElement());
+        critics.add(new CrComponentWithoutNode());
+        critics.add(new CrCompInstanceWithoutNode());
+        critics.add(new CrClassWithoutComponent());
+        critics.add(new CrInterfaceWithoutComponent());
+        critics.add(new CrObjectWithoutComponent());
+        critics.add(new CrInstanceWithoutClassifier());
+        critics.add(noTrans1);
+        critics.add(noTrans2);                                  
+        
+        this.setCritics(critics);
+        
+        addProfileDependency("GoodPractices");
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return "Critics for Code Generation";
+    }
+
+   /*
+    * @see org.argouml.profile.Profile#getProfileIdentifier()
+    */
+    public String getProfileIdentifier() {
+        return "CodeGeneration";
+    }
+}

Added: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java?view=auto&rev=15557
==============================================================================
--- (empty file)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/ProfileGoodPractices.java	2008-08-13 04:47:36-0700
@@ -0,0 +1,82 @@
+// $Id: eclipse-argo-codetemplates.xml 11347 2006-10-26 22:37:44Z linus $
+// Copyright (c) 2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.uml.cognitive.critics;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.argouml.cognitive.Critic;
+import org.argouml.profile.Profile;
+
+/**
+ * Profile which contains the critics that define optional good practices for
+ * general UML models
+ * 
+ * @author maurelio1234
+ */
+public class ProfileGoodPractices extends Profile {
+
+    private Set<Critic>  critics = new HashSet<Critic>();
+    
+    /**
+     * Default Constructor 
+     */
+    public ProfileGoodPractices() {
+        
+        // general
+        critics.add(new CrEmptyPackage());
+        critics.add(new CrNodesOverlap());
+        critics.add(new CrZeroLengthEdge());
+        critics.add(new CrCircularComposition());
+        critics.add(new CrMissingAttrName());
+        critics.add(new CrMissingClassName());
+        critics.add(new CrMissingStateName());
+        critics.add(new CrMissingOperName());
+        critics.add(new CrNonAggDataType());
+        critics.add(new CrSubclassReference());
+        critics.add(new CrTooManyAssoc());
+        critics.add(new CrTooManyAttr());
+        critics.add(new CrTooManyOper());
+        critics.add(new CrTooManyTransitions());
+        critics.add(new CrTooManyStates());
+        critics.add(new CrTooManyClasses());
+        critics.add(new CrWrongLinkEnds());
+        critics.add(new CrUtilityViolated());
+
+        this.setCritics(critics);
+    }
+    
+    @Override
+    public String getDisplayName() {
+        return "Critics for Good Practices";
+    }
+
+   /*
+    * @see org.argouml.profile.Profile#getProfileIdentifier()
+    */
+    public String getProfileIdentifier() {
+        return "GoodPractices";
+    }
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.