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 85114 Details for
Bug 80307
Validation Rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Update for ActorOperations
Validation_ActorOperations.patch (text/plain), 4.57 KB, created by
James Bruck
on 2007-12-12 15:11:45 EST
(
hide
)
Description:
Update for ActorOperations
Filename:
MIME Type:
Creator:
James Bruck
Created:
2007-12-12 15:11:45 EST
Size:
4.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.uml2.uml >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 12 Dec 2007 20:10:25 -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 $ > */ >@@ -17,9 +18,12 @@ > import org.eclipse.emf.common.util.BasicDiagnostic; > import org.eclipse.emf.common.util.Diagnostic; > import org.eclipse.emf.common.util.DiagnosticChain; >- >+import org.eclipse.emf.common.util.EList; > 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 +68,35 @@ > * @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 association : actor.getAssociations()) { >+ >+ if (!association.isBinary()) { >+ isValid = false; >+ break; >+ } >+ EList<Property> ends = association.getMemberEnds(); >+ Property otherEnd = (Property) ends.get(0); >+ if (otherEnd.getType() == actor) { >+ otherEnd = (Property) ends.get(1); >+ } >+ >+ if ((otherEnd == null) >+ || (otherEnd.getType() instanceof Behavior) >+ || (!(otherEnd.getType() instanceof UseCase) && >+ !(otherEnd.getType() instanceof org.eclipse.uml2.uml.Class))) { >+ isValid = false; >+ break; >+ } >+ } >+ } >+ if (!isValid) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -81,7 +105,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 +123,12 @@ > * @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) { >+ >+ if (isEmpty(actor.getName())) { > if (diagnostics != null) { > diagnostics > .add(new BasicDiagnostic( >@@ -116,7 +137,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;
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