Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 84050 Details for
Bug 80307
Validation Rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch that implements several validations
validations-UML2.patch (text/plain), 75.26 KB, created by
Javier Muñoz
on 2007-11-29 05:55:15 EST
(
hide
)
Description:
patch that implements several validations
Filename:
MIME Type:
Creator:
Javier Muñoz
Created:
2007-11-29 05:55:15 EST
Size:
75.26 KB
patch
obsolete
>Index: src/org/eclipse/uml2/uml/internal/operations/StateOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateOperations.java,v >retrieving revision 1.10 >diff -u -r1.10 StateOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/StateOperations.java 3 May 2007 21:11:51 -0000 1.10 >+++ src/org/eclipse/uml2/uml/internal/operations/StateOperations.java 29 Nov 2007 10:42:39 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: StateOperations.java,v 1.10 2007/05/03 21:11:51 khussey Exp $ > */ >@@ -22,6 +23,8 @@ > > import org.eclipse.uml2.uml.BehavioredClassifier; > import org.eclipse.uml2.uml.Classifier; >+import org.eclipse.uml2.uml.Pseudostate; >+import org.eclipse.uml2.uml.PseudostateKind; > import org.eclipse.uml2.uml.RedefinableElement; > import org.eclipse.uml2.uml.Region; > import org.eclipse.uml2.uml.State; >@@ -77,15 +80,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSubmachineStates(State state, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (state.getConnectionPoints().size() > 0) { >+ isValid = state.isSubmachineState(); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -94,7 +100,7 @@ > UMLValidator.STATE__SUBMACHINE_STATES, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSubmachineStates", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_State_SubmachineStates_diagnostic", new Object[]{"validateSubmachineStates", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{state})); > } > return false; >@@ -150,15 +156,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSubmachineOrRegions(State state, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (state.getSubmachine() != null) { >+ isValid = state.getRegions().size() == 0; >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -167,7 +176,7 @@ > UMLValidator.STATE__SUBMACHINE_OR_REGIONS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSubmachineOrRegions", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_State_SubmachineOrRegions_diagnostic", new Object[]{"validateSubmachineOrRegions", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{state})); > } > return false; >@@ -185,15 +194,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateCompositeStates(State state, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (state.getConnectionPoints().size() > 0) { >+ isValid = state.isComposite(); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -202,7 +214,7 @@ > UMLValidator.STATE__COMPOSITE_STATES, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateCompositeStates", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_State_OnlyCompositesHaveConnectionPoints_diagnostic", new Object[]{"validateCompositeStates", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{state})); > } > return false; >@@ -220,15 +232,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateEntryOrExit(State state, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ for (Pseudostate pseudo : state.getConnectionPoints()) { >+ isValid = isValid >+ && ((pseudo.getKind() == PseudostateKind.ENTRY_POINT_LITERAL) || (pseudo >+ .getKind() == PseudostateKind.EXIT_POINT_LITERAL)); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -237,7 +254,7 @@ > UMLValidator.STATE__ENTRY_OR_EXIT, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateEntryOrExit", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_State_EntryOrExit_diagnostic", new Object[]{"validateEntryOrExit", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(state, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{state})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/MergeNodeOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/MergeNodeOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 MergeNodeOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/MergeNodeOperations.java 3 May 2007 21:11:51 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/MergeNodeOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: MergeNodeOperations.java,v 1.6 2007/05/03 21:11:51 khussey Exp $ > */ >@@ -59,15 +60,16 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateOneOutgoingEdge(MergeNode mergeNode, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ isValid = mergeNode.getOutgoings().size() == 1; >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -76,7 +78,7 @@ > UMLValidator.MERGE_NODE__ONE_OUTGOING_EDGE, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateOneOutgoingEdge", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(mergeNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_MergeNode_OneOutoingEdge_diagnostic", new Object[]{"validateOneOutgoingEdge", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(mergeNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{mergeNode})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/UseCaseOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/UseCaseOperations.java,v >retrieving revision 1.12 >diff -u -r1.12 UseCaseOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/UseCaseOperations.java 3 May 2007 21:11:51 -0000 1.12 >+++ src/org/eclipse/uml2/uml/internal/operations/UseCaseOperations.java 29 Nov 2007 10:42:39 -0000 >@@ -7,11 +7,14 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: UseCaseOperations.java,v 1.12 2007/05/03 21:11:51 khussey Exp $ > */ > package org.eclipse.uml2.uml.internal.operations; > >+import java.util.ArrayList; >+import java.util.List; > import java.util.Map; > > import org.eclipse.emf.common.util.BasicDiagnostic; >@@ -104,9 +107,13 @@ > */ > public static boolean validateBinaryAssociations(UseCase useCase, > DiagnosticChain diagnostics, Map<Object, Object> context) { >+ >+ List<Association> assocList = new ArrayList<Association>(); >+ if (useCase.getAssociations() != null) { >+ assocList.addAll(useCase.getAssociations()); >+ } > >- for (Association association : useCase.getAssociations()) { >- >+ for (Association association : assocList) { > if (!association.isBinary()) { > > if (diagnostics != null) { >@@ -141,7 +148,12 @@ > public static boolean validateNoAssociationToUseCase(UseCase useCase, > DiagnosticChain diagnostics, Map<Object, Object> context) { > >- for (Association association : useCase.getAssociations()) { >+ ArrayList<Association> assocList = new ArrayList<Association>(); >+ if (useCase.getAssociations() != null) { >+ assocList.addAll(useCase.getAssociations()); >+ } >+ >+ for (Association association : assocList) { > EList<Type> endTypes = association.getEndTypes(); > > if (endTypes.size() == 2) { >Index: src/org/eclipse/uml2/uml/internal/operations/PseudostateOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/PseudostateOperations.java,v >retrieving revision 1.7 >diff -u -r1.7 PseudostateOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/PseudostateOperations.java 3 May 2007 21:11:52 -0000 1.7 >+++ src/org/eclipse/uml2/uml/internal/operations/PseudostateOperations.java 29 Nov 2007 10:42:38 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: PseudostateOperations.java,v 1.7 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -19,6 +20,7 @@ > import org.eclipse.emf.common.util.DiagnosticChain; > > import org.eclipse.uml2.uml.Pseudostate; >+import org.eclipse.uml2.uml.PseudostateKind; > > import org.eclipse.uml2.uml.util.UMLValidator; > >@@ -66,15 +68,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateInitialVertex(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.INITIAL_LITERAL)) { >+ isValid = (pseudostate.getOutgoings().size() <= 1); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -83,7 +88,7 @@ > UMLValidator.PSEUDOSTATE__INITIAL_VERTEX, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateInitialVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_InitialTransitions_diagnostic", new Object[]{"validateInitialVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >@@ -103,15 +108,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateHistoryVertices(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.DEEP_HISTORY_LITERAL) >+ || (pseudostate.getKind() == PseudostateKind.SHALLOW_HISTORY_LITERAL)) { >+ isValid = pseudostate.getOutgoings().size() <= 1; >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -120,7 +129,7 @@ > UMLValidator.PSEUDOSTATE__HISTORY_VERTICES, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateHistoryVertices", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_HistoryTransitions_diagnostic", new Object[]{"validateHistoryVertices", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >@@ -140,15 +149,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateJoinVertex(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.JOIN_LITERAL)) { >+ isValid = (pseudostate.getOutgoings().size() == 1) >+ && (pseudostate.getIncomings().size() >= 2); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -157,7 +170,7 @@ > UMLValidator.PSEUDOSTATE__JOIN_VERTEX, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateJoinVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_JoinTransitions_diagnostic", new Object[]{"validateJoinVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >@@ -214,15 +227,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateForkVertex(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.FORK_LITERAL)) { >+ isValid = (pseudostate.getOutgoings().size() >= 2) >+ && (pseudostate.getIncomings().size() == 1); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -231,7 +248,7 @@ > UMLValidator.PSEUDOSTATE__FORK_VERTEX, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateForkVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_ForkTransitions_diagnostic", new Object[]{"validateForkVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >@@ -288,15 +305,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateJunctionVertex(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.JUNCTION_LITERAL)) { >+ isValid = (pseudostate.getOutgoings().size() >= 1) >+ && (pseudostate.getIncomings().size() >= 1); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -305,7 +326,7 @@ > UMLValidator.PSEUDOSTATE__JUNCTION_VERTEX, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateJunctionVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_JunctionTransitions_diagnostic", new Object[]{"validateJunctionVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >@@ -325,15 +346,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateChoiceVertex(Pseudostate pseudostate, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((pseudostate.getKind() == PseudostateKind.CHOICE_LITERAL)) { >+ isValid = (pseudostate.getOutgoings().size() >= 1) >+ && (pseudostate.getIncomings().size() >= 1); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -342,7 +367,7 @@ > UMLValidator.PSEUDOSTATE__CHOICE_VERTEX, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateChoiceVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Pseudostate_ChoiceTransitions_diagnostic", new Object[]{"validateChoiceVertex", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(pseudostate, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{pseudostate})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/OperationOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/OperationOperations.java,v >retrieving revision 1.14 >diff -u -r1.14 OperationOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/OperationOperations.java 3 May 2007 21:11:52 -0000 1.14 >+++ src/org/eclipse/uml2/uml/internal/operations/OperationOperations.java 29 Nov 2007 10:42:36 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: OperationOperations.java,v 1.14 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -83,15 +84,22 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateAtMostOneReturn(Operation operation, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ int countReturn = 0; >+ >+ for (Parameter param : operation.getOwnedParameters()) { >+ if (param.getDirection().getValue() == ParameterDirectionKind.RETURN) >+ countReturn++; >+ } >+ isValid = (countReturn <= 1); >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -100,7 +108,7 @@ > UMLValidator.OPERATION__AT_MOST_ONE_RETURN, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateAtMostOneReturn", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(operation, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Operation_AtMostOneReturn_diagnostic", new Object[]{"validateAtMostOneReturn", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(operation, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{operation})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/CallActionOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/CallActionOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 CallActionOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/CallActionOperations.java 3 May 2007 21:11:51 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/CallActionOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: CallActionOperations.java,v 1.6 2007/05/03 21:11:51 khussey Exp $ > */ >@@ -60,15 +61,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSynchronousCall(CallAction callAction, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((callAction.getResults().size() > 0)) { >+ isValid = callAction.isSynchronous(); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -77,7 +81,7 @@ > UMLValidator.CALL_ACTION__SYNCHRONOUS_CALL, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSynchronousCall", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(callAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_CallAction_SynchronousCallOutputPins_diagnostic", new Object[]{"validateSynchronousCall", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(callAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{callAction})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ObjectNodeOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ObjectNodeOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 ObjectNodeOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ObjectNodeOperations.java 3 May 2007 21:11:52 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/ObjectNodeOperations.java 29 Nov 2007 10:42:36 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ObjectNodeOperations.java,v 1.6 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -19,6 +20,7 @@ > import org.eclipse.emf.common.util.DiagnosticChain; > > import org.eclipse.uml2.uml.ObjectNode; >+import org.eclipse.uml2.uml.ObjectNodeOrderingKind; > > import org.eclipse.uml2.uml.util.UMLValidator; > >@@ -131,15 +133,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSelectionBehavior(ObjectNode objectNode, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (objectNode.getSelection() != null) { >+ isValid = (objectNode.getOrdering() == ObjectNodeOrderingKind.ORDERED_LITERAL); >+ } else { >+ isValid = (objectNode.getOrdering() != ObjectNodeOrderingKind.ORDERED_LITERAL); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -148,7 +155,7 @@ > UMLValidator.OBJECT_NODE__SELECTION_BEHAVIOR, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSelectionBehavior", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(objectNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_ObjectNode_SelectionBehaviorAndOrdering_diagnostic", new Object[]{"validateSelectionBehavior", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(objectNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{objectNode})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java,v >retrieving revision 1.13 >diff -u -r1.13 StateMachineOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java 3 May 2007 21:11:52 -0000 1.13 >+++ src/org/eclipse/uml2/uml/internal/operations/StateMachineOperations.java 29 Nov 2007 10:42:38 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: StateMachineOperations.java,v 1.13 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -22,6 +23,8 @@ > > import org.eclipse.uml2.uml.BehavioredClassifier; > import org.eclipse.uml2.uml.Namespace; >+import org.eclipse.uml2.uml.Pseudostate; >+import org.eclipse.uml2.uml.PseudostateKind; > import org.eclipse.uml2.uml.RedefinableElement; > import org.eclipse.uml2.uml.Region; > import org.eclipse.uml2.uml.State; >@@ -142,15 +145,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateConnectionPoints(StateMachine stateMachine, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ for (Pseudostate pseudo : stateMachine.getConnectionPoints()) { >+ isValid = isValid >+ && ((pseudo.getKind() == PseudostateKind.ENTRY_POINT_LITERAL) || (pseudo >+ .getKind() == PseudostateKind.EXIT_POINT_LITERAL)); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -159,7 +167,7 @@ > UMLValidator.STATE_MACHINE__CONNECTION_POINTS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateConnectionPoints", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(stateMachine, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_StateMachine_ConnectionPointsEntryOrExit_diagnostic", new Object[]{"validateConnectionPoints", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(stateMachine, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{stateMachine})); > } > return false; >@@ -177,15 +185,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateMethod(StateMachine stateMachine, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (stateMachine.getSpecification() != null) { >+ isValid = stateMachine.getConnectionPoints().size() == 0; >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -194,7 +205,7 @@ > UMLValidator.STATE_MACHINE__METHOD, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateMethod", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(stateMachine, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_StateMachine_Method_diagnostic", new Object[]{"validateMethod", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(stateMachine, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{stateMachine})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ExtensionEndOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ExtensionEndOperations.java,v >retrieving revision 1.14 >diff -u -r1.14 ExtensionEndOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ExtensionEndOperations.java 3 May 2007 21:11:51 -0000 1.14 >+++ src/org/eclipse/uml2/uml/internal/operations/ExtensionEndOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ExtensionEndOperations.java,v 1.14 2007/05/03 21:11:51 khussey Exp $ > */ >@@ -18,6 +19,7 @@ > import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; > >+import org.eclipse.uml2.uml.AggregationKind; > import org.eclipse.uml2.uml.ExtensionEnd; > import org.eclipse.uml2.uml.ValueSpecification; > >@@ -98,15 +100,16 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateAggregation(ExtensionEnd extensionEnd, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ isValid = extensionEnd.getAggregation() == AggregationKind.COMPOSITE_LITERAL; >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -115,7 +118,7 @@ > UMLValidator.EXTENSION_END__AGGREGATION, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateAggregation", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(extensionEnd, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_ExtensionEnd_Aggregation_diagnostic", new Object[]{"validateAggregation", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(extensionEnd, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{extensionEnd})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ActorOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ActorOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 ActorOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ActorOperations.java 3 May 2007 21:11:53 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/ActorOperations.java 29 Nov 2007 10:42:33 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ActorOperations.java,v 1.6 2007/05/03 21:11:53 khussey Exp $ > */ >@@ -19,6 +20,10 @@ > import org.eclipse.emf.common.util.DiagnosticChain; > > import org.eclipse.uml2.uml.Actor; >+import org.eclipse.uml2.uml.Association; >+import org.eclipse.uml2.uml.Behavior; >+import org.eclipse.uml2.uml.Property; >+import org.eclipse.uml2.uml.UseCase; > > import org.eclipse.uml2.uml.util.UMLValidator; > >@@ -64,15 +69,29 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateAssociations(Actor actor, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (actor.getAssociations() != null) >+ for (Association assoc : actor.getAssociations()) { >+ >+ isValid = isValid && assoc.isBinary(); >+ >+ for (Property prop : assoc.getOwnedEnds()) { >+ if (prop.getType() != actor) { >+ isValid &= (prop.getType() instanceof UseCase) >+ || (prop.getType() instanceof org.eclipse.uml2.uml.Class) >+ || (prop.getType() instanceof Behavior); >+ } >+ } >+ } >+ >+ if (!isValid) { >+ > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -81,7 +100,7 @@ > UMLValidator.ACTOR__ASSOCIATIONS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateAssociations", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(actor, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Actor_Associations_diagnostic", new Object[]{"validateAssociations", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(actor, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{actor})); > } > return false; >@@ -99,15 +118,21 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateMustHaveName(Actor actor, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (actor.getName() == null) { >+ isValid = false; >+ >+ } else { >+ isValid = !actor.getName().equals(""); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -116,7 +141,7 @@ > UMLValidator.ACTOR__MUST_HAVE_NAME, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateMustHaveName", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(actor, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Actor_MustHaveName_diagnostic", new Object[]{"validateMustHaveName", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(actor, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{actor})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ObjectFlowOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ObjectFlowOperations.java,v >retrieving revision 1.7 >diff -u -r1.7 ObjectFlowOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ObjectFlowOperations.java 3 May 2007 21:11:52 -0000 1.7 >+++ src/org/eclipse/uml2/uml/internal/operations/ObjectFlowOperations.java 29 Nov 2007 10:42:35 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ObjectFlowOperations.java,v 1.7 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -313,16 +314,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateIsMulticastOrIsMultireceive( > ObjectFlow objectFlow, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (objectFlow.isMulticast()) { >+ isValid = !objectFlow.isMultireceive(); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -331,7 +335,7 @@ > UMLValidator.OBJECT_FLOW__IS_MULTICAST_OR_IS_MULTIRECEIVE, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateIsMulticastOrIsMultireceive", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(objectFlow, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_ObjectFlow_MulticasOrMultireceive_diagnostic", new Object[]{"validateIsMulticastOrIsMultireceive", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(objectFlow, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{objectFlow})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ActivityEdgeOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ActivityEdgeOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 ActivityEdgeOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ActivityEdgeOperations.java 3 May 2007 21:11:51 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/ActivityEdgeOperations.java 29 Nov 2007 10:42:33 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ActivityEdgeOperations.java,v 1.6 2007/05/03 21:11:51 khussey Exp $ > */ >@@ -19,7 +20,6 @@ > import org.eclipse.emf.common.util.DiagnosticChain; > > import org.eclipse.uml2.uml.ActivityEdge; >- > import org.eclipse.uml2.uml.util.UMLValidator; > > /** >@@ -64,11 +64,18 @@ > */ > public static boolean validateSourceAndTarget(ActivityEdge activityEdge, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if ((activityEdge.getSource() != null) >+ && (activityEdge.getTarget() != null)) { >+ isValid = (activityEdge.getActivity() == activityEdge.getSource() >+ .getActivity()) >+ && (activityEdge.getActivity() == activityEdge.getTarget() >+ .getActivity()); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -77,7 +84,7 @@ > UMLValidator.ACTIVITY_EDGE__SOURCE_AND_TARGET, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSourceAndTarget", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(activityEdge, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_ActivityEdge_SourceAndTarget_diagnostic", new Object[]{"validateSourceAndTarget", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(activityEdge, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{activityEdge})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/OpaqueExpressionOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/OpaqueExpressionOperations.java,v >retrieving revision 1.14 >diff -u -r1.14 OpaqueExpressionOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/OpaqueExpressionOperations.java 3 May 2007 21:11:52 -0000 1.14 >+++ src/org/eclipse/uml2/uml/internal/operations/OpaqueExpressionOperations.java 29 Nov 2007 10:42:36 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: OpaqueExpressionOperations.java,v 1.14 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -71,16 +72,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateLanguageBodySize( > OpaqueExpression opaqueExpression, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (opaqueExpression.getLanguages().size() > 0) { >+ isValid = (opaqueExpression.getLanguages().size() == opaqueExpression >+ .getBodies().size()); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -89,7 +94,7 @@ > UMLValidator.OPAQUE_EXPRESSION__LANGUAGE_BODY_SIZE, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateLanguageBodySize", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_OpaqueExpression_LanguageAndBodySize_diagnostic", new Object[]{"validateLanguageBodySize", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{opaqueExpression})); > } > return false; >@@ -108,16 +113,23 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateOnlyReturnResultParameters( > OpaqueExpression opaqueExpression, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (opaqueExpression.getBehavior() != null) { >+ for (Parameter param : opaqueExpression.getBehavior() >+ .getOwnedParameters()) { >+ isValid = isValid >+ && (param.getDirection().getValue() == ParameterDirectionKind.RETURN); >+ } >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -126,7 +138,7 @@ > UMLValidator.OPAQUE_EXPRESSION__ONLY_RETURN_RESULT_PARAMETERS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateOnlyReturnResultParameters", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_OpaqueExpression_OnlyReturnParameters_diagnostic", new Object[]{"validateOnlyReturnResultParameters", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{opaqueExpression})); > } > return false; >@@ -145,16 +157,25 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated nOT > */ > public static boolean validateOneReturnResultParameter( > OpaqueExpression opaqueExpression, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ int countReturn = 0; >+ if (opaqueExpression.getBehavior() != null) { >+ for (Parameter param : opaqueExpression.getBehavior() >+ .getOwnedParameters()) { >+ if (param.getDirection().getValue() == ParameterDirectionKind.RETURN) >+ countReturn++; >+ } >+ isValid = (countReturn == 1); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -163,7 +184,7 @@ > UMLValidator.OPAQUE_EXPRESSION__ONE_RETURN_RESULT_PARAMETER, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateOneReturnResultParameter", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_OpaqueExpression_OneReturnParameter_diagnostic", new Object[]{"validateOneReturnResultParameter", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(opaqueExpression, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{opaqueExpression})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/JoinNodeOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/JoinNodeOperations.java,v >retrieving revision 1.7 >diff -u -r1.7 JoinNodeOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/JoinNodeOperations.java 3 May 2007 21:11:53 -0000 1.7 >+++ src/org/eclipse/uml2/uml/internal/operations/JoinNodeOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: JoinNodeOperations.java,v 1.7 2007/05/03 21:11:53 khussey Exp $ > */ >@@ -59,15 +60,16 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateOneOutgoingEdge(JoinNode joinNode, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ isValid = joinNode.getOutgoings().size() == 1; >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -76,7 +78,7 @@ > UMLValidator.JOIN_NODE__ONE_OUTGOING_EDGE, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateOneOutgoingEdge", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(joinNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_JoinNode_OneOutgoingEdge_diagnostic", new Object[]{"validateOneOutgoingEdge", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(joinNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{joinNode})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/CreateObjectActionOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/CreateObjectActionOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 CreateObjectActionOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/CreateObjectActionOperations.java 3 May 2007 21:11:52 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/CreateObjectActionOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: CreateObjectActionOperations.java,v 1.6 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -18,7 +19,9 @@ > import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; > >+import org.eclipse.uml2.uml.AssociationClass; > import org.eclipse.uml2.uml.CreateObjectAction; >+import org.eclipse.uml2.uml.OutputPin; > > import org.eclipse.uml2.uml.util.UMLValidator; > >@@ -61,16 +64,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateClassifierNotAbstract( > CreateObjectAction createObjectAction, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (createObjectAction.getClassifier() != null) { >+ isValid = !(createObjectAction.getClassifier().isAbstract()); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -79,7 +85,7 @@ > UMLValidator.CREATE_OBJECT_ACTION__CLASSIFIER_NOT_ABSTRACT, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateClassifierNotAbstract", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_CreateObjectAction_ClassifierNotAbstract_diagnostic", new Object[]{"validateClassifierNotAbstract", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{createObjectAction})); > } > return false; >@@ -97,16 +103,19 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateClassifierNotAssociationClass( > CreateObjectAction createObjectAction, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (createObjectAction.getClassifier() != null) { >+ isValid = !(createObjectAction.getClassifier() instanceof AssociationClass); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -115,7 +124,7 @@ > UMLValidator.CREATE_OBJECT_ACTION__CLASSIFIER_NOT_ASSOCIATION_CLASS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateClassifierNotAssociationClass", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_CreateObjectAction_ClassifierNotAssocClass_diagnostic", new Object[]{"validateClassifierNotAssociationClass", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{createObjectAction})); > } > return false; >@@ -169,16 +178,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateMultiplicity( > CreateObjectAction createObjectAction, DiagnosticChain diagnostics, > Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ for (OutputPin out : createObjectAction.getOutputs()) { >+ isValid = isValid >+ && ((out.getLower() == 1) && (out.getUpper() == 1)); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -187,7 +200,7 @@ > UMLValidator.CREATE_OBJECT_ACTION__MULTIPLICITY, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateMultiplicity", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_CreateObjectAction_OutputPinsMultiplicity_diagnostic", new Object[]{"validateMultiplicity", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(createObjectAction, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{createObjectAction})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/InitialNodeOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/InitialNodeOperations.java,v >retrieving revision 1.6 >diff -u -r1.6 InitialNodeOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/InitialNodeOperations.java 3 May 2007 21:11:52 -0000 1.6 >+++ src/org/eclipse/uml2/uml/internal/operations/InitialNodeOperations.java 29 Nov 2007 10:42:34 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: InitialNodeOperations.java,v 1.6 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -59,15 +60,16 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateNoIncomingEdges(InitialNode initialNode, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ isValid = initialNode.getIncomings().size() == 0; >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -76,7 +78,7 @@ > UMLValidator.INITIAL_NODE__NO_INCOMING_EDGES, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateNoIncomingEdges", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(initialNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_InitialNode_NoIncomingEdges_diagnostic", new Object[]{"validateNoIncomingEdges", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(initialNode, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{initialNode})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/AssociationOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/AssociationOperations.java,v >retrieving revision 1.12 >diff -u -r1.12 AssociationOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/AssociationOperations.java 3 May 2007 21:11:52 -0000 1.12 >+++ src/org/eclipse/uml2/uml/internal/operations/AssociationOperations.java 29 Nov 2007 10:42:33 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: AssociationOperations.java,v 1.12 2007/05/03 21:11:52 khussey Exp $ > */ >@@ -24,6 +25,7 @@ > > import org.eclipse.uml2.common.util.UnionEObjectEList; > import org.eclipse.uml2.uml.Association; >+import org.eclipse.uml2.uml.Generalization; > import org.eclipse.uml2.uml.Property; > import org.eclipse.uml2.uml.Type; > import org.eclipse.uml2.uml.UMLPackage; >@@ -71,15 +73,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateSpecializedEndNumber(Association association, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ for (Generalization gen : association.getGeneralizations()) { >+ isValid = isValid >+ && (((Association) gen.getGeneral()).getMemberEnds().size() == association >+ .getMemberEnds().size()); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -88,7 +95,7 @@ > UMLValidator.ASSOCIATION__SPECIALIZED_END_NUMBER, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateSpecializedEndNumber", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(association, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Association_SpecializedEndNumber_diagnostic", new Object[]{"validateSpecializedEndNumber", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(association, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{association})); > } > return false; >@@ -141,15 +148,20 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateBinaryAssociations(Association association, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ for (Property membEnd : association.getMemberEnds()) { >+ isValid = isValid >+ && ((membEnd.getAggregation().getValue() == org.eclipse.uml2.uml.AggregationKind.NONE) || association >+ .isBinary()); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -158,7 +170,7 @@ > UMLValidator.ASSOCIATION__BINARY_ASSOCIATIONS, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateBinaryAssociations", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(association, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Association_AggregationIsBinary_diagnostic", new Object[]{"validateBinaryAssociations", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(association, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{association})); > } > return false; >Index: src/org/eclipse/uml2/uml/internal/operations/ParameterOperations.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/internal/operations/ParameterOperations.java,v >retrieving revision 1.20 >diff -u -r1.20 ParameterOperations.java >--- src/org/eclipse/uml2/uml/internal/operations/ParameterOperations.java 4 May 2007 20:35:34 -0000 1.20 >+++ src/org/eclipse/uml2/uml/internal/operations/ParameterOperations.java 29 Nov 2007 10:42:37 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM - initial API and implementation >+ * Javier Muñoz (Integranova) - Implementation of some validations > * > * $Id: ParameterOperations.java,v 1.20 2007/05/04 20:35:34 khussey Exp $ > */ >@@ -24,6 +25,8 @@ > import org.eclipse.uml2.uml.LiteralString; > import org.eclipse.uml2.uml.LiteralUnlimitedNatural; > import org.eclipse.uml2.uml.Parameter; >+import org.eclipse.uml2.uml.ParameterDirectionKind; >+import org.eclipse.uml2.uml.ParameterEffectKind; > import org.eclipse.uml2.uml.Type; > import org.eclipse.uml2.uml.UMLPackage; > import org.eclipse.uml2.uml.ValueSpecification; >@@ -114,15 +117,18 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateStreamAndException(Parameter parameter, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (parameter.isStream()) { >+ isValid = !parameter.isException(); >+ } >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -131,7 +137,7 @@ > UMLValidator.PARAMETER__STREAM_AND_EXCEPTION, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateStreamAndException", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(parameter, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Parameter_StreamAndException_diagnostic", new Object[]{"validateStreamAndException", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(parameter, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{parameter})); > } > return false; >@@ -219,15 +225,24 @@ > * @param diagnostics The chain of diagnostics to which problems are to be appended. > * @param context The cache of context-specific information. > * <!-- end-model-doc --> >- * @generated >+ * @generated NOT > */ > public static boolean validateInAndOut(Parameter parameter, > DiagnosticChain diagnostics, Map<Object, Object> context) { >- // TODO: implement this method >- // -> specify the condition that violates the invariant >- // -> verify the details of the diagnostic, including severity and message >- // Ensure that you remove @generated or mark it @generated NOT >- if (false) { >+ >+ boolean isValid = true; >+ >+ if (parameter.getEffect() == ParameterEffectKind.DELETE_LITERAL) { >+ isValid = ((parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) || (parameter >+ .getDirection() == ParameterDirectionKind.IN_LITERAL)); >+ } else if (parameter.getEffect() == ParameterEffectKind.CREATE_LITERAL) { >+ isValid = ((parameter.getDirection() == ParameterDirectionKind.INOUT_LITERAL) >+ || (parameter.getDirection() == ParameterDirectionKind.OUT_LITERAL) || (parameter >+ .getDirection() == ParameterDirectionKind.RETURN_LITERAL)); >+ } >+ ; >+ >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -236,7 +251,7 @@ > UMLValidator.PARAMETER__IN_AND_OUT, > org.eclipse.emf.ecore.plugin.EcorePlugin.INSTANCE > .getString( >- "_UI_GenericInvariant_diagnostic", new Object[]{"validateInAndOut", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(parameter, context)}), //$NON-NLS-1$ //$NON-NLS-2$ >+ "_UI_Parameter_InAndOut_diagnostic", new Object[]{"validateInAndOut", org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(parameter, context)}), //$NON-NLS-1$ //$NON-NLS-2$ > new Object[]{parameter})); > } > return false; >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.mdt/org.eclipse.uml2/plugins/org.eclipse.uml2.uml/plugin.properties,v >retrieving revision 1.16 >diff -u -r1.16 plugin.properties >--- plugin.properties 29 May 2007 12:24:59 -0000 1.16 >+++ plugin.properties 29 Nov 2007 10:42:33 -0000 >@@ -158,7 +158,63 @@ > _UI_ExecutionSpecification_SameLifeline_diagnostic = The start and finish of execution specification ''{0}'' must be on the same lifelines. > > _UI_Message_SignatureIsOperation_diagnostic = The signature of message ''{0}'' is an operation but the arguments of the message do not correspond to the parameters of the operation. >-_UI_Message_SignatureIsSignal_diagnostic = The signature of message ''{0}'' is a signal but the arguments of the message do not correspond to the attributes of the signal. >+_UI_Message_SignatureIsSignal_diagnostic = The signature of message ''{0}'' is a signal but the arguments of the message do not correspond to the attributes of the signal. >+ >+ >+ >+_UI_ExtensionEnd_Aggregation_diagnostic = ExtensionEnd ''{0}'' must have composite aggregation kind. >+ >+_UI_ActivityEdge_SourceAndTarget_diagnostic = The source and target of ActivityEdge ''{0}'' must be in the same activity as the edge. >+ >+_UI_OpaqueExpression_EqualSizeLanguageAndBody_diagnostic = The size of the body and language arrays of opaque expression ''{0}'' are not the same. >+ >+_UI_Actor_MustHaveName_diagnostic = Actor ''{0}'' must have a name. >+_UI_Actor_Associations_diagnostic = Associations of actor ''{0}'' are not binary or they do not relate the actor with use cases, components or classes. >+ >+_UI_Association_AggregationIsBinary_diagnostic = Association ''{0}'' must be binary, since it is an aggregation. >+_UI_Association_SpecializedEndNumber_diagnostic = Association ''{0}'' must have the same number of ends as its parents. >+ >+_UI_CallAction_SynchronousCallOutputPins_diagnostic = Call action ''{0}'' has output pins and it is not synchronous. >+ >+_UI_CreateObjectAction_ClassifierNotAbstract_diagnostic = The CreateObject Action ''{0}'' creates an abstract classifier. >+_UI_CreateObjectAction_ClassifierNotAssocClass_diagnostic = The CreateObject Action ''{0}'' should not create an association class. >+_UI_CreateObjectAction_OutputPinsMultiplicity_diagnostic = Not all the pins of CreateObject Action ''{0}'' have 1..1 multiplicity. >+ >+_UI_InitialNode_NoIncomingEdges_diagnostic = The initial node ''{0}'' has incomming edges. >+ >+_UI_MergeNode_OneOutoingEdge_diagnostic = The merge node ''{0}'' do not have exactly one outgoing edge. >+ >+_UI_ObjectFlow_MulticasOrMultireceive_diagnostic = The object flow ''{0}'' can not be both multicast and multireceive. >+ >+_UI_ObjectNode_SelectionBehaviorAndOrdering_diagnostic = The object node ''{0}'' has a selection behavior and it is not ordered (or viceversa). >+ >+_UI_OpaqueExpression_LanguageAndBodySize_diagnostic = The size of language and body properties of opaque expression ''{0}'' are not equal. >+_UI_OpaqueExpression_OneReturnParameter_diagnostic = The behavior of opaque expression ''{0}'' must have exactly one return result parameter. >+_UI_OpaqueExpression_OnlyReturnParameters_diagnostic = The behavior of opaque expression ''{0}'' must only have return result parameters. >+ >+_UI_Operation_AtMostOneReturn_diagnostic = The operation ''{0}'' has more than one return parameter. >+ >+_UI_Parameter_InAndOut_diagnostic = Incorrect direction of parameter ''{0}''. Only in and inout parameters may have a delete effect. Only out, inout, and return parameters may have a create effect. >+_UI_Parameter_StreamAndException_diagnostic = Parameter ''{0}'' cannot be a stream and exception at the same time. >+ >+_UI_Pin_ControlAndControlType_diagnostic = Control pin ''{0}'' do not have a control type. >+ >+_UI_Pseudostate_ChoiceTransitions_diagnostic = The choice vertex ''{0}'' must have at least one incoming and one outgoing transition. >+_UI_Pseudostate_ForkTransitions_diagnostic = The fork vertex ''{0}'' must have at least two outgoing transitions and exactly one incoming transition. >+_UI_Pseudostate_HistoryTransitions_diagnostic = The history vertex ''{0}'' can have at most one outgoing transition. >+_UI_Pseudostate_InitialTransitions_diagnostic = The initial vertex ''{0}'' can have at most one outgoing transition. >+_UI_Pseudostate_JoinTransitions_diagnostic = The join vertex ''{0}'' must have at least two incoming transitions and exactly one outgoing transition. >+_UI_Pseudostate_JunctionTransitions_diagnostic = The junciton vertex ''{0}'' must have at least one incoming transition and one outgoing transition. >+ >+_UI_StateMachine_ConnectionPointsEntryOrExit_diagnostic = The connection points of the state machine ''{0}'' must be pseudostates of kind entry point or exit point. >+_UI_StateMachine_Method_diagnostic = The state machine ''{0}'' cannot have entry/exit connection points, since it is the method for a behavioral feature. >+ >+_UI_State_OnlyCompositesHaveConnectionPoints_diagnostic = The state ''{0}'' has connection points but it is not composite. >+_UI_State_EntryOrExit_diagnostic = The state ''{0}'' has connection points which are not entry or exit pseudostates. >+_UI_State_SubmachineOrRegions_diagnostic = The state ''{0}'' is not allowed to have both a submachine and regions. >+_UI_State_SubmachineStates_diagnostic = The state ''{0}'' has connection points but it is not a submachine. >+ >+_UI_JoinNode_OneOutgoingEdge_diagnostic = The join node ''{0}'' must have exactly one outgoing transition. > > _UI_PackageRegistry_extensionpoint = UML Package Registry >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 80307
:
35921
|
36338
|
36914
|
37131
|
37153
|
37217
|
37236
|
37419
|
40586
|
41343
| 84050 |
85114
|
85115
|
85127
|
228168