[500520] Plumb Operation.isTransient from CS to ES
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/as2es/AS2EcoreDeclarationVisitor.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/as2es/AS2EcoreDeclarationVisitor.java
index 03d8402..142d0ed 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/as2es/AS2EcoreDeclarationVisitor.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/as2es/AS2EcoreDeclarationVisitor.java
@@ -88,7 +88,7 @@
import com.google.common.collect.Iterables;
public class AS2EcoreDeclarationVisitor
- extends AbstractExtendingVisitor<Object, AS2Ecore>
+extends AbstractExtendingVisitor<Object, AS2Ecore>
{
public static final @NonNull DuplicateConstraintsFilter duplicateConstraintsFilter = new DuplicateConstraintsFilter();
public static final @NonNull DuplicateOperationsFilter duplicateOperationsFilter = new DuplicateOperationsFilter();
@@ -125,7 +125,7 @@
return false; // FIXME Bug 405061 workaround
}
return true;
-// return (anOperation != null) && (anOperation.getRedefinedOperation().size() != 0);
+ // return (anOperation != null) && (anOperation.getRedefinedOperation().size() != 0);
}
}
@@ -171,7 +171,7 @@
return true; // FIXME Bug 405061 workaround
}
return false;
-// return (anOperation != null) && (anOperation.getRedefinedOperation().size() == 0);
+ // return (anOperation != null) && (anOperation.getRedefinedOperation().size() == 0);
}
}
@@ -186,12 +186,12 @@
return true;
}
return !ClassUtil.safeEquals(aProperty.getName(), aProperty.getRedefinedProperties().get(0).getName());
-// return (aProperty != null) && (aProperty.getRedefinedProperty().size() == 0);
+ // return (aProperty != null) && (aProperty.getRedefinedProperty().size() == 0);
}
}
protected final @NonNull DelegateInstaller delegateInstaller;
-
+
public AS2EcoreDeclarationVisitor(@NonNull AS2Ecore context) {
super(context);
this.delegateInstaller = context.getDelegateInstaller();
@@ -207,7 +207,7 @@
else {
eClassifier.eUnset(EcorePackage.Literals.ECLASSIFIER__INSTANCE_CLASS_NAME);
}
-// visitAll(eClassifier.getETypeParameters(), pivotType.getTypeParameters());
+ // visitAll(eClassifier.getETypeParameters(), pivotType.getTypeParameters());
delegateInstaller.installDelegates(eClassifier, pivotType);
for (Constraint pivotInvariant : pivotType.getOwnedInvariants()) {
if (!pivotInvariant.isIsCallable()) {
@@ -364,7 +364,7 @@
}
public <T extends EObject> void safeVisitAll(@NonNull List<T> eObjects, @NonNull Iterable<? extends Element> pivotObjects) {
- for (Element pivotObject : pivotObjects) {
+ for (Element pivotObject : pivotObjects) {
@SuppressWarnings("unchecked")
T eObject = (T) safeVisit(pivotObject);
if (eObject != null) {
@@ -449,11 +449,11 @@
isAbstract = true;
isInterface = true;
}
-// else if ("OclSelf".equals(className)) {
-// instanceClass = Object.class;
-// isAbstract = true;
-// isInterface = true;
-// }
+ // else if ("OclSelf".equals(className)) {
+ // instanceClass = Object.class;
+ // isAbstract = true;
+ // isInterface = true;
+ // }
else if ("OclState".equals(className)) {
instanceClass = Object.class;
isAbstract = true;
@@ -487,7 +487,7 @@
context.defer(pivotClass); // Defer superclass resolution
@SuppressWarnings("null")@NonNull List<EOperation> eOperations = eClass.getEOperations();
@NonNull Iterable<Constraint> nonDuplicateConstraints = Iterables.filter(pivotClass.getOwnedInvariants(), nonDuplicateConstraintsFilter);
-// safeVisitAll(eOperations, nonDuplicateConstraints);
+ // safeVisitAll(eOperations, nonDuplicateConstraints);
@NonNull Iterable<Operation> nonDuplicateOperations = Iterables.filter(pivotClass.getOwnedOperations(), nonDuplicateOperationsFilter);
safeVisitAll(eOperations, nonDuplicateOperations);
@SuppressWarnings("null")@NonNull List<EStructuralFeature> eStructuralFeatures = eClass.getEStructuralFeatures();
@@ -514,7 +514,7 @@
if (eDuplicates == null) {
eDuplicates = new ArrayList<ETypedElement>();
}
-// Object eOperation = safeVisit(asConstraint);
+ // Object eOperation = safeVisit(asConstraint);
if (asConstraint.isIsCallable()) {
EOperation eOperation = AS2Ecore.createConstraintEOperation(asConstraint, asConstraint.getName(), options);
eOperations.add(eOperation);
@@ -669,17 +669,17 @@
if (imports.size() > 0) {
imports = new ArrayList<Import>(imports);
Collections.sort(imports, new Comparator<Import>()
- {
- @Override
- public int compare(Import o1, Import o2) {
- String n1 = o1.getName();
- String n2 = o2.getName();
- if (n1 == null) n1 = "";
- if (n2 == null) n1 = "";
- return n1.compareTo(n2);
- }
+ {
+ @Override
+ public int compare(Import o1, Import o2) {
+ String n1 = o1.getName();
+ String n2 = o2.getName();
+ if (n1 == null) n1 = "";
+ if (n2 == null) n1 = "";
+ return n1.compareTo(n2);
}
- );
+ }
+ );
}
EAnnotation importAnnotation = null;
URI ecoreURI = context.getEcoreURI();
@@ -694,7 +694,7 @@
if (eTarget != null) {
URI uri = null;
if ((eTarget instanceof EPackage) && ClassUtil.isRegistered(eTarget.eResource())) {
- String nsURI = ((EPackage)eTarget).getNsURI();
+ String nsURI = ((EPackage)eTarget).getNsURI();
if (nsURI != null) {
uri = URI.createURI(nsURI);
}
@@ -732,12 +732,12 @@
copyTemplateSignature(eTypeParameters, pivotOperation);
@SuppressWarnings("null")@NonNull List<EParameter> eParameters = eOperation.getEParameters();
safeVisitAll(eParameters, pivotOperation.getOwnedParameters());
-// safeVisitAll(eOperation.getEGenericExceptions(), pivotOperation.getRaisedException());
+ // safeVisitAll(eOperation.getEGenericExceptions(), pivotOperation.getRaisedException());
LanguageExpression bodyExpression = pivotOperation.getBodyExpression();
if (bodyExpression != null) {
EAnnotation eBodyConstraint = delegateInstaller.createOperationDelegate(eOperation, bodyExpression, context.getEcoreURI());
if (eBodyConstraint != null) {
-// AS2Ecore.copyComments(eBodyConstraint, bodyExpression);
+ // AS2Ecore.copyComments(eBodyConstraint, bodyExpression);
}
}
for (Constraint pivotConstraint : pivotOperation.getOwnedPreconditions()) {
@@ -746,6 +746,13 @@
for (Constraint pivotConstraint : pivotOperation.getOwnedPostconditions()) {
safeVisit(pivotConstraint); // Results are inserted directly
}
+ if (pivotOperation.isIsTransient()) {
+ EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ eAnnotation.setSource(PivotConstants.OPERATION_ANNOTATION_SOURCE);
+ EMap<String, String> details = eAnnotation.getDetails();
+ details.put(PivotConstants.OPERATION_IS_TRANSIENT, "true");
+ eOperation.getEAnnotations().add(eAnnotation);
+ }
return eOperation;
}
@@ -784,7 +791,7 @@
@SuppressWarnings("null")
@NonNull EDataType eDataType = EcoreFactory.eINSTANCE.createEDataType();
copyDataTypeOrEnum(eDataType, pivotPrimitiveType);
-/* Class<?> instanceClass = null;
+ /* Class<?> instanceClass = null;
String name = pivotPrimitiveType.getName();
if ("Boolean".equals(name)) {
instanceClass = Boolean.class;
@@ -843,9 +850,9 @@
eStructuralFeature.setTransient(pivotProperty.isIsTransient());
eStructuralFeature.setUnsettable(pivotProperty.isIsUnsettable());
eStructuralFeature.setVolatile(pivotProperty.isIsVolatile());
-// Object defaultValue = pivotProperty.getDefaultValue();
+ // Object defaultValue = pivotProperty.getDefaultValue();
String defaultValueLiteral = pivotProperty.getDefaultValueString();
-/* if (defaultValue != null) {
+ /* if (defaultValue != null) {
if (defaultValue instanceof String) {
defaultValueLiteral = (String)defaultValue;
}
@@ -879,8 +886,8 @@
boxedValue = metamodelManager.getExternalResourceSet().getEObject(uri, false);
}
pivotElement.setDefaultValue(boxedValue); * /
-
-
+
+
} */
if (defaultValueLiteral != null) {
eStructuralFeature.setDefaultValueLiteral(defaultValueLiteral);
@@ -892,7 +899,7 @@
if (defaultExpression != null) {
delegateInstaller.createPropertyDelegate(eStructuralFeature, defaultExpression, context.getEcoreURI());
}
-/* for (Property redefinedProperty : pivotProperty.getRedefinedProperty()) {
+ /* for (Property redefinedProperty : pivotProperty.getRedefinedProperty()) {
EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(PivotConstants.REDEFINES_ANNOTATION_SOURCE);
eStructuralFeature.getEAnnotations().add(eAnnotation);
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASDeclarationSwitch.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASDeclarationSwitch.java
index eff06e0..e434b7b 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASDeclarationSwitch.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/internal/ecore/es2as/Ecore2ASDeclarationSwitch.java
@@ -91,28 +91,28 @@
{
public static boolean hasDocumentationKey(@Nullable String source, @NonNull EMap<String, String> details) {
return (details.size() == 1) && PivotConstantsInternal.DOCUMENTATION_ANNOTATION_SOURCE.equals(source)
- && details.containsKey(PivotConstantsInternal.DOCUMENTATION_ANNOTATION_KEY);
+ && details.containsKey(PivotConstantsInternal.DOCUMENTATION_ANNOTATION_KEY);
}
-
+
public static boolean hasImportKey(@Nullable String source, @NonNull EMap<String, String> details) {
return PivotConstants.IMPORT_ANNOTATION_SOURCE.equals(source);
}
-
+
public static boolean isDocumentationKey(@Nullable String source, @Nullable String key) {
return PivotConstantsInternal.DOCUMENTATION_ANNOTATION_SOURCE.equals(source)
- && PivotConstantsInternal.DOCUMENTATION_ANNOTATION_KEY.equals(key);
+ && PivotConstantsInternal.DOCUMENTATION_ANNOTATION_KEY.equals(key);
}
protected final @NonNull AbstractExternal2AS converter;
protected final @NonNull EnvironmentFactoryInternal environmentFactory;
protected final @NonNull Technology technology;
-
+
public Ecore2ASDeclarationSwitch(@NonNull AbstractExternal2AS converter) {
this.converter = converter;
this.environmentFactory = converter.getEnvironmentFactory();
this.technology = environmentFactory.getTechnology();
}
-
+
@Override
public Object caseEAnnotation(EAnnotation eObject) {
String source = eObject.getSource();
@@ -178,8 +178,8 @@
excludedAnnotations.add(redefinesAnnotation);
}
copyClassifier(pivotElement, eObject2, excludedAnnotations);
- pivotElement.setIsAbstract(eObject2.isAbstract());
- pivotElement.setIsInterface(eObject2.isInterface());
+ pivotElement.setIsAbstract(eObject2.isAbstract());
+ pivotElement.setIsInterface(eObject2.isInterface());
doSwitchAll(eObject2.getEGenericSuperTypes());
List<Operation> pivotOperations = pivotElement.getOwnedOperations();
List<Constraint> pivotInvariants = pivotElement.getOwnedInvariants();
@@ -247,7 +247,7 @@
}
else if ("String".equals(newName) && (instanceClass == String.class)) {
isPrimitive = true;
- }
+ }
else if ("UnlimitedNatural".equals(newName) && ((instanceClass == Number.class) || (instanceClass == BigInteger.class)
|| (instanceClass == Long.class) || (instanceClass == long.class)
|| (instanceClass == Integer.class) || (instanceClass == int.class)
@@ -275,7 +275,7 @@
if (!isPrimitive && (instanceClass != null)) {
try {
PivotMetamodelManager metamodelManager = converter.getMetamodelManager();
- StandardLibraryInternal standardLibrary = metamodelManager.getStandardLibrary();
+ StandardLibraryInternal standardLibrary = metamodelManager.getStandardLibrary();
PrimitiveType behavioralClass = standardLibrary.getBehavioralClass(instanceClass);
if (behavioralClass != null) {
pivotElement.setBehavioralClass(behavioralClass);
@@ -307,7 +307,7 @@
pivotElement.setName(newName);
copyDataTypeOrEnum(pivotElement, eObject2);
doSwitchAll(pivotElement.getOwnedLiterals(), eObject2.getELiterals());
-// pivotElement.getSuperClass().add(metamodelManager.getOclAnyType());
+ // pivotElement.getSuperClass().add(metamodelManager.getOclAnyType());
pivotElement.getSuperClasses().add(environmentFactory.getStandardLibrary().getOclEnumerationType());
return pivotElement;
}
@@ -325,17 +325,17 @@
else {
pivotElement.eUnset(PivotPackage.Literals.ENUMERATION_LITERAL__VALUE);
}
-// String literal = basicGet(eObject, EcorePackage.Literals.EENUM_LITERAL__LITERAL, String.class);
-// Enumerator instance = eEnumLiteral.getInstance();
-// if (literal != null) {
-/* AnnotationCS csAnnotation = PivotFactory.eINSTANCE.createAnnotationCS();
+ // String literal = basicGet(eObject, EcorePackage.Literals.EENUM_LITERAL__LITERAL, String.class);
+ // Enumerator instance = eEnumLiteral.getInstance();
+ // if (literal != null) {
+ /* AnnotationCS csAnnotation = PivotFactory.eINSTANCE.createAnnotationCS();
csAnnotation.setIdSource(EcorePackage.eNS_URI);
DetailCS csDetail = PivotFactory.eINSTANCE.createDetailCS();
csDetail.setIdName("literal");
copyDetailLines(csDetail.getValue(), literal);
csAnnotation.getDetails().add(csDetail);
pivotElement.getAnnotations().add(csAnnotation); */
-// }
+ // }
return pivotElement;
}
@@ -363,10 +363,10 @@
org.eclipse.ocl.pivot.Package pivotElement = converter.refreshElement(org.eclipse.ocl.pivot.Package.class, PivotPackage.Literals.PACKAGE, eObject2);
String oldName = pivotElement.getName();
String newName = technology.getOriginalName(eObject2);
-// if (newName == null) {
-// newName = "anon_" + Integer.toHexString(System.identityHashCode(eObject2));
-// logger.error("Anonymous package named as '" + newName + "'");
-// }
+ // if (newName == null) {
+ // newName = "anon_" + Integer.toHexString(System.identityHashCode(eObject2));
+ // logger.error("Anonymous package named as '" + newName + "'");
+ // }
String oldNsURI = pivotElement.getURI();
String newNsURI = eObject2.getNsURI();
boolean nameChange = (oldName != newName) || ((oldName != null) && !oldName.equals(newName));
@@ -407,13 +407,13 @@
List<EAnnotation> exclusions = new ArrayList<EAnnotation>();
EAnnotation eAnnotation = eObject2.getEAnnotation(EcorePackage.eNS_URI);
if (eAnnotation != null) {
- exclusions.add(eAnnotation);
+ exclusions.add(eAnnotation);
}
if (ClassUtil.basicGetMetamodelAnnotation(eObject2) != null) {
- exclusions.add(ClassUtil.getMetamodelAnnotation(eObject2));
+ exclusions.add(ClassUtil.getMetamodelAnnotation(eObject2));
}
converter.addMapping(eObject2, pivotElement);
-// copyNamedElement(pivotElement, eObject2);
+ // copyNamedElement(pivotElement, eObject2);
copyAnnotatedElement(pivotElement, eObject2, exclusions);
doSwitchAll(pivotElement.getOwnedPackages(), eObject2.getESubpackages());
doSwitchAll(pivotElement.getOwnedClasses(), eObject2.getEClassifiers());
@@ -431,7 +431,7 @@
@Override
public Object caseEReference(EReference eObject) {
@SuppressWarnings("null") @NonNull EReference eObject2 = eObject;
- Property pivotElement = converter.refreshNamedElement(Property.class, PivotPackage.Literals.PROPERTY, eObject2);
+ Property pivotElement = converter.refreshNamedElement(Property.class, PivotPackage.Literals.PROPERTY, eObject2);
List<EAnnotation> excludedAnnotations = null;
EAnnotation oppositeRole = eObject2.getEAnnotation(EMOFExtendedMetaData.EMOF_PACKAGE_NS_URI_2_0);
if (oppositeRole != null) {
@@ -446,11 +446,11 @@
excludedAnnotations.add(oppositeRole);
}
copyStructuralFeature(pivotElement, eObject2, excludedAnnotations);
- pivotElement.setIsComposite(eObject2.isContainment());
- pivotElement.setIsResolveProxies(eObject2.isResolveProxies());
+ pivotElement.setIsComposite(eObject2.isContainment());
+ pivotElement.setIsResolveProxies(eObject2.isResolveProxies());
if ((eObject2.getEOpposite() != null)
- || (excludedAnnotations != null)
- || !eObject2.getEKeys().isEmpty()) {
+ || (excludedAnnotations != null)
+ || !eObject2.getEKeys().isEmpty()) {
converter.queueReference(eObject2); // Defer
}
return pivotElement;
@@ -463,11 +463,11 @@
converter.addMapping(eObject2, pivotElement);
String name = technology.getOriginalName(eObject2);
pivotElement.setName(name);
-// TemplateParameter templateParameter = pivotElement.isTemplateParameter();
-// if (templateParameter == null) {
-// templateParameter = PivotFactory.eINSTANCE.createTemplateParameter();
-// templateParameter.setOwnedParameteredElement(pivotElement);
-// }
+ // TemplateParameter templateParameter = pivotElement.isTemplateParameter();
+ // if (templateParameter == null) {
+ // templateParameter = PivotFactory.eINSTANCE.createTemplateParameter();
+ // templateParameter.setOwnedParameteredElement(pivotElement);
+ // }
List<EGenericType> eBounds = eObject2.getEBounds();
if (!eBounds.isEmpty()) {
doSwitchAll(eBounds);
@@ -501,7 +501,7 @@
Comment pivotComment = PivotFactory.eINSTANCE.createComment();
pivotComment.setBody(commentBody.replaceAll("\\r", ""));
constraint.getOwnedComments().add(pivotComment);
- }
+ }
converter.addMapping(eOperation, constraint);
return constraint;
}
@@ -514,6 +514,8 @@
@SuppressWarnings("null") @NonNull List<ETypeParameter> eTypeParameters = eOperation.getETypeParameters();
copyTemplateSignature(pivotElement,eTypeParameters);
doSwitchAll(eOperation.getEGenericExceptions());
+ String isTransientString = EcoreUtil.getAnnotation(eOperation, PivotConstants.OPERATION_ANNOTATION_SOURCE, PivotConstants.OPERATION_IS_TRANSIENT);
+ pivotElement.setIsTransient((isTransientString != null) && Boolean.getBoolean(isTransientString));
converter.queueReference(eOperation); // For superclasses
return pivotElement;
}
@@ -522,9 +524,9 @@
List<EAnnotation> excludedAnnotations = null;
EAnnotation redefinesAnnotation = eOperation.getEAnnotation(PivotConstantsInternal.REDEFINES_ANNOTATION_SOURCE);
if (redefinesAnnotation != null) {
-// if (excludedAnnotations == null) {
- excludedAnnotations = new ArrayList<EAnnotation>();
-// }
+ // if (excludedAnnotations == null) {
+ excludedAnnotations = new ArrayList<EAnnotation>();
+ // }
excludedAnnotations.add(redefinesAnnotation);
}
EAnnotation oclAnnotation = OCLCommon.getDelegateAnnotation(eOperation);
@@ -574,8 +576,8 @@
}
ExpressionInOCL specification = PivotFactory.eINSTANCE.createExpressionInOCL();
specification.setBody(value);
-// constraint.setExprString(entry.getValue());
-// constraint.setExprString(entry.getValue());
+ // constraint.setExprString(entry.getValue());
+ // constraint.setExprString(entry.getValue());
if (bodyName != null) {
pivotElement.setBodyExpression(specification);
pivotElement.setImplementation(new EObjectOperation(pivotElement, eOperation, specification));
@@ -593,7 +595,7 @@
}
copyAnnotationComment(constraint, oclAnnotation, key);
}
- }
+ }
}
return excludedAnnotations;
}
@@ -641,9 +643,9 @@
Comment pivotComment = PivotFactory.eINSTANCE.createComment();
pivotComment.setBody(details.get(PivotConstantsInternal.DOCUMENTATION_ANNOTATION_KEY));
pivotElement.getOwnedComments().add(pivotComment);
- }
+ }
else if (hasImportKey(source, details)) {
- }
+ }
else /*if (!eAnnotation.getContents().isEmpty()
|| !eAnnotation.getReferences().isEmpty()
|| (details.size() > 1)
@@ -710,12 +712,12 @@
{
converter.error("Unsupported feature constraint " + key);
}
- }
+ }
if (bestEntry != null) {
String value = bestEntry.getValue();
ExpressionInOCL specification = PivotFactory.eINSTANCE.createExpressionInOCL();
specification.setBody(value);
-// constraint.setExprString(entry.getValue());
+ // constraint.setExprString(entry.getValue());
pivotElement.setOwnedExpression(specification);
pivotElement.setImplementation(new EObjectProperty(eObject, specification));
}
@@ -724,11 +726,11 @@
}
}
copyTypedElement(pivotElement, eObject, excludedAnnotations);
- pivotElement.setIsReadOnly(!eObject.isChangeable());
- pivotElement.setIsDerived(eObject.isDerived());
- pivotElement.setIsTransient(eObject.isTransient());
- pivotElement.setIsUnsettable(eObject.isUnsettable());
- pivotElement.setIsVolatile(eObject.isVolatile());
+ pivotElement.setIsReadOnly(!eObject.isChangeable());
+ pivotElement.setIsDerived(eObject.isDerived());
+ pivotElement.setIsTransient(eObject.isTransient());
+ pivotElement.setIsUnsettable(eObject.isUnsettable());
+ pivotElement.setIsVolatile(eObject.isVolatile());
}
protected void copyTypedElement(@NonNull TypedElement pivotElement, @NonNull ETypedElement eTypedElement, List<EAnnotation> excludedAnnotations) {
diff --git a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotConstants.java b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotConstants.java
index d322dc8..cfa50f4 100644
--- a/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotConstants.java
+++ b/plugins/org.eclipse.ocl.pivot/src/org/eclipse/ocl/pivot/utilities/PivotConstants.java
@@ -13,6 +13,9 @@
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.common.OCLConstants;
+/**
+ * @noimplement This interface is not intended to be implemented by clients.
+ */
public interface PivotConstants
{
/**
@@ -23,17 +26,17 @@
* intended to be used by client code.
*/
static final @NonNull String AS_METAMODEL_ANNOTATION_SOURCE = "http://www.eclipse.org/OCL/ASMetamodel";
-
+
/**
* The Package name of the shared metamodel.
*/
static final @NonNull String METAMODEL_NAME = "$metamodel$";
-
+
/**
* The Package name of the shared types metamodel.
*/
static final @NonNull String TYPES_METAMODEL_NAME = "$types$"; // FIXME Use extension point
-
+
/**
* The Package name of the shared uml metamodel.
*/
@@ -45,7 +48,7 @@
static final @NonNull String OCLSTDLIB_FILE_EXTENSION = "oclstdlib";
static final @NonNull String OCL_AS_FILE_EXTENSION = "oclas";
static final @NonNull String DOT_OCL_AS_FILE_EXTENSION = "." + OCL_AS_FILE_EXTENSION;
-
+
/**
* String-valued URI prefix of a package defining the primitive types. Proxy references to
* e.g. OCL's String rather than Ecore's EString are constructed by just appending 'String' to
@@ -65,7 +68,17 @@
*/
static final @NonNull String COLLECTION_ANNOTATION_SOURCE = "http://www.eclipse.org/OCL/Collection";
static final @NonNull String COLLECTION_IS_NULL_FREE = "nullFree";
-
+
+ /**
+ * EOperation annotation identifying that anoperation is transient (not-cached).
+ * @since 1.3
+ */
+ static final @NonNull String OPERATION_ANNOTATION_SOURCE = "http://www.eclipse.org/OCL/Operation";
+ /**
+ * @since 1.3
+ */
+ static final @NonNull String OPERATION_IS_TRANSIENT = "isTransient";
+
/**
* EPackage annotation indicating that the EPackage is an Ecore serialisation of an OCL AS Library.
* No details are defined for this EAnnotation.
@@ -92,10 +105,10 @@
static final @NonNull String ORPHANAGE_PREFIX = "orphanage";
static final @NonNull String ORPHANAGE_URI = "http://www.eclipse.org/ocl/2015/Orphanage";
static final @NonNull String PRIMITIVES_URI = "http://www.eclipse.org/ocl/2015/Primitives";
-
+
static final @NonNull String OCL_LANGUAGE = "OCL"; // More visible UMLUtil.Language_OCL
static final @NonNull String OCL_NAME = "ocl";
-
+
static final @NonNull String MESSAGE_PART_NAME = "message";
static final @NonNull String SEVERITY_PART_NAME = "severity";
static final @NonNull String STATUS_PART_NAME = "status";
diff --git a/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/as2cs/BaseDeclarationVisitor.java b/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/as2cs/BaseDeclarationVisitor.java
index f26b760..362ab51 100644
--- a/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/as2cs/BaseDeclarationVisitor.java
+++ b/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/as2cs/BaseDeclarationVisitor.java
@@ -221,6 +221,8 @@
List<LanguageExpression> bodyExpressions = object.getBodyExpression() != null ? Collections.singletonList(object.getBodyExpression()) : Collections.<LanguageExpression>emptyList();
context.refreshList(csElement.getOwnedBodyExpressions(), context.visitDeclarations(SpecificationCS.class, bodyExpressions, null));
context.refreshList(csElement.getOwnedPostconditions(), context.visitDeclarations(ConstraintCS.class, object.getOwnedPostconditions(), null));
+ List<@NonNull String> qualifiers = ClassUtil.nullFree(csElement.getQualifiers());
+ context.refreshQualifiers(qualifiers, "transient", "!transient", object.isIsTransient() ? Boolean.TRUE : null);
return csElement;
}
diff --git a/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/cs2as/BaseCSContainmentVisitor.java b/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/cs2as/BaseCSContainmentVisitor.java
index 486752e..43ee158 100644
--- a/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/cs2as/BaseCSContainmentVisitor.java
+++ b/plugins/org.eclipse.ocl.xtext.base/src/org/eclipse/ocl/xtext/base/cs2as/BaseCSContainmentVisitor.java
@@ -114,7 +114,7 @@
protected Continuation<?> refreshClass(org.eclipse.ocl.pivot.@NonNull Class pivotElement, @NonNull StructuredClassCS csElement) {
pivotElement.setIsAbstract(csElement.isIsAbstract());
pivotElement.setIsInterface(csElement.isIsInterface());
-// pivotElement.setIsStatic(qualifiers.contains("static"));
+ // pivotElement.setIsStatic(qualifiers.contains("static"));
context.refreshPivotList(Property.class, pivotElement.getOwnedProperties(), csElement.getOwnedProperties());
context.refreshPivotList(Operation.class, pivotElement.getOwnedOperations(), csElement.getOwnedOperations());
refreshClassifier(pivotElement, csElement);
@@ -158,7 +158,7 @@
if (name == null) {
throw new IllegalStateException("Null name");
}
-/* if ((name == null) && (csElement.eContainer() == null)) {
+ /* if ((name == null) && (csElement.eContainer() == null)) {
Resource csResource = csElement.eResource();
if (csResource != null) {
URI csURI = csResource.getURI();
@@ -210,7 +210,7 @@
throw new IllegalStateException("Null resource for root package");
}
Object pivotObject = context.getConverter().getPivotElement(csElement);
-// Object pivotObject = csElement.getPivot();
+ // Object pivotObject = csElement.getPivot();
if (pivotObject == null) {
Resource asResource = context.getConverter().getASResource();
for (EObject oldRoot : asResource.getContents()) {
@@ -250,18 +250,18 @@
return pivotElement;
}
-
+
/**
* Method used to refresh every {@link RootPackageCS} element.
- *
- * There are some Roots which may own packages like those created in OCLinEcore or StdLin documents
+ *
+ * There are some Roots which may own packages like those created in OCLinEcore or StdLin documents
*/
protected @NonNull <@NonNull T extends Model> T refreshRootPackage(@NonNull Class<T> pivotClass, /*@NonNull*/ EClass pivotEClass, @NonNull RootPackageCS csElement) {
@NonNull T pivotElement = refreshRoot(pivotClass, pivotEClass, csElement);
context.refreshPivotList(org.eclipse.ocl.pivot.Package.class, pivotElement.getOwnedPackages(), csElement.getOwnedPackages());
return pivotElement;
}
-
+
@Override
public Continuation<?> visitAnnotationCS(@NonNull AnnotationCS csElement) {
@SuppressWarnings("null") @NonNull EClass eClass = PivotPackage.Literals.ANNOTATION;
@@ -320,7 +320,7 @@
@Override
public Continuation<?> visitElementCS(@NonNull ElementCS csElement) {
-// FIXME return visiting(csElement);
+ // FIXME return visiting(csElement);
System.out.println("Unsupported " + csElement.eClass().getName() + " for CS2AS Containment pass");
return null;
}
@@ -359,7 +359,7 @@
context.addDiagnostic(csElement, "An all-package import cannot have an associated alias name");
}
Namespace namespace = csElement.getReferredNamespace();
- if ((namespace != null) && !namespace.eIsProxy()) {
+ if ((namespace != null) && !namespace.eIsProxy()) {
Namespace oldNamespace = pivotElement.getImportedNamespace();
if (namespace != oldNamespace) {
pivotElement.setImportedNamespace(namespace);
@@ -403,6 +403,9 @@
List<SpecificationCS> csBodyExpressions = csElement.getOwnedBodyExpressions();
SpecificationCS csBodyExpression = csBodyExpressions.size() > 0 ? csBodyExpressions.get(0) : null;
pivotElement.setBodyExpression(PivotUtil.getPivot(ExpressionInOCL.class, csBodyExpression));
+ List<String> qualifiers = csElement.getQualifiers();
+ assert qualifiers != null;
+ pivotElement.setIsTransient(ElementUtil.getQualifier(qualifiers, "transient", "!transient", true));
return null;
}