svn commit: r15341 - branches/gsoc2008/work_preissue5029_maurelio1234: src/org/argouml/profile src/org/argouml/profile/internal/ocl tests/org/argouml/profile tests/org/argouml/profile/internal/ocl

[email protected]
Newsgroups gmane.comp.lang.uml.argouml.cvs
Message-ID <[email protected]>
Author: maurelio1234
Date: 2008-07-22 10:26:36-0700
New Revision: 15341

Removed:
   branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/internal/ocl/
   branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/internal/ocl/
Modified:
   branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java
   branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java

Log:
code for issue 5029



Modified: branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java?view=diff&rev=15341&p1=branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&p2=branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&r1=15340&r2=15341
==============================================================================
--- branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java	(original)
+++ branches/gsoc2008/work_preissue5029_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java	2008-07-22 10:26:36-0700
@@ -41,14 +41,8 @@
 import javax.swing.ImageIcon;
 
 import org.apache.log4j.Logger;
-import org.argouml.cognitive.Critic;
-import org.argouml.cognitive.Decision;
-import org.argouml.cognitive.ToDoItem;
 import org.argouml.cognitive.Translator;
 import org.argouml.model.Model;
-import org.argouml.profile.internal.ocl.CrOCL;
-import org.argouml.profile.internal.ocl.InvalidOclException;
-import org.argouml.uml.cognitive.UMLDecision;
 import org.argouml.uml.cognitive.critics.CrUML;
 
 /**
@@ -245,7 +239,8 @@
         }
 
         // load critiques
-        Vector<CrUML> allCritiques = getAllCritiquesInModel();
+        // TODO read critics in OCL from xmi
+        Vector<CrUML> allCritiques = new Vector<CrUML>();
         Set<CrUML> myCritics = this.getCritics(); 
         
         for (CrUML critique : allCritiques) {
@@ -255,149 +250,6 @@
         this.setCritics(myCritics);
     }
 
-    private CrUML generateCriticFromComment(Object critique) {
-        String ocl = "" + Model.getFacade().getBody(critique);
-        String headline = null;
-        String description = null;
-        int priority = ToDoItem.HIGH_PRIORITY;
-        Vector<Decision> supportedDecisions = new Vector<Decision>();
-        Vector<String> knowledgeTypes = new Vector<String>();
-        String moreInfoURL = null;
-
-        Collection tags = Model.getFacade().getTaggedValuesCollection(critique);
-
-        for (Object tag : tags) {
-            if (Model.getFacade().getTag(tag).toLowerCase().equals("headline")) {
-                headline = Model.getFacade().getValueOfTag(tag);
-            } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
-                    "description")) {
-                description = Model.getFacade().getValueOfTag(tag);
-            } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
-                    "priority")) {
-                String prioStr = Model.getFacade().getValueOfTag(tag);
-
-                if (prioStr.toLowerCase().equals("high")) {
-                    priority = ToDoItem.HIGH_PRIORITY;
-                } else if (prioStr.toLowerCase().equals("med")) {
-                    priority = ToDoItem.MED_PRIORITY;
-                } else if (prioStr.toLowerCase().equals("low")) {
-                    priority = ToDoItem.LOW_PRIORITY;
-                } else if (prioStr.toLowerCase().equals("interruptive")) {
-                    priority = ToDoItem.INTERRUPTIVE_PRIORITY;
-                }
-            } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
-                    "supporteddecision")) {
-                String decStr = Model.getFacade().getValueOfTag(tag);
-
-                StringTokenizer st = new StringTokenizer(decStr, ",;:");
-
-                while (st.hasMoreTokens()) {
-                    String token = st.nextToken().trim().toLowerCase();
-
-                    if (token.equals("behavior"))
-                        supportedDecisions.add(UMLDecision.BEHAVIOR);
-                    if (token.equals("containment"))
-                        supportedDecisions.add(UMLDecision.CONTAINMENT);
-                    if (token.equals("classselection"))
-                        supportedDecisions.add(UMLDecision.CLASS_SELECTION);
-                    if (token.equals("codegen"))
-                        supportedDecisions.add(UMLDecision.CODE_GEN);
-                    if (token.equals("expectedusage"))
-                        supportedDecisions.add(UMLDecision.EXPECTED_USAGE);
-                    if (token.equals("inheritance"))
-                        supportedDecisions.add(UMLDecision.INHERITANCE);
-                    if (token.equals("instantiation"))
-                        supportedDecisions.add(UMLDecision.INSTANCIATION);
-                    if (token.equals("methods"))
-                        supportedDecisions.add(UMLDecision.METHODS);
-                    if (token.equals("modularity"))
-                        supportedDecisions.add(UMLDecision.MODULARITY);
-                    if (token.equals("naming"))
-                        supportedDecisions.add(UMLDecision.NAMING);
-                    if (token.equals("patterns"))
-                        supportedDecisions.add(UMLDecision.PATTERNS);
-                    if (token.equals("plannedextensions"))
-                        supportedDecisions.add(UMLDecision.PLANNED_EXTENSIONS);
-                    if (token.equals("relationships"))
-                        supportedDecisions.add(UMLDecision.RELATIONSHIPS);
-                    if (token.equals("statemachines"))
-                        supportedDecisions.add(UMLDecision.STATE_MACHINES);
-                    if (token.equals("stereotypes"))
-                        supportedDecisions.add(UMLDecision.STEREOTYPES);
-                    if (token.equals("storage"))
-                        supportedDecisions.add(UMLDecision.STORAGE);
-                }
-            } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
-                    "knowledgetype")) {
-                String ktStr = Model.getFacade().getValueOfTag(tag);
-
-                StringTokenizer st = new StringTokenizer(ktStr, ",;:");
-
-                while (st.hasMoreTokens()) {
-                    String token = st.nextToken().trim().toLowerCase();
-
-                    if (token.equals("completeness"))
-                        knowledgeTypes.add(Critic.KT_COMPLETENESS);
-                    if (token.equals("consistency"))
-                        knowledgeTypes.add(Critic.KT_CONSISTENCY);
-                    if (token.equals("correctness"))
-                        knowledgeTypes.add(Critic.KT_CORRECTNESS);
-                    if (token.equals("designers"))
-                        knowledgeTypes.add(Critic.KT_DESIGNERS);
-                    if (token.equals("experiencial"))
-                        knowledgeTypes.add(Critic.KT_EXPERIENCIAL);
-                    if (token.equals("optimization"))
-                        knowledgeTypes.add(Critic.KT_OPTIMIZATION);
-                    if (token.equals("organizational"))
-                        knowledgeTypes.add(Critic.KT_ORGANIZATIONAL);
-                    if (token.equals("presentation"))
-                        knowledgeTypes.add(Critic.KT_PRESENTATION);
-                    if (token.equals("semantics"))
-                        knowledgeTypes.add(Critic.KT_SEMANTICS);
-                    if (token.equals("syntax"))
-                        knowledgeTypes.add(Critic.KT_SYNTAX);
-                    if (token.equals("tool"))
-                        knowledgeTypes.add(Critic.KT_TOOL);
-                }
-            } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
-                    "moreinfourl")) {
-                moreInfoURL = Model.getFacade().getValueOfTag(tag);
-            }
-
-        }
-
-        LOG.debug("OCL-Critic: " + ocl);
-
-        try {
-            return new CrOCL(ocl, headline, description, priority,
-                    supportedDecisions, knowledgeTypes, moreInfoURL);
-        } catch (InvalidOclException e) {
-            LOG.error("Invalid OCL in XMI!", e);
-
-            return null;
-        }
-
-    }
-
-    @SuppressWarnings("unchecked")
-    private Vector<CrUML> getAllCritiquesInModel() {
-        Vector<CrUML> ret = new Vector();
-
-        Collection comments = getAllCommentsInModel(profilePackages);
-
-        for (Object comment : comments) {
-            if (Model.getExtensionMechanismsHelper().hasStereotype(comment,
-                    "Critic")) {
-                CrUML cr = generateCriticFromComment(comment);
-
-                if (cr != null) {
-                    ret.add(cr);
-                }
-            }
-        }
-        return ret;
-    }
-
     @SuppressWarnings("unchecked")
     private Collection getAllCommentsInModel(Collection objs) {
         Collection col = new Vector<Object>();

Modified: branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java?view=diff&rev=15341&p1=branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java&p2=branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java&r1=15340&r2=15341
==============================================================================
--- branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java	(original)
+++ branches/gsoc2008/work_preissue5029_maurelio1234/tests/org/argouml/profile/TestUserDefinedProfile.java	2008-07-22 10:26:36-0700
@@ -33,7 +33,6 @@
 import org.argouml.FileHelper;
 import org.argouml.model.InitializeModel;
 import org.argouml.profile.internal.ProfileManagerImpl;
-import org.argouml.profile.internal.ocl.CrOCL;
 import org.argouml.uml.cognitive.critics.CrUML;
 
 /**
@@ -94,11 +93,7 @@
         File profileFile = new File(testDir, "testLoadingConstructor.xmi");
         profileMother.saveProfileModel(model, profileFile);
 
-        CrOCL critic = new CrOCL("context Class inv: 3 > 2", null, null, null,
-                null, null, null);
         Set<CrUML> critics = new HashSet<CrUML>();
-        critics.add(critic);
-
         Set<String> profiles = new HashSet<String>();
         profiles.add(pm.getUMLProfile().getProfileIdentifier());
 
@@ -107,6 +102,5 @@
 
         assertEquals(profile.getDisplayName(), "displayName");
         assertTrue(profile.getDependencies().contains(pm.getUMLProfile()));
-        assertTrue(profile.getCritics().contains(critic));
     }
 }
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.