Author: maurelio1234
Date: 2008-08-12 05:03:38-0700
New Revision: 15554
Added:
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/
- copied from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/CompositeModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CompositeModelInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/ComputeDesignMaterials.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/ComputeDesignMaterials.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/ComputeTriggers.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/ComputeTriggers.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/ContextApplicable.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/ContextApplicable.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/CrOCL.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/DefaultOclEvaluator.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateExpression.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateInvariant.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/EvaluateInvariant.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/InvalidOclException.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/InvalidOclException.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/LambdaEvaluator.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/LambdaEvaluator.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/ModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/ModelInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclExpressionEvaluator.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/OclInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/OclInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/
- copied from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/Bag.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/Bag.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/CollectionsModelInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/HashBag.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/HashBag.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/ModelAccessModelInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclAPIModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclAPIModelInterpreter.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclEnumLiteral.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclEnumLiteral.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclType.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/OclType.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java
- copied unchanged from r15551, /branches/gsoc2008/work_issue5042_maurelio1234/src/org/argouml/profile/internal/ocl/uml14/Uml14ModelInterpreter.java
Modified:
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.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/ui/PropPanelCritic.java
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi
branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/uml/cognitive/critics/InitCognitiveCritics.java
Log:
commiting merged code
Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties?view=diff&rev=15554&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties&r1=15553&r2=15554
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties (original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/i18n/label.properties 2008-08-12 05:03:38-0700
@@ -144,6 +144,7 @@
label.deprecated = Deprecated:
label.deprecated-p = <Deprecated>
label.derived = Derived:
+label.description = Description:
label.destroy-action = DestroyAction
label.diagramappearance.fontlist = Name
label.diagramappearance.fontsize = Size
@@ -154,6 +155,7 @@
label.display = Display:
label.do-activity = Do Activity:
label.docpane.author = Author
+
label.docpane.deprecated = Deprecated
label.docpane.documentation = Documentation
label.docpane.see = See
@@ -219,6 +221,7 @@
label.interaction-title = Interaction
label.interface = Interface
label.internal-transitions = Internal transitions:
+label.knowledge_types = Knowledge Types:
label.language = Language:
label.language.tooltip = Language
label.leaf = Leaf
@@ -258,6 +261,7 @@
label.notation-language = Notation Language:
label.object = Object
label.object-flow-state = ObjectFlowState
+label.ocl = Ocl:
label.off = Off
label.offenders = Offenders:
label.operations = Operations:
Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java?view=diff&rev=15554&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java&r1=15553&r2=15554
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java (original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/UserDefinedProfile.java 2008-08-12 05:03:38-0700
@@ -36,13 +36,19 @@
import java.util.HashMap;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.Vector;
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;
/**
* Represents a profile defined by the user
@@ -63,7 +69,8 @@
private Collection profilePackages;
- private UserDefinedFigNodeStrategy figNodeStrategy = new UserDefinedFigNodeStrategy();
+ private UserDefinedFigNodeStrategy figNodeStrategy
+ = new UserDefinedFigNodeStrategy();
private class UserDefinedFigNodeStrategy implements FigNodeStrategy {
@@ -242,11 +249,233 @@
}
// load critiques
- // TODO read critics in OCL from xmi
- Set<Critic> myCritics = this.getCritics();
+ Set<Critic> myCritics = this.getCritics();
+ myCritics.addAll(getAllCritiquesInModel());
this.setCritics(myCritics);
}
+ private CrOCL 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);
+ boolean i18nFound = false;
+
+ for (Object tag : tags) {
+ if (Model.getFacade().getTag(tag).toLowerCase().equals("i18n")) {
+ i18nFound = true;
+ String i18nSource = Model.getFacade().getValueOfTag(tag);
+ headline = Translator.localize(i18nSource + "-head");
+ description = Translator.localize(i18nSource + "-desc");
+ moreInfoURL = Translator.localize(i18nSource + "-moreInfoURL");
+ } else if (!i18nFound
+ && Model.getFacade().getTag(tag).toLowerCase().equals(
+ "headline")) {
+ headline = Model.getFacade().getValueOfTag(tag);
+ } else if (!i18nFound
+ && Model.getFacade().getTag(tag).toLowerCase().equals(
+ "description")) {
+ description = Model.getFacade().getValueOfTag(tag);
+ } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
+ "priority")) {
+ priority = str2Priority(Model.getFacade().getValueOfTag(tag));
+ } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
+ "supporteddecision")) {
+ String decStr = Model.getFacade().getValueOfTag(tag);
+
+ StringTokenizer st = new StringTokenizer(decStr, ",;:");
+
+ while (st.hasMoreTokens()) {
+ Decision decision = str2Decision(st.nextToken().trim()
+ .toLowerCase());
+
+ if (decision != null) {
+ supportedDecisions.add(decision);
+ }
+ }
+ } else if (Model.getFacade().getTag(tag).toLowerCase().equals(
+ "knowledgetype")) {
+ String ktStr = Model.getFacade().getValueOfTag(tag);
+
+ StringTokenizer st = new StringTokenizer(ktStr, ",;:");
+
+ while (st.hasMoreTokens()) {
+ String knowledge = str2KnowledgeType(st.nextToken().trim()
+ .toLowerCase());
+
+ if (knowledge != null) {
+ knowledgeTypes.add(knowledge);
+ }
+ }
+ } else if (!i18nFound
+ && 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;
+ }
+
+ }
+
+ private String str2KnowledgeType(String token) {
+ String knowledge = null;
+
+ if (token.equals("completeness")) {
+ knowledge = Critic.KT_COMPLETENESS;
+ }
+ if (token.equals("consistency")) {
+ knowledge = Critic.KT_CONSISTENCY;
+ }
+ if (token.equals("correctness")) {
+ knowledge = Critic.KT_CORRECTNESS;
+ }
+ if (token.equals("designers")) {
+ knowledge = Critic.KT_DESIGNERS;
+ }
+ if (token.equals("experiencial")) {
+ knowledge = Critic.KT_EXPERIENCIAL;
+ }
+ if (token.equals("optimization")) {
+ knowledge = Critic.KT_OPTIMIZATION;
+ }
+ if (token.equals("organizational")) {
+ knowledge = Critic.KT_ORGANIZATIONAL;
+ }
+ if (token.equals("presentation")) {
+ knowledge = Critic.KT_PRESENTATION;
+ }
+ if (token.equals("semantics")) {
+ knowledge = Critic.KT_SEMANTICS;
+ }
+ if (token.equals("syntax")) {
+ knowledge = Critic.KT_SYNTAX;
+ }
+ if (token.equals("tool")) {
+ knowledge = Critic.KT_TOOL;
+ }
+ return knowledge;
+ }
+
+ private int str2Priority(String prioStr) {
+ int prio = ToDoItem.MED_PRIORITY;
+
+ if (prioStr.toLowerCase().equals("high")) {
+ prio = ToDoItem.HIGH_PRIORITY;
+ } else if (prioStr.toLowerCase().equals("med")) {
+ prio = ToDoItem.MED_PRIORITY;
+ } else if (prioStr.toLowerCase().equals("low")) {
+ prio = ToDoItem.LOW_PRIORITY;
+ } else if (prioStr.toLowerCase().equals("interruptive")) {
+ prio = ToDoItem.INTERRUPTIVE_PRIORITY;
+ }
+ return prio;
+ }
+
+ private Decision str2Decision(String token) {
+ Decision decision = null;
+
+ if (token.equals("behavior")) {
+ decision = UMLDecision.BEHAVIOR;
+ }
+ if (token.equals("containment")) {
+ decision = UMLDecision.CONTAINMENT;
+ }
+ if (token.equals("classselection")) {
+ decision = UMLDecision.CLASS_SELECTION;
+ }
+ if (token.equals("codegen")) {
+ decision = UMLDecision.CODE_GEN;
+ }
+ if (token.equals("expectedusage")) {
+ decision = UMLDecision.EXPECTED_USAGE;
+ }
+ if (token.equals("inheritance")) {
+ decision = UMLDecision.INHERITANCE;
+ }
+ if (token.equals("instantiation")) {
+ decision = UMLDecision.INSTANCIATION;
+ }
+ if (token.equals("methods")) {
+ decision = UMLDecision.METHODS;
+ }
+ if (token.equals("modularity")) {
+ decision = UMLDecision.MODULARITY;
+ }
+ if (token.equals("naming")) {
+ decision = UMLDecision.NAMING;
+ }
+ if (token.equals("patterns")) {
+ decision = UMLDecision.PATTERNS;
+ }
+ if (token.equals("plannedextensions")) {
+ decision = UMLDecision.PLANNED_EXTENSIONS;
+ }
+ if (token.equals("relationships")) {
+ decision = UMLDecision.RELATIONSHIPS;
+ }
+ if (token.equals("statemachines")) {
+ decision = UMLDecision.STATE_MACHINES;
+ }
+ if (token.equals("stereotypes")) {
+ decision = UMLDecision.STEREOTYPES;
+ }
+ if (token.equals("storage")) {
+ decision = UMLDecision.STORAGE;
+ }
+ return decision;
+ }
+
+ private Vector<CrOCL> getAllCritiquesInModel() {
+ Vector<CrOCL> ret = new Vector<CrOCL>();
+
+ Collection<Object> comments = getAllCommentsInModel(profilePackages);
+
+ for (Object comment : comments) {
+ if (Model.getExtensionMechanismsHelper().hasStereotype(comment,
+ "Critic")) {
+ CrOCL cr = generateCriticFromComment(comment);
+
+ if (cr != null) {
+ ret.add(cr);
+ }
+ }
+ }
+ return ret;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Collection<Object> getAllCommentsInModel(Collection objs) {
+ Collection<Object> col = new Vector<Object>();
+ for (Object obj : objs) {
+ if (Model.getFacade().isAComment(obj)) {
+ col.add(obj);
+ } else if (Model.getFacade().isANamespace(obj)) {
+ Collection contents = Model
+ .getModelManagementHelper().getAllContents(obj);
+ if (contents != null) {
+ col.addAll(contents);
+ }
+ }
+ }
+ return col;
+ }
+
/**
* @return the string that should represent this profile in the GUI.
*/
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=15554&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=15553&r2=15554
==============================================================================
--- 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-12 05:03:38-0700
@@ -32,6 +32,8 @@
import java.util.StringTokenizer;
import org.apache.log4j.Logger;
+import org.argouml.cognitive.Agency;
+import org.argouml.cognitive.Critic;
import org.argouml.configuration.Configuration;
import org.argouml.configuration.ConfigurationKey;
import org.argouml.model.Model;
@@ -199,7 +201,14 @@
if (p instanceof UserDefinedProfile
|| getProfileForClass(p.getClass().getName()) == null) {
profiles.add(p);
-
+ for (Critic critic : p.getCritics()) {
+ for (Object meta : critic.getCriticizedDesignMaterials()) {
+ Agency.register(critic, meta);
+ }
+
+ critic.setEnabled(false);
+ }
+
// this profile could have not been loaded when
// the default profile configuration
// was loaded at first, so we need to do it again
Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java?view=diff&rev=15554&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java&r1=15553&r2=15554
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java (original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/internal/ui/PropPanelCritic.java 2008-08-12 05:03:38-0700
@@ -24,11 +24,16 @@
package org.argouml.profile.internal.ui;
+import java.util.Collection;
+import java.util.Set;
+
import javax.swing.ImageIcon;
+import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import org.argouml.cognitive.Critic;
+import org.argouml.profile.internal.ocl.CrOCL;
import org.argouml.uml.ui.PropPanel;
/**
@@ -48,6 +53,10 @@
private JTextArea description;
+ private JTextArea ocl;
+
+ private JLabel oclLabel;
+
private JTextField supportedDecision;
private JTextField knowledgeType;
@@ -70,15 +79,20 @@
addField("label.headline", headline);
headline.setEditable(false);
- priority = new JTextField();
- addField("label.priority", priority);
- priority.setEditable(false);
-
description = new JTextArea(5, 30);
addField("label.description", description);
description.setEditable(false);
description.setLineWrap(true);
-
+
+ priority = new JTextField();
+ addField("label.priority", priority);
+ priority.setEditable(false);
+
+ ocl = new JTextArea(5, 30);
+ oclLabel = addField("label.ocl", ocl);
+ ocl.setEditable(false);
+ ocl.setLineWrap(true);
+
supportedDecision = new JTextField();
addField("label.decision", supportedDecision);
supportedDecision.setEditable(false);
@@ -101,9 +115,30 @@
name.setText(c.getCriticName());
headline.setText(c.getHeadline());
description.setText(c.getDescriptionTemplate());
- supportedDecision.setText("" + c.getSupportedDecisions());
-
+ supportedDecision.setText("" + colToString(c.getSupportedDecisions()));
+ if (c instanceof CrOCL) {
+ oclLabel.setVisible(true);
+ ocl.setVisible(true);
+ ocl.setText(((CrOCL) c).getOCL());
+ } else {
+ oclLabel.setVisible(false);
+ ocl.setVisible(false);
+ }
+
priority.setText("" + c.getPriority());
- knowledgeType.setText("" + c.getKnowledgeTypes());
+ knowledgeType.setText("" + colToString(c.getKnowledgeTypes()));
+ }
+
+ private String colToString(Collection set) {
+ String r = "";
+ int count = 0;
+ for (Object obj : set) {
+ if (count > 0) {
+ r += ", ";
+ }
+ r += obj;
+ ++count;
+ }
+ return r;
}
}
Modified: branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi
Url: http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi?view=diff&rev=15554&p1=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi&p2=branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi&r1=15553&r2=15554
==============================================================================
--- branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi (original)
+++ branches/gsoc2008/work_issue5042_merged15552_maurelio1234/src/org/argouml/profile/profiles/uml14/metaprofile.xmi 2008-08-12 05:03:38-0700
@@ -1,5 +1,5 @@
<?xml version = '1.0' encoding = 'UTF-8' ?>
-<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Thu Jul 17 07:16:58 CEST 2008'>
+<XMI xmi.version = '1.2' xmlns:UML = 'org.omg.xmi.namespace.UML' timestamp = 'Fri Jul 25 09:56:02 CEST 2008'>
<XMI.header> <XMI.documentation>
<XMI.exporter>ArgoUML (using Netbeans XMI Writer version 1.0)</XMI.exporter>
<XMI.exporterVersion>PRE-0.26.beta1(6) revised on $Date: 2007-05-12 08:08:08 +0200 (sam., 12 mai 2007) $ </XMI.exporterVersion>
@@ -7,7 +7,7 @@
<XMI.metamodel xmi.name="UML" xmi.version="1.4"/></XMI.header>
<XMI.content>
<UML:Model xmi.id = '127-0-1-1--3790810c:11a1f2b16a5:-8000:00000000000007BD'
- name = 'ArgoUMLProfile' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
+ name = 'metaprofile' isSpecification = 'false' isRoot = 'false' isLeaf = 'false'
isAbstract = 'false'>
<UML:ModelElement.stereotype>
<UML:Stereotype href = 'http://argouml.org/profiles/uml14/default-uml14.xmi#.:0000000000000877'/>
@@ -110,6 +110,17 @@
</UML:Multiplicity>
</UML:TagDefinition.multiplicity>
</UML:TagDefinition>
+ <UML:TagDefinition xmi.id = '127-0-1-1--4d07ba8d:11b593372d3:-8000:00000000000008D7'
+ name = 'i18n' isSpecification = 'false'>
+ <UML:TagDefinition.multiplicity>
+ <UML:Multiplicity xmi.id = '127-0-1-1--4d07ba8d:11b593372d3:-8000:00000000000008DB'>
+ <UML:Multiplicity.range>
+ <UML:MultiplicityRange xmi.id = '127-0-1-1--4d07ba8d:11b593372d3:-8000:00000000000008DA'
+ lower = '0' upper = '1'/>
+ </UML:Multiplicity.range>
+ </UML:Multiplicity>
+ </UML:TagDefinition.multiplicity>
+ </UML:TagDefinition>
</UML:Namespace.ownedElement>
</UML:Model>
</XMI.content>
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=15554&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=15553&r2=15554
==============================================================================
--- 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-12 05:03:38-0700
@@ -33,7 +33,10 @@
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;
@@ -269,6 +272,8 @@
* 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();
@@ -417,7 +422,129 @@
Agency.register(new CrNameConflict(), namespaceCls);
Agency.register(crAlreadyRealizes, classCls);
Agency.register(new CrUtilityViolated(), classifierCls);
- Agency.register(new CrOppEndVsAttr(), 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();
+ }
+
}
public List<GUISettingsTabInterface> getProjectSettingsTabs() {
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.