Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src')
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/Activator.java4
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/CategoryImpl.java31
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java16
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java108
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java20
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java68
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/WrongStereotypeException.java6
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Category.java22
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java20
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java13
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsManager.java18
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IValidationRule.java28
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Mode.java6
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Severity.java6
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/profilenames/Utils.java60
15 files changed, 215 insertions, 211 deletions
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/Activator.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/Activator.java
index 07f60882d4c..9bc46eb9f0b 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/Activator.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/Activator.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -61,7 +61,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/CategoryImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/CategoryImpl.java
index ea4b946cc7b..9d40c238d94 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/CategoryImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/CategoryImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
*
* Contributors:
* Ernest Wozniak (CEA LIST) ernest.wozniak@cea.fr - Initial API and implementation
- * Patrick Tessier (CEA LIST) patrick.Tessuier@cea.fr - modification
+ * Patrick Tessier (CEA LIST) patrick.Tessuier@cea.fr - modification
*****************************************************************************/
package org.eclipse.papyrus.dsml.validation.model.elements.impl;
@@ -19,8 +19,8 @@ import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category;
/**
* Implementation of a category interface.
- *
- *
+ *
+ *
*/
public class CategoryImpl implements Category {
@@ -32,10 +32,11 @@ public class CategoryImpl implements Category {
/**
- *
+ *
* Constructor.
*
- * @param name the name of the category
+ * @param name
+ * the name of the category
* @param parentCategory
*/
public CategoryImpl(String name, Category parentCategory) {
@@ -53,11 +54,11 @@ public class CategoryImpl implements Category {
return this.id;
}
-/**
- *
- * @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#getName()
- *
- */
+ /**
+ *
+ * @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#getName()
+ *
+ */
public String getName() {
return this.name;
}
@@ -65,7 +66,7 @@ public class CategoryImpl implements Category {
private String name;
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#isMandatory()
*
*/
@@ -76,7 +77,7 @@ public class CategoryImpl implements Category {
private boolean isMandatory;
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#getSubcategories()
*
*/
@@ -85,7 +86,7 @@ public class CategoryImpl implements Category {
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#addSubcategories(java.util.List)
*
*/
@@ -94,7 +95,7 @@ public class CategoryImpl implements Category {
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Category#getParentCategory()
*
*/
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
index 576032b56d1..65adcbcf313 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintCategoryImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,10 +21,10 @@ import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IValidation
/**
* Implementation of a constraint category interface.
- *
- *
+ *
+ *
*/
-public class ConstraintCategoryImpl extends CategoryImpl implements IConstraintsCategory {
+public class ConstraintCategoryImpl extends CategoryImpl implements IConstraintsCategory {
private List<IValidationRule> constraints = new ArrayList<IValidationRule>();
@@ -32,7 +32,7 @@ public class ConstraintCategoryImpl extends CategoryImpl implements IConstraint
/**
- *
+ *
* Constructor.
*
* @param category
@@ -42,7 +42,7 @@ public class ConstraintCategoryImpl extends CategoryImpl implements IConstraint
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory#getCategoriesList()
*
*/
@@ -51,7 +51,7 @@ public class ConstraintCategoryImpl extends CategoryImpl implements IConstraint
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory#getConstraints()
*
*/
@@ -60,7 +60,7 @@ public class ConstraintCategoryImpl extends CategoryImpl implements IConstraint
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsCategory#addConstraints(java.util.List)
*
* @param constraints
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
index 57d3aa3b1f1..8a9b98d85b8 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintManagerImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,18 +30,18 @@ import org.eclipse.uml2.uml.Stereotype;
* Management of validationRules assigned to the stereotypes specified in the
* defined profile.
* ContraintProvider=Category=profile or subprofile
- *
- *
+ *
+ *
*/
public class ConstraintManagerImpl implements IConstraintsManager {
private List<IConstraintProvider> constraintsProviders = new ArrayList<IConstraintProvider>();
private Map<Stereotype, List<Constraint>> constraintsOfStereotype = new HashMap<Stereotype, List<Constraint>>();
- private Map<Constraint,ValidationRuleImpl > validationRuleMap = new HashMap<Constraint,ValidationRuleImpl>();
-
-
-
+ private Map<Constraint, ValidationRuleImpl> validationRuleMap = new HashMap<Constraint, ValidationRuleImpl>();
+
+
+
public Map<Constraint, ValidationRuleImpl> getValidationRuleMap() {
return validationRuleMap;
}
@@ -58,9 +58,9 @@ public class ConstraintManagerImpl implements IConstraintsManager {
/**
- *
+ *
* Constructor.
- *
+ *
* @param profile
*/
public ConstraintManagerImpl(Profile profile) {
@@ -72,19 +72,19 @@ public class ConstraintManagerImpl implements IConstraintsManager {
/**
* Method to get all the elements from the model, necessary to build a
* plugin for validationRules validation.
- *
+ *
* @param root
- * root profile for which the validation plugin will be generated
+ * root profile for which the validation plugin will be generated
*/
private void extractElements(Profile root) {
- //get the list of validationRules for each stereotype
+ // get the list of validationRules for each stereotype
createStereotypeToConstraintsMapping(root);
- //the top profile becomes the prime category
+ // the top profile becomes the prime category
primeCategory = new CategoryImpl(root.getName().toLowerCase(), null);
- //construct all sub categories
+ // construct all sub categories
relateCategoriesWithConstraints(root, primeCategory);
}
@@ -92,45 +92,45 @@ public class ConstraintManagerImpl implements IConstraintsManager {
* Recursive function to relate categories with the validationRules
* a profile becomes a category= a constraint Provider
* a stereotype becomes a category
- *
+ *
* @param element
- * element for which function will find validationRules and its
- * related categories
+ * element for which function will find validationRules and its
+ * related categories
* @param category
- * category for a group of validationRules
+ * category for a group of validationRules
*/
private void relateCategoriesWithConstraints(Element element, Category category) {
- if(element instanceof Profile) {
+ if (element instanceof Profile) {
- //creation of a category
- ConstraintCategoryImpl subCategory = new ConstraintCategoryImpl(((Profile)element).getName(), category);
+ // creation of a category
+ ConstraintCategoryImpl subCategory = new ConstraintCategoryImpl(((Profile) element).getName(), category);
// add the category to the list of category
category.getSubcategories().add(subCategory);
- //creation of a provider
- //construct one constraint provider
+ // creation of a provider
+ // construct one constraint provider
constraintProvider = new ConstraintProviderImpl();
// associate validation to category to provider
constraintProvider.getConstraintsCategories().add(subCategory);
constraintsProviders.add(constraintProvider);
- if(((Profile)element).getDefinition() != null) {
- constraintProvider.setEPackage(((Profile)element).getDefinition());
+ if (((Profile) element).getDefinition() != null) {
+ constraintProvider.setEPackage(((Profile) element).getDefinition());
}
- //iterate on all direct element of the profile
- for(NamedElement subElement : ((Profile)element).getOwnedMembers()) {
+ // iterate on all direct element of the profile
+ for (NamedElement subElement : ((Profile) element).getOwnedMembers()) {
- //this a profile
- if(subElement instanceof Profile) {
+ // this a profile
+ if (subElement instanceof Profile) {
this.relateCategoriesWithConstraints(subElement, subCategory);
- } else if(subElement instanceof Stereotype) {
+ } else if (subElement instanceof Stereotype) {
- //create validation rules
- if(this.constraintsOfStereotype.get(subElement) != null) {
- for(Constraint constraint : this.constraintsOfStereotype.get(subElement)) {
+ // create validation rules
+ if (this.constraintsOfStereotype.get(subElement) != null) {
+ for (Constraint constraint : this.constraintsOfStereotype.get(subElement)) {
try {
- ValidationRuleImpl rule=new ValidationRuleImpl(constraint, subCategory);
+ ValidationRuleImpl rule = new ValidationRuleImpl(constraint, subCategory);
validationRuleMap.put(constraint, rule);
subCategory.getConstraints().add(rule);
} catch (WrongStereotypeException e) {
@@ -147,11 +147,11 @@ public class ConstraintManagerImpl implements IConstraintsManager {
/**
* create a category from the owner category and the sub-element that will becomes a category
- *
+ *
* @param category
- * the category owner
+ * the category owner
* @param subElement
- * the element that will become a category
+ * the element that will become a category
* @return the category
*/
protected Category createCategory(Category category, NamedElement subElement) {
@@ -164,28 +164,28 @@ public class ConstraintManagerImpl implements IConstraintsManager {
* Recursive method that finds validationRules of each stereotype defined in the
* model.
* it add validationRules only if there are stereotype validationRules
- *
+ *
* @param profile
- * root profile with stereotypes for which validationRules defined in
- * the model will be found
+ * root profile with stereotypes for which validationRules defined in
+ * the model will be found
*/
private void createStereotypeToConstraintsMapping(Profile profile) {
- for(Element element : profile.allOwnedElements()) {
+ for (Element element : profile.allOwnedElements()) {
- if(element instanceof Constraint) {
- if(element.getAppliedStereotype(IDSMLValidation.VALIDATIONRULE_STEREOTYPE) != null) {
+ if (element instanceof Constraint) {
+ if (element.getAppliedStereotype(IDSMLValidation.VALIDATIONRULE_STEREOTYPE) != null) {
- Element contextElement = ((Constraint)element).getContext();
+ Element contextElement = ((Constraint) element).getContext();
- //get the stereotype to add the constraint
- if(contextElement instanceof Stereotype) {
- if(this.constraintsOfStereotype.keySet().contains(contextElement)) {
- this.constraintsOfStereotype.get(contextElement).add((Constraint)element);
+ // get the stereotype to add the constraint
+ if (contextElement instanceof Stereotype) {
+ if (this.constraintsOfStereotype.keySet().contains(contextElement)) {
+ this.constraintsOfStereotype.get(contextElement).add((Constraint) element);
} else {
List<Constraint> constraintsList = new ArrayList<Constraint>();
- constraintsList.add((Constraint)element);
- this.constraintsOfStereotype.put((Stereotype)contextElement, constraintsList);
+ constraintsList.add((Constraint) element);
+ this.constraintsOfStereotype.put((Stereotype) contextElement, constraintsList);
}
}
}
@@ -194,9 +194,9 @@ public class ConstraintManagerImpl implements IConstraintsManager {
}
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsManager#getConstraintsProviders()
- *
+ *
*/
public List<IConstraintProvider> getConstraintsProviders() {
@@ -205,9 +205,9 @@ public class ConstraintManagerImpl implements IConstraintsManager {
/**
- *
+ *
* @see org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraintsManager#getPrimeCategory()
- *
+ *
*/
public Category getPrimeCategory() {
return this.primeCategory;
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
index d973d540545..e022bc0a3bd 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ConstraintProviderImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@ import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.IConstraint
import org.eclipse.papyrus.dsml.validation.model.elements.interfaces.Mode;
/**
- * this is constraint constraint provider see extension point
+ * this is constraint constraint provider see extension point
*
*/
public class ConstraintProviderImpl implements IConstraintProvider {
@@ -29,14 +29,14 @@ public class ConstraintProviderImpl implements IConstraintProvider {
private List<IConstraintsCategory> constraintsCategories = new ArrayList<IConstraintsCategory>();
private Mode mode;
private boolean cache;
- private EPackage ePackage=null;
+ private EPackage ePackage = null;
-/**
- *
- * Constructor.
- *
- */
+ /**
+ *
+ * Constructor.
+ *
+ */
public ConstraintProviderImpl() {
this.mode = Mode.Batch;
@@ -72,7 +72,7 @@ public class ConstraintProviderImpl implements IConstraintProvider {
return ePackage;
}
- public void setEPackage(EPackage ePackage){
- this.ePackage=ePackage;
+ public void setEPackage(EPackage ePackage) {
+ this.ePackage = ePackage;
}
}
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
index bfbd2cb3984..b236587f9ff 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/ValidationRuleImpl.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,8 +27,8 @@ import org.eclipse.uml2.uml.Stereotype;
/**
* Implementation of an interface relating to the constraint.
- *
- *
+ *
+ *
*/
public class ValidationRuleImpl implements IValidationRule {
@@ -44,17 +44,17 @@ public class ValidationRuleImpl implements IValidationRule {
/**
* Constructor which takes as an parameter constraint from the model.
- *
+ *
* @param constraint
- * constraint from the model
+ * constraint from the model
* @throws WrongStereotypeException
- * exception in case when constraint passed to the constructor
- * is not stereotyped with IValidationRule stereotype
+ * exception in case when constraint passed to the constructor
+ * is not stereotyped with IValidationRule stereotype
*/
public ValidationRuleImpl(Constraint constraint) throws WrongStereotypeException {
this.constraint = constraint;
stereotype = constraint.getAppliedStereotype(IDSMLValidation.VALIDATIONRULE_STEREOTYPE);
- if(stereotype == null) {
+ if (stereotype == null) {
throw new WrongStereotypeException(ERROR);
}
}
@@ -62,14 +62,14 @@ public class ValidationRuleImpl implements IValidationRule {
/**
* Constructor which takes as an parameter constraint from the model and
* category to which this constraint will belong.
- *
+ *
* @param constraint
- * constraint from the model
+ * constraint from the model
* @param parentCategory
- * parent category
+ * parent category
* @throws WrongStereotypeException
- * exception in case when constraint passed to the constructor
- * is not stereotyped with IValidationRule stereotype
+ * exception in case when constraint passed to the constructor
+ * is not stereotyped with IValidationRule stereotype
*/
@SuppressWarnings("rawtypes")
public ValidationRuleImpl(Constraint constraint, Category parentCategory) throws WrongStereotypeException {
@@ -80,13 +80,13 @@ public class ValidationRuleImpl implements IValidationRule {
* If the value of id has not been declared by the user, generated id
* value will be assigned and saved in the model.
*/
- if(constraint.getValue(stereotype, "id") == null || constraint.getValue(stereotype, "id").equals("")) {
+ if (constraint.getValue(stereotype, "id") == null || constraint.getValue(stereotype, "id").equals("")) {
String qname = constraint.getQualifiedName().replace("::", ".");
this.id = qname;
} else {
- this.id = (String)constraint.getValue(stereotype, "id");
+ this.id = (String) constraint.getValue(stereotype, "id");
}
this.implementingClass = parentCategory.getID() + "." + this.getName() + "Constraint";
@@ -100,13 +100,13 @@ public class ValidationRuleImpl implements IValidationRule {
* a target for a constraint, those elements which are extended by the
* stereotype to which the constraint applies.
*/
- if(constraint.getValue(stereotype, "target") != null && ((EDataTypeUniqueEList)constraint.getValue(stereotype, "target")).size() > 0) {
- for(Object target : (EDataTypeUniqueEList)constraint.getValue(stereotype, "target")) {
- if(target != null) {
- this.targets.add((String)target);
+ if (constraint.getValue(stereotype, "target") != null && ((EDataTypeUniqueEList) constraint.getValue(stereotype, "target")).size() > 0) {
+ for (Object target : (EDataTypeUniqueEList) constraint.getValue(stereotype, "target")) {
+ if (target != null) {
+ this.targets.add((String) target);
}
}
-
+
}
/*
@@ -114,8 +114,8 @@ public class ValidationRuleImpl implements IValidationRule {
* assign default value for each constraint which is 1 and save it to
* the model.
*/
- this.statusCode = (Integer)constraint.getValue(stereotype, "statusCode");
- if(this.statusCode == null) {
+ this.statusCode = (Integer) constraint.getValue(stereotype, "statusCode");
+ if (this.statusCode == null) {
this.statusCode = new Integer(1);
}
@@ -128,7 +128,7 @@ public class ValidationRuleImpl implements IValidationRule {
public String getID() {
// TODO Auto-generated method stub
- return id == null ? (String)constraint.getValue(stereotype, "id") : id;
+ return id == null ? (String) constraint.getValue(stereotype, "id") : id;
}
private String id;
@@ -137,7 +137,7 @@ public class ValidationRuleImpl implements IValidationRule {
public Integer getStatusCode() {
// TODO Auto-generated method stub
- Integer statusCode = (Integer)constraint.getValue(stereotype, "statusCode");
+ Integer statusCode = (Integer) constraint.getValue(stereotype, "statusCode");
return statusCode == null ? new Integer(1) : statusCode;
}
@@ -147,15 +147,15 @@ public class ValidationRuleImpl implements IValidationRule {
public Severity getSeverity() {
Object severityObj = constraint.getValue(stereotype, "severity"); //$NON-NLS-1$
if (severityObj instanceof Enumerator) {
- Enumerator severity = (Enumerator)severityObj;
+ Enumerator severity = (Enumerator) severityObj;
String severityType = severity.getName();
- if(severityType.compareTo(Severity.INFO.name()) == 0) {
+ if (severityType.compareTo(Severity.INFO.name()) == 0) {
return Severity.INFO;
- } else if(severityType.compareTo(Severity.WARNING.name()) == 0) {
+ } else if (severityType.compareTo(Severity.WARNING.name()) == 0) {
return Severity.WARNING;
- } else if(severityType.compareTo(Severity.CANCEL.name()) == 0) {
+ } else if (severityType.compareTo(Severity.CANCEL.name()) == 0) {
return Severity.CANCEL;
}
}
@@ -170,15 +170,15 @@ public class ValidationRuleImpl implements IValidationRule {
private String implementingClass;
public Mode getMode() {
- Object modeObj = constraint.getValue(stereotype, "mode"); //$NON-NLS-1$
+ Object modeObj = constraint.getValue(stereotype, "mode"); //$NON-NLS-1$
if (modeObj instanceof Enumerator) {
Enumerator mode = (Enumerator) modeObj;
String modeType = mode.getName();
- if(modeType.compareTo(Mode.Batch.name()) == 0) {
+ if (modeType.compareTo(Mode.Batch.name()) == 0) {
return Mode.Batch;
- } else if(modeType.compareTo(Mode.Live.name()) == 0) {
+ } else if (modeType.compareTo(Mode.Live.name()) == 0) {
return Mode.Live;
}
}
@@ -187,17 +187,17 @@ public class ValidationRuleImpl implements IValidationRule {
public boolean isEnabledByDefault() {
// TODO Auto-generated method stub
- return constraint.getValue(stereotype, "isEnabledByDefault") == null ? true : ((Boolean)constraint.getValue(stereotype, "isEnabledByDefault")).booleanValue();
+ return constraint.getValue(stereotype, "isEnabledByDefault") == null ? true : ((Boolean) constraint.getValue(stereotype, "isEnabledByDefault")).booleanValue();
}
public String getMessage() {
// TODO Auto-generated method stub
- return (String)constraint.getValue(stereotype, "message");
+ return (String) constraint.getValue(stereotype, "message");
}
public String getDescription() {
// TODO Auto-generated method stub
- return (String)constraint.getValue(stereotype, "description");
+ return (String) constraint.getValue(stereotype, "description");
}
public List<String> getTargets() {
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/WrongStereotypeException.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/WrongStereotypeException.java
index 3f1e1dc4ff3..14121c58c8d 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/WrongStereotypeException.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/impl/WrongStereotypeException.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,8 @@ package org.eclipse.papyrus.dsml.validation.model.elements.impl;
/**
* Exception which is thrown in case specific model element is not stereotype
* with and expected stereotype.
- *
- *
+ *
+ *
*/
public class WrongStereotypeException extends Exception {
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Category.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Category.java
index 1d4b1e00c14..648fff008cc 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Category.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Category.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,33 +16,33 @@ import java.util.List;
/**
* Interface representing category from the EMF Validation Framework.
- *
- *
+ *
+ *
*/
public interface Category {
/**
*
- *
- * @return ID of a category
+ *
+ * @return ID of a category
*/
public String getID();
/**
- *
- *
+ *
+ *
* @return Name of a category
*/
public String getName();
/**
- *
- * @return Information whether category is mandatory
+ *
+ * @return Information whether category is mandatory
*/
public boolean isMandatory();
/**
- *
+ *
* @return Sub-categories of a given category
*/
public List<Category> getSubcategories();
@@ -50,7 +50,7 @@ public interface Category {
/**
* Adding list of sub-categories
- *
+ *
* @param subCategories
* list of sub-categories to add
*/
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
index ab8f38b654d..6c157d999d7 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintProvider.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,31 +21,33 @@ import org.eclipse.emf.ecore.EPackage;
*/
public interface IConstraintProvider {
/**
- *
- * @return the mode of this provider
+ *
+ * @return the mode of this provider
*/
public Mode getMode();
/**
- *
+ *
* @return the cache of the provider
*/
public boolean getCache();
-
-
+
+
public EPackage getEPackage();
-
+
public void setEPackage(EPackage ePackage);
/**
- *
+ *
* @return the list of categories
*/
public List<IConstraintsCategory> getConstraintsCategories();
/**
* add categories
- * @param constraintCategories a list of categories
+ *
+ * @param constraintCategories
+ * a list of categories
*/
public void addConstraintCategories(
List<IConstraintsCategory> constraintCategories);
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
index a3107e1ff0c..7df8e457734 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsCategory.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,19 +16,19 @@ import java.util.List;
/**
* Interface representing constraint category from EMF Validation Framework
- *
- *
+ *
+ *
*/
-public interface IConstraintsCategory extends Category{
+public interface IConstraintsCategory extends Category {
/**
- *
+ *
* @return constraints
*/
public List<IValidationRule> getConstraints();
/**
- *
+ *
* @return the list of categories as a string
*/
public String getCategoriesList();
@@ -36,6 +36,7 @@ public interface IConstraintsCategory extends Category{
/**
* add a list of constraint
+ *
* @param constraints
*/
public void addConstraints(List<IValidationRule> constraints);
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsManager.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsManager.java
index 637e454e9e6..dd5a037abde 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsManager.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IConstraintsManager.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import org.eclipse.uml2.uml.Stereotype;
/**
* Interface which specifies methods for the manager taking charge of a
* constraints defined in a profile.
- *
+ *
*/
public interface IConstraintsManager {
@@ -30,24 +30,24 @@ public interface IConstraintsManager {
/**
* Access to the list of constraint providers which are necessary for the
* specification of a validation plugin.
- *
+ *
* @return list of constraint providers
*/
public List<IConstraintProvider> getConstraintsProviders();
-
+
public Map<Constraint, ValidationRuleImpl> getValidationRuleMap();
-
+
/**
* Access to the prime category.
- *
+ *
* @return prime category
*/
public Category getPrimeCategory();
-
-
+
+
/**
- *
+ *
* @return the hashmap of constraint per stereotype
*/
public Map<Stereotype, List<Constraint>> getConstraintsOfStereotype();
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IValidationRule.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IValidationRule.java
index 387547bdb48..c96f67e8bef 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IValidationRule.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/IValidationRule.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,35 +18,35 @@ import org.eclipse.uml2.uml.Constraint;
/**
* Interface representing constraints specified in a profile model
- *
- *
+ *
+ *
*/
public interface IValidationRule {
/**
* Getting the name of a constraint
- *
+ *
* @return name of a constraint
*/
public String getName();
/**
* Getting the id of a constraint
- *
+ *
* @return id of a constraint
*/
public String getID();
/**
* Getting the status code of a constraint
- *
+ *
* @return status code of a constraint
*/
public Integer getStatusCode();
/**
* Getting the severity of a constraint (ERROR, INFO, WARNING or CANCEL)
- *
+ *
* @return severity of a constraint
*/
public Severity getSeverity();
@@ -54,14 +54,14 @@ public interface IValidationRule {
/**
* Getting the name of a Java class that implements the method validating
* the constraint
- *
+ *
* @return name of a Java class
*/
public String getImplementingClass();
/**
* Getting the mode of a constraint (Batch or Live)
- *
+ *
* @return mode of a constraint
*/
public Mode getMode();
@@ -69,7 +69,7 @@ public interface IValidationRule {
/**
* Getting the value that tells whether the constraint validation will be
* triggered
- *
+ *
* @return value specifying triggering of a constraint
*/
public boolean isEnabledByDefault();
@@ -77,14 +77,14 @@ public interface IValidationRule {
/**
* Getting the message that is displayed in the Properties view if the
* constraint was violated
- *
+ *
* @return message displayed in case when constraint was violated
*/
public String getMessage();
/**
* Getting the natural language description of a constraint
- *
+ *
* @return natural language description of a constraint
*/
public String getDescription();
@@ -92,7 +92,7 @@ public interface IValidationRule {
/**
* Getting the targets, namely the names of model elements against which the
* constraint will be validated
- *
+ *
* @return names of model elements for which the constraint applies
*/
public List<String> getTargets();
@@ -100,7 +100,7 @@ public interface IValidationRule {
/**
* Constraint from the model represented by this interface
- *
+ *
* @return model constraint
*/
public Constraint getConstraint();
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Mode.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Mode.java
index 8f3bbcf128e..da15b7b08d2 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Mode.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Mode.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,8 +16,8 @@ package org.eclipse.papyrus.dsml.validation.model.elements.interfaces;
* Enumeration that specifies modes for the constraints validation: Batch -
* constraints validation is triggered on user demand Live - constraints
* validation is triggered every time when change in the model occures
- *
- *
+ *
+ *
*/
public enum Mode {
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Severity.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Severity.java
index 284333d07ec..22234391b89 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Severity.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/elements/interfaces/Severity.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,8 +14,8 @@ package org.eclipse.papyrus.dsml.validation.model.elements.interfaces;
/**
* Enumeration that specifies different types of a constraint violation.
- *
- *
+ *
+ *
*/
public enum Severity {
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/profilenames/Utils.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/profilenames/Utils.java
index bf7f74e51d0..a16bb5db32f 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/profilenames/Utils.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.model/src/org/eclipse/papyrus/dsml/validation/model/profilenames/Utils.java
@@ -1,6 +1,6 @@
/*****************************************************************************
* Copyright (c) 2011 CEA LIST.
- *
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,8 +23,8 @@ import org.eclipse.uml2.uml.ValueSpecification;
/**
* Provision of functionality for management of constraints.
- *
- *
+ *
+ *
*/
public class Utils {
@@ -42,7 +42,7 @@ public class Utils {
/**
* This method returns the package for the specific constraint.
- *
+ *
* @param constraint
* constraint for which the method will return name of its
* package
@@ -55,7 +55,7 @@ public class Utils {
/**
* Retrieval of a java constraint body.
- *
+ *
* @param valueSpecification
* ValueSpecification which contains specification of a java code
* validating the constraint.
@@ -64,13 +64,13 @@ public class Utils {
public static String getJavaConstraintBody(ValueSpecification valueSpecification) {
if (valueSpecification == null
- || !(valueSpecification instanceof OpaqueExpression)) {
+ || !(valueSpecification instanceof OpaqueExpression)) {
return null;
}
int index = 0;
for (String language : ((OpaqueExpression) valueSpecification)
- .getLanguages()) {
+ .getLanguages()) {
if (language.compareTo(JAVA_LANGUAGE) == 0) {
return ((OpaqueExpression) valueSpecification).getBodies().get(index);
}
@@ -83,7 +83,7 @@ public class Utils {
/**
* This method performs check whether for specific constraint exists
* specification of a java code.
- *
+ *
* @param constraint
* constraint for which check for existing java code is performed
* @return true if there is an existing specification of a java code
@@ -108,32 +108,32 @@ public class Utils {
/**
* return the qualified name of the stereotype that is the context of the constraint.
- * @param constraint the constraint
+ *
+ * @param constraint
+ * the constraint
* @return the qualified name of the constraint or ""
*/
public static String getConstraintForStereotype(Constraint constraint) {
Namespace nameSpace = constraint.getContext();
- if( nameSpace instanceof Stereotype){
- return ((Stereotype)constraint.getContext()).getQualifiedName() ;
+ if (nameSpace instanceof Stereotype) {
+ return ((Stereotype) constraint.getContext()).getQualifiedName();
}
return "";
}
/**
-
-
-
-
- /**
+ * /**
* return true if the constraint is to validate something about a stereotype
- * @param constraint the constraint
+ *
+ * @param constraint
+ * the constraint
* @return true if the context of the constraint is a stereotype
*/
public static Boolean isConstraintForStereotype(Constraint constraint) {
Namespace nameSpace = constraint.getContext();
- if( nameSpace instanceof Stereotype){
+ if (nameSpace instanceof Stereotype) {
return true;
}
return false;
@@ -142,7 +142,7 @@ public class Utils {
/**
* Retrieval of an OCL constraint body.
- *
+ *
* @param constraint
* constraint for which OCL body is retrieved
* @return OCL constraint body
@@ -155,11 +155,11 @@ public class Utils {
if (valueSpec != null && valueSpec instanceof OpaqueExpression) {
for (String language : ((OpaqueExpression) valueSpec)
- .getLanguages()) {
+ .getLanguages()) {
if (language.compareTo(OCL_LANGUAGE) == 0) {
return ((OpaqueExpression) valueSpec).getBodies()
- .get(index);
+ .get(index);
}
index++;
}
@@ -171,7 +171,7 @@ public class Utils {
/**
* Check whether there is specification of an OCL specification
- *
+ *
* @param constraint
* constraint for which check is performed
* @return true if there is an existing specification of an OCL expression
@@ -198,7 +198,7 @@ public class Utils {
/**
* Method to insert the correspondence between the constraint and the
* package in which the java class validating the constraint will be placed.
- *
+ *
* @param constraint
* constraint for which the package is being assigned
* @param pkg
@@ -208,12 +208,12 @@ public class Utils {
public static void putMappnig(Constraint constraint, String pkg) {
Utils.getConstraintToItsPackage().put(constraint.getQualifiedName(),
- pkg);
+ pkg);
}
/**
* Getter for constraintToItsPackage map.
- *
+ *
* @return
*/
public static Map<String, String> getConstraintToItsPackage() {
@@ -222,21 +222,21 @@ public class Utils {
/**
* Setter for constraintToItsPackage map.
- *
+ *
* @param constraintToItsPackage
*/
public static void setConstraintToItsPackage(
- Map<String, String> constraintToItsPackage) {
+ Map<String, String> constraintToItsPackage) {
Utils.constraintToItsPackage = constraintToItsPackage;
}
-
+
public static String getPluginID() {
return pluginID;
}
-
+
public static void setPluginID(String ID) {
pluginID = ID;
}
-
+
private static String pluginID;
}

Back to the top