Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java')
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java
index 5f522c488..6c96c1c56 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java
@@ -22,6 +22,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.ENamedElement;
@@ -58,6 +59,8 @@ public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint
private String[] extraAnnotationsSources = new String[] {};
+ private PersistenceOptions persistenceOptions = null;
+
/** Parse an pamodel */
public void process(PAnnotatedModel paModel) {
for (PAnnotatedEPackage pap : paModel.getPaEPackages()) {
@@ -165,10 +168,11 @@ public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint
private ArrayList<NamedParserNode> process(EAnnotation ea, ENamedElement ene) {
final ArrayList<NamedParserNode> result = new ArrayList<NamedParserNode>();
- if (!isValidSource(ea.getSource())) {
+ if (!isValidSource(ea.getSource(), ene.getEAnnotations())) {
return result;
}
+
log.debug("Processing annotations ");
for (Map.Entry<String, String> pAnnotationDetails : ea.getDetails().entrySet()) {
final String fName = pAnnotationDetails.getKey();
@@ -215,7 +219,7 @@ public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint
}
/** Is a valid source */
- protected boolean isValidSource(String source) {
+ protected boolean isValidSource(String source, EList<EAnnotation> eAnnotations) {
if (source == null) {
return false;
}
@@ -226,6 +230,18 @@ public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint
return true;
}
}
+
+ // check if there is an extra annotation which could have been used
+ // if so then return false, it should already have been caught in the above if
+ if (persistenceOptions != null && persistenceOptions.isExtraAnnotationsOverridesDefault()) {
+ for (EAnnotation eAnnotation : eAnnotations) {
+ for (String annotationSource : extraAnnotationsSources) {
+ if (eAnnotation.getSource().equals(annotationSource)) {
+ return false;
+ }
+ }
+ }
+ }
}
if (source.equals(Constants.ANNOTATION_SOURCE_TENEO_JPA_AUDITING)) {
@@ -236,12 +252,15 @@ public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint
|| source.startsWith(Constants.ANNOTATION_SOURCE_TENEO_MAPPING);
}
+
+
/** Find the efeature */
public EStructuralFeature getEStructuralFeature(EClass eClass, String name) {
return ParserUtil.getEStructuralFeature(eClass, name);
}
public void setExtraAnnotationSources(PersistenceOptions po) {
+ persistenceOptions = po;
if (po.getExtraAnnotationSources() != null
&& po.getExtraAnnotationSources().trim().length() > 0) {
extraAnnotationsSources = po.getExtraAnnotationSources().split(",");

Back to the top