Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.emf.teneo/src/org/eclipse')
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/Constants.java20
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/EContainerRepairControl.java67
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ERuntime.java35
-rw-r--r--core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PackageRegistryProvider.java6
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PersistenceOptions.java585
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/StoreValidationException.java4
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractAnnotator.java13
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractProcessingContext.java135
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AnnotationGenerator.java27
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BaseEFeatureAnnotator.java33
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BasicPamodelBuilder.java113
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BidirectionalManyToManyAnnotator.java22
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EClassAnnotator.java49
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EFeatureAnnotator.java117
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/ManyToOneReferenceAnnotator.java24
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyAttributeAnnotator.java39
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyReferenceAnnotator.java130
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToOneReferenceAnnotator.java30
-rw-r--r--core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceFileProvider.java9
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceMappingBuilder.java26
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/SingleAttributeAnnotator.java26
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/UnidirectionalManyToManyAnnotator.java16
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationParser.java282
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationTokenizer.java193
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ArrayValueNode.java3
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ComplexNode.java62
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/EAnnotationParserImporter.java69
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/NamedParserNode.java2
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ParserUtil.java14
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/PrimitiveValueNode.java5
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ReferenceValueNode.java5
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/PersistenceMappingSchemaGenerator.java109
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlElementToEStructuralFeatureMapper.java16
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceContentHandler.java149
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceMapper.java20
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassClassLoaderStrategy.java19
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassLoaderResolver.java2
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ecore/EModelResolver.java18
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/DefaultExtensionManager.java25
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/Extension.java11
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManager.java12
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManagerFactory.java2
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionUtil.java204
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/MapPersistableEMap.java15
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableDelegateList.java2
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEList.java97
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEMap.java26
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableFeatureMap.java48
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/EntityNameStrategy.java21
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/SQLNameStrategy.java66
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/StrategyUtil.java40
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingDiagnostician.java3
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingEContentsEList.java13
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java248
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Element.java4
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Node.java4
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/FeatureMapEntry.java107
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/MixedFeatureMapEntry.java4
-rw-r--r--core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/PersistentStoreAdapter.java67
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/AssertUtil.java29
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/EcoreDataTypes.java142
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/FieldUtil.java26
-rwxr-xr-xcore/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/StoreUtil.java248
63 files changed, 1820 insertions, 2138 deletions
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/Constants.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/Constants.java
index 1a35d75dd..9be89039f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/Constants.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/Constants.java
@@ -30,13 +30,16 @@ import org.eclipse.emf.ecore.xml.type.XMLTypePackage;
public class Constants {
/** StructuralFeatures for TEXT content (part of a mixed complex type) */
- public static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
+ public static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE
+ .getXMLTypeDocumentRoot_Text();
/** StructuralFeatures for CDATA content (part of a mixed complex type) */
- public static final EStructuralFeature CDATA = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_CDATA();
+ public static final EStructuralFeature CDATA = XMLTypePackage.eINSTANCE
+ .getXMLTypeDocumentRoot_CDATA();
/** StructuralFeatures for COMMENT content (part of a mixed complex type) */
- public static final EStructuralFeature COMMENT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Comment();
+ public static final EStructuralFeature COMMENT = XMLTypePackage.eINSTANCE
+ .getXMLTypeDocumentRoot_Comment();
/**
* The name under which this connection (PersistenceManagerFactory) is registered
@@ -50,7 +53,8 @@ public class Constants {
public static final String PROP_EDITOR_ID = "editorid";
/**
- * The NS URI of the epackage handled by this database (can be more than one, then should be a comma delimited list)
+ * The NS URI of the epackage handled by this database (can be more than one, then should be a
+ * comma delimited list)
*/
public static final String PROP_EPACKAGE_NSURI = "nsuri";
@@ -91,4 +95,12 @@ public class Constants {
public final static String ANNOTATION_SOURCE_TENEO_JPA = "teneo.jpa";
public final static String ANNOTATION_SOURCE_TENEO_MAPPING = "teneo.mapping";
+
+ public final static String ANNOTATION_SOURCE_AUDITING = "teneo.auditing";
+ public final static String ANNOTATION_AUDITING_MODELELEMENT = "teneo.auditing.modelelement";
+ public final static String ANNOTATION_AUDITING_MODELELEMENT_AUDITING = "teneo.auditing.modelelement.auditing";
+
+ public final static String ANNOTATION_AUDITING_NOT = "@NoAuditing";
+
+ public final static String ANNOTATION_SOURCE_TENEO_JPA_AUDITING = "teneo.jpa.auditing";
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/EContainerRepairControl.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/EContainerRepairControl.java
index 4304fe844..44def2d13 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/EContainerRepairControl.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/EContainerRepairControl.java
@@ -62,12 +62,11 @@ public class EContainerRepairControl {
private static final Hashtable<Class<?>, Class<?>> norepairRequired = new Hashtable<Class<?>, Class<?>>();
/** Hashmap of repair controls for a certain class */
- private static final Hashtable<Class<?>, List<RepairControl>> repair =
- new Hashtable<Class<?>, List<RepairControl>>();
+ private static final Hashtable<Class<?>, List<RepairControl>> repair = new Hashtable<Class<?>, List<RepairControl>>();
/**
- * Recursively sets the resource of the object and all its referenced objects, only if the
- * object has a resource which is not set and does not have a container.
+ * Recursively sets the resource of the object and all its referenced objects, only if the object
+ * has a resource which is not set and does not have a container.
*/
public static void setEResourceToAlLContent(InternalEObject start, Resource res) {
for (EStructuralFeature estruct : start.eClass().getEAllStructuralFeatures()) {
@@ -102,7 +101,8 @@ public class EContainerRepairControl {
}
/** Sets the resource on an object or if it has a container on its container */
- private static void setResource(InternalEObject eobj, ArrayList<EObject> objs, Resource.Internal res) {
+ private static void setResource(InternalEObject eobj, ArrayList<EObject> objs,
+ Resource.Internal res) {
// been here go away
if (objs.contains(eobj)) {
return;
@@ -146,8 +146,8 @@ public class EContainerRepairControl {
for (int i = 0; i < repairList.size(); i++) {
RepairControl repairControl = repairList.get(i);
if (log.isDebugEnabled()) {
- log.debug("Repairing reference " + repairControl.container.getName() + " to child " +
- repairControl.childClass.getName());
+ log.debug("Repairing reference " + repairControl.container.getName() + " to child "
+ + repairControl.childClass.getName());
}
repairControl.repair((InternalEObject) owner);
@@ -156,10 +156,11 @@ public class EContainerRepairControl {
/**
* Convenience method to just set the container directly for an object, this method does not
- * cascade down. The featureid is the id of the feature of the owner which contains the child.
- * The feature id is corrected in the method.
+ * cascade down. The featureid is the id of the feature of the owner which contains the child. The
+ * feature id is corrected in the method.
*/
- public static void setContainer(InternalEObject owner, InternalEObject child, EStructuralFeature estruct) {
+ public static void setContainer(InternalEObject owner, InternalEObject child,
+ EStructuralFeature estruct) {
if (child.eContainer() == owner) {
return;
}
@@ -189,10 +190,11 @@ public class EContainerRepairControl {
final int correctedFeatureID;
if (estruct instanceof EReference && ((EReference) estruct).getEOpposite() != null) {
- correctedFeatureID = ((InternalEObject) child).eClass().getFeatureID(((EReference) estruct).getEOpposite());
+ correctedFeatureID = ((InternalEObject) child).eClass().getFeatureID(
+ ((EReference) estruct).getEOpposite());
} else {
- correctedFeatureID =
- InternalEObject.EOPPOSITE_FEATURE_BASE - ((InternalEObject) owner).eClass().getFeatureID(estruct);
+ correctedFeatureID = InternalEObject.EOPPOSITE_FEATURE_BASE
+ - ((InternalEObject) owner).eClass().getFeatureID(estruct);
}
if (norepairRequired.get(owner.getClass()) != null) {
@@ -211,8 +213,8 @@ public class EContainerRepairControl {
for (int i = 0; i < repairList.size(); i++) {
RepairControl repairControl = repairList.get(i);
- if (repairControl.getFeatureID() == correctedFeatureID &&
- ((Class<?>) repairControl.childClass).isAssignableFrom(child.getClass())) {
+ if (repairControl.getFeatureID() == correctedFeatureID
+ && ((Class<?>) repairControl.childClass).isAssignableFrom(child.getClass())) {
repairControl.repair((InternalEObject) owner, (InternalEObject) child);
return;
}
@@ -286,13 +288,12 @@ public class EContainerRepairControl {
assert (!(containedObject instanceof PersistableDelegateList<?>));
/*
- * if (containedObject instanceof JPOXEList) { if
- * (((JPOXEList)containedObject).getOwner() == owner) return;
+ * if (containedObject instanceof JPOXEList) { if (((JPOXEList)containedObject).getOwner() ==
+ * owner) return;
*
- * throw new StoreJPOXEmfException("Owner of containerobject is different from passed
- * owner, " + "this should have been solved in the
- * elist" + containedObject.getClass() + "/" + owner.getClass().getName() + "/" +
- * container.getName()); }
+ * throw new StoreJPOXEmfException("Owner of containerobject is different from passed owner,
+ * " + "this should have been solved in the elist" + containedObject.getClass() + "
+ * /" + owner.getClass().getName() + "/" + container.getName()); }
*/
if (!(containedObject instanceof InternalEObject)) {
@@ -305,8 +306,8 @@ public class EContainerRepairControl {
}
if (log.isDebugEnabled()) {
- log.debug("Set container of child " + containedObject.getClass().getName() + " containerfield " +
- container.getName());
+ log.debug("Set container of child " + containedObject.getClass().getName()
+ + " containerfield " + container.getName());
}
// and set it
@@ -317,8 +318,8 @@ public class EContainerRepairControl {
* if (containedObject instanceof InternalEObject) { final InternalEObject eobj =
* (InternalEObject)containedObject; if (eobj.eResource() != owner.eResource()) {
* log.debug("Set resource of eobj " + eobj.getClass().getName() + " to resource " +
- * owner.eResource().getURI()); eobj.eSetResource((Resource.Internal)owner.eResource(),
- * null); } }
+ * owner.eResource().getURI()); eobj.eSetResource((Resource.Internal)owner.eResource(), null);
+ * } }
*/
// and also do its children
@@ -336,8 +337,8 @@ public class EContainerRepairControl {
}
if (log.isDebugEnabled()) {
- log.debug("Set container of child " + child.getClass().getName() + " containerfield " +
- container.getName());
+ log.debug("Set container of child " + child.getClass().getName() + " containerfield "
+ + container.getName());
}
// and set it
@@ -346,11 +347,10 @@ public class EContainerRepairControl {
// also repair the resource if applicable!
/*
* if (child instanceof InternalEObject) { final InternalEObject eobj =
- * (InternalEObject)child; Object ores = owner.eResource(); Object eres =
- * eobj.eResource(); if (eobj.eResource() != owner.eResource()) { log.debug("Set
- * resource of eobj " + eobj.getClass().getName() + " to resource " +
- * owner.eResource().getURI()); eobj.eSetResource((Resource.Internal)owner.eResource(),
- * null); } }
+ * (InternalEObject)child; Object ores = owner.eResource(); Object eres = eobj.eResource(); if
+ * (eobj.eResource() != owner.eResource()) { log.debug("Set resource of eobj " +
+ * eobj.getClass().getName() + " to resource " + owner.eResource().getURI());
+ * eobj.eSetResource((Resource.Internal)owner.eResource(), null); } }
*/
EContainerRepairControl.repair(child);
@@ -363,7 +363,8 @@ public class EContainerRepairControl {
private static class OneWayContainer extends RepairControl {
/** Constructor */
OneWayContainer(EReference containerReference) {
- super(containerReference, InternalEObject.EOPPOSITE_FEATURE_BASE - containerReference.getFeatureID());
+ super(containerReference, InternalEObject.EOPPOSITE_FEATURE_BASE
+ - containerReference.getFeatureID());
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ERuntime.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ERuntime.java
index fc2f5b682..e4313a236 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ERuntime.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ERuntime.java
@@ -61,7 +61,7 @@ public class ERuntime extends EModelResolver {
/** Count of times that an epackage got registered */
private final ArrayList<Integer> registrationCount = new ArrayList<Integer>();
-
+
/** The mapping from concrete classes to eclass and back */
private final HashMap<Class<?>, EClass> concreteToEClass = new HashMap<Class<?>, EClass>();
@@ -74,11 +74,11 @@ public class ERuntime extends EModelResolver {
/** The list of contained classes/interfaces */
private final ArrayList<Class<?>> containedClasses = new ArrayList<Class<?>>();
-
+
/** Remove an epackage from the internal lists */
public void removeEPackages(List<EPackage> ePackages) {
for (EPackage ePackage : ePackages) {
- epackages.remove(ePackage);
+ epackages.remove(ePackage);
}
// recompute everything
@@ -177,8 +177,8 @@ public class ERuntime extends EModelResolver {
}
/**
- * Walks through a interface inheritance structure and determines if a superclass is contained
- * if so then the class is added to the containedclasses
+ * Walks through a interface inheritance structure and determines if a superclass is contained if
+ * so then the class is added to the containedclasses
*/
private boolean isSelfOrSuperContained(Class<?> checkClass, ArrayList<Class<?>> containedClasses) {
// assert (checkClass.isInterface());
@@ -276,8 +276,8 @@ public class ERuntime extends EModelResolver {
}
/**
- * Walks up the class hierarchy and adds the superclasses to the concrete-interface mapping
- * class sets
+ * Walks up the class hierarchy and adds the superclasses to the concrete-interface mapping class
+ * sets
*/
private void addAbstractSupers(Class<?> clazz) {
@@ -321,15 +321,15 @@ public class ERuntime extends EModelResolver {
/** Convenience method to easily determine which packages should be ignored */
private static boolean ignorePackage(EPackage epack) {
- return false;
-// }
-// if (epack instanceof XMLTypePackageImpl) {
-// return true; // ignore this
-// }
-// if (epack instanceof EcorePackageImpl) {
-// return true; // ignore this
-// }
-// return false;
+ return false;
+ // }
+ // if (epack instanceof XMLTypePackageImpl) {
+ // return true; // ignore this
+ // }
+ // if (epack instanceof EcorePackageImpl) {
+ // return true; // ignore this
+ // }
+ // return false;
}
/** Returns the instanceclass for a passed interface */
@@ -419,8 +419,7 @@ public class ERuntime extends EModelResolver {
/**
* Returns the list of EMF interfaces which are contained. Only the topmost interface in a class
- * hierarchy is returned. This can be used to automatically create the econtainer field
- * mappings.
+ * hierarchy is returned. This can be used to automatically create the econtainer field mappings.
*
* Note that multiple classes in one inheritance structure can be present.
*/
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PackageRegistryProvider.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PackageRegistryProvider.java
index cb54612fe..5e2d6a18f 100644
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PackageRegistryProvider.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PackageRegistryProvider.java
@@ -19,9 +19,9 @@ package org.eclipse.emf.teneo;
import org.eclipse.emf.ecore.EPackage;
/**
- * Provides the package registry to the rest of Teneo. As a default the global Package.Registry is used. There are two
- * ways to override the behavior in this class by setting a Package.Registry explicitly. Or by replacing the singleton
- * instance with your own implementation.
+ * Provides the package registry to the rest of Teneo. As a default the global Package.Registry is
+ * used. There are two ways to override the behavior in this class by setting a Package.Registry
+ * explicitly. Or by replacing the singleton instance with your own implementation.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.2 $
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PersistenceOptions.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PersistenceOptions.java
index ffc1cda0d..350748485 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PersistenceOptions.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/PersistenceOptions.java
@@ -54,6 +54,13 @@ public class PersistenceOptions implements ExtensionPoint {
/** The logger */
private static Log log = LogFactory.getLog(PersistenceOptions.class);
+ // START: ++++++++++++++++++++++ AUDITING Naming related Options
+ // ++++++++++++++++++++++++++++++++++++
+
+ public static final String ENABLE_AUDITING = NAMING_PREFIX + "auditing.enable";
+ public static final String AUDITING_ENTITY_PREFIX = NAMING_PREFIX + "auditing.entity.prefix";
+ public static final String AUDITING_ENTITY_POSTFIX = NAMING_PREFIX + "auditing.entity.postfix";
+
// START: ++++++++++++++++++++++ SQL Naming related Options
// ++++++++++++++++++++++++++++++++++++
@@ -80,91 +87,78 @@ public class PersistenceOptions implements ExtensionPoint {
+ "join_table_naming_strategy";
/**
- * Join column naming strategy, two values: unique and simple. unique is the
- * default and results in guaranteed unique naming for the join columns
- * simple will always try to use minimal name lengths and will most of the
- * time just use the efeaturename.
+ * Join column naming strategy, two values: unique and simple. unique is the default and results
+ * in guaranteed unique naming for the join columns simple will always try to use minimal name
+ * lengths and will most of the time just use the efeaturename.
*/
public static final String JOIN_COLUMN_NAMING_STRATEGY = NAMING_PREFIX
+ "join_column_naming_strategy";
/** The column name of the id column in the idbag, default is id */
- public static final String IDBAG_ID_COLUMN_NAME = NAMING_PREFIX
- + "idbag_id_column_name";
+ public static final String IDBAG_ID_COLUMN_NAME = NAMING_PREFIX + "idbag_id_column_name";
/** Name of version column, default value is e_version */
- public static final String VERSION_COLUMN_NAME = NAMING_PREFIX
- + "version_column";
+ public static final String VERSION_COLUMN_NAME = NAMING_PREFIX + "version_column";
/** Name of id column, default value is e_id */
- public static final String ID_COLUMN_NAME = NAMING_PREFIX
- + "default_id_column";
+ public static final String ID_COLUMN_NAME = NAMING_PREFIX + "default_id_column";
/**
- * Truncate the column name if the length is larger than this property. In
- * case of concatenating property names for foreign keys
+ * Truncate the column name if the length is larger than this property. In case of concatenating
+ * property names for foreign keys
*/
- public static final String MAXIMUM_SQL_NAME_LENGTH = NAMING_PREFIX
- + "max_sql_name_length";
+ public static final String MAXIMUM_SQL_NAME_LENGTH = NAMING_PREFIX + "max_sql_name_length";
/**
- * The option which determines the casing of columns and table names,
- * lowercase will result in lowercase letters, uppercase in uppercase, none
- * will just work as it did until now
+ * The option which determines the casing of columns and table names, lowercase will result in
+ * lowercase letters, uppercase in uppercase, none will just work as it did until now
*/
public static final String SQL_CASE_STRATEGY = NAMING_PREFIX + "strategy";
/**
- * If set then the system will generate readable foreign key names. The
- * default is true. Set to false for backward compatibility. Note that
- * before the default value of this property was false.
+ * If set then the system will generate readable foreign key names. The default is true. Set to
+ * false for backward compatibility. Note that before the default value of this property was
+ * false.
*/
- public static final String SET_FOREIGN_KEY_NAME = NAMING_PREFIX
- + "set_foreign_key_name";
+ public static final String SET_FOREIGN_KEY_NAME = NAMING_PREFIX + "set_foreign_key_name";
/**
- * The escape character to use when escaping table and column names.
- * Standard Hibernate uses the ` (backtick). This is the default value.
+ * The escape character to use when escaping table and column names. Standard Hibernate uses the `
+ * (backtick). This is the default value.
*/
public static final String SQL_NAME_ESCAPE_CHARACTER = MAPPING_PREFIX
+ "sql_name_escape_character";
/**
- * The sql name strategy, if not set then the ClassicSQLNameStrategy is
- * used.
+ * The sql name strategy, if not set then the ClassicSQLNameStrategy is used.
*
* @Deprecated use the extensionManager concept
*/
- public static final String SQL_NAME_STRATEGY = NAMING_PREFIX
- + "sql_name_strategy";
+ public static final String SQL_NAME_STRATEGY = NAMING_PREFIX + "sql_name_strategy";
/**
* The Table name prefix, as a default set to "".
*/
- public static final String SQL_TABLE_NAME_PREFIX = NAMING_PREFIX
- + "sql_table_name_prefix";
+ public static final String SQL_TABLE_NAME_PREFIX = NAMING_PREFIX + "sql_table_name_prefix";
/**
* The Column name prefix, as a default set to "".
*/
- public static final String SQL_COLUMN_NAME_PREFIX = NAMING_PREFIX
- + "sql_column_name_prefix";
+ public static final String SQL_COLUMN_NAME_PREFIX = NAMING_PREFIX + "sql_column_name_prefix";
/**
* The FK name prefix, as a default set to "".
*/
- public static final String SQL_FOREIGN_KEY_NAME_PREFIX = NAMING_PREFIX
- + "sql_fk_name_prefix";
+ public static final String SQL_FOREIGN_KEY_NAME_PREFIX = NAMING_PREFIX + "sql_fk_name_prefix";
/**
* The Index name prefix, as a default set to "".
*/
- public static final String SQL_INDEX_KEY_NAME_PREFIX = NAMING_PREFIX
- + "sql_index_name_prefix";
+ public static final String SQL_INDEX_KEY_NAME_PREFIX = NAMING_PREFIX + "sql_index_name_prefix";
/**
- * Controls if manually set sql names (table name, column names) should also
- * be truncated or cased. Default is true for backward compatability.
+ * Controls if manually set sql names (table name, column names) should also be truncated or
+ * cased. Default is true for backward compatability.
*/
public static final String AUTO_ADAPT_MANUAL_SET_SQL_NAMES = NAMING_PREFIX
+ "auto_adapt_manual_set_sql_names";
@@ -173,8 +167,8 @@ public class PersistenceOptions implements ExtensionPoint {
// ++++++++++++++++++++++++++++++++++++
/**
- * Controls if non-mutable eclasses should have a discriminator or version
- * column. Default is false.
+ * Controls if non-mutable eclasses should have a discriminator or version column. Default is
+ * false.
*
* @Deprecated use the extensionManager concept
*/
@@ -182,8 +176,8 @@ public class PersistenceOptions implements ExtensionPoint {
+ "sql_discriminator_version_immutable_eclass";
/**
- * Controls how the econtainer feature id is persisted. There are three
- * values: featureid or featurename
+ * Controls how the econtainer feature id is persisted. There are three values: featureid or
+ * featurename
*
* @Deprecated use the extensionManager concept
*/
@@ -191,40 +185,33 @@ public class PersistenceOptions implements ExtensionPoint {
+ "econtainer_feature_persistence_strategy";
/**
- * see bugzilla 227673, option can be used to set the hibernate usertype
- * used for xsd date and xsd date time fields.
+ * see bugzilla 227673, option can be used to set the hibernate usertype used for xsd date and xsd
+ * date time fields.
*/
- public static final String USER_XSDDATE_TYPE = MAPPING_PREFIX
- + "UserDateType";
- public static final String USER_XSDDATETIME_TYPE = MAPPING_PREFIX
- + "UserDateTimeType";
- public static final String USER_XSDTIME_TYPE = MAPPING_PREFIX
- + "UserTimeType";
+ public static final String USER_XSDDATE_TYPE = MAPPING_PREFIX + "UserDateType";
+ public static final String USER_XSDDATETIME_TYPE = MAPPING_PREFIX + "UserDateTimeType";
+ public static final String USER_XSDTIME_TYPE = MAPPING_PREFIX + "UserTimeType";
/**
- * This option can be used to control the actual xsd date class used, as a
- * default the javax.xml.datatype.XMLGregorianCalendar class is used.
+ * This option can be used to control the actual xsd date class used, as a default the
+ * javax.xml.datatype.XMLGregorianCalendar class is used.
*/
public static final String XSDDATE_CLASS = MAPPING_PREFIX + "XSDDateClass";
/**
- * The default length of a varchar column. Normally hibernate will choose to
- * set this to 255.
+ * The default length of a varchar column. Normally hibernate will choose to set this to 255.
*/
- public static final String DEFAULT_VARCHAR_LENGTH = MAPPING_PREFIX
- + "default_varchar_length";
+ public static final String DEFAULT_VARCHAR_LENGTH = MAPPING_PREFIX + "default_varchar_length";
/**
- * The maximum length of the comments which are copied from the model to the
- * mapping file. The default is zero which means no comments are copied from
- * the model to the mapping.
+ * The maximum length of the comments which are copied from the model to the mapping file. The
+ * default is zero which means no comments are copied from the model to the mapping.
*/
- public static final String MAX_COMMENT_LENGTH = MAPPING_PREFIX
- + "max_comment_length";
+ public static final String MAX_COMMENT_LENGTH = MAPPING_PREFIX + "max_comment_length";
/**
- * EClass marked with Embeddable is always embedded, default is false. If
- * this is set to true then it is not required anymore to set a
+ * EClass marked with Embeddable is always embedded, default is false. If this is set to true then
+ * it is not required anymore to set a
*
* @Embedded annotation on an ereference,
* @Embeddable on the EClass is then sufficient.
@@ -233,21 +220,17 @@ public class PersistenceOptions implements ExtensionPoint {
+ "map_embeddable_as_embedded";
/** Optimistic locking */
- public static final String OPTIMISTIC = MAPPING_PREFIX
- + "optimistic_locking";
+ public static final String OPTIMISTIC = MAPPING_PREFIX + "optimistic_locking";
/**
- * Add an index for each foreign key mapping. Some databases do not add an
- * index for a foreign key automatically. Setting this to true will
- * automatically add an index field to each foreign key.
+ * Add an index for each foreign key mapping. Some databases do not add an index for a foreign key
+ * automatically. Setting this to true will automatically add an index field to each foreign key.
*/
- public static final String ADD_INDEX_FOR_FOREIGN_KEY = MAPPING_PREFIX
- + "add_index_for_fk";
+ public static final String ADD_INDEX_FOR_FOREIGN_KEY = MAPPING_PREFIX + "add_index_for_fk";
/**
- * Set or not set the cascade attribute on a mto, mtm or otm non-containment
- * relation. The backward compatible value is true. The better performing
- * value is false. The default is false.
+ * Set or not set the cascade attribute on a mto, mtm or otm non-containment relation. The
+ * backward compatible value is true. The better performing value is false. The default is false.
*
* @Deprecated use CASCADE_POLICY_ON_NON_CONTAINMENT
*/
@@ -255,13 +238,11 @@ public class PersistenceOptions implements ExtensionPoint {
+ "set_default_cascade_on_non_containment";
/** Inheritance mapping */
- public static final String INHERITANCE_MAPPING = MAPPING_PREFIX
- + "inheritance";
+ public static final String INHERITANCE_MAPPING = MAPPING_PREFIX + "inheritance";
/**
- * Can be set to force an update of the schema when the application starts.
- * Note this option is only meaningfull for jpox, for hibernate use the
- * hibernate property: hibernate.hbm2ddl_auto
+ * Can be set to force an update of the schema when the application starts. Note this option is
+ * only meaningfull for jpox, for hibernate use the hibernate property: hibernate.hbm2ddl_auto
*/
public static final String UPDATE_SCHEMA = RUNTIME_PREFIX + "update_schema";
@@ -270,10 +251,9 @@ public class PersistenceOptions implements ExtensionPoint {
+ "fetch_containment_eagerly";
/**
- * Force all associations to be extra lazy loaded See here
- * http://sites.google
- * .com/a/pintailconsultingllc.com/java/hibernate-extra-lazy
- * -collection-fetching for some information.
+ * Force all associations to be extra lazy loaded See here http://sites.google
+ * .com/a/pintailconsultingllc.com/java/hibernate-extra-lazy -collection-fetching for some
+ * information.
*
* Default is false.
*/
@@ -290,8 +270,8 @@ public class PersistenceOptions implements ExtensionPoint {
/**
* Can be used to set custom cascade policy for containment : <br>
- * <code>ALL</code> or a combination of (<code>REMOVE</code>,
- * <code>REFRESH</code>, <code>PERSIST</code>, <code>MERGE</code>) <br>
+ * <code>ALL</code> or a combination of (<code>REMOVE</code>, <code>REFRESH</code>,
+ * <code>PERSIST</code>, <code>MERGE</code>) <br>
* e.g. : REMOVE,PERSIST,MERGE <br>
* Warning : ALL != REMOVE,REFRESH,PERSIST,MERGE <br>
* but ALL == REMOVE with delete Orphan, REFRESH,PERSIST,MERGE
@@ -301,44 +281,37 @@ public class PersistenceOptions implements ExtensionPoint {
/**
* Can be used to set custom cascade policy for non containment : <br>
- * a combination of (<code>REFRESH</code>,<code>PERSIST</code>,
- * <code>MERGE</code>) e.g. : PERSIST,MERGE
+ * a combination of (<code>REFRESH</code>,<code>PERSIST</code>, <code>MERGE</code>) e.g. :
+ * PERSIST,MERGE
*/
public static final String CASCADE_POLICY_ON_NON_CONTAINMENT = MAPPING_PREFIX
+ "cascade_policy_on_non_containment";
/**
- * Can be used to control if the entity ann. should be added automatically
- * to the model elements or that the default annotator should work according
- * to the ejb3 spec.
+ * Can be used to control if the entity ann. should be added automatically to the model elements
+ * or that the default annotator should work according to the ejb3 spec.
*/
- public static final String SET_ENTITY_AUTOMATICALLY = MAPPING_PREFIX
- + "set_entity_automatically";
+ public static final String SET_ENTITY_AUTOMATICALLY = MAPPING_PREFIX + "set_entity_automatically";
/**
- * Map all lists as a bag to the db (does not map the list index to the db),
- * default is false
+ * Map all lists as a bag to the db (does not map the list index to the db), default is false
*/
- public static final String ALWAYS_MAP_LIST_AS_BAG = MAPPING_PREFIX
- + "always_map_list_as_bag";
+ public static final String ALWAYS_MAP_LIST_AS_BAG = MAPPING_PREFIX + "always_map_list_as_bag";
/**
- * Map all lists as a hibernate idbag to the db (does not map the list index
- * to the db), default is false
+ * Map all lists as a hibernate idbag to the db (does not map the list index to the db), default
+ * is false
*/
- public static final String MAP_ALL_LISTS_AS_IDBAG = MAPPING_PREFIX
- + "map_all_lists_as_idbag";
+ public static final String MAP_ALL_LISTS_AS_IDBAG = MAPPING_PREFIX + "map_all_lists_as_idbag";
/** Use static hibernate mapping file */
- public static final String USE_MAPPING_FILE = MAPPING_PREFIX
- + "hibernate_mapping_file";
+ public static final String USE_MAPPING_FILE = MAPPING_PREFIX + "hibernate_mapping_file";
/**
- * The complete resource path to the mapping file, can be used instead of
- * the USE_MAPPING_FILE option
+ * The complete resource path to the mapping file, can be used instead of the USE_MAPPING_FILE
+ * option
*/
- public static final String MAPPING_FILE_PATH = MAPPING_PREFIX
- + "mapping_file_name";
+ public static final String MAPPING_FILE_PATH = MAPPING_PREFIX + "mapping_file_name";
/**
* Automatically add @Id to ID feature
@@ -362,145 +335,122 @@ public class PersistenceOptions implements ExtensionPoint {
*
* @id annotation
*/
- public static final String DEFAULT_ID_FEATURE_NAME = NAMING_PREFIX
- + "default_id_feature";
+ public static final String DEFAULT_ID_FEATURE_NAME = NAMING_PREFIX + "default_id_feature";
/**
* The path of the persistence XML file.
*/
- public static final String PERSISTENCE_XML = MAPPING_PREFIX
- + "persistence_xml";
+ public static final String PERSISTENCE_XML = MAPPING_PREFIX + "persistence_xml";
/**
- * Ignore mapping EAnnotations. Primarily meant for test cases that use
- * Persistence XML mapping, so that they can reuse the same sample models.
+ * Ignore mapping EAnnotations. Primarily meant for test cases that use Persistence XML mapping,
+ * so that they can reuse the same sample models.
*/
- public static final String IGNORE_EANNOTATIONS = MAPPING_PREFIX
- + "ignore_eannotations";
+ public static final String IGNORE_EANNOTATIONS = MAPPING_PREFIX + "ignore_eannotations";
/**
- * Map all emaps as true hibernate maps, default is true. In EMF an EMap is
- * in fact an EList with Map entries. Originally Teneo maps this as a
- * hibernate list. In the new behavior hibernate can map the emap as a real
- * map. The default is true.
+ * Map all emaps as true hibernate maps, default is true. In EMF an EMap is in fact an EList with
+ * Map entries. Originally Teneo maps this as a hibernate list. In the new behavior hibernate can
+ * map the emap as a real map. The default is true.
*/
- public static final String EMAP_AS_TRUE_MAP = MAPPING_PREFIX
- + "emap_as_true_map";
+ public static final String EMAP_AS_TRUE_MAP = MAPPING_PREFIX + "emap_as_true_map";
/**
- * This option controls if in case of hibernate also a name attribute should
- * be added to the class/subclass tag. By adding this a class is mapped as
- * an entity as well as a normal class. Also mapping as a normal class has
- * the advantage that proxies can be used and that queries can use actual
- * class names and interface names. This option is really there for backward
- * compatibility. There are no apparent dis-advantages of adding a name
- * attribute so the default of this option is true. Note that an eclass must
- * have an implementation class otherwise this option has no effect.
- * Interfaces are for example always mapped as an entity.
+ * This option controls if in case of hibernate also a name attribute should be added to the
+ * class/subclass tag. By adding this a class is mapped as an entity as well as a normal class.
+ * Also mapping as a normal class has the advantage that proxies can be used and that queries can
+ * use actual class names and interface names. This option is really there for backward
+ * compatibility. There are no apparent dis-advantages of adding a name attribute so the default
+ * of this option is true. Note that an eclass must have an implementation class otherwise this
+ * option has no effect. Interfaces are for example always mapped as an entity.
*/
- public static final String ALSO_MAP_AS_CLASS = MAPPING_PREFIX
- + "also_map_as_class";
+ public static final String ALSO_MAP_AS_CLASS = MAPPING_PREFIX + "also_map_as_class";
/**
- * This option controls if as a default all classes should be proxied (for
- * hibernate). This means that you don't need to add a
+ * This option controls if as a default all classes should be proxied (for hibernate). This means
+ * that you don't need to add a
*
- * @Proxy annotation to each eclass. As a default Teneo will use the eclass
- * interface as the proxy class. When this is set to true then the
- * option ALSO_MAP_AS_CLASS should also be true.
+ * @Proxy annotation to each eclass. As a default Teneo will use the eclass interface as the proxy
+ * class. When this is set to true then the option ALSO_MAP_AS_CLASS should also be true.
*/
public static final String SET_PROXY = MAPPING_PREFIX + "set_proxy";
/**
- * This option forces lazy=true without the proxy attribute in the hibernate
- * mapping.
+ * This option forces lazy=true without the proxy attribute in the hibernate mapping.
*/
public static final String FORCE_LAZY = MAPPING_PREFIX + "force_lazy";
/**
* Disable EContainer mapping.
*/
- public static final String DISABLE_ECONTAINER_MAPPING = MAPPING_PREFIX
- + "disable_econtainer";
+ public static final String DISABLE_ECONTAINER_MAPPING = MAPPING_PREFIX + "disable_econtainer";
/**
- * Option to specify that for non-contained one-to-many always a join table
- * is used, default is true
+ * Option to specify that for non-contained one-to-many always a join table is used, default is
+ * true
*/
public static final String JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS = MAPPING_PREFIX
+ "join_table_for_non_contained_associations";
/**
- * Determines whether to always include a version mapping even if one is not
- * specified. Defaults to "true"
+ * Determines whether to always include a version mapping even if one is not specified. Defaults
+ * to "true"
*/
- public static final String ALWAYS_VERSION = MAPPING_PREFIX
- + "always_version";
+ public static final String ALWAYS_VERSION = MAPPING_PREFIX + "always_version";
/**
- * The default cache strategy, can be one of: NONE, READ_ONLY,
- * NONSTRICT_READ_ONLY, READ_WRITE, TRANSACTIONAl. If different than NONE
- * (=default) then for Hibernate every class will be second-level cached!
+ * The default cache strategy, can be one of: NONE, READ_ONLY, NONSTRICT_READ_ONLY, READ_WRITE,
+ * TRANSACTIONAl. If different than NONE (=default) then for Hibernate every class will be
+ * second-level cached!
*/
- public static final String DEFAULT_CACHE_STRATEGY = MAPPING_PREFIX
- + "default_cache_strategy";
+ public static final String DEFAULT_CACHE_STRATEGY = MAPPING_PREFIX + "default_cache_strategy";
/** The default time/date type used */
- public static final String DEFAULT_TEMPORAL_VALUE = MAPPING_PREFIX
- + "default_temporal";
+ public static final String DEFAULT_TEMPORAL_VALUE = MAPPING_PREFIX + "default_temporal";
/**
- * If true then EAttributes which are not set are stored as null in the
- * database, if false then the default values is stored in the database.
+ * If true then EAttributes which are not set are stored as null in the database, if false then
+ * the default values is stored in the database.
*/
- public static final String HANDLE_UNSET_AS_NULL = RUNTIME_PREFIX
- + "handle_unset_as_null";
+ public static final String HANDLE_UNSET_AS_NULL = RUNTIME_PREFIX + "handle_unset_as_null";
/**
- * When an unset feature is persisted, the database will get a null value,
- * default is false.
+ * When an unset feature is persisted, the database will get a null value, default is false.
*/
- public static final String CONVERT_UNSET_TO_NULL = RUNTIME_PREFIX
- + "convert_unset_to_null";
+ public static final String CONVERT_UNSET_TO_NULL = RUNTIME_PREFIX + "convert_unset_to_null";
/**
* If set to true then the document root is also mapped.
*/
- public static final String MAP_DOCUMENT_ROOT = MAPPING_PREFIX
- + "map_document_root";
+ public static final String MAP_DOCUMENT_ROOT = MAPPING_PREFIX + "map_document_root";
/**
- * If set to true then the system will automatically add referenced
- * epackages
+ * If set to true then the system will automatically add referenced epackages
*/
public static final String AUTO_ADD_REFERENCED_EPACKAGES = MAPPING_PREFIX
+ "auto_add_referenced_epackages";
/**
- * If set to true then the system will map all eclasses as an EAV mapping.
- * See http://www.elver.org/hibernate/eav_mapping.html
+ * If set to true then the system will map all eclasses as an EAV mapping. See
+ * http://www.elver.org/hibernate/eav_mapping.html
*/
public static final String EAV_MAPPING = MAPPING_PREFIX + "eav_mapping";
/**
- * If set then the eav mapping file is read from the location defined by
- * this property.
+ * If set then the eav mapping file is read from the location defined by this property.
*/
- public static final String EAV_MAPPING_FILE = MAPPING_PREFIX
- + "eav_location";
+ public static final String EAV_MAPPING_FILE = MAPPING_PREFIX + "eav_location";
/**
* Map the FeatureMap as a component entity
*/
- public static final String FEATUREMAP_AS_COMPONENT = MAPPING_PREFIX
- + "featuremap_as_component";
+ public static final String FEATUREMAP_AS_COMPONENT = MAPPING_PREFIX + "featuremap_as_component";
/**
- * Additional sources which are taken into account parsing model
- * annotations. The value can be a comma delimited list of source values.
+ * Additional sources which are taken into account parsing model annotations. The value can be a
+ * comma delimited list of source values.
*/
- public static final String EXTRA_ANNOTATION_SOURCES = MAPPING_PREFIX
- + "extra_annotation_sources";
+ public static final String EXTRA_ANNOTATION_SOURCES = MAPPING_PREFIX + "extra_annotation_sources";
public final static String ECONTAINER_CLASS_COLUMN = "econtainer_class_column";
public final static String ECONTAINER_COLUMN = "e_container_column";
@@ -509,6 +459,11 @@ public class PersistenceOptions implements ExtensionPoint {
/** Returns the default properties used in the system */
public static Properties getDefaultProperties() {
final Properties props = new Properties();
+
+ props.setProperty(ENABLE_AUDITING, "false");
+ props.setProperty(AUDITING_ENTITY_PREFIX, "");
+ props.setProperty(AUDITING_ENTITY_POSTFIX, "Auditing");
+
props.setProperty(HANDLE_UNSET_AS_NULL, "false");
props.setProperty(CONVERT_UNSET_TO_NULL, "false");
props.setProperty(JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS, "true");
@@ -553,17 +508,12 @@ public class PersistenceOptions implements ExtensionPoint {
props.setProperty(MAX_COMMENT_LENGTH, "0");
props.setProperty(DEFAULT_VARCHAR_LENGTH, "-1");
props.setProperty(SQL_NAME_ESCAPE_CHARACTER, "`");
- props.setProperty(USER_XSDDATE_TYPE,
- "org.eclipse.emf.teneo.hibernate.mapping.XSDDate");
- props.setProperty(USER_XSDDATETIME_TYPE,
- "org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime");
- props.setProperty(USER_XSDTIME_TYPE,
- "org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime");
- props.setProperty(XSDDATE_CLASS,
- "javax.xml.datatype.XMLGregorianCalendar");
+ props.setProperty(USER_XSDDATE_TYPE, "org.eclipse.emf.teneo.hibernate.mapping.XSDDate");
+ props.setProperty(USER_XSDDATETIME_TYPE, "org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime");
+ props.setProperty(USER_XSDTIME_TYPE, "org.eclipse.emf.teneo.hibernate.mapping.XSDDateTime");
+ props.setProperty(XSDDATE_CLASS, "javax.xml.datatype.XMLGregorianCalendar");
props.setProperty(SQL_DISCRIMINATOR_VERSION_IMMUTABLE_ECLASS, "true");
- props.setProperty(ECONTAINER_FEATURE_PERSISTENCE_STRATEGY,
- "FEATURENAME");
+ props.setProperty(ECONTAINER_FEATURE_PERSISTENCE_STRATEGY, "FEATURENAME");
props.setProperty(SQL_TABLE_NAME_PREFIX, "");
props.setProperty(SQL_COLUMN_NAME_PREFIX, "");
props.setProperty(SQL_FOREIGN_KEY_NAME_PREFIX, "");
@@ -571,11 +521,9 @@ public class PersistenceOptions implements ExtensionPoint {
props.setProperty(MAP_DOCUMENT_ROOT, "false");
props.setProperty(EAV_MAPPING, "false");
props.setProperty(AUTO_ADD_REFERENCED_EPACKAGES, "false");
- props.setProperty(ECONTAINER_CLASS_COLUMN,
- Constants.COLUMN_ECONTAINER_CLASS);
+ props.setProperty(ECONTAINER_CLASS_COLUMN, Constants.COLUMN_ECONTAINER_CLASS);
props.setProperty(ECONTAINER_COLUMN, Constants.COLUMN_ECONTAINER);
- props.setProperty(ECONTAINER_FEATURE_NAME_COLUMN,
- Constants.COLUMN_ECONTAINER_FEATURE_NAME);
+ props.setProperty(ECONTAINER_FEATURE_NAME_COLUMN, Constants.COLUMN_ECONTAINER_FEATURE_NAME);
props.setProperty(FEATUREMAP_AS_COMPONENT, "false");
props.setProperty(EXTRA_ANNOTATION_SOURCES, "");
props.setProperty(AUTO_ADAPT_MANUAL_SET_SQL_NAMES, "true");
@@ -589,6 +537,27 @@ public class PersistenceOptions implements ExtensionPoint {
private final Properties properties;
/**
+ * @return value of {@link #ENABLE_AUDITING}
+ */
+ public boolean isEnableAuditing() {
+ return Boolean.valueOf(properties.getProperty(ENABLE_AUDITING)).booleanValue();
+ }
+
+ /**
+ * @return value of {@link #AUDITING_ENTITY_PREFIX}
+ */
+ public String getAuditingEntityPrefix() {
+ return properties.getProperty(AUDITING_ENTITY_PREFIX);
+ }
+
+ /**
+ * @return value of {@link #AUDITING_ENTITY_POSTFIX}
+ */
+ public String getAuditingEntityPostfix() {
+ return properties.getProperty(AUDITING_ENTITY_POSTFIX);
+ }
+
+ /**
* @return value of {@link #DISCRIMINATOR_COLUMN_NAME}
*/
public String getDiscriminatorColumnName() {
@@ -606,17 +575,14 @@ public class PersistenceOptions implements ExtensionPoint {
* @return value of {@link #FEATUREMAP_AS_COMPONENT}
*/
public boolean isMapFeatureMapAsComponent() {
- return Boolean.valueOf(properties.getProperty(FEATUREMAP_AS_COMPONENT))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(FEATUREMAP_AS_COMPONENT)).booleanValue();
}
/**
* @return value of {@link AUTO_ADAPT_MANUAL_SET_SQL_NAMES}
*/
public boolean isAutoAdaptManualSQLNames() {
- return Boolean.valueOf(
- properties.getProperty(AUTO_ADAPT_MANUAL_SET_SQL_NAMES))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(AUTO_ADAPT_MANUAL_SET_SQL_NAMES)).booleanValue();
}
/**
@@ -644,8 +610,7 @@ public class PersistenceOptions implements ExtensionPoint {
* @return value of {@link #EAV_MAPPING}
*/
public boolean isEAVMapping() {
- return Boolean.valueOf(properties.getProperty(EAV_MAPPING))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(EAV_MAPPING)).booleanValue();
}
/**
@@ -659,33 +624,28 @@ public class PersistenceOptions implements ExtensionPoint {
* @return value of {@link #AUTO_ADD_REFERENCED_EPACKAGES}
*/
public boolean isAutoAddReferencedEPackages() {
- return Boolean.valueOf(
- properties.getProperty(AUTO_ADD_REFERENCED_EPACKAGES))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(AUTO_ADD_REFERENCED_EPACKAGES)).booleanValue();
}
/**
* @return value of {@link #MAP_DOCUMENT_ROOT}
*/
public boolean isMapDocumentRoot() {
- return Boolean.valueOf(properties.getProperty(MAP_DOCUMENT_ROOT))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(MAP_DOCUMENT_ROOT)).booleanValue();
}
/**
* @return value of the {@link #HANDLE_UNSET_AS_NULL} option
*/
public boolean getHandleUnsetAsNull() {
- return Boolean.valueOf(properties.getProperty(HANDLE_UNSET_AS_NULL))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(HANDLE_UNSET_AS_NULL)).booleanValue();
}
/**
* @return value of the {@link #CONVERT_UNSET_TO_NULL} option
*/
public boolean getConvertUnsetToNull() {
- return Boolean.valueOf(properties.getProperty(CONVERT_UNSET_TO_NULL))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(CONVERT_UNSET_TO_NULL)).booleanValue();
}
/**
@@ -702,8 +662,8 @@ public class PersistenceOptions implements ExtensionPoint {
}
/**
- * Constructs a new instance by loading properties from
- * "/elver-persistence.properties" at the root of the classpath.
+ * Constructs a new instance by loading properties from "/elver-persistence.properties" at the
+ * root of the classpath.
*/
public PersistenceOptions() {
this.properties = getDefaultProperties();
@@ -711,19 +671,17 @@ public class PersistenceOptions implements ExtensionPoint {
final Properties props = new Properties();
InputStream in = null;
try {
- in = this.getClass()
- .getResourceAsStream(DEFAULT_CLASSPATH_FILENAME);
+ in = this.getClass().getResourceAsStream(DEFAULT_CLASSPATH_FILENAME);
if (in != null) {
if (log.isDebugEnabled()) {
- log.debug("Loading persistence options from classpath \""
- + DEFAULT_CLASSPATH_FILENAME + "\".");
+ log.debug("Loading persistence options from classpath \"" + DEFAULT_CLASSPATH_FILENAME
+ + "\".");
}
props.load(in);
}
} catch (IOException e) {
- throw new RuntimeException("Error loading \""
- + DEFAULT_CLASSPATH_FILENAME + "\" from classpath:"
- + e.getMessage(), e);
+ throw new RuntimeException("Error loading \"" + DEFAULT_CLASSPATH_FILENAME
+ + "\" from classpath:" + e.getMessage(), e);
} finally {
try {
if (in != null) {
@@ -772,35 +730,29 @@ public class PersistenceOptions implements ExtensionPoint {
/** Return the IDBAG_ID_COLUMN_NAME */
public String getIDBagIDColumnName() {
- return getSQLColumnNamePrefix()
- + properties.getProperty(IDBAG_ID_COLUMN_NAME);
+ return getSQLColumnNamePrefix() + properties.getProperty(IDBAG_ID_COLUMN_NAME);
}
/**
* Returns the value of the EMAP_AS_TRUE_MAP option, default is false
*/
public boolean isMapEMapAsTrueMap() {
- return Boolean.valueOf(properties.getProperty(EMAP_AS_TRUE_MAP))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(EMAP_AS_TRUE_MAP)).booleanValue();
}
/**
- * Returns the value of the SET_DEFAULT_CASCADE_ON_MTO_MTM option, default
- * is false
+ * Returns the value of the SET_DEFAULT_CASCADE_ON_MTO_MTM option, default is false
*/
public boolean isSetDefaultCascadeOnNonContainment() {
- String property = properties
- .getProperty(SET_DEFAULT_CASCADE_ON_NON_CONTAINMENT);
+ String property = properties.getProperty(SET_DEFAULT_CASCADE_ON_NON_CONTAINMENT);
if (!property.equals("")) {
return Boolean.valueOf(property).booleanValue();
}
- return !properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT)
- .equals("");
+ return !properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT).equals("");
}
public boolean isSetCascadePolicyForNonContainment() {
- return !properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT)
- .equals("");
+ return !properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT).equals("");
}
public String getCascadePolicyForContainment() {
@@ -812,121 +764,100 @@ public class PersistenceOptions implements ExtensionPoint {
}
/**
- * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains
- * the merge cascade type
+ * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains the merge cascade type
*/
public boolean isSetCascadeMergeOnNonContainment() {
return isSetCascadeOnNonContainement(CascadeType.MERGE.getName());
}
/**
- * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains
- * the persist cascade type
+ * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains the persist cascade
+ * type
*/
public boolean isSetCascadePersistOnNonContainment() {
return isSetCascadeOnNonContainement(CascadeType.PERSIST.getName());
}
/**
- * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains
- * the refresh cascade type
+ * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains the refresh cascade
+ * type
*/
public boolean isSetCascadeRefreshOnNonContainment() {
return isSetCascadeOnNonContainement(CascadeType.REFRESH.getName());
}
/**
- * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains
- * the given cascade type
+ * Returns true if the CASCADE_POLICY_ON_NON_CONTAINMENT property contains the given cascade type
*/
private boolean isSetCascadeOnNonContainement(String cascadeType) {
- return isSetCascade(
- properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT),
- cascadeType);
+ return isSetCascade(properties.getProperty(CASCADE_POLICY_ON_NON_CONTAINMENT), cascadeType);
}
/**
* Returns the value of the SET_FOREIGN_KEY_NAME option, default is true
*/
public boolean isSetForeignKeyNames() {
- return Boolean.valueOf(properties.getProperty(SET_FOREIGN_KEY_NAME))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(SET_FOREIGN_KEY_NAME)).booleanValue();
}
/**
* Returns the value of the ALSO_MAP_AS_CLASS option, default is false
*/
public boolean isAlsoMapAsClass() {
- return Boolean.valueOf(properties.getProperty(ALSO_MAP_AS_CLASS))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(ALSO_MAP_AS_CLASS)).booleanValue();
}
/**
- * Returns the value of the MAP_EMBEDDABLE_AS_EMBEDDED option, default is
- * false
+ * Returns the value of the MAP_EMBEDDABLE_AS_EMBEDDED option, default is false
*/
public boolean isMapEmbeddableAsEmbedded() {
- return Boolean.valueOf(
- properties.getProperty(MAP_EMBEDDABLE_AS_EMBEDDED))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(MAP_EMBEDDABLE_AS_EMBEDDED)).booleanValue();
}
/**
* Returns true if the proxy annotation should be added automatically
*/
public boolean isSetProxy() {
- return Boolean.valueOf(properties.getProperty(SET_PROXY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(SET_PROXY)).booleanValue();
}
/**
- * Returns true if the lazy attribute should be forced to true in the hbm
- * mapping.
+ * Returns true if the lazy attribute should be forced to true in the hbm mapping.
*/
public boolean isForceLazy() {
- return Boolean.valueOf(properties.getProperty(FORCE_LAZY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(FORCE_LAZY)).booleanValue();
}
/**
* Returns the value of the ALWAYS_MAP_LIST_AS_BAG option, default is false
*/
public boolean alwaysMapListAsBag() {
- return Boolean.valueOf(properties.getProperty(ALWAYS_MAP_LIST_AS_BAG))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(ALWAYS_MAP_LIST_AS_BAG)).booleanValue();
}
/**
* Returns the value of the MAP_ALL_LISTS_AS_IDBAG option, default is false
*/
public boolean alwaysMapListAsIdBag() {
- return Boolean.valueOf(properties.getProperty(MAP_ALL_LISTS_AS_IDBAG))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(MAP_ALL_LISTS_AS_IDBAG)).booleanValue();
}
/** Returns the value of the ADD_INDEX_FOR_FOREIGN_KEY option */
public boolean isAddIndexForForeignKey() {
- return Boolean.valueOf(
- properties.getProperty(ADD_INDEX_FOR_FOREIGN_KEY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(ADD_INDEX_FOR_FOREIGN_KEY)).booleanValue();
}
/**
- * Returns the value of the UseJoinTableForNonContainedAssociations option,
- * default is false
+ * Returns the value of the UseJoinTableForNonContainedAssociations option, default is false
*/
public boolean isJoinTableForNonContainedAssociations() {
- return Boolean
- .valueOf(
- properties
- .getProperty(JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS))
+ return Boolean.valueOf(properties.getProperty(JOIN_TABLE_FOR_NON_CONTAINED_ASSOCIATIONS))
.booleanValue();
}
/** Returns the value of the UseMappingFile option, default is false */
public boolean isUseMappingFile() {
- return Boolean.valueOf(properties.getProperty(USE_MAPPING_FILE))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(USE_MAPPING_FILE)).booleanValue();
}
/** Returns the value of the MAPPING_FILE_PATH option, default is "" */
@@ -936,107 +867,86 @@ public class PersistenceOptions implements ExtensionPoint {
/** Returns the value of the id feature as primary key */
public boolean isIDFeatureAsPrimaryKey() {
- return Boolean.valueOf(
- properties.getProperty(ID_FEATURE_AS_PRIMARY_KEY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(ID_FEATURE_AS_PRIMARY_KEY)).booleanValue();
}
/** Returns the value of the SET_GENERATED_VALUE_ON_ID_FEATURE option */
public boolean isSetGeneratedValueOnIDFeature() {
- return Boolean.valueOf(
- properties.getProperty(SET_GENERATED_VALUE_ON_ID_FEATURE))
+ return Boolean.valueOf(properties.getProperty(SET_GENERATED_VALUE_ON_ID_FEATURE))
.booleanValue();
}
/** Returns the value of the orphan delete on containment, default is true */
public boolean isSetCascadeAllOnContainment() {
if (!properties.getProperty(SET_CASCADE_ALL_ON_CONTAINMENT).equals("")) {
- return Boolean.valueOf(
- properties.getProperty(SET_CASCADE_ALL_ON_CONTAINMENT))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(SET_CASCADE_ALL_ON_CONTAINMENT)).booleanValue();
}
return isSetCascadeOnContainement(CascadeType.ALL.getName());
}
/**
- * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the MERGE
- * cascade type
+ * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the MERGE cascade type
*/
public boolean isSetCascadeMergeOnContainment() {
return isSetCascadeOnContainement(CascadeType.MERGE.getName());
}
/**
- * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the
- * PERSIST cascade type
+ * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the PERSIST cascade type
*/
public boolean isSetCascadePersistOnContainment() {
return isSetCascadeOnContainement(CascadeType.PERSIST.getName());
}
/**
- * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the
- * REMOVE cascade type
+ * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the REMOVE cascade type
*/
public boolean isSetCascadeRemoveOnContainment() {
return isSetCascadeOnContainement(CascadeType.REMOVE.getName());
}
/**
- * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the
- * REFRESH cascade type
+ * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the REFRESH cascade type
*/
public boolean isSetCascadeRefreshOnContainment() {
return isSetCascadeOnContainement(CascadeType.REFRESH.getName());
}
/**
- * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the given
- * cascade type
+ * Returns true if CASCADE_POLICY_ON_CONTAINMENT property contains the given cascade type
*/
private boolean isSetCascadeOnContainement(String cascadeType) {
- return isSetCascade(
- properties.getProperty(CASCADE_POLICY_ON_CONTAINMENT),
- cascadeType);
+ return isSetCascade(properties.getProperty(CASCADE_POLICY_ON_CONTAINMENT), cascadeType);
}
/** Returns true if property contains the given cascade type */
private boolean isSetCascade(String property, String cascadeType) {
- return Pattern.matches(".*\\b" + cascadeType.toUpperCase() + "\\b.*",
- property.toUpperCase());
+ return Pattern.matches(".*\\b" + cascadeType.toUpperCase() + "\\b.*", property.toUpperCase());
}
/** Returns the value of the Optimistic option, default is true */
public boolean isUseOptimisticLocking() {
- return Boolean.valueOf(properties.getProperty(OPTIMISTIC))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(OPTIMISTIC)).booleanValue();
}
/** Returns the value of the UpdateSchema option, default is true */
public boolean isUpdateSchema() {
- return Boolean.valueOf(properties.getProperty(UPDATE_SCHEMA))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(UPDATE_SCHEMA)).booleanValue();
}
/** Returns the value of the fetch containment eagerly, default is false */
public boolean isFetchContainmentEagerly() {
- return Boolean.valueOf(
- properties.getProperty(FETCH_CONTAINMENT_EAGERLY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(FETCH_CONTAINMENT_EAGERLY)).booleanValue();
}
/** Returns the value of the fetch extra lazy option, default is false */
public boolean isFetchAssociationExtraLazy() {
- return Boolean.valueOf(
- properties.getProperty(FETCH_ASSOCIATION_EXTRA_LAZY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(FETCH_ASSOCIATION_EXTRA_LAZY)).booleanValue();
}
/** Is set entity automatically, default is true */
public boolean isSetEntityAutomatically() {
- return Boolean
- .valueOf(properties.getProperty(SET_ENTITY_AUTOMATICALLY))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(SET_ENTITY_AUTOMATICALLY)).booleanValue();
}
/** Returns the inheritance mapping strategy, can be null */
@@ -1046,8 +956,7 @@ public class PersistenceOptions implements ExtensionPoint {
/** Returns the value of the version column option, returns null if not set */
public String getVersionColumnName() {
- return getSQLColumnNamePrefix()
- + properties.getProperty(VERSION_COLUMN_NAME);
+ return getSQLColumnNamePrefix() + properties.getProperty(VERSION_COLUMN_NAME);
}
/** Returns the value of the naming strategy, default is lower case */
@@ -1057,8 +966,7 @@ public class PersistenceOptions implements ExtensionPoint {
/** Returns the value of the id column option, returns null if not set */
public String getIdColumnName() {
- return getSQLColumnNamePrefix()
- + properties.getProperty(ID_COLUMN_NAME);
+ return getSQLColumnNamePrefix() + properties.getProperty(ID_COLUMN_NAME);
}
/** Returns the value of the default id property */
@@ -1074,8 +982,7 @@ public class PersistenceOptions implements ExtensionPoint {
/** Returns the value of the join table naming strategy */
public String getJoinTableNamingStrategy() {
if (properties.get(JOIN_TABLE_NAMING_STRATEGY_OLD) != null) {
- log.warn("The option " + JOIN_TABLE_NAMING_STRATEGY_OLD
- + " is deprecated, please use: "
+ log.warn("The option " + JOIN_TABLE_NAMING_STRATEGY_OLD + " is deprecated, please use: "
+ JOIN_TABLE_NAMING_STRATEGY);
return properties.getProperty(JOIN_TABLE_NAMING_STRATEGY);
}
@@ -1088,8 +995,8 @@ public class PersistenceOptions implements ExtensionPoint {
}
/**
- * Returns the default second level caching strategy, default value is NONE
- * (no second level caching).
+ * Returns the default second level caching strategy, default value is NONE (no second level
+ * caching).
*/
public String getDefaultCacheStrategy() {
return properties.getProperty(DEFAULT_CACHE_STRATEGY);
@@ -1102,9 +1009,7 @@ public class PersistenceOptions implements ExtensionPoint {
/** Are econtainer mappings (hibernate) disabled */
public boolean isDisableEContainerMapping() {
- return Boolean.valueOf(
- properties.getProperty(DISABLE_ECONTAINER_MAPPING))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(DISABLE_ECONTAINER_MAPPING)).booleanValue();
}
/** Return the value of the MAX_COMMENT_LENGTH */
@@ -1114,8 +1019,7 @@ public class PersistenceOptions implements ExtensionPoint {
final int maxLength = Integer.parseInt(colLength);
return maxLength;
} catch (NumberFormatException e) {
- log.error("Property " + MAXIMUM_SQL_NAME_LENGTH
- + " as a non-integer value: " + colLength
+ log.error("Property " + MAXIMUM_SQL_NAME_LENGTH + " as a non-integer value: " + colLength
+ " value is ignored");
return 0;
}
@@ -1123,44 +1027,37 @@ public class PersistenceOptions implements ExtensionPoint {
/** Return the max. sql name length, or -1 if not set or illegal */
public int getMaximumSqlNameLength() {
- final String colLength = properties
- .getProperty(MAXIMUM_SQL_NAME_LENGTH);
+ final String colLength = properties.getProperty(MAXIMUM_SQL_NAME_LENGTH);
try {
final int maxLength = Integer.parseInt(colLength);
if (maxLength == 0) {
- throw new TeneoException(
- "The option MAXIMUM_SQL_NAME_LENGTH has a value of zero. "
- + "This will result in empty column and table names in the mapping! "
- + "Please change this option to a more usable value.");
+ throw new TeneoException("The option MAXIMUM_SQL_NAME_LENGTH has a value of zero. "
+ + "This will result in empty column and table names in the mapping! "
+ + "Please change this option to a more usable value.");
}
if (maxLength < 4 && maxLength > -1) {
- log.warn("The option MAXIMUM_SQL_NAME_LENGTH has a low value: "
- + maxLength + ". Are you sure this is correct?");
+ log.warn("The option MAXIMUM_SQL_NAME_LENGTH has a low value: " + maxLength
+ + ". Are you sure this is correct?");
}
return maxLength;
} catch (NumberFormatException e) {
- log.error("Property " + MAXIMUM_SQL_NAME_LENGTH
- + " as a non-integer value: " + colLength
+ log.error("Property " + MAXIMUM_SQL_NAME_LENGTH + " as a non-integer value: " + colLength
+ " value is ignored");
return -1;
}
}
/**
- * Returns the value of the SQL_DISCRIMINATOR_VERSION_IMMUTABLE_ECLASS
- * option.
+ * Returns the value of the SQL_DISCRIMINATOR_VERSION_IMMUTABLE_ECLASS option.
*/
public Boolean isDiscriminatorVersionOnImmutableEClass() {
- return Boolean
- .valueOf(
- properties
- .getProperty(SQL_DISCRIMINATOR_VERSION_IMMUTABLE_ECLASS))
+ return Boolean.valueOf(properties.getProperty(SQL_DISCRIMINATOR_VERSION_IMMUTABLE_ECLASS))
.booleanValue();
}
/**
- * Returns the path of the XML persistence mapping file or null if the
- * property has not been defined.
+ * Returns the path of the XML persistence mapping file or null if the property has not been
+ * defined.
*/
public String getPersistenceXmlPath() {
return properties.getProperty(PERSISTENCE_XML);
@@ -1170,8 +1067,7 @@ public class PersistenceOptions implements ExtensionPoint {
* Returns a boolean indication whether to ignore mapping EAnnotations.
*/
public boolean isIgnoreEAnnotations() {
- return Boolean.valueOf(properties.getProperty(IGNORE_EANNOTATIONS))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(IGNORE_EANNOTATIONS)).booleanValue();
}
/**
@@ -1183,8 +1079,7 @@ public class PersistenceOptions implements ExtensionPoint {
final List<String> names = new ArrayList<String>();
for (Field field : PersistenceOptions.class.getFields()) {
try {
- if ((field.getModifiers() & Modifier.STATIC) > 0
- & field.getType().equals(String.class)) {
+ if ((field.getModifiers() & Modifier.STATIC) > 0 & field.getType().equals(String.class)) {
final String value = (String) field.get(null);
if (value.startsWith("teneo.")) {
names.add(value);
@@ -1198,8 +1093,7 @@ public class PersistenceOptions implements ExtensionPoint {
}
public boolean getAlwaysVersion() {
- return Boolean.valueOf(properties.getProperty(ALWAYS_VERSION))
- .booleanValue();
+ return Boolean.valueOf(properties.getProperty(ALWAYS_VERSION)).booleanValue();
}
/**
@@ -1235,8 +1129,7 @@ public class PersistenceOptions implements ExtensionPoint {
}
public EContainerFeaturePersistenceStrategy getEContainerFeaturePersistenceStrategy() {
- String strategy = properties
- .getProperty(ECONTAINER_FEATURE_PERSISTENCE_STRATEGY);
+ String strategy = properties.getProperty(ECONTAINER_FEATURE_PERSISTENCE_STRATEGY);
if (strategy == null) {
throw new TeneoException(
"Option ECONTAINER_FEATURE_PERSISTENCE_STRATEGY not set, please set it to one of: featureid, featurename, both");
@@ -1244,10 +1137,8 @@ public class PersistenceOptions implements ExtensionPoint {
EContainerFeaturePersistenceStrategy result = EContainerFeaturePersistenceStrategy
.valueOf(strategy.toUpperCase());
if (result == null) {
- throw new TeneoException(
- "Option ECONTAINER_FEATURE_PERSISTENCE_STRATEGY not set correctly ("
- + strategy
- + "), please set it to one of: featureid, featurename, both");
+ throw new TeneoException("Option ECONTAINER_FEATURE_PERSISTENCE_STRATEGY not set correctly ("
+ + strategy + "), please set it to one of: featureid, featurename, both");
}
return result;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/StoreValidationException.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/StoreValidationException.java
index 9e83087a2..e6c655368 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/StoreValidationException.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/StoreValidationException.java
@@ -36,8 +36,8 @@ public class StoreValidationException extends TeneoException {
for (Diagnostic childDiagnostic : diagnostics[i].getChildren()) {
switch (childDiagnostic.getSeverity()) {
- case Diagnostic.ERROR:
- result.append("\n\t" + childDiagnostic.getMessage());
+ case Diagnostic.ERROR:
+ result.append("\n\t" + childDiagnostic.getMessage());
}
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractAnnotator.java
index a09855927..a4d08d577 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractAnnotator.java
@@ -64,7 +64,8 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
* followed (the entity name of the value is returned.
*/
public String getEntityName(EClass eClass) {
- return StrategyUtil.getEntityName(entityNameStrategy, persistenceOptions, annotatedModel, eClass);
+ return StrategyUtil.getEntityName(entityNameStrategy, persistenceOptions, annotatedModel,
+ eClass);
}
/**
@@ -76,7 +77,7 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
/**
* @param extensionManager
- * the extensionManager to set
+ * the extensionManager to set
*/
public void setExtensionManager(ExtensionManager extensionManager) {
this.extensionManager = extensionManager;
@@ -91,7 +92,7 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
/**
* @param annotatedModel
- * the annotatedModel to set
+ * the annotatedModel to set
*/
public void setAnnotatedModel(PAnnotatedModel annotatedModel) {
this.annotatedModel = annotatedModel;
@@ -106,7 +107,7 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
/**
* @param factory
- * the factory to set
+ * the factory to set
*/
public void setFactory(PannotationFactory factory) {
this.factory = factory;
@@ -135,7 +136,7 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
/**
* @param persistenceOptions
- * the persistenceOptions to set
+ * the persistenceOptions to set
*/
public void setPersistenceOptions(PersistenceOptions persistenceOptions) {
this.persistenceOptions = persistenceOptions;
@@ -161,7 +162,7 @@ public abstract class AbstractAnnotator implements ExtensionManagerAware, Extens
/**
* @param featureAnnotator
- * the eFeatureAnnotator to set
+ * the eFeatureAnnotator to set
*/
public void setEFeatureAnnotator(EFeatureAnnotator featureAnnotator) {
eFeatureAnnotator = featureAnnotator;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractProcessingContext.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractProcessingContext.java
index 15d4da9be..71dcedbe8 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractProcessingContext.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AbstractProcessingContext.java
@@ -48,27 +48,25 @@ import org.eclipse.emf.teneo.mapping.strategy.SQLNameStrategy;
public class AbstractProcessingContext {
/** The logger for all these exceptions */
- protected static final Log log = LogFactory
- .getLog(AbstractProcessingContext.class);
+ protected static final Log log = LogFactory.getLog(AbstractProcessingContext.class);
/** The current list of overrides */
private Map<String, Object> currentOverrides = new HashMap<String, Object>();
/**
- * Pushes the current overrides on the stack, to be popped later, this is to
- * handle nested components
+ * Pushes the current overrides on the stack, to be popped later, this is to handle nested
+ * components
*/
private Stack<Map<String, Object>> overrideStack = new Stack<Map<String, Object>>();
/**
- * Pushes the current embedding feature on the stack, to be popped later,
- * this is to handle nested components and automatic renaming of props
+ * Pushes the current embedding feature on the stack, to be popped later, this is to handle nested
+ * components and automatic renaming of props
*/
private Stack<PAnnotatedEStructuralFeature> embeddingFeatureStack = new Stack<PAnnotatedEStructuralFeature>();
/**
- * Add attribute overrides, happens for each mapped superclass and each
- * embedded component
+ * Add attribute overrides, happens for each mapped superclass and each embedded component
*/
public void addAttributeOverrides(EList<AttributeOverride> aos) {
if (aos != null) {
@@ -88,8 +86,8 @@ public class AbstractProcessingContext {
}
/**
- * Pushes the current overrides on the stack, to be popped later, this is to
- * handle nested components
+ * Pushes the current overrides on the stack, to be popped later, this is to handle nested
+ * components
*/
public void pushOverrideOnStack() {
overrideStack.push(new HashMap<String, Object>(currentOverrides));
@@ -133,8 +131,7 @@ public class AbstractProcessingContext {
}
/** Return the overridden columns for the indicated featureName */
- public Column getAttributeOverride(String featureName,
- int embeddingFeatureIndex) {
+ public Column getAttributeOverride(String featureName, int embeddingFeatureIndex) {
final Column c = (Column) currentOverrides.get(featureName);
if (c == null) {
final Object o = getFromStack(featureName);
@@ -143,38 +140,30 @@ public class AbstractProcessingContext {
}
// o == null, try one level deeper
if (embeddingFeatureIndex == -1 && !embeddingFeatureStack.isEmpty()) {
- String newFeatureName = embeddingFeatureStack.peek()
- .getModelElement().getName()
- + "." + featureName;
- return getAttributeOverride(newFeatureName,
- embeddingFeatureStack.size() - 1);
+ String newFeatureName = embeddingFeatureStack.peek().getModelElement().getName() + "."
+ + featureName;
+ return getAttributeOverride(newFeatureName, embeddingFeatureStack.size() - 1);
} else if (embeddingFeatureIndex > 0) {
- String newFeatureName = embeddingFeatureStack
- .get(embeddingFeatureIndex - 1).getModelElement()
- .getName()
+ String newFeatureName = embeddingFeatureStack.get(embeddingFeatureIndex - 1)
+ .getModelElement().getName()
+ "." + featureName;
- return getAttributeOverride(newFeatureName,
- embeddingFeatureIndex - 1);
+ return getAttributeOverride(newFeatureName, embeddingFeatureIndex - 1);
}
}
return c;
}
/** Return the overridden JoinColumns for this reference */
- public AssociationOverride getAssociationOverrides(
- PAnnotatedEReference paReference) {
- return getAssociationOverrides(paReference.getModelEReference()
- .getName());
+ public AssociationOverride getAssociationOverrides(PAnnotatedEReference paReference) {
+ return getAssociationOverrides(paReference.getModelEReference().getName());
}
public AssociationOverride getAssociationOverrides(String featureName) {
return getAssociationOverrides(featureName, -1);
}
- public AssociationOverride getAssociationOverrides(String featureName,
- int embeddingFeatureIndex) {
- final AssociationOverride jcs = (AssociationOverride) currentOverrides
- .get(featureName);
+ public AssociationOverride getAssociationOverrides(String featureName, int embeddingFeatureIndex) {
+ final AssociationOverride jcs = (AssociationOverride) currentOverrides.get(featureName);
if (jcs == null) {
final Object o = getFromStack(featureName);
if (o instanceof List<?>) {
@@ -182,18 +171,14 @@ public class AbstractProcessingContext {
}
// o == null, try one level deeper
if (embeddingFeatureIndex == -1 && !embeddingFeatureStack.isEmpty()) {
- String newFeatureName = embeddingFeatureStack.peek()
- .getModelElement().getName()
- + "." + featureName;
- return getAssociationOverrides(newFeatureName,
- embeddingFeatureStack.size() - 1);
+ String newFeatureName = embeddingFeatureStack.peek().getModelElement().getName() + "."
+ + featureName;
+ return getAssociationOverrides(newFeatureName, embeddingFeatureStack.size() - 1);
} else if (embeddingFeatureIndex > 0) {
- String newFeatureName = embeddingFeatureStack
- .get(embeddingFeatureIndex - 1).getModelElement()
- .getName()
+ String newFeatureName = embeddingFeatureStack.get(embeddingFeatureIndex - 1)
+ .getModelElement().getName()
+ "." + featureName;
- return getAssociationOverrides(newFeatureName,
- embeddingFeatureIndex - 1);
+ return getAssociationOverrides(newFeatureName, embeddingFeatureIndex - 1);
}
}
return jcs;
@@ -211,19 +196,16 @@ public class AbstractProcessingContext {
}
/**
- * This method returns all inherited features which need to be added to the
- * mapping of the aclass itself. The method makes a distinction makes a
- * distinction between the first supertype (the first one in the list) and
- * later ones. The features of the first type are only added to the mapping
- * if the first type is a mappedsuperclass, in all other cases the features
- * of the first type are not mapped in the aclass itself because they are
- * inherited (the mapping describes the inheritance relation). For the other
- * supertypes (located at index 1 and up in getESuperTypes) the features are
- * mapped as properties in the class itself. The superEntity is the super
- * aclass denoted as the real supertype extended by teneo.
+ * This method returns all inherited features which need to be added to the mapping of the aclass
+ * itself. The method makes a distinction makes a distinction between the first supertype (the
+ * first one in the list) and later ones. The features of the first type are only added to the
+ * mapping if the first type is a mappedsuperclass, in all other cases the features of the first
+ * type are not mapped in the aclass itself because they are inherited (the mapping describes the
+ * inheritance relation). For the other supertypes (located at index 1 and up in getESuperTypes)
+ * the features are mapped as properties in the class itself. The superEntity is the super aclass
+ * denoted as the real supertype extended by teneo.
*/
- public List<PAnnotatedEStructuralFeature> getInheritedFeatures(
- PAnnotatedEClass aClass) {
+ public List<PAnnotatedEStructuralFeature> getInheritedFeatures(PAnnotatedEClass aClass) {
// if no supertypes then there are no inherited features
final EClass eclass = aClass.getModelEClass();
if (eclass.getESuperTypes().size() == 0) {
@@ -244,8 +226,8 @@ public class AbstractProcessingContext {
// remove all features inherited from the first supertype
// as this inheritance is done in the mapping file
if (aClass.getPaSuperEntity() != null) {
- inheritedFeatures.removeAll(aClass.getPaSuperEntity()
- .getModelEClass().getEAllStructuralFeatures());
+ inheritedFeatures.removeAll(aClass.getPaSuperEntity().getModelEClass()
+ .getEAllStructuralFeatures());
}
// get all efeatures from direct mappedsuperclasses
@@ -267,11 +249,9 @@ public class AbstractProcessingContext {
// solve: https://issues.openbravo.com/view.php?id=19236
for (PAnnotatedEStructuralFeature paFeature : result) {
- if (paFeature.getForeignKey() != null
- && paFeature.getForeignKey().isGenerated()) {
- paFeature.getForeignKey().setName(
- getSqlNameStrategy().getForeignKeyName(aClass,
- paFeature));
+ if (paFeature.getForeignKey() != null && paFeature.getForeignKey().isGenerated()) {
+ paFeature.getForeignKey()
+ .setName(getSqlNameStrategy().getForeignKeyName(aClass, paFeature));
}
}
@@ -284,18 +264,15 @@ public class AbstractProcessingContext {
}
/**
- * Remove all id-features not inherited from a direct mapped superclass, and
- * add the features from the mapped superclass
+ * Remove all id-features not inherited from a direct mapped superclass, and add the features from
+ * the mapped superclass
*/
- private void removeIdFeatures(PAnnotatedEClass aClass,
- List<EStructuralFeature> inheritedFeatures) {
+ private void removeIdFeatures(PAnnotatedEClass aClass, List<EStructuralFeature> inheritedFeatures) {
// first get all the mapped superclasses
final ArrayList<EClass> mappedSuperEClasses = new ArrayList<EClass>();
for (EClass superEClass : aClass.getModelEClass().getESuperTypes()) {
- final PAnnotatedEClass superPAClass = aClass.getPaModel()
- .getPAnnotated(superEClass);
- if (superPAClass != null
- && superPAClass.getMappedSuperclass() != null) {
+ final PAnnotatedEClass superPAClass = aClass.getPaModel().getPAnnotated(superEClass);
+ if (superPAClass != null && superPAClass.getMappedSuperclass() != null) {
mappedSuperEClasses.add(superPAClass.getModelEClass());
}
}
@@ -309,21 +286,17 @@ public class AbstractProcessingContext {
if (aClass.getPaSuperEntity() == null
|| aClass.getPaSuperEntity().getMappedSuperclass() != null) {
for (EClass mappedSuperEClass : mappedSuperEClasses) {
- mappedSuperFeatures.removeAll(mappedSuperEClass
- .getEAllStructuralFeatures());
- mappedSuperFeatures.addAll(mappedSuperEClass
- .getEAllStructuralFeatures());
+ mappedSuperFeatures.removeAll(mappedSuperEClass.getEAllStructuralFeatures());
+ mappedSuperFeatures.addAll(mappedSuperEClass.getEAllStructuralFeatures());
}
}
// now remove all id features not coming from a direct mapped superclass
final ArrayList<EStructuralFeature> toRemove = new ArrayList<EStructuralFeature>();
for (EStructuralFeature esf : inheritedFeatures) {
- final PAnnotatedEStructuralFeature pef = aClass.getPaModel()
- .getPAnnotated(esf);
+ final PAnnotatedEStructuralFeature pef = aClass.getPaModel().getPAnnotated(esf);
- if (pef instanceof PAnnotatedEAttribute
- && ((PAnnotatedEAttribute) pef).getId() != null
+ if (pef instanceof PAnnotatedEAttribute && ((PAnnotatedEAttribute) pef).getId() != null
&& !mappedSuperFeatures.contains(esf)) {
toRemove.add(esf);
}
@@ -356,21 +329,17 @@ public class AbstractProcessingContext {
// }
/**
- * Returns true if the eclass only has mappedsuperclasses without id
- * annotated property
+ * Returns true if the eclass only has mappedsuperclasses without id annotated property
*/
public boolean mustAddSyntheticID(PAnnotatedEClass entity) {
if (entity.hasIdAnnotatedFeature()) {
return false;
}
for (EClass superEClass : entity.getModelEClass().getEAllSuperTypes()) {
- final PAnnotatedEClass superPAClass = entity.getPaModel()
- .getPAnnotated(superEClass);
- if (superPAClass != null
- && superPAClass.getMappedSuperclass() == null) {
+ final PAnnotatedEClass superPAClass = entity.getPaModel().getPAnnotated(superEClass);
+ if (superPAClass != null && superPAClass.getMappedSuperclass() == null) {
return false;
- } else if (superPAClass != null
- && superPAClass.getMappedSuperclass() != null) {
+ } else if (superPAClass != null && superPAClass.getMappedSuperclass() != null) {
if (superPAClass.hasIdAnnotatedFeature()) {
return false;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AnnotationGenerator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AnnotationGenerator.java
index 8320e1cc2..54e7d3455 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AnnotationGenerator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/AnnotationGenerator.java
@@ -69,8 +69,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
private EDataTypeAnnotator eDataTypeAnnotator;
/**
- * Adds default annotations to a pamodel, the method is synchronized because globals are set.
- * Not necessary because this class should always be used single threaded but okay.
+ * Adds default annotations to a pamodel, the method is synchronized because globals are set. Not
+ * necessary because this class should always be used single threaded but okay.
*/
public synchronized void map(PAnnotatedModel annotatedModel, PersistenceOptions po) {
@@ -86,8 +86,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
final EModelResolver eModelResolver = EModelResolver.instance();
if (log.isDebugEnabled()) {
- log.debug("Registering epackages in model resolver, modelresolver instance is: " +
- eModelResolver.getClass().getName());
+ log.debug("Registering epackages in model resolver, modelresolver instance is: "
+ + eModelResolver.getClass().getName());
}
eModelResolver.register(epacks);
@@ -99,7 +99,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
// and now set the map as entity for each eclass
for (PAnnotatedEPackage apack : annotatedModel.getPaEPackages()) {
for (PAnnotatedEClass aclass : apack.getPaEClasses()) {
- aclass.setOnlyMapAsEntity(!eModelResolver.hasImplementationClass(aclass.getModelEClass()));
+ aclass
+ .setOnlyMapAsEntity(!eModelResolver.hasImplementationClass(aclass.getModelEClass()));
}
}
}
@@ -108,7 +109,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
// eSuperTypes
// see bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=205790
for (EPackage epack : epacks) {
- if (epack.getNsURI() != null && epack.getNsURI().compareTo(EcorePackage.eINSTANCE.getNsURI()) == 0) {
+ if (epack.getNsURI() != null
+ && epack.getNsURI().compareTo(EcorePackage.eINSTANCE.getNsURI()) == 0) {
// now find the
for (EClassifier eClassifier : epack.getEClassifiers()) {
if (eClassifier.eClass() == EcorePackage.eINSTANCE.getEClass()) {
@@ -116,7 +118,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
for (EStructuralFeature eFeature : eClass.getEAllStructuralFeatures()) {
if (eFeature.getName().compareTo("eSuperTypes") == 0) {
if (eFeature.getEAnnotation(Constants.ANNOTATION_SOURCE_TENEO_JPA) == null) {
- EcoreUtil.setAnnotation(eFeature, Constants.ANNOTATION_SOURCE_TENEO_JPA, "value", "@ManyToMany");
+ EcoreUtil.setAnnotation(eFeature, Constants.ANNOTATION_SOURCE_TENEO_JPA, "value",
+ "@ManyToMany");
break;
}
}
@@ -131,7 +134,8 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
// initialize the strategies so they have the correct information
// TODO this should be handled in aware like interfaces
- final EntityNameStrategy entityNameStrategy = extensionManager.getExtension(EntityNameStrategy.class);
+ final EntityNameStrategy entityNameStrategy = extensionManager
+ .getExtension(EntityNameStrategy.class);
entityNameStrategy.setPaModel(annotatedModel); // is maybe already set?
final SQLNameStrategy sqlNameStrategy = extensionManager.getExtension(SQLNameStrategy.class);
sqlNameStrategy.setPersistenceOptions(po);
@@ -162,8 +166,9 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
/** Maps one epackage */
protected void processPackage(PAnnotatedEPackage aPackage) {
if (log.isDebugEnabled()) {
- log.debug(">>>> Adding default annotations for EPackage " + aPackage.getModelElement().getName());
-
+ log.debug(">>>> Adding default annotations for EPackage "
+ + aPackage.getModelElement().getName());
+
log.debug("Processing EDataTypes");
}
for (PAnnotatedEDataType annotatedEDataType : aPackage.getPaEDataTypes()) {
@@ -180,7 +185,7 @@ public class AnnotationGenerator implements ExtensionPoint, ExtensionManagerAwar
/**
* @param extensionManager
- * the extensionManager to set
+ * the extensionManager to set
*/
public void setExtensionManager(ExtensionManager extensionManager) {
this.extensionManager = extensionManager;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BaseEFeatureAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BaseEFeatureAnnotator.java
index f06624c05..2a84b6a1f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BaseEFeatureAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BaseEFeatureAnnotator.java
@@ -44,7 +44,8 @@ import org.eclipse.emf.teneo.annotations.pannotation.TemporalType;
import org.eclipse.emf.teneo.util.EcoreDataTypes;
/**
- * Placeholder for several utility methods which are relevant for annotating ereferences and eattributes.
+ * Placeholder for several utility methods which are relevant for annotating ereferences and
+ * eattributes.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.17 $
@@ -72,8 +73,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
/*
* (non-Javadoc)
*
- * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator# setPersistenceOptions(org.eclipse
- * .emf.teneo.PersistenceOptions)
+ * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator#
+ * setPersistenceOptions(org.eclipse .emf.teneo.PersistenceOptions)
*/
@Override
public void setPersistenceOptions(PersistenceOptions persistenceOptions) {
@@ -89,9 +90,9 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
// disabled because of bugzilla:
// 317479
-// if (aAttribute.getId() != null) {
-// aAttribute.getModelEAttribute().setLowerBound(1);
-// }
+ // if (aAttribute.getId() != null) {
+ // aAttribute.getModelEAttribute().setLowerBound(1);
+ // }
final EAttribute eAttribute = aAttribute.getModelEAttribute();
@@ -110,7 +111,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
final String fractionDigits = getExtendedMetaData(eAttribute, "fractionDigits");
boolean setUnique = false;
// bugzilla 249246
- if (getPersistenceOptions().isIDFeatureAsPrimaryKey() && eAttribute.isID() && aAttribute.getId() == null) {
+ if (getPersistenceOptions().isIDFeatureAsPrimaryKey() && eAttribute.isID()
+ && aAttribute.getId() == null) {
if (aAttribute.getPaEClass().getPaSuperEntity() != null
&& aAttribute.getPaEClass().getPaSuperEntity().getMappedSuperclass() == null) {
setUnique = true;
@@ -151,7 +153,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
}
final Column c = aAttribute.getColumn();
- if (isStringType(aAttribute.getModelEAttribute()) && c != null && defaultVarCharLength > 0 && !c.isSetLength()) {
+ if (isStringType(aAttribute.getModelEAttribute()) && c != null && defaultVarCharLength > 0
+ && !c.isSetLength()) {
c.setLength(defaultVarCharLength);
}
@@ -187,8 +190,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
}
/** Return a list of join columns */
- protected List<JoinColumn> getJoinColumns(List<String> names, boolean optional, boolean isUpdateInsertable,
- PAnnotation pAnnotation) {
+ protected List<JoinColumn> getJoinColumns(List<String> names, boolean optional,
+ boolean isUpdateInsertable, PAnnotation pAnnotation) {
final List<JoinColumn> result = new ArrayList<JoinColumn>();
for (String name : names) {
JoinColumn jc = getFactory().createJoinColumn();
@@ -239,7 +242,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
}
/**
- * Determines where to place a certain annotation/characteristic, this is done by comparing names..
+ * Determines where to place a certain annotation/characteristic, this is done by comparing
+ * names..
*/
protected boolean compareNames(EReference here, EReference there) {
final String nameHere = here.eClass().getName() + here.getName();
@@ -295,8 +299,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
Class<?> clazz = eAttribute.getEAttributeType().getInstanceClass();
// clazz is hidden somewhere
if (clazz == null || Object.class.equals(clazz)) {
- ArrayList<EClassifier> eclassifiers = EcoreDataTypes.INSTANCE.getItemTypes((EDataType) eAttribute
- .getEType());
+ ArrayList<EClassifier> eclassifiers = EcoreDataTypes.INSTANCE
+ .getItemTypes((EDataType) eAttribute.getEType());
for (EClassifier eclassifier : eclassifiers) {
if (eclassifier.getInstanceClass() != null) {
clazz = eclassifier.getInstanceClass();
@@ -320,7 +324,8 @@ public abstract class BaseEFeatureAnnotator extends AbstractAnnotator {
aAttribute.setTemporal(temporal);
temporal.setEModelElement(eAttribute);
} else if (clazz != null
- && (Calendar.class.isAssignableFrom(clazz) || eDataType == XMLTypePackage.eINSTANCE.getDate() || eDataType == XMLTypePackage.eINSTANCE
+ && (Calendar.class.isAssignableFrom(clazz)
+ || eDataType == XMLTypePackage.eINSTANCE.getDate() || eDataType == XMLTypePackage.eINSTANCE
.getDateTime())) {
final Temporal temporal = getFactory().createTemporal();
if (eDataType == XMLTypePackage.eINSTANCE.getDate()) {
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BasicPamodelBuilder.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BasicPamodelBuilder.java
index 5ce949aa7..c3951ff71 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BasicPamodelBuilder.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BasicPamodelBuilder.java
@@ -77,8 +77,9 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return a <code>PAnnotatedModelElement</code> assoiciated to the given <code>EModelElement</code>. The element is
- * created only if not already present in the model.
+ * @return a <code>PAnnotatedModelElement</code> assoiciated to the given
+ * <code>EModelElement</code>. The element is created only if not already present in the
+ * model.
*/
protected PAnnotatedEModelElement create(EModelElement eModelElement) {
PAnnotatedEModelElement paElement = target.getPAnnotated(eModelElement);
@@ -92,10 +93,10 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return A newly created PAnnotatedEModelElement. This method is only responsible for the actual creation (and
- * initialization) of this object. No other logic should happen here. This allows subclasses to alter how
- * objects are created. If you'd like to alter any other logic around the creation, you should override the
- * <code>create</code> method(s).
+ * @return A newly created PAnnotatedEModelElement. This method is only responsible for the actual
+ * creation (and initialization) of this object. No other logic should happen here. This
+ * allows subclasses to alter how objects are created. If you'd like to alter any other
+ * logic around the creation, you should override the <code>create</code> method(s).
* @throws AssertionError
*/
protected PAnnotatedEModelElement doCreate(EModelElement eModelElement) throws AssertionError {
@@ -119,16 +120,19 @@ public class BasicPamodelBuilder implements ExtensionPoint {
paElement = PamodelFactory.eINSTANCE.createPAnnotatedEDataType();
break;
default:
- throw new AssertionError("Trying to build PAnnotatedEModelElement for a " + eModelElementEClass);
+ throw new AssertionError("Trying to build PAnnotatedEModelElement for a "
+ + eModelElementEClass);
}
paElement.setModelElement((ENamedElement) eModelElement);
return paElement;
}
/**
- * @return a <code>PAnnotatedEPackage</code> associated to the given <code>EPackage</code> and adds it the model.
+ * @return a <code>PAnnotatedEPackage</code> associated to the given <code>EPackage</code> and
+ * adds it the model.
* <p>
- * The <code>PAnnotatedEPackage</code> is created only if not already present in the model.
+ * The <code>PAnnotatedEPackage</code> is created only if not already present in the
+ * model.
*/
public PAnnotatedEPackage pElement(EPackage ePackage) {
PAnnotatedEPackage pPackage = (PAnnotatedEPackage) create(ePackage);
@@ -139,12 +143,13 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return a <code>PAnnotatedEClass</code> associated to the given <code>EClass</code> and adds it the model.
+ * @return a <code>PAnnotatedEClass</code> associated to the given <code>EClass</code> and adds it
+ * the model.
* <p>
* The <code>PAnnotatedEClass</code> is created only if not already present in the model.
* <p>
- * The operation may involve the creation of a <code>PAnnotatedEPackage</code> associated to the given
- * <code>EClass</code> package.
+ * The operation may involve the creation of a <code>PAnnotatedEPackage</code> associated
+ * to the given <code>EClass</code> package.
*/
protected PAnnotatedEClass pElement(EClass eClass) {
PAnnotatedEClass pClass = (PAnnotatedEClass) create(eClass);
@@ -153,10 +158,11 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return a <code>PAnnotatedEStructuralFeature</code> associated to the given <code>EStructuralFeature</code> and
- * adds it the model.
+ * @return a <code>PAnnotatedEStructuralFeature</code> associated to the given
+ * <code>EStructuralFeature</code> and adds it the model.
* <p>
- * The <code>PAnnotatedEStructuralFeature</code> is created only if not already present in the model.
+ * The <code>PAnnotatedEStructuralFeature</code> is created only if not already present in
+ * the model.
* <p>
* The operation may involve the creation of a <code>PAnnotatedEPackage</code> and a
* <code>PAnnotatedEClass</code>.
@@ -168,10 +174,11 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return a <code>PAnnotatedEStructuralFeature</code> associated to the given <code>EStructuralFeature</code> and
- * adds it the model.
+ * @return a <code>PAnnotatedEStructuralFeature</code> associated to the given
+ * <code>EStructuralFeature</code> and adds it the model.
* <p>
- * The <code>PAnnotatedEStructuralFeature</code> is created only if not already present in the model.
+ * The <code>PAnnotatedEStructuralFeature</code> is created only if not already present in
+ * the model.
* <p>
* The operation may involve the creation of a <code>PAnnotatedEPackage</code> and a
* <code>PAnnotatedEClass</code>.
@@ -183,8 +190,8 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * @return a <code>PAnnotatedEModelElement</code> associated to the given <code>EModelElement</code> and adds it the
- * model.
+ * @return a <code>PAnnotatedEModelElement</code> associated to the given
+ * <code>EModelElement</code> and adds it the model.
* @see #pElement(EPackage)
* @see #pElement(EClass)
* @see #pElement(EStructuralFeature)
@@ -212,8 +219,8 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * Builds a <code>PAnnotatedEPackage</code> associated to the given <code>EPackage</code> (if such an
- * <code>PAnnotatedEPackage</code> does not yet exists) and adds it to the target model.
+ * Builds a <code>PAnnotatedEPackage</code> associated to the given <code>EPackage</code> (if such
+ * an <code>PAnnotatedEPackage</code> does not yet exists) and adds it to the target model.
*/
public void add(EPackage ePackage) {
pElement(ePackage);
@@ -224,23 +231,25 @@ public class BasicPamodelBuilder implements ExtensionPoint {
* <code>PAnnotatedEClass</code> does not yet exists) and adds it to the target model.
*
* <p>
- * The creation of a new <code>PAnnotatedEClass</code> may involve the creation of a <code>PAnnotatedEPackage</code>
- * associated to the containing <code>EPackage</code> of the given class.
+ * The creation of a new <code>PAnnotatedEClass</code> may involve the creation of a
+ * <code>PAnnotatedEPackage</code> associated to the containing <code>EPackage</code> of the given
+ * class.
*/
public void add(EClass eClass) {
pElement(eClass);
}
/**
- * Add to the the target model a new <code>PAnnotatedEStructuralFeature</code> refering to the given
- * EStructuralFeature.
+ * Add to the the target model a new <code>PAnnotatedEStructuralFeature</code> refering to the
+ * given EStructuralFeature.
*
* <p>
- * A PAnnotatedEClass and a PAnnotatedEPackage for the containing EClass and EPackage are added if needed.
+ * A PAnnotatedEClass and a PAnnotatedEPackage for the containing EClass and EPackage are added if
+ * needed.
*
* <p>
- * The added element have no annotations. Elements for which a corresponding PAnnotatedElement is already present in
- * the target model are ignored.
+ * The added element have no annotations. Elements for which a corresponding PAnnotatedElement is
+ * already present in the target model are ignored.
*/
public void add(EStructuralFeature eFeature) {
pElement(eFeature);
@@ -250,36 +259,39 @@ public class BasicPamodelBuilder implements ExtensionPoint {
* Add the given annotation to the given PAnnotatedEModelElement.
*
* @throws IllegalArgumentException
- * if the given PAnnotation is not admitted for the given PAnnotatedEModelElement. protected void
- * setPAnnotation(PAnnotatedEModelElement pElement, PAnnotation pAnnotation) { EReference pAnnotationRef
- * = PamodelPackage.eINSTANCE .pAnnotationReference(pElement.eClass(), pAnnotation.eClass()); if
- * (pAnnotationRef == null) throw new IllegalArgumentException("PAnnotation of type '" +
- * pAnnotation.eClass() + "' does not apply to elements of type '" + pElement.eClass() + "'");
- * pElement.eSet(pAnnotationRef, pAnnotation); }
+ * if the given PAnnotation is not admitted for the given PAnnotatedEModelElement.
+ * protected void setPAnnotation(PAnnotatedEModelElement pElement, PAnnotation
+ * pAnnotation) { EReference pAnnotationRef = PamodelPackage.eINSTANCE
+ * .pAnnotationReference(pElement.eClass(), pAnnotation.eClass()); if (pAnnotationRef ==
+ * null) throw new IllegalArgumentException("PAnnotation of type '" +
+ * pAnnotation.eClass() + "' does not apply to elements of type '" + pElement.eClass() +
+ * "'"); pElement.eSet(pAnnotationRef, pAnnotation); }
*/
/**
* Add the given PAnnotation to the target model.
*
* <p>
- * This operation may involve the addition to the model of a newly created PAnnotatedEModelElement for the
- * PAnnotation EModelElement.
+ * This operation may involve the addition to the model of a newly created PAnnotatedEModelElement
+ * for the PAnnotation EModelElement.
*
* @throws NullPointerException
- * if either <code>pAnnotation</code> or <code>pAnnotation.getEModelElement()</code> are null.
+ * if either <code>pAnnotation</code> or <code>pAnnotation.getEModelElement()</code> are
+ * null.
* @throws IllegalArgumentException
- * if the given <code>PAnnotation</code> references an invalid <code>PAnnotatedElement</code> public
- * void add(PAnnotation pAnnotation) { PAnnotatedEModelElement pElement =
- * pElement(pAnnotation.getEModelElement()); setPAnnotation(pElement, pAnnotation); }
+ * if the given <code>PAnnotation</code> references an invalid
+ * <code>PAnnotatedElement</code> public void add(PAnnotation pAnnotation) {
+ * PAnnotatedEModelElement pElement = pElement(pAnnotation.getEModelElement());
+ * setPAnnotation(pElement, pAnnotation); }
*/
/**
- * Add to the the target model a new PAnnotatedPackage refering to the given EPackage. Recursively adds a
- * PAnnotatedEClass for each EClass in the given EPackage (see {@link addEClass}).
+ * Add to the the target model a new PAnnotatedPackage refering to the given EPackage. Recursively
+ * adds a PAnnotatedEClass for each EClass in the given EPackage (see {@link addEClass}).
*
* <p>
- * The added elements have no annotations. Elements for which a corresponding PAnnotatedElement is already present
- * in the target model are ignored.
+ * The added elements have no annotations. Elements for which a corresponding PAnnotatedElement is
+ * already present in the target model are ignored.
*/
public void addRecurse(EPackage ePackage) {
PAnnotatedEPackage paPackage = pElement(ePackage);
@@ -336,9 +348,9 @@ public class BasicPamodelBuilder implements ExtensionPoint {
}
/**
- * Add to the the target model a new PAnnotatedPackage refering to the given EClass. Recursively adds a
- * PAnnotatedEStructuralFeature for each EStructuralFeature in the given EClass (see {@link addEStructuralFeature}
- * ).
+ * Add to the the target model a new PAnnotatedPackage refering to the given EClass. Recursively
+ * adds a PAnnotatedEStructuralFeature for each EStructuralFeature in the given EClass (see
+ * {@link addEStructuralFeature} ).
*
* <p>
* A PAnnotatedEPackage for the containng EPackage is added if needed.
@@ -347,8 +359,9 @@ public class BasicPamodelBuilder implements ExtensionPoint {
* The added elements have no annotations.
*
* <p>
- * Elements for which a corresponding PAnnotatedElement is already present in the target model are ignored. public
- * void addRecurse(EClass eClass) { addRecurse((PAnnotatedEPackage) pElement(eClass), eClass); }
+ * Elements for which a corresponding PAnnotatedElement is already present in the target model are
+ * ignored. public void addRecurse(EClass eClass) { addRecurse((PAnnotatedEPackage)
+ * pElement(eClass), eClass); }
*/
/**
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BidirectionalManyToManyAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BidirectionalManyToManyAnnotator.java
index e532158d4..3f1d2bf2c 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BidirectionalManyToManyAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/BidirectionalManyToManyAnnotator.java
@@ -33,20 +33,22 @@ import org.eclipse.emf.teneo.extension.ExtensionPoint;
* @version $Revision: 1.10 $
*/
-public class BidirectionalManyToManyAnnotator extends BaseEFeatureAnnotator implements ExtensionPoint {
+public class BidirectionalManyToManyAnnotator extends BaseEFeatureAnnotator implements
+ ExtensionPoint {
// The logger
protected static final Log log = LogFactory.getLog(BidirectionalManyToManyAnnotator.class);
/** Process the features of the eclass */
public void annotate(PAnnotatedEReference aReference) {
- final String featureLogStr =
- aReference.getModelEReference().getName() + "/" +
- aReference.getModelEReference().getEContainingClass().getName();
-
- if (aReference.getOneToMany() != null || aReference.getOneToOne() != null || aReference.getManyToOne() != null) {
- throw new StoreMappingException("The feature/eclass " + featureLogStr + " should be a ManyToMany but " +
- "it already has a OneToMany, OneToOne or ManyToOne annotation");
+ final String featureLogStr = aReference.getModelEReference().getName() + "/"
+ + aReference.getModelEReference().getEContainingClass().getName();
+
+ if (aReference.getOneToMany() != null || aReference.getOneToOne() != null
+ || aReference.getManyToOne() != null) {
+ throw new StoreMappingException("The feature/eclass " + featureLogStr
+ + " should be a ManyToMany but "
+ + "it already has a OneToMany, OneToOne or ManyToOne annotation");
}
final EReference eReference = (EReference) aReference.getModelElement();
@@ -91,8 +93,8 @@ public class BidirectionalManyToManyAnnotator extends BaseEFeatureAnnotator impl
// set
// bugzilla: 164808
final PAnnotatedEReference otherPA = aReference.getPaModel().getPAnnotated(eOpposite);
- if (mtm.getMappedBy() == null && setMappedBy(eReference) &&
- (otherPA.getManyToMany() == null || otherPA.getManyToMany().getMappedBy() == null)) {
+ if (mtm.getMappedBy() == null && setMappedBy(eReference)
+ && (otherPA.getManyToMany() == null || otherPA.getManyToMany().getMappedBy() == null)) {
mtm.setMappedBy(eOpposite.getName());
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EClassAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EClassAnnotator.java
index 3805dc4bf..10fe8feca 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EClassAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EClassAnnotator.java
@@ -63,8 +63,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
private EFeatureAnnotator eFeatureAnnotator = null;
/**
- * Returns the annotated version of an EClass, Returns false if no efeatures of this eclass should be annotated,
- * true if its features can be annotated.
+ * Returns the annotated version of an EClass, Returns false if no efeatures of this eclass should
+ * be annotated, true if its features can be annotated.
*/
protected boolean annotate(PAnnotatedEClass aClass) {
if (aClass == null) {
@@ -82,7 +82,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
}
// do not process the document root
- if (!getPersistenceOptions().isMapDocumentRoot() && ExtendedMetaData.INSTANCE.isDocumentRoot(eclass)) {
+ if (!getPersistenceOptions().isMapDocumentRoot()
+ && ExtendedMetaData.INSTANCE.isDocumentRoot(eclass)) {
return false;
}
@@ -144,7 +145,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
if (aClass.getEntity() != null && aClass.getEntity().getName() == null) {
aClass.getEntity().setName(getEntityNameStrategy().toEntityName(eclass));
}
- // if (aClass.getEavMapping() != null && EModelResolver.instance().getJavaClass(aClass.getModelEClass()) !=
+ // if (aClass.getEavMapping() != null &&
+ // EModelResolver.instance().getJavaClass(aClass.getModelEClass()) !=
// null) {
// aClass.getEntity().setName(EModelResolver.instance().getJavaClass(aClass.getModelEClass()).getName());
// }
@@ -197,7 +199,7 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
if (aClass.getTable() == null
&& ((isInheritanceRoot && inheritanceType.equals(InheritanceType.SINGLE_TABLE))
|| inheritanceType.equals(InheritanceType.JOINED) || inheritanceType
- .equals(InheritanceType.TABLE_PER_CLASS))) {
+ .equals(InheritanceType.TABLE_PER_CLASS))) {
final Table table = getFactory().createTable();
table.setEModelElement(eclass);
// name is set in next step
@@ -230,12 +232,14 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
col.setNullable(false);
}
if (aClass.getDiscriminatorColumn().getColumn().getName() == null) {
- aClass.getDiscriminatorColumn().getColumn().setName(aClass.getDiscriminatorColumn().getName());
+ aClass.getDiscriminatorColumn().getColumn()
+ .setName(aClass.getDiscriminatorColumn().getName());
}
}
// add a discriminator value
- if (aClass.getDiscriminatorValue() == null && inheritanceType.equals(InheritanceType.SINGLE_TABLE)) {
+ if (aClass.getDiscriminatorValue() == null
+ && inheritanceType.equals(InheritanceType.SINGLE_TABLE)) {
final DiscriminatorValue dv = getFactory().createDiscriminatorValue();
final DiscriminatorColumn dc = getDiscriminatorColumn(aClass);
@@ -245,10 +249,9 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
// use the entityname to translate to an int value,
// hopefully hashcode is more or less unique...
final String entityName = getEntityName(eclass);
- log
- .warn("Generating an integer discriminator value for entity "
- + entityName
- + ". The hashcode of the entityName is used as the discriminatorvalue. This may not be unique! To ensure uniques you should set a @DiscriminatorValue annotation");
+ log.warn("Generating an integer discriminator value for entity "
+ + entityName
+ + ". The hashcode of the entityName is used as the discriminatorvalue. This may not be unique! To ensure uniques you should set a @DiscriminatorValue annotation");
dv.setValue("" + entityName.hashCode());
} else {
dv.setValue(getEntityName(eclass));
@@ -267,8 +270,10 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
// attributes of the primary table.
final List<PAnnotatedEStructuralFeature> aIdFeatures = aClass.getPaIdFeatures();
for (PAnnotatedEStructuralFeature idef : aIdFeatures) {
- final PrimaryKeyJoinColumn pkJoinColumn = PannotationFactory.eINSTANCE.createPrimaryKeyJoinColumn();
- pkJoinColumn.setName(getSqlNameStrategy().getSecondaryTablePrimaryKeyJoinColumnName(idef));
+ final PrimaryKeyJoinColumn pkJoinColumn = PannotationFactory.eINSTANCE
+ .createPrimaryKeyJoinColumn();
+ pkJoinColumn
+ .setName(getSqlNameStrategy().getSecondaryTablePrimaryKeyJoinColumnName(idef));
pkJoinColumns.add(pkJoinColumn);
}
}
@@ -335,7 +340,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
return;
}
- final PAnnotatedEClass superAClass = aClass.getPaModel().getPAnnotated(eclass.getESuperTypes().get(0));
+ final PAnnotatedEClass superAClass = aClass.getPaModel().getPAnnotated(
+ eclass.getESuperTypes().get(0));
if (superAClass.getEntity() != null || superAClass.getMappedSuperclass() != null) {
aClass.setPaSuperEntity(superAClass);
}
@@ -360,8 +366,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
if (!getPersistenceOptions().isSetEntityAutomatically() && aClass.getEntity() == null
&& aClass.getEmbeddable() == null) {
if (log.isDebugEnabled()) {
- log.debug("Entities are not added automatically and this eclass: " + aClass.getModelEClass().getName()
- + " does not have an entity/embeddable annotation.");
+ log.debug("Entities are not added automatically and this eclass: "
+ + aClass.getModelEClass().getName() + " does not have an entity/embeddable annotation.");
}
return false;
}
@@ -369,10 +375,9 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
// ignore these
if (!mapMappedSuperEClass() && aClass.getMappedSuperclass() != null) {
if (aClass.getEntity() != null) {
- log
- .warn("EClass "
- + eclass.getName()
- + " has entity as well as mappedsuperclass annotation, following mappedsuperclass annotation, therefore ignoring it for the mapping");
+ log.warn("EClass "
+ + eclass.getName()
+ + " has entity as well as mappedsuperclass annotation, following mappedsuperclass annotation, therefore ignoring it for the mapping");
}
return false;
}
@@ -395,8 +400,8 @@ public class EClassAnnotator extends AbstractAnnotator implements ExtensionPoint
/*
* (non-Javadoc)
*
- * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator# setPersistenceOptions(org.eclipse
- * .emf.teneo.PersistenceOptions)
+ * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator#
+ * setPersistenceOptions(org.eclipse .emf.teneo.PersistenceOptions)
*/
@Override
public void setPersistenceOptions(PersistenceOptions persistenceOptions) {
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EFeatureAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EFeatureAnnotator.java
index 9a7bb3440..7b090e03c 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EFeatureAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/EFeatureAnnotator.java
@@ -36,15 +36,14 @@ import org.eclipse.emf.teneo.extension.ExtensionPoint;
import org.eclipse.emf.teneo.util.StoreUtil;
/**
- * Sets the annotation on an efeature. In fact determines which efeature
- * annotator to use (one-to-many, many-to-many etc.).
+ * Sets the annotation on an efeature. In fact determines which efeature annotator to use
+ * (one-to-many, many-to-many etc.).
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.15 $
*/
-public class EFeatureAnnotator extends AbstractAnnotator implements
- ExtensionPoint {
+public class EFeatureAnnotator extends AbstractAnnotator implements ExtensionPoint {
// The logger
protected static final Log log = LogFactory.getLog(EFeatureAnnotator.class);
@@ -79,8 +78,7 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
/** Process the features of the eclass */
public void annotate(PAnnotatedEStructuralFeature aStructuralFeature) {
- EStructuralFeature eStructuralFeature = aStructuralFeature
- .getModelEStructuralFeature();
+ EStructuralFeature eStructuralFeature = aStructuralFeature.getModelEStructuralFeature();
boolean errorOccured = true;
try {
@@ -93,8 +91,7 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
boolean isTransient = eStructuralFeature.isTransient()
&& (eStructuralFeature instanceof EAttribute
|| ((EReference) eStructuralFeature).getEOpposite() == null
- || !((EReference) eStructuralFeature)
- .getEOpposite().isContainment() || ((EReference) eStructuralFeature)
+ || !((EReference) eStructuralFeature).getEOpposite().isContainment() || ((EReference) eStructuralFeature)
.getEOpposite().isTransient());
// check if the refered to eclass is transient if so then this
@@ -112,17 +109,14 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
trans.setEModelElement(eStructuralFeature);
aStructuralFeature.setTransient(trans);
} else if (aReference.getAReferenceType() != null) {
- isTransient = aReference.getAReferenceType()
- .getTransient() != null;
+ isTransient = aReference.getAReferenceType().getTransient() != null;
}
}
if (aReference != null && aReference.getTransient() == null
- && aReference.getExternal() == null
- && aReference.getAReferenceType() != null
+ && aReference.getExternal() == null && aReference.getAReferenceType() != null
&& aReference.getAReferenceType().getExternal() != null) {
- aReference.setExternal(aReference.getAReferenceType()
- .getExternal());
+ aReference.setExternal(aReference.getAReferenceType().getExternal());
}
}
@@ -132,12 +126,10 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
}
if (aStructuralFeature.getTransient() == null
- && ((!mapVolitatileFeature() && eStructuralFeature
- .isVolatile()) || isTransient)) {
+ && ((!mapVolitatileFeature() && eStructuralFeature.isVolatile()) || isTransient)) {
if (log.isDebugEnabled()) {
- log.debug("Structural feature "
- + eStructuralFeature.getName()
- + " is transient, therefore adding transient annotation");
+ log.debug("Structural feature " + eStructuralFeature.getName()
+ + " is transient, therefore adding transient annotation");
}
final Transient trans = getFactory().createTransient();
trans.setEModelElement(eStructuralFeature);
@@ -156,24 +148,21 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
return;
}
- final Class<?> instanceClass = eStructuralFeature.getEType()
- .getInstanceClass();
+ final Class<?> instanceClass = eStructuralFeature.getEType().getInstanceClass();
boolean isMany = false;
// instanceClass will be null for enums
// Lob-annotated attributes must not be treated as one-to-many.
// eattributes with a hibernate type annotations should not be
// treated as a list
if (instanceClass != null && aAttribute.getLob() == null) {
- isMany = eStructuralFeature.isMany()
- || instanceClass.isArray()
+ isMany = eStructuralFeature.isMany() || instanceClass.isArray()
|| Collection.class.isAssignableFrom(instanceClass)
|| Set.class.isAssignableFrom(instanceClass)
|| List.class.isAssignableFrom(instanceClass);
// note this causes a featuremap within a featuremap to get
// the
// basic annotation!
- isMany = isMany
- && !StoreUtil.isElementOfAGroup(eStructuralFeature);
+ isMany = isMany && !StoreUtil.isElementOfAGroup(eStructuralFeature);
}
if (isMany) {
@@ -182,11 +171,8 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
singleAttributeAnnotator.annotate(aAttribute);
}
- if (aAttribute.getColumn() != null
- && aAttribute.getColumn().getName() == null) {
- aAttribute.getColumn().setName(
- getSqlNameStrategy()
- .getColumnName(aAttribute, null));
+ if (aAttribute.getColumn() != null && aAttribute.getColumn().getName() == null) {
+ aAttribute.getColumn().setName(getSqlNameStrategy().getColumnName(aAttribute, null));
}
} else if (aStructuralFeature instanceof PAnnotatedEReference) {
@@ -202,54 +188,41 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
// specified manually, the system as a default will choose
// uni-manytoone
- final EReference eReference = (EReference) aStructuralFeature
- .getModelElement();
+ final EReference eReference = (EReference) aStructuralFeature.getModelElement();
final EReference eOpposite = eReference.getEOpposite();
// elements of a group are never multi-occurence because the
// multi-occurence is
// handled by the containing featuremap
- final boolean isMany = eReference.isMany()
- && !StoreUtil.isElementOfAGroup(eReference);
- final boolean isOppositeMany = eOpposite != null
- && eOpposite.isMany()
+ final boolean isMany = eReference.isMany() && !StoreUtil.isElementOfAGroup(eReference);
+ final boolean isOppositeMany = eOpposite != null && eOpposite.isMany()
&& !StoreUtil.isElementOfAGroup(eOpposite);
- final boolean mtmBidirectionalRelation = isMany
- && eOpposite != null && isOppositeMany;
- final boolean mtmUnidirectionalRelation = isMany
- && eOpposite == null
+ final boolean mtmBidirectionalRelation = isMany && eOpposite != null && isOppositeMany;
+ final boolean mtmUnidirectionalRelation = isMany && eOpposite == null
&& aReference.getManyToMany() != null;
- final boolean otmBidirectionalRelation = isMany
- && eOpposite != null && !isOppositeMany;
- final boolean otmUnidirectionalRelation = isMany
- && eOpposite == null;
+ final boolean otmBidirectionalRelation = isMany && eOpposite != null && !isOppositeMany;
+ final boolean otmUnidirectionalRelation = isMany && eOpposite == null;
// note as a default if the system has to choose between oto uni
// or mto uni then it will
// place a mto
- final boolean otoBidirectionalRelation = aReference
- .getManyToOne() == null
- && !isMany
- && eOpposite != null
- && !isOppositeMany;
- final boolean otoUnidirectionalRelation = aReference
- .getManyToOne() == null
+ final boolean otoBidirectionalRelation = aReference.getManyToOne() == null && !isMany
+ && eOpposite != null && !isOppositeMany;
+ final boolean otoUnidirectionalRelation = aReference.getManyToOne() == null
&& !isMany
&& eOpposite == null
- && (aReference.getOneToOne() != null || !aReference
- .getPrimaryKeyJoinColumns().isEmpty());
- final boolean mtoBidirectionalRelation = !isMany
- && eOpposite != null && isOppositeMany;
- final boolean mtoUnidirectionalRelation = !isMany
- && eOpposite == null && !otoUnidirectionalRelation;
+ && (aReference.getOneToOne() != null || !aReference.getPrimaryKeyJoinColumns()
+ .isEmpty());
+ final boolean mtoBidirectionalRelation = !isMany && eOpposite != null && isOppositeMany;
+ final boolean mtoUnidirectionalRelation = !isMany && eOpposite == null
+ && !otoUnidirectionalRelation;
if (mtmBidirectionalRelation) {
bidirectionalManyToManyAnnotator.annotate(aReference);
} else if (mtmUnidirectionalRelation) {
unidirectionalManyToManyAnnotator.annotate(aReference);
- } else if (otmBidirectionalRelation
- || otmUnidirectionalRelation) {
+ } else if (otmBidirectionalRelation || otmUnidirectionalRelation) {
oneToManyReferenceAnnotator.annotate(aReference);
} else if (aReference.getManyToOne() == null
&& (otoBidirectionalRelation || otoUnidirectionalRelation)) {
@@ -261,17 +234,13 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
}
// handle column naming at this level
- if (aReference.getColumn() != null
- && aReference.getColumn().getName() == null) {
- aReference.getColumn().setName(
- getSqlNameStrategy()
- .getColumnName(aReference, null));
+ if (aReference.getColumn() != null && aReference.getColumn().getName() == null) {
+ aReference.getColumn().setName(getSqlNameStrategy().getColumnName(aReference, null));
}
} else {
- throw new IllegalArgumentException(
- "This type of StructuralFeature is not supported: "
- + aStructuralFeature.getClass().getName());
+ throw new IllegalArgumentException("This type of StructuralFeature is not supported: "
+ + aStructuralFeature.getClass().getName());
}
errorOccured = false;
} finally {
@@ -279,15 +248,12 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
// check that at least one ann was set
if (aStructuralFeature instanceof PAnnotatedEAttribute) {
PAnnotatedEAttribute pae = (PAnnotatedEAttribute) aStructuralFeature;
- assert (errorOccured || pae.getBasic() != null
- || pae.getVersion() != null || pae.getId() != null
- || pae.getTransient() != null || pae.getOneToMany() != null);
+ assert (errorOccured || pae.getBasic() != null || pae.getVersion() != null
+ || pae.getId() != null || pae.getTransient() != null || pae.getOneToMany() != null);
} else {
PAnnotatedEReference par = (PAnnotatedEReference) aStructuralFeature;
- assert (errorOccured || par.getTransient() != null
- || par.getOneToMany() != null
- || par.getManyToMany() != null
- || par.getManyToOne() != null || par.getOneToOne() != null);
+ assert (errorOccured || par.getTransient() != null || par.getOneToMany() != null
+ || par.getManyToMany() != null || par.getManyToOne() != null || par.getOneToOne() != null);
}
}
}
@@ -307,8 +273,7 @@ public class EFeatureAnnotator extends AbstractAnnotator implements
// checks for the presence of the @Transient annotation
// without requiring the refered class to be processed
private boolean hasTransientAnnotation(EClass eClass) {
- final EAnnotation eAnnotation = eClass
- .getEAnnotation(Constants.ANNOTATION_SOURCE_TENEO_JPA);
+ final EAnnotation eAnnotation = eClass.getEAnnotation(Constants.ANNOTATION_SOURCE_TENEO_JPA);
if (eAnnotation == null) {
return false;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/ManyToOneReferenceAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/ManyToOneReferenceAnnotator.java
index f26ff6aa1..434001000 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/ManyToOneReferenceAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/ManyToOneReferenceAnnotator.java
@@ -44,8 +44,10 @@ public class ManyToOneReferenceAnnotator extends BaseEFeatureAnnotator implement
final String logStr = aReference.getModelEReference().getName() + "/"
+ aReference.getModelEReference().getEContainingClass().getName();
- if (aReference.getOneToMany() != null || aReference.getManyToMany() != null || aReference.getOneToOne() != null) {
- throw new StoreMappingException("The feature/eclass " + logStr + " should be a ManyToOne but "
+ if (aReference.getOneToMany() != null || aReference.getManyToMany() != null
+ || aReference.getOneToOne() != null) {
+ throw new StoreMappingException("The feature/eclass " + logStr
+ + " should be a ManyToOne but "
+ "it already has a OneToMany, ManyToMany or OneToOne annotation");
}
@@ -66,9 +68,10 @@ public class ManyToOneReferenceAnnotator extends BaseEFeatureAnnotator implement
// mto.setOptional(!eReference.isRequired() ||
// eReference.isUnsettable() ||
// eReference.getEOpposite() != null);
- mto.setOptional(!eReference.isRequired() || eReference.getEOpposite() != null || eReference.isUnsettable());
+ mto.setOptional(!eReference.isRequired() || eReference.getEOpposite() != null
+ || eReference.isUnsettable());
mto.setEModelElement(eReference);
- } else if (log.isDebugEnabled()){
+ } else if (log.isDebugEnabled()) {
log.debug("EReference + " + logStr + " does have a manytoone annotation, using it");
}
@@ -114,16 +117,19 @@ public class ManyToOneReferenceAnnotator extends BaseEFeatureAnnotator implement
boolean hasJoinTable = false;
boolean isInsertableUpdatable = true;
if (eReference.getEOpposite() != null && !eReference.getEOpposite().isTransient()) {
- final PAnnotatedEReference aOpposite = getAnnotatedModel().getPAnnotated(eReference.getEOpposite());
+ final PAnnotatedEReference aOpposite = getAnnotatedModel().getPAnnotated(
+ eReference.getEOpposite());
hasJoinTable = (!aOpposite.getModelEReference().isContainment() && getPersistenceOptions()
- .isJoinTableForNonContainedAssociations())
- || aOpposite.getJoinTable() != null;
+ .isJoinTableForNonContainedAssociations()) || aOpposite.getJoinTable() != null;
- if (!hasJoinTable && aOpposite.getOneToMany() != null && aOpposite.getOneToMany().isList() && !aOpposite.getOneToMany().getFetch().equals(FetchType.EXTRA)) {
+ if (!hasJoinTable && aOpposite.getOneToMany() != null
+ && aOpposite.getOneToMany().isList()
+ && !aOpposite.getOneToMany().getFetch().equals(FetchType.EXTRA)) {
isInsertableUpdatable = false;
}
- // if the refered to is stored as an eav then do the update of the columns from here.
+ // if the refered to is stored as an eav then do the update of the
+ // columns from here.
if (aReference.getAReferenceType().getEavMapping() != null) {
isInsertableUpdatable = true;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyAttributeAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyAttributeAnnotator.java
index 354be5d8f..970bfc414 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyAttributeAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyAttributeAnnotator.java
@@ -35,28 +35,24 @@ import org.eclipse.emf.teneo.annotations.pannotation.TemporalType;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
/**
- * Annotates a one-to-many attribute (an eattribute with ismany=true), an
- * example is a list of primitives (list of ints).
+ * Annotates a one-to-many attribute (an eattribute with ismany=true), an example is a list of
+ * primitives (list of ints).
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.11 $
*/
-public class OneToManyAttributeAnnotator extends BaseEFeatureAnnotator
- implements ExtensionPoint {
+public class OneToManyAttributeAnnotator extends BaseEFeatureAnnotator implements ExtensionPoint {
// The logger
- protected static final Log log = LogFactory
- .getLog(OneToManyAttributeAnnotator.class);
+ protected static final Log log = LogFactory.getLog(OneToManyAttributeAnnotator.class);
private TemporalType optionDefaultTemporal = null;
/** Process the features of the eclass */
public void annotate(PAnnotatedEAttribute aAttribute) {
- final String logStr = aAttribute.getModelEAttribute().getName()
- + "/"
- + aAttribute.getModelEAttribute().getEContainingClass()
- .getName();
+ final String logStr = aAttribute.getModelEAttribute().getName() + "/"
+ + aAttribute.getModelEAttribute().getEContainingClass().getName();
if (log.isDebugEnabled()) {
log.debug("EAttribute " + logStr + " needs a onetomany");
@@ -83,14 +79,12 @@ public class OneToManyAttributeAnnotator extends BaseEFeatureAnnotator
log.debug("One to many present adding default information if required");
}
- if (getPersistenceOptions().isSetForeignKeyNames()
- && aAttribute.getForeignKey() == null) {
+ if (getPersistenceOptions().isSetForeignKeyNames() && aAttribute.getForeignKey() == null) {
aAttribute.setForeignKey(createFK(aAttribute));
}
// handle list of enums
- if (eAttribute.getEType() instanceof EEnum
- && aAttribute.getEnumerated() == null) {
+ if (eAttribute.getEType() instanceof EEnum && aAttribute.getEnumerated() == null) {
final Enumerated enumerated = getFactory().createEnumerated();
enumerated.setValue(EnumType.STRING);
enumerated.setEModelElement(eAttribute);
@@ -118,26 +112,22 @@ public class OneToManyAttributeAnnotator extends BaseEFeatureAnnotator
}
if (aAttribute.getJoinColumns().size() == 0) {
- final List<String> names = getSqlNameStrategy()
- .getOneToManyEAttributeJoinColumns(aAttribute);
- aAttribute
- .getJoinColumns()
- .addAll(getJoinColumns(names,
- FeatureMapUtil.isFeatureMap(eAttribute), true, otm));
+ final List<String> names = getSqlNameStrategy().getOneToManyEAttributeJoinColumns(aAttribute);
+ aAttribute.getJoinColumns().addAll(
+ getJoinColumns(names, FeatureMapUtil.isFeatureMap(eAttribute), true, otm));
}
// set unique and indexed
if (!otmWasSet) {
if (log.isDebugEnabled()) {
log.debug("Setting indexed and unique on otm from eAttribute.isOrdered/isUnique "
- + "because otm was not set manually");
+ + "because otm was not set manually");
}
otm.setIndexed(eAttribute.isOrdered());
otm.setUnique(eAttribute.isUnique());
if (aAttribute.getElementCollection() != null
- && aAttribute.getElementCollection().getFetch() != otm
- .getFetch()) {
+ && aAttribute.getElementCollection().getFetch() != otm.getFetch()) {
otm.setFetch(aAttribute.getElementCollection().getFetch());
}
}
@@ -153,8 +143,7 @@ public class OneToManyAttributeAnnotator extends BaseEFeatureAnnotator
public void setPersistenceOptions(PersistenceOptions persistenceOptions) {
super.setPersistenceOptions(persistenceOptions);
- optionDefaultTemporal = TemporalType.get(persistenceOptions
- .getDefaultTemporalValue());
+ optionDefaultTemporal = TemporalType.get(persistenceOptions.getDefaultTemporalValue());
if (optionDefaultTemporal == null) {
throw new StoreMappingException("Temporal value not found: "
+ persistenceOptions.getDefaultTemporalValue());
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyReferenceAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyReferenceAnnotator.java
index c3b3adb4f..2acbb6e59 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyReferenceAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToManyReferenceAnnotator.java
@@ -41,28 +41,21 @@ import org.eclipse.emf.teneo.util.StoreUtil;
* @version $Revision: 1.20 $
*/
-public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
- implements ExtensionPoint {
+public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator implements ExtensionPoint {
// The logger
- protected static final Log log = LogFactory
- .getLog(OneToManyReferenceAnnotator.class);
+ protected static final Log log = LogFactory.getLog(OneToManyReferenceAnnotator.class);
/** Annotate it */
public void annotate(PAnnotatedEReference aReference) {
- final String logStr = aReference.getModelEReference().getName()
- + "/"
- + aReference.getModelEReference().getEContainingClass()
- .getName();
+ final String logStr = aReference.getModelEReference().getName() + "/"
+ + aReference.getModelEReference().getEContainingClass().getName();
- if (aReference.getManyToMany() != null
- || aReference.getOneToOne() != null
+ if (aReference.getManyToMany() != null || aReference.getOneToOne() != null
|| aReference.getManyToOne() != null) {
- throw new StoreMappingException(
- "The feature/eclass "
- + logStr
- + " should be a OneToMany but "
- + "it already has a ManyToMany, OneToOne or ManyToOne annotation");
+ throw new StoreMappingException("The feature/eclass " + logStr
+ + " should be a OneToMany but "
+ + "it already has a ManyToMany, OneToOne or ManyToOne annotation");
}
final EReference eReference = (EReference) aReference.getModelElement();
@@ -70,22 +63,19 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
final boolean otmWasSet = otm != null; // otm was set manually
if (otm == null) {
if (log.isDebugEnabled()) {
- log.debug("EReference + " + logStr
- + " does not have a onetomany annotation, adding one");
+ log.debug("EReference + " + logStr + " does not have a onetomany annotation, adding one");
}
otm = getFactory().createOneToMany();
aReference.setOneToMany(otm);
otm.setEModelElement(eReference);
- if (eReference.isContainment()
- && getPersistenceOptions().isFetchContainmentEagerly()) {
+ if (eReference.isContainment() && getPersistenceOptions().isFetchContainmentEagerly()) {
otm.setFetch(FetchType.EAGER);
} else if (getPersistenceOptions().isFetchAssociationExtraLazy()) {
otm.setFetch(FetchType.EXTRA);
}
} else if (log.isDebugEnabled()) {
- log.debug("EReference + " + logStr
- + " has onetomany, check if defaults should be set");
+ log.debug("EReference + " + logStr + " has onetomany, check if defaults should be set");
}
// don't set mappedBy explicitly anymore
@@ -100,8 +90,7 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
aReference.setEmbedded(getFactory().createEmbedded());
}
- if (getPersistenceOptions().isSetForeignKeyNames()
- && aReference.getForeignKey() == null) {
+ if (getPersistenceOptions().isSetForeignKeyNames() && aReference.getForeignKey() == null) {
// See bugzilla 211798: handle a specific case when this is a
// bidirectional
// one-to-many/many-to-one. In that case the foreign key name has to
@@ -110,11 +99,10 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
// annotated reference from the other side to ensure that the same
// foreign key name
// is used.
- if (eReference.getEOpposite() != null
- && !eReference.getEOpposite().isMany()
+ if (eReference.getEOpposite() != null && !eReference.getEOpposite().isMany()
&& !eReference.getEOpposite().isTransient()) {
- final PAnnotatedEReference aOpposite = aReference.getPaModel()
- .getPAnnotated(eReference.getEOpposite());
+ final PAnnotatedEReference aOpposite = aReference.getPaModel().getPAnnotated(
+ eReference.getEOpposite());
if (aOpposite != null && aOpposite.getTransient() == null) {
// don't do anything as otherwise hibernate will create two
// fk's with the same name
@@ -134,9 +122,7 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
}
}
- if (eReference.isContainment()
- || getPersistenceOptions()
- .isSetDefaultCascadeOnNonContainment()) {
+ if (eReference.isContainment() || getPersistenceOptions().isSetDefaultCascadeOnNonContainment()) {
setCascade(otm.getCascade(), eReference.isContainment());
}
@@ -174,47 +160,39 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
// set unique and indexed
if (!otmWasSet) {
- log
- .debug("Setting indexed and unique from ereference because otm was not set manually!");
+ log.debug("Setting indexed and unique from ereference because otm was not set manually!");
// note force a join table in case of idbag!
otm.setIndexed(!getPersistenceOptions().alwaysMapListAsBag()
- && !getPersistenceOptions().alwaysMapListAsIdBag()
- && eReference.isOrdered()
+ && !getPersistenceOptions().alwaysMapListAsIdBag() && eReference.isOrdered()
&& aReference.getOrderBy() == null);
// in case of containment it is always unique
// in case optionidbag then ignore the unique attribute on the
// ereference
- otm
- .setUnique(eReference.isContainment()
- || (!getPersistenceOptions().alwaysMapListAsIdBag() && eReference
- .isUnique()));
+ otm.setUnique(eReference.isContainment()
+ || (!getPersistenceOptions().alwaysMapListAsIdBag() && eReference.isUnique()));
if (aReference.getModelEReference().getEOpposite() != null) {
- log
- .debug("Setting unique because is bidirectional (has eopposite) otm");
+ log.debug("Setting unique because is bidirectional (has eopposite) otm");
otm.setUnique(true);
}
} else if (!otm.isUnique() && !eReference.isUnique()
&& aReference.getModelEReference().getEOpposite() != null) {
- log
- .warn("The EReference "
- + logStr
- + " is not unique (allows duplicates) but it is bi-directional, this is not logical");
+ log.warn("The EReference " + logStr
+ + " is not unique (allows duplicates) but it is bi-directional, this is not logical");
}
// only use a jointable if the relation is non unique
- final boolean isEObject = EntityNameStrategy.EOBJECT_ECLASS_NAME
- .compareTo(otm.getTargetEntity()) == 0;
+ final boolean isEObject = EntityNameStrategy.EOBJECT_ECLASS_NAME.compareTo(otm
+ .getTargetEntity()) == 0;
// in case of eobject always a join table is required
boolean mapJoinTable = aReference.getJoinTable() != null
|| isEObject
- || (getPersistenceOptions()
- .isJoinTableForNonContainedAssociations() && !eReference
+ || (getPersistenceOptions().isJoinTableForNonContainedAssociations() && !eReference
.isContainment()) || !otm.isUnique();
// also always map join table if the one refered to is an EAV
- mapJoinTable |= (aReference.getAReferenceType() != null && aReference
- .getAReferenceType().getEavMapping() != null);
+ mapJoinTable |= (aReference.getAReferenceType() != null && aReference.getAReferenceType()
+ .getEavMapping() != null);
if (mapJoinTable) {
JoinTable joinTable = aReference.getJoinTable();
@@ -226,46 +204,35 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
// see remark in manytomany about naming of jointables
if (joinTable.getName() == null) {
- joinTable.setName(getSqlNameStrategy().getJoinTableName(
- aReference));
+ joinTable.setName(getSqlNameStrategy().getJoinTableName(aReference));
}
// note joincolumns in jointable can be generated automatically by
// hib/jpox. need to explicitly do this in case of
// composite id
if (joinTable.getJoinColumns().size() == 0) {
- final List<String> names = getSqlNameStrategy()
- .getJoinTableJoinColumns(aReference, false);
- joinTable.getJoinColumns().addAll(
- getJoinColumns(names, false, true, otm));
+ final List<String> names = getSqlNameStrategy().getJoinTableJoinColumns(aReference, false);
+ joinTable.getJoinColumns().addAll(getJoinColumns(names, false, true, otm));
}
- if (joinTable.getInverseJoinColumns().size() == 0
- && aReference.getAReferenceType() != null) {
- final List<String> names = getSqlNameStrategy()
- .getJoinTableJoinColumns(aReference, true);
+ if (joinTable.getInverseJoinColumns().size() == 0 && aReference.getAReferenceType() != null) {
+ final List<String> names = getSqlNameStrategy().getJoinTableJoinColumns(aReference, true);
// todo: should the inverse join columns not be
- joinTable.getInverseJoinColumns().addAll(
- getJoinColumns(names, false, true, otm));
+ joinTable.getInverseJoinColumns().addAll(getJoinColumns(names, false, true, otm));
}
- } else if (aReference.getJoinColumns() == null
- || aReference.getJoinColumns().isEmpty()) { // add
+ } else if (aReference.getJoinColumns() == null || aReference.getJoinColumns().isEmpty()) { // add
boolean borrowJoinColumnsOtherSide = false;
final EReference eOther = getOpposite(aReference);
if (eOther != null) {
- final PAnnotatedEReference aOther = aReference.getPaModel()
- .getPAnnotated(eOther);
+ final PAnnotatedEReference aOther = aReference.getPaModel().getPAnnotated(eOther);
// map the other side, before checking if there are joincolumns
- getEFeatureAnnotator().getManyToOneReferenceAnnotator()
- .annotate(aOther);
+ getEFeatureAnnotator().getManyToOneReferenceAnnotator().annotate(aOther);
- if (aOther.getJoinColumns() != null
- && !aOther.getJoinColumns().isEmpty()) {
+ if (aOther.getJoinColumns() != null && !aOther.getJoinColumns().isEmpty()) {
borrowJoinColumnsOtherSide = true;
for (JoinColumn jc : aOther.getJoinColumns()) {
- aReference.getJoinColumns().add(
- (JoinColumn) EcoreUtil.copy(jc));
+ aReference.getJoinColumns().add((JoinColumn) EcoreUtil.copy(jc));
}
// repair updatable/insertable
for (JoinColumn jc : aReference.getJoinColumns()) {
@@ -275,11 +242,10 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
}
}
if (!borrowJoinColumnsOtherSide) {
- final List<String> names = getSqlNameStrategy()
- .getOneToManyEReferenceJoinColumns(aReference);
+ final List<String> names = getSqlNameStrategy().getOneToManyEReferenceJoinColumns(
+ aReference);
aReference.getJoinColumns().addAll(
- getJoinColumns(names, aReference.getEmbedded() == null,
- true, otm));
+ getJoinColumns(names, aReference.getEmbedded() == null, true, otm));
}
// In case of a bidirectional relation without a join table
@@ -293,8 +259,7 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
// indexed collections
boolean thisEAVMapped = aReference.getPaEClass().getEavMapping() != null;
if (otm.isList() && eOther != null && !thisEAVMapped) {
- final PAnnotatedEReference aOpposite = getAnnotatedModel()
- .getPAnnotated(eOther);
+ final PAnnotatedEReference aOpposite = getAnnotatedModel().getPAnnotated(eOther);
if (aReference.getTransient() == null) {
if (aOpposite.getJoinColumns().size() > 0) {
for (JoinColumn jc : aOpposite.getJoinColumns()) {
@@ -320,21 +285,18 @@ public class OneToManyReferenceAnnotator extends BaseEFeatureAnnotator
// now handle a special case, the aReference is a map
// and there is a mapped by and a one to many
- if (aReference.getOneToMany() == null
- || aReference.getOneToMany().getMappedBy() == null) {
+ if (aReference.getOneToMany() == null || aReference.getOneToMany().getMappedBy() == null) {
return null;
}
final EClass eclass = eReference.getEReferenceType();
- if (getPersistenceOptions().isMapEMapAsTrueMap()
- && StoreUtil.isMapEntry(eclass)) {
+ if (getPersistenceOptions().isMapEMapAsTrueMap() && StoreUtil.isMapEntry(eclass)) {
EStructuralFeature feature = eclass.getEStructuralFeature("value");
if (feature instanceof EReference) {
final String mappedBy = aReference.getOneToMany().getMappedBy();
final EReference valueERef = (EReference) feature;
final EClass valueEClass = valueERef.getEReferenceType();
- final EStructuralFeature ef = valueEClass
- .getEStructuralFeature(mappedBy);
+ final EStructuralFeature ef = valueEClass.getEStructuralFeature(mappedBy);
if (ef == null || ef instanceof EAttribute) {
return null;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToOneReferenceAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToOneReferenceAnnotator.java
index 4e783f0e6..c4659cb7f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToOneReferenceAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/OneToOneReferenceAnnotator.java
@@ -37,14 +37,13 @@ public class OneToOneReferenceAnnotator extends BaseEFeatureAnnotator implements
/** Annotate it */
public void annotate(PAnnotatedEReference aReference) {
- final String logStr =
- aReference.getModelEReference().getName() + "/" +
- aReference.getModelEReference().getEContainingClass().getName();
-
- if (aReference.getOneToMany() != null || aReference.getManyToMany() != null ||
- aReference.getManyToOne() != null) {
- throw new StoreMappingException("The feature/eclass " + logStr + " should be a OneToOne but " +
- "it already has a OneToMany, ManyToMany or ManyToOne annotation");
+ final String logStr = aReference.getModelEReference().getName() + "/"
+ + aReference.getModelEReference().getEContainingClass().getName();
+
+ if (aReference.getOneToMany() != null || aReference.getManyToMany() != null
+ || aReference.getManyToOne() != null) {
+ throw new StoreMappingException("The feature/eclass " + logStr + " should be a OneToOne but "
+ + "it already has a OneToMany, ManyToMany or ManyToOne annotation");
}
final EReference eReference = (EReference) aReference.getModelElement();
@@ -66,7 +65,8 @@ public class OneToOneReferenceAnnotator extends BaseEFeatureAnnotator implements
oto.setOptional(!eReference.isRequired());
oto.setEModelElement(eReference);
} else if (log.isDebugEnabled()) {
- log.debug("EReference + " + logStr + " has an onetoone annotation setting defaults if required");
+ log.debug("EReference + " + logStr
+ + " has an onetoone annotation setting defaults if required");
}
if (!oto.isSetFetch()) {
@@ -78,10 +78,11 @@ public class OneToOneReferenceAnnotator extends BaseEFeatureAnnotator implements
oto.setMappedBy(eReference.getEOpposite().getName());
}
- if (oto.getCascade().isEmpty() && eReference.isContainment() && getPersistenceOptions().isSetCascadeAllOnContainment()) {
+ if (oto.getCascade().isEmpty() && eReference.isContainment()
+ && getPersistenceOptions().isSetCascadeAllOnContainment()) {
oto.setOrphanRemoval(true);
}
-
+
if (getPersistenceOptions().isSetForeignKeyNames() && aReference.getForeignKey() == null) {
// See bugzilla 211798: handle a specific case when this is a
// bidirectional
@@ -91,7 +92,8 @@ public class OneToOneReferenceAnnotator extends BaseEFeatureAnnotator implements
// foreign key name
// is used.
if (eReference.getEOpposite() != null && !eReference.getEOpposite().isTransient()) {
- final PAnnotatedEReference aOpposite = aReference.getPaModel().getPAnnotated(eReference.getEOpposite());
+ final PAnnotatedEReference aOpposite = aReference.getPaModel().getPAnnotated(
+ eReference.getEOpposite());
if (aOpposite != null && aOpposite.getTransient() == null) {
// don't do anything as otherwise hibernate will create two
// fk's with the same name
@@ -113,8 +115,8 @@ public class OneToOneReferenceAnnotator extends BaseEFeatureAnnotator implements
setCascade(oto.getCascade(), eReference.isContainment());
- if (getPersistenceOptions().isMapEmbeddableAsEmbedded() &&
- aReference.getAReferenceType().getEmbeddable() != null) {
+ if (getPersistenceOptions().isMapEmbeddableAsEmbedded()
+ && aReference.getAReferenceType().getEmbeddable() != null) {
aReference.setEmbedded(getFactory().createEmbedded());
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceFileProvider.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceFileProvider.java
index d851a8e98..14d876d8b 100644
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceFileProvider.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceFileProvider.java
@@ -27,16 +27,15 @@ public class PersistenceFileProvider implements ExtensionPoint {
protected static final Log log = LogFactory.getLog(PersistenceFileProvider.class);
/**
- * Returns an InputStream with the file content, note if the file does not exist then null may
- * be returned. This implementation searches for the file in the classpath using the path
- * parameters.
+ * Returns an InputStream with the file content, note if the file does not exist then null may be
+ * returned. This implementation searches for the file in the classpath using the path parameters.
*
* Custom implementations of this class may use any other method to find the file.
*
* @param clz
- * the class to use when reading the file through a classloader
+ * the class to use when reading the file through a classloader
* @param path
- * the path to the file (incl. the filename and extension)
+ * the path to the file (incl. the filename and extension)
*
* @return an InputStream if found, or null otherwise
*/
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceMappingBuilder.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceMappingBuilder.java
index ffedfde67..96450f53d 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceMappingBuilder.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/PersistenceMappingBuilder.java
@@ -43,8 +43,8 @@ import org.eclipse.emf.teneo.extension.ExtensionPoint;
import org.eclipse.emf.teneo.util.StoreUtil;
/**
- * Receives a list of ecore files and generates a mapping model using different strategies. The mapping model is
- * returned.
+ * Receives a list of ecore files and generates a mapping model using different strategies. The
+ * mapping model is returned.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.14 $
@@ -60,7 +60,8 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
/**
* Receives a list of ecore files and returns a Mapping
*/
- public PAnnotatedModel buildMapping(String[] ecoreFiles, PersistenceOptions po, ExtensionManager extensionManager) {
+ public PAnnotatedModel buildMapping(String[] ecoreFiles, PersistenceOptions po,
+ ExtensionManager extensionManager) {
return buildMapping(StoreUtil.readEPackages(ecoreFiles), po, extensionManager);
}
@@ -69,14 +70,16 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
*
* @Deprecated use the method with the List<EPackage> parameter
*/
- public PAnnotatedModel buildMapping(EPackage[] epackages, PersistenceOptions po, ExtensionManager extensionManager) {
+ public PAnnotatedModel buildMapping(EPackage[] epackages, PersistenceOptions po,
+ ExtensionManager extensionManager) {
return buildMapping(Arrays.asList(epackages), po, extensionManager);
}
/**
* Builds a persistence mapping for one or more epackages
*/
- public PAnnotatedModel buildMapping(List<EPackage> epacks, PersistenceOptions po, ExtensionManager extensionManager) {
+ public PAnnotatedModel buildMapping(List<EPackage> epacks, PersistenceOptions po,
+ ExtensionManager extensionManager) {
// read the subepackages
List<EPackage> epackages = new ArrayList<EPackage>();
for (EPackage epack : epacks) {
@@ -113,8 +116,8 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
if (po.isMapDocumentRoot()) {
// use the ecore package which is present in the package registry
- final EPackage ecorePackage = PackageRegistryProvider.getInstance().getPackageRegistry().getEPackage(
- EcorePackage.eNS_URI);
+ final EPackage ecorePackage = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(EcorePackage.eNS_URI);
final EClassifier eClassifier = ecorePackage.getEClassifier(EcorePackage.eINSTANCE
.getEStringToStringMapEntry().getName());
pamodelBuilder.addSpecificEClass((EClass) eClassifier);
@@ -246,7 +249,8 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
private void addAllUsedEPackages(EClass eClass, List<EPackage> ePackages) {
addAllUsedEPackages(eClass.getEPackage(), ePackages);
for (EClass eSuperClass : eClass.getESuperTypes()) {
- // apparently there is a cycle in one of the XSD/XML packages, this prevents this.
+ // apparently there is a cycle in one of the XSD/XML packages, this
+ // prevents this.
if (!ePackages.contains(eSuperClass.getEPackage())) {
addAllUsedEPackages(eSuperClass, ePackages);
}
@@ -267,8 +271,8 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
}
/**
- * For each pannotated eattribute find the pannotated edatatype and copy the values of the estructuralfeature if not
- * yet set in the eattribute
+ * For each pannotated eattribute find the pannotated edatatype and copy the values of the
+ * estructuralfeature if not yet set in the eattribute
*/
protected void processEDataTypeAnnotations(PAnnotatedModel pam) {
if (log.isDebugEnabled()) {
@@ -289,7 +293,7 @@ public class PersistenceMappingBuilder implements ExtensionPoint {
if (asf != null && !pea.eIsSet(asf) && ped.eIsSet(esf)) {
if (log.isDebugEnabled()) {
log.debug("Copying value for feature " + esf.getName() + " from edatatype "
- + et.getName() + " to " + pea.getModelEAttribute().getName());
+ + et.getName() + " to " + pea.getModelEAttribute().getName());
}
final Object obj = ped.eGet(esf);
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/SingleAttributeAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/SingleAttributeAnnotator.java
index 4c7df93ee..493977c91 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/SingleAttributeAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/SingleAttributeAnnotator.java
@@ -49,7 +49,8 @@ public class SingleAttributeAnnotator extends BaseEFeatureAnnotator implements E
public void annotate(PAnnotatedEAttribute aAttribute) {
if (log.isDebugEnabled()) {
- log.debug(" Adding default annotations for EAttribute " + aAttribute.getModelElement().getName());
+ log.debug(" Adding default annotations for EAttribute "
+ + aAttribute.getModelElement().getName());
}
final EAttribute eAttribute = (EAttribute) aAttribute.getModelElement();
@@ -63,17 +64,17 @@ public class SingleAttributeAnnotator extends BaseEFeatureAnnotator implements E
aAttribute.setEnumerated(enumerated);
}
- if (getPersistenceOptions().isIDFeatureAsPrimaryKey() && eAttribute.isID() && aAttribute.getId() == null) {
+ if (getPersistenceOptions().isIDFeatureAsPrimaryKey() && eAttribute.isID()
+ && aAttribute.getId() == null) {
// bugzilla 249246
if (aAttribute.getPaEClass().getPaSuperEntity() != null
&& aAttribute.getPaEClass().getPaSuperEntity().getMappedSuperclass() == null) {
- log
- .warn("The eclass "
- + aAttribute.getPaEClass().getModelEClass().getName()
- + " has an efeature ("
- + aAttribute.getModelEAttribute().getName()
- + ")"
- + " which has type ID, Teneo will not annotate this efeature with @Id because it is an efeature of a subtype");
+ log.warn("The eclass "
+ + aAttribute.getPaEClass().getModelEClass().getName()
+ + " has an efeature ("
+ + aAttribute.getModelEAttribute().getName()
+ + ")"
+ + " which has type ID, Teneo will not annotate this efeature with @Id because it is an efeature of a subtype");
} else {
final Id id = getFactory().createId();
id.setEModelElement(eAttribute);
@@ -139,8 +140,8 @@ public class SingleAttributeAnnotator extends BaseEFeatureAnnotator implements E
/*
* (non-Javadoc)
*
- * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator# setPersistenceOptions(org.eclipse
- * .emf.teneo.PersistenceOptions)
+ * @seeorg.eclipse.emf.teneo.annotations.mapper.AbstractAnnotator#
+ * setPersistenceOptions(org.eclipse .emf.teneo.PersistenceOptions)
*/
@Override
public void setPersistenceOptions(PersistenceOptions persistenceOptions) {
@@ -148,7 +149,8 @@ public class SingleAttributeAnnotator extends BaseEFeatureAnnotator implements E
optionDefaultTemporal = TemporalType.get(persistenceOptions.getDefaultTemporalValue());
if (optionDefaultTemporal == null) {
- throw new StoreMappingException("Temporal value not found: " + persistenceOptions.getDefaultTemporalValue());
+ throw new StoreMappingException("Temporal value not found: "
+ + persistenceOptions.getDefaultTemporalValue());
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/UnidirectionalManyToManyAnnotator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/UnidirectionalManyToManyAnnotator.java
index c0afd52a1..d062e0e2f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/UnidirectionalManyToManyAnnotator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/mapper/UnidirectionalManyToManyAnnotator.java
@@ -33,20 +33,22 @@ import org.eclipse.emf.teneo.extension.ExtensionPoint;
* @version $Revision: 1.9 $
*/
-public class UnidirectionalManyToManyAnnotator extends BaseEFeatureAnnotator implements ExtensionPoint {
+public class UnidirectionalManyToManyAnnotator extends BaseEFeatureAnnotator implements
+ ExtensionPoint {
// The logger
protected static final Log log = LogFactory.getLog(UnidirectionalManyToManyAnnotator.class);
/** Process the features of the eclass */
public void annotate(PAnnotatedEReference aReference) {
- final String featureLogStr =
- aReference.getModelEReference().getName() + "/" +
- aReference.getModelEReference().getEContainingClass().getName();
+ final String featureLogStr = aReference.getModelEReference().getName() + "/"
+ + aReference.getModelEReference().getEContainingClass().getName();
- if (aReference.getOneToMany() != null || aReference.getOneToOne() != null || aReference.getManyToOne() != null) {
- throw new StoreMappingException("The feature/eclass " + featureLogStr + " should be a ManyToMany but " +
- "it already has a OneToMany, OneToOne or ManyToOne annotation");
+ if (aReference.getOneToMany() != null || aReference.getOneToOne() != null
+ || aReference.getManyToOne() != null) {
+ throw new StoreMappingException("The feature/eclass " + featureLogStr
+ + " should be a ManyToMany but "
+ + "it already has a OneToMany, OneToOne or ManyToOne annotation");
}
final EReference eReference = (EReference) aReference.getModelElement();
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationParser.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationParser.java
index bc5cface6..f68ee521f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationParser.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationParser.java
@@ -43,11 +43,11 @@ public class AnnotationParser {
annotationTokenizer = new AnnotationTokenizer(eNamedElement, content);
parserNodes.clear();
int token;
- while (annotationTokenizer.getCurrentToken() != AnnotationTokenizer.T_EOF &&
- (token = annotationTokenizer.nextToken()) != AnnotationTokenizer.T_EOF) {
+ while (annotationTokenizer.getCurrentToken() != AnnotationTokenizer.T_EOF
+ && (token = annotationTokenizer.nextToken()) != AnnotationTokenizer.T_EOF) {
if (token != AnnotationTokenizer.T_TYPENAME) {
- throw new AnnotationParserException("Only typenames are allowed at the root of the " +
- "annotation, see _ for the error " + annotationTokenizer.getErrorText());
+ throw new AnnotationParserException("Only typenames are allowed at the root of the "
+ + "annotation, see _ for the error " + annotationTokenizer.getErrorText());
}
parseTypeName(null);
}
@@ -81,24 +81,24 @@ public class AnnotationParser {
final int token = annotationTokenizer.nextToken();
switch (token) {
- case AnnotationTokenizer.T_EOF:
- return;
- case AnnotationTokenizer.T_CONTENTSTART:
- parseContent(cn);
- break;
- case AnnotationTokenizer.T_TYPENAME:
- parseTypeName(null); // the next one
- break;
- case AnnotationTokenizer.T_COMMA: // in case of array
- if (!(pn instanceof ArrayValueNode)) {
- throw new AnnotationParserException(
- "Encountered comma but not within an array definition, see _ for error location " +
- annotationTokenizer.getErrorText());
- }
- return;
- default:
- throw new AnnotationParserException("Unknown token, see _ for error position: " +
- annotationTokenizer.getErrorText());
+ case AnnotationTokenizer.T_EOF:
+ return;
+ case AnnotationTokenizer.T_CONTENTSTART:
+ parseContent(cn);
+ break;
+ case AnnotationTokenizer.T_TYPENAME:
+ parseTypeName(null); // the next one
+ break;
+ case AnnotationTokenizer.T_COMMA: // in case of array
+ if (!(pn instanceof ArrayValueNode)) {
+ throw new AnnotationParserException(
+ "Encountered comma but not within an array definition, see _ for error location "
+ + annotationTokenizer.getErrorText());
+ }
+ return;
+ default:
+ throw new AnnotationParserException("Unknown token, see _ for error position: "
+ + annotationTokenizer.getErrorText());
}
}
@@ -106,99 +106,97 @@ public class AnnotationParser {
private void parseContent(NamedParserNode pn) {
// content can either be an array or a set of values
- expectedToken =
- AnnotationTokenizer.T_ARRAYSTART + AnnotationTokenizer.T_IDENTIFIER + AnnotationTokenizer.T_VALUE;
+ expectedToken = AnnotationTokenizer.T_ARRAYSTART + AnnotationTokenizer.T_IDENTIFIER
+ + AnnotationTokenizer.T_VALUE;
boolean finished = false;
while (!finished) {
final int token = annotationTokenizer.nextToken();
checkToken(token);
switch (token) {
- case AnnotationTokenizer.T_COMMA:
- expectedToken = AnnotationTokenizer.T_IDENTIFIER;
- break;
- case AnnotationTokenizer.T_EOF:
- throw new AnnotationParserException("Unexcepted end to annotation string, " +
- annotationTokenizer.getErrorText());
- case AnnotationTokenizer.T_CONTENTEND:
- return;
- case AnnotationTokenizer.T_VALUE:
- final String theValue = annotationTokenizer.getLexeme();
- final PrimitiveValueNode valueNode = new PrimitiveValueNode();
- valueNode.setName("value");
- valueNode.setValue(theValue);
- addToParent(pn, valueNode);
- if (annotationTokenizer.nextToken() != AnnotationTokenizer.T_CONTENTEND) {
- throw new AnnotationParserException("After this value a closing ) should follow " +
- annotationTokenizer.getErrorText());
- }
+ case AnnotationTokenizer.T_COMMA:
+ expectedToken = AnnotationTokenizer.T_IDENTIFIER;
+ break;
+ case AnnotationTokenizer.T_EOF:
+ throw new AnnotationParserException("Unexcepted end to annotation string, "
+ + annotationTokenizer.getErrorText());
+ case AnnotationTokenizer.T_CONTENTEND:
+ return;
+ case AnnotationTokenizer.T_VALUE:
+ final String theValue = annotationTokenizer.getLexeme();
+ final PrimitiveValueNode valueNode = new PrimitiveValueNode();
+ valueNode.setName("value");
+ valueNode.setValue(theValue);
+ addToParent(pn, valueNode);
+ if (annotationTokenizer.nextToken() != AnnotationTokenizer.T_CONTENTEND) {
+ throw new AnnotationParserException("After this value a closing ) should follow "
+ + annotationTokenizer.getErrorText());
+ }
+ return;
+ case AnnotationTokenizer.T_IDENTIFIER:
+ final String identifier = annotationTokenizer.getLexeme();
+ // next token must be an is
+ int nextToken = annotationTokenizer.nextToken();
+ // in case of simple annotations with just a value member
+ if (nextToken == AnnotationTokenizer.T_CONTENTEND) {
+ final PrimitiveValueNode vn = new PrimitiveValueNode();
+ vn.setName("value");
+ vn.setValue(identifier);
+ addToParent(pn, vn);
return;
- case AnnotationTokenizer.T_IDENTIFIER:
- final String identifier = annotationTokenizer.getLexeme();
- // next token must be an is
- int nextToken = annotationTokenizer.nextToken();
- // in case of simple annotations with just a value member
- if (nextToken == AnnotationTokenizer.T_CONTENTEND) {
- final PrimitiveValueNode vn = new PrimitiveValueNode();
- vn.setName("value");
- vn.setValue(identifier);
- addToParent(pn, vn);
- return;
- }
- if (nextToken != AnnotationTokenizer.T_IS) {
- throw new AnnotationParserException(
- "No = character after identifier, see _ for error position " +
- annotationTokenizer.getErrorText());
- }
- nextToken = annotationTokenizer.nextToken();
- // if (nextToken == AnnotationTokenizer.T_VALUE) {
- // final String value = annotationTokenizer.getLexeme();
- // final PrimitiveValueNode vn = new PrimitiveValueNode();
- // vn.setName(identifier);
- // vn.setValue(value);
- // addToParent(pn, vn);
- // }
- if (nextToken == AnnotationTokenizer.T_VALUE) {
- final String value = annotationTokenizer.getLexeme();
- final PrimitiveValueNode vn = new PrimitiveValueNode();
- vn.setName(identifier);
- vn.setValue(value);
- addToParent(pn, vn);
- } else if (nextToken == AnnotationTokenizer.T_IDENTIFIER) {
- final String value = annotationTokenizer.getLexeme();
- final PrimitiveValueNode vn = new PrimitiveValueNode();
- vn.setName(identifier);
- vn.setValue(value);
- addToParent(pn, vn);
- } else if (nextToken == AnnotationTokenizer.T_TYPENAME) {
- final ReferenceValueNode rvn = new ReferenceValueNode();
- rvn.setName(identifier);
- parseTypeName(rvn);
- addToParent(pn, rvn);
- } else if (nextToken == AnnotationTokenizer.T_ARRAYSTART) {
- final ArrayValueNode avn = new ArrayValueNode();
- avn.setName(identifier);
- parseArray(avn);
- addToParent(pn, avn);
- } else if (annotationTokenizer.nextToken() != AnnotationTokenizer.T_VALUE) {
- throw new AnnotationParserException("No value token after =, see _ for error position " +
- annotationTokenizer.getErrorText());
- }
- expectedToken =
- AnnotationTokenizer.T_COMMA + AnnotationTokenizer.T_IDENTIFIER +
- AnnotationTokenizer.T_CONTENTEND;
- break;
- case AnnotationTokenizer.T_ARRAYSTART:
- // special case in which the main type is just a list of other
- // types
- // for example SecondaryTables which is just a list of
- // SecondaryTable
- parseArray(pn);
- ((ComplexNode) pn).setList(true);
- expectedToken =
- AnnotationTokenizer.T_COMMA + AnnotationTokenizer.T_IDENTIFIER +
- AnnotationTokenizer.T_CONTENTEND;
- break;
+ }
+ if (nextToken != AnnotationTokenizer.T_IS) {
+ throw new AnnotationParserException(
+ "No = character after identifier, see _ for error position "
+ + annotationTokenizer.getErrorText());
+ }
+ nextToken = annotationTokenizer.nextToken();
+ // if (nextToken == AnnotationTokenizer.T_VALUE) {
+ // final String value = annotationTokenizer.getLexeme();
+ // final PrimitiveValueNode vn = new PrimitiveValueNode();
+ // vn.setName(identifier);
+ // vn.setValue(value);
+ // addToParent(pn, vn);
+ // }
+ if (nextToken == AnnotationTokenizer.T_VALUE) {
+ final String value = annotationTokenizer.getLexeme();
+ final PrimitiveValueNode vn = new PrimitiveValueNode();
+ vn.setName(identifier);
+ vn.setValue(value);
+ addToParent(pn, vn);
+ } else if (nextToken == AnnotationTokenizer.T_IDENTIFIER) {
+ final String value = annotationTokenizer.getLexeme();
+ final PrimitiveValueNode vn = new PrimitiveValueNode();
+ vn.setName(identifier);
+ vn.setValue(value);
+ addToParent(pn, vn);
+ } else if (nextToken == AnnotationTokenizer.T_TYPENAME) {
+ final ReferenceValueNode rvn = new ReferenceValueNode();
+ rvn.setName(identifier);
+ parseTypeName(rvn);
+ addToParent(pn, rvn);
+ } else if (nextToken == AnnotationTokenizer.T_ARRAYSTART) {
+ final ArrayValueNode avn = new ArrayValueNode();
+ avn.setName(identifier);
+ parseArray(avn);
+ addToParent(pn, avn);
+ } else if (annotationTokenizer.nextToken() != AnnotationTokenizer.T_VALUE) {
+ throw new AnnotationParserException("No value token after =, see _ for error position "
+ + annotationTokenizer.getErrorText());
+ }
+ expectedToken = AnnotationTokenizer.T_COMMA + AnnotationTokenizer.T_IDENTIFIER
+ + AnnotationTokenizer.T_CONTENTEND;
+ break;
+ case AnnotationTokenizer.T_ARRAYSTART:
+ // special case in which the main type is just a list of other
+ // types
+ // for example SecondaryTables which is just a list of
+ // SecondaryTable
+ parseArray(pn);
+ ((ComplexNode) pn).setList(true);
+ expectedToken = AnnotationTokenizer.T_COMMA + AnnotationTokenizer.T_IDENTIFIER
+ + AnnotationTokenizer.T_CONTENTEND;
+ break;
}
}
}
@@ -210,54 +208,54 @@ public class AnnotationParser {
addToParent(pn, an);
boolean finished = false;
- expectedToken = AnnotationTokenizer.T_TYPENAME + AnnotationTokenizer.T_VALUE + AnnotationTokenizer.T_IDENTIFIER;
+ expectedToken = AnnotationTokenizer.T_TYPENAME + AnnotationTokenizer.T_VALUE
+ + AnnotationTokenizer.T_IDENTIFIER;
while (!finished) {
final int token = annotationTokenizer.nextToken();
checkToken(token);
switch (token) {
- case AnnotationTokenizer.T_EOF:
- throw new AnnotationParserException("Unexcepted end to annotation string, " +
- annotationTokenizer.getErrorText());
- case AnnotationTokenizer.T_TYPENAME:
- parseTypeName(an);
+ case AnnotationTokenizer.T_EOF:
+ throw new AnnotationParserException("Unexcepted end to annotation string, "
+ + annotationTokenizer.getErrorText());
+ case AnnotationTokenizer.T_TYPENAME:
+ parseTypeName(an);
- expectedToken = AnnotationTokenizer.T_ARRAYEND + AnnotationTokenizer.T_COMMA;
+ expectedToken = AnnotationTokenizer.T_ARRAYEND + AnnotationTokenizer.T_COMMA;
- break;
- case AnnotationTokenizer.T_VALUE:
- String value = annotationTokenizer.getLexeme();
- if (value != null && value.length() > 1 && value.charAt(0) == '"' &&
- value.charAt(value.length() - 1) == '"') {
- value = value.substring(1, value.length() - 1);
- }
- an.getChildren().add(value);
- expectedToken = AnnotationTokenizer.T_ARRAYEND + AnnotationTokenizer.T_COMMA;
- break;
- case AnnotationTokenizer.T_IDENTIFIER:
- an.getChildren().add(annotationTokenizer.getLexeme());
+ break;
+ case AnnotationTokenizer.T_VALUE:
+ String value = annotationTokenizer.getLexeme();
+ if (value != null && value.length() > 1 && value.charAt(0) == '"'
+ && value.charAt(value.length() - 1) == '"') {
+ value = value.substring(1, value.length() - 1);
+ }
+ an.getChildren().add(value);
+ expectedToken = AnnotationTokenizer.T_ARRAYEND + AnnotationTokenizer.T_COMMA;
+ break;
+ case AnnotationTokenizer.T_IDENTIFIER:
+ an.getChildren().add(annotationTokenizer.getLexeme());
- expectedToken =
- AnnotationTokenizer.T_IS + AnnotationTokenizer.T_ARRAYEND + AnnotationTokenizer.T_COMMA;
- break;
- case AnnotationTokenizer.T_COMMA:
- expectedToken =
- AnnotationTokenizer.T_TYPENAME + AnnotationTokenizer.T_VALUE +
- AnnotationTokenizer.T_IDENTIFIER;
- break;
- case AnnotationTokenizer.T_ARRAYEND:
- expectedToken = Long.MAX_VALUE;
- return;
+ expectedToken = AnnotationTokenizer.T_IS + AnnotationTokenizer.T_ARRAYEND
+ + AnnotationTokenizer.T_COMMA;
+ break;
+ case AnnotationTokenizer.T_COMMA:
+ expectedToken = AnnotationTokenizer.T_TYPENAME + AnnotationTokenizer.T_VALUE
+ + AnnotationTokenizer.T_IDENTIFIER;
+ break;
+ case AnnotationTokenizer.T_ARRAYEND:
+ expectedToken = Long.MAX_VALUE;
+ return;
}
}
- throw new AnnotationParserException("Unexpected end of array. " + annotationTokenizer.getErrorText());
+ throw new AnnotationParserException("Unexpected end of array. "
+ + annotationTokenizer.getErrorText());
}
protected void checkToken(int currentToken) {
if ((currentToken & expectedToken) == 0) {
- final String msg =
- "Found " + annotationTokenizer.getCurrentTokenName() + " but expected one of : " +
- annotationTokenizer.getTokenNames(expectedToken);
+ final String msg = "Found " + annotationTokenizer.getCurrentTokenName()
+ + " but expected one of : " + annotationTokenizer.getTokenNames(expectedToken);
throw new AnnotationParserException(msg + ". " + annotationTokenizer.getErrorText());
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationTokenizer.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationTokenizer.java
index 85091e863..c16ce25e1 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationTokenizer.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/AnnotationTokenizer.java
@@ -185,112 +185,111 @@ class AnnotationTokenizer {
char lChar = data[lCur]; // Grab next character.
switch (lChar) {
- case ' ': // Skip leading whitespace!
- case '\n': // new line
- case '\r': // Carriage Return.
- case '\f': // Line Feed.
- case '\t': {
- lCur++;
- continue Loop; // --> Keep on skipping leading whitespace!
- }
+ case ' ': // Skip leading whitespace!
+ case '\n': // new line
+ case '\r': // Carriage Return.
+ case '\f': // Line Feed.
+ case '\t': {
+ lCur++;
+ continue Loop; // --> Keep on skipping leading whitespace!
+ }
- case 0: // End of buffer.
+ case 0: // End of buffer.
+ {
+ if (lCur == length) // Guard against embedded nulls in the
+ // Source.
{
- if (lCur == length) // Guard against embedded nulls in the
- // Source.
- {
- // EOBuf may only occur at the first non whitespace char.
-
- return T_EOF; // --> End of file.
- }
- throw new AnnotationParserException("Char is 0 but end not reached " + lCur + " " + length);
+ // EOBuf may only occur at the first non whitespace char.
+
+ return T_EOF; // --> End of file.
}
+ throw new AnnotationParserException("Char is 0 but end not reached " + lCur + " " + length);
+ }
- // TYPENAME
- case '@': {
- ++lCur; // get rid of the @
- tokBeg = lCur; // Save starting point of current lexeme.
+ // TYPENAME
+ case '@': {
+ ++lCur; // get rid of the @
+ tokBeg = lCur; // Save starting point of current lexeme.
- do {
- lChar = data[++lCur];
- } while (lChar == '-' || lChar == '_' || lChar == '/' || lChar == '@' ||
- ('0' <= lChar && lChar <= '9') || lChar == ':' || ('a' <= lChar && lChar <= 'z') ||
- ('A' <= lChar && lChar <= 'Z'));
+ do {
+ lChar = data[++lCur];
+ } while (lChar == '-' || lChar == '_' || lChar == '/' || lChar == '@'
+ || ('0' <= lChar && lChar <= '9') || lChar == ':' || ('a' <= lChar && lChar <= 'z')
+ || ('A' <= lChar && lChar <= 'Z'));
- tokEnd = lCur; // Save endpoint of current lexeme.
+ tokEnd = lCur; // Save endpoint of current lexeme.
- return T_TYPENAME; // --> Identifier.
- }
- // VALUE with double quotes
- case '"': {
- // after the dollar the identifier part needs to be found
- tokBeg = lCur; // Save starting point of current lexeme.
-
- do {
- lChar = data[++lCur];
- } while (lChar == ',' || lChar == '-' || lChar == '.' || lChar == ' ' || lChar == '_' ||
- lChar == '/' || lChar == '`' || lChar == '@' || lChar == ':' || lChar == '=' ||
- lChar == '(' || lChar == ')' || lChar == '{' || lChar == '}' || lChar == '\'' ||
- lChar == '#' || lChar == '&' || lChar == '<' || lChar == '>' || lChar == '$' ||
- lChar == ';' || lChar == '%' || lChar == '*' || lChar == '\'' ||
- ('0' <= lChar && lChar <= '9') || ('a' <= lChar && lChar <= 'z') || lChar == '?' ||
- ('A' <= lChar && lChar <= 'Z'));
-
- if (lChar != '"') {
- final AnnotationParserException e =
- new AnnotationParserException(
- "Value not closed with double quote, see the _ for the location " + getErrorText());
- tokEnd = lCur + 1; // prevent infinite looping
- throw e;
- }
- tokEnd = lCur + 1;
- return T_VALUE;
- }
- case '(': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_CONTENTSTART;
- }
- case ')': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_CONTENTEND;
- }
- case '{': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_ARRAYSTART;
- }
- case '}': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_ARRAYEND;
- }
- case ',': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_COMMA;
- }
- case '=': {
- tokBeg = lCur;
- tokEnd = lCur + 1;
- return T_IS;
+ return T_TYPENAME; // --> Identifier.
+ }
+ // VALUE with double quotes
+ case '"': {
+ // after the dollar the identifier part needs to be found
+ tokBeg = lCur; // Save starting point of current lexeme.
+
+ do {
+ lChar = data[++lCur];
+ } while (lChar == ',' || lChar == '-' || lChar == '.' || lChar == ' ' || lChar == '_'
+ || lChar == '/' || lChar == '`' || lChar == '@' || lChar == ':' || lChar == '='
+ || lChar == '(' || lChar == ')' || lChar == '{' || lChar == '}' || lChar == '\''
+ || lChar == '#' || lChar == '&' || lChar == '<' || lChar == '>' || lChar == '$'
+ || lChar == ';' || lChar == '%' || lChar == '*' || lChar == '\''
+ || ('0' <= lChar && lChar <= '9') || ('a' <= lChar && lChar <= 'z') || lChar == '?'
+ || ('A' <= lChar && lChar <= 'Z'));
+
+ if (lChar != '"') {
+ final AnnotationParserException e = new AnnotationParserException(
+ "Value not closed with double quote, see the _ for the location " + getErrorText());
+ tokEnd = lCur + 1; // prevent infinite looping
+ throw e;
}
- default: // the rest must be identifiers
- {
- // after the dollar the identifier part needs to be found
- tokBeg = lCur; // Save starting point of current lexeme.
+ tokEnd = lCur + 1;
+ return T_VALUE;
+ }
+ case '(': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_CONTENTSTART;
+ }
+ case ')': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_CONTENTEND;
+ }
+ case '{': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_ARRAYSTART;
+ }
+ case '}': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_ARRAYEND;
+ }
+ case ',': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_COMMA;
+ }
+ case '=': {
+ tokBeg = lCur;
+ tokEnd = lCur + 1;
+ return T_IS;
+ }
+ default: // the rest must be identifiers
+ {
+ // after the dollar the identifier part needs to be found
+ tokBeg = lCur; // Save starting point of current lexeme.
- do {
- lChar = data[++lCur];
- } while (lChar == '.' || lChar == '-' || lChar == '_' || lChar == '/' || lChar == '@' ||
- ('0' <= lChar && lChar <= '9') || ('a' <= lChar && lChar <= 'z') ||
- ('A' <= lChar && lChar <= 'Z'));
+ do {
+ lChar = data[++lCur];
+ } while (lChar == '.' || lChar == '-' || lChar == '_' || lChar == '/' || lChar == '@'
+ || ('0' <= lChar && lChar <= '9') || ('a' <= lChar && lChar <= 'z')
+ || ('A' <= lChar && lChar <= 'Z'));
- tokEnd = lCur; // Save endpoint of current lexeme.
+ tokEnd = lCur; // Save endpoint of current lexeme.
- return T_IDENTIFIER; // --> Identifier.
- }
+ return T_IDENTIFIER; // --> Identifier.
+ }
}
}
}
@@ -316,8 +315,8 @@ class AnnotationTokenizer {
// result.append("Last part: " + new String(data, tokEnd, data.length -
// tokEnd - 2) + "\n");
- return new String(data, 0, tokEnd) + "_" + new String(data, tokEnd, data.length - tokEnd - 2) +
- "\nCurrent lexeme: " + getLexeme();
+ return new String(data, 0, tokEnd) + "_" + new String(data, tokEnd, data.length - tokEnd - 2)
+ + "\nCurrent lexeme: " + getLexeme();
}
/**
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ArrayValueNode.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ArrayValueNode.java
index 03ae052f2..9ca756bb3 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ArrayValueNode.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ArrayValueNode.java
@@ -59,7 +59,8 @@ class ArrayValueNode extends NamedParserNode {
final ArrayValueNode avn = (ArrayValueNode) ob;
result.addAll((List<Object>) avn.convert(ecr));
} else {
- throw new AnnotationParserException("Type " + ob.getClass().getName() + " not supported here");
+ throw new AnnotationParserException("Type " + ob.getClass().getName()
+ + " not supported here");
}
}
return result;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ComplexNode.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ComplexNode.java
index 877bdb932..34e623045 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ComplexNode.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ComplexNode.java
@@ -71,53 +71,40 @@ class ComplexNode extends NamedParserNode {
}
if (eClass == null) {
- throw new AnnotationParserException("No eclass found with name "
- + getName());
+ throw new AnnotationParserException("No eclass found with name " + getName());
}
final EObject eobj = EcoreUtil.create(eClass);
((PAnnotation) eobj).setGenerated(false);
for (NamedParserNode child : children) {
- final EStructuralFeature efeature = ecr.getEStructuralFeature(
- eClass, child.getName());
+ final EStructuralFeature efeature = ecr.getEStructuralFeature(eClass, child.getName());
if (child instanceof PrimitiveValueNode) {
final PrimitiveValueNode pvn = (PrimitiveValueNode) child;
if (log.isDebugEnabled()) {
- log.debug("Primitive child: " + pvn.getName() + ": "
- + pvn.getValue());
+ log.debug("Primitive child: " + pvn.getName() + ": " + pvn.getValue());
}
if (!(efeature instanceof EAttribute)) {
- throw new AnnotationParserException("The EFeature "
- + efeature.getName() + "/" + eClass.getName()
- + " is not an eattribute but a "
- + efeature.getClass().getName());
+ throw new AnnotationParserException("The EFeature " + efeature.getName() + "/"
+ + eClass.getName() + " is not an eattribute but a " + efeature.getClass().getName());
}
final EClassifier eType = efeature.getEType();
if (!efeature.isMany()) {
- eobj.eSet(
- efeature,
- ParserUtil.convertValue((EDataType) eType,
- pvn.getValue()));
+ eobj.eSet(efeature, ParserUtil.convertValue((EDataType) eType, pvn.getValue()));
} else {
final String[] sources = pvn.getValue().split("\\s+");
- log.debug("Child is many, splitting content into "
- + sources.length + " parts");
- final List<Object> referenced = new ArrayList<Object>(
- sources.length);
+ log.debug("Child is many, splitting content into " + sources.length + " parts");
+ final List<Object> referenced = new ArrayList<Object>(sources.length);
for (String source : sources) {
- referenced.add(ParserUtil.convertValue(
- (EDataType) eType, source));
+ referenced.add(ParserUtil.convertValue((EDataType) eType, source));
}
final List currentList = (List) eobj.eGet(efeature);
currentList.addAll(referenced);
}
- } else if (child instanceof ArrayValueNode
- && efeature instanceof EAttribute) {
+ } else if (child instanceof ArrayValueNode && efeature instanceof EAttribute) {
final EAttribute eattr = (EAttribute) efeature;
if (!eattr.isMany()) {
- throw new AnnotationParserException("The EFeature "
- + efeature.getName() + "/" + eClass.getName()
- + " is not ismany");
+ throw new AnnotationParserException("The EFeature " + efeature.getName() + "/"
+ + eClass.getName() + " is not ismany");
}
log.debug("Array child with primitive values");
List<Object> list = ((ArrayValueNode) child).convert(ecr);
@@ -125,38 +112,31 @@ class ComplexNode extends NamedParserNode {
for (Object object : list) {
final String val = (String) object;
log.debug("Value " + val);
- convertedList.add(ParserUtil.convertValue(
- (EDataType) eattr.getEType(), val));
+ convertedList.add(ParserUtil.convertValue((EDataType) eattr.getEType(), val));
}
final List currentList = (List) eobj.eGet(efeature);
currentList.addAll(convertedList);
} else if (child instanceof ArrayValueNode) {
if (!(efeature instanceof EReference)) {
- throw new AnnotationParserException("The EFeature "
- + efeature.getName() + "/" + eClass.getName()
- + " is not an ereference but a "
- + efeature.getClass().getName());
+ throw new AnnotationParserException("The EFeature " + efeature.getName() + "/"
+ + eClass.getName() + " is not an ereference but a " + efeature.getClass().getName());
}
final EReference eref = (EReference) efeature;
if (!eref.isMany()) {
- throw new AnnotationParserException("The EFeature "
- + efeature.getName() + "/" + eClass.getName()
- + " is not ismany");
+ throw new AnnotationParserException("The EFeature " + efeature.getName() + "/"
+ + eClass.getName() + " is not ismany");
}
log.debug("Array child");
eobj.eSet(eref, ((ArrayValueNode) child).convert(ecr));
} else if (child instanceof ReferenceValueNode) {
if (!(efeature instanceof EReference)) {
- throw new AnnotationParserException("The EFeature "
- + efeature.getName() + "/" + eClass.getName()
- + " is not an ereference but a "
- + efeature.getClass().getName());
+ throw new AnnotationParserException("The EFeature " + efeature.getName() + "/"
+ + eClass.getName() + " is not an ereference but a " + efeature.getClass().getName());
}
final EReference eref = (EReference) efeature;
log.debug("Reference child " + child.getName());
if (eref.isMany()) {
- ((List) eobj.eGet(eref)).add(((ReferenceValueNode) child)
- .convert(ecr));
+ ((List) eobj.eGet(eref)).add(((ReferenceValueNode) child).convert(ecr));
} else {
eobj.eSet(eref, ((ReferenceValueNode) child).convert(ecr));
}
@@ -174,7 +154,7 @@ class ComplexNode extends NamedParserNode {
/**
* @param isList
- * the isList to set
+ * the isList to set
*/
public void setList(boolean isList) {
this.isList = isList;
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 06e83bddc..21cd5ed0e 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
@@ -41,16 +41,14 @@ import org.eclipse.emf.teneo.annotations.pannotation.PannotationPackage;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
/**
- * Walks over the pamodel and the paepackages and translates eannotations to
- * pannotation types and sets the corresponding values in the pamodel.
+ * Walks over the pamodel and the paepackages and translates eannotations to pannotation types and
+ * sets the corresponding values in the pamodel.
*
* @author <a href="mailto:mtaal at elver.org">Martin Taal</a>
*/
-public class EAnnotationParserImporter implements EClassResolver,
- ExtensionPoint {
+public class EAnnotationParserImporter implements EClassResolver, ExtensionPoint {
/** Log it */
- private final static Log log = LogFactory
- .getLog(EAnnotationParserImporter.class);
+ private final static Log log = LogFactory.getLog(EAnnotationParserImporter.class);
/** annotation parser */
private AnnotationParser annotationParser = new AnnotationParser();
@@ -74,13 +72,11 @@ public class EAnnotationParserImporter implements EClassResolver,
/** Process package */
protected void process(PAnnotatedEPackage pap) {
for (PAnnotatedEClass pac : pap.getPaEClasses()) {
- processAnnotatedModelElement(pac, pac.getModelEClass()
- .getEPackage());
+ processAnnotatedModelElement(pac, pac.getModelEClass().getEPackage());
process(pac);
}
for (PAnnotatedEDataType pac : pap.getPaEDataTypes()) {
- processAnnotatedModelElement(pac, pac.getModelEDataType()
- .getEPackage());
+ processAnnotatedModelElement(pac, pac.getModelEDataType().getEPackage());
}
}
@@ -88,15 +84,13 @@ public class EAnnotationParserImporter implements EClassResolver,
protected void process(PAnnotatedEClass pac) {
log.debug("Processing eclass " + pac.getModelEClass().getName());
for (PAnnotatedEStructuralFeature paf : pac.getPaEStructuralFeatures()) {
- processAnnotatedModelElement(paf, paf.getModelEStructuralFeature()
- .eClass().getEPackage());
+ processAnnotatedModelElement(paf, paf.getModelEStructuralFeature().eClass().getEPackage());
}
}
/** Process a type with its eannotations */
@SuppressWarnings("unchecked")
- protected void processAnnotatedModelElement(PAnnotatedEModelElement pee,
- EPackage epack) {
+ protected void processAnnotatedModelElement(PAnnotatedEModelElement pee, EPackage epack) {
log.debug("Processing " + pee.getModelElement().getName());
final ArrayList<NamedParserNode> parsedNodes = new ArrayList<NamedParserNode>();
for (EAnnotation annotation : pee.getModelElement().getEAnnotations()) {
@@ -105,12 +99,10 @@ public class EAnnotationParserImporter implements EClassResolver,
// now also do the annotations on the edatatype (if any)
/*
- * if (pee.getAnnotatedElement() instanceof EAttribute) { final
- * EAttribute eattr = (EAttribute)pee.getAnnotatedElement(); final
- * EDataType edt = (EDataType)eattr.getEType(); for (Iterator it =
- * edt.getEAnnotations().iterator(); it.hasNext();) {
- * parsedNodes.addAll(process((EAnnotation)it.next(),
- * pee.getAnnotatedElement())); } }
+ * if (pee.getAnnotatedElement() instanceof EAttribute) { final EAttribute eattr =
+ * (EAttribute)pee.getAnnotatedElement(); final EDataType edt = (EDataType)eattr.getEType(); for
+ * (Iterator it = edt.getEAnnotations().iterator(); it.hasNext();) {
+ * parsedNodes.addAll(process((EAnnotation)it.next(), pee.getAnnotatedElement())); } }
*/
// now the parsed nodes should be translated into features of the
@@ -121,8 +113,7 @@ public class EAnnotationParserImporter implements EClassResolver,
final ComplexNode cn = (ComplexNode) namedParserNode;
if (cn.isList()) {
// find the efeature
- final EStructuralFeature ef = getEStructuralFeature(
- pee.eClass(), cn.getName());
+ final EStructuralFeature ef = getEStructuralFeature(pee.eClass(), cn.getName());
pee.eSet(ef, cn.convert(this));
} else {
EObject eobj = (EObject) cn.convert(this);
@@ -130,8 +121,7 @@ public class EAnnotationParserImporter implements EClassResolver,
// first find exact type
for (EReference eref : pee.eClass().getEAllReferences()) {
if (eref.getEReferenceType() == eobj.eClass()) {
- log.debug("Found EReference " + eref.getName()
- + " for " + eobj.eClass().getName());
+ log.debug("Found EReference " + eref.getName() + " for " + eobj.eClass().getName());
if (eref.isMany()) {
((List<EObject>) pee.eGet(eref)).add(eobj);
} else {
@@ -144,8 +134,7 @@ public class EAnnotationParserImporter implements EClassResolver,
if (!found) {
for (EReference eref : pee.eClass().getEAllReferences()) {
if (eref.getEReferenceType().isInstance(eobj)) {
- log.debug("Found EReference " + eref.getName()
- + " for " + eobj.eClass().getName());
+ log.debug("Found EReference " + eref.getName() + " for " + eobj.eClass().getName());
if (eref.isMany()) {
((List<EObject>) pee.eGet(eref)).add(eobj);
} else {
@@ -157,10 +146,8 @@ public class EAnnotationParserImporter implements EClassResolver,
}
}
if (!found) {
- throw new AnnotationParserException("The eclass: "
- + pee.eClass().getName()
- + " does not have an efeature for "
- + eobj.eClass().getName());
+ throw new AnnotationParserException("The eclass: " + pee.eClass().getName()
+ + " does not have an efeature for " + eobj.eClass().getName());
}
}
}
@@ -183,16 +170,12 @@ public class EAnnotationParserImporter implements EClassResolver,
}
log.debug("Processing annotations ");
- for (Map.Entry<String, String> pAnnotationDetails : ea.getDetails()
- .entrySet()) {
+ for (Map.Entry<String, String> pAnnotationDetails : ea.getDetails().entrySet()) {
final String fName = pAnnotationDetails.getKey();
// todo externalize
- if (fName.compareToIgnoreCase("appinfo") == 0
- || fName.compareToIgnoreCase("value") == 0) {
- log.debug("Annotation content: \n "
- + pAnnotationDetails.getValue());
- final String content = removeCommentLines(pAnnotationDetails
- .getValue());
+ if (fName.compareToIgnoreCase("appinfo") == 0 || fName.compareToIgnoreCase("value") == 0) {
+ log.debug("Annotation content: \n " + pAnnotationDetails.getValue());
+ final String content = removeCommentLines(pAnnotationDetails.getValue());
result.addAll(annotationParser.parse(ene, content));
}
}
@@ -221,9 +204,7 @@ public class EAnnotationParserImporter implements EClassResolver,
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.teneo.annotations.parser.EClassResolver#getEClass(java
- * .lang.String)
+ * @see org.eclipse.emf.teneo.annotations.parser.EClassResolver#getEClass(java .lang.String)
*/
public EClass getEClass(String name) {
if (name.startsWith(JPA_PREFIX)) {
@@ -261,10 +242,8 @@ public class EAnnotationParserImporter implements EClassResolver,
extraAnnotationsSources = po.getExtraAnnotationSources().split(",");
for (int i = 0; i < extraAnnotationsSources.length; i++) {
extraAnnotationsSources[i] = extraAnnotationsSources[i].trim();
- if (extraAnnotationsSources[i]
- .startsWith(Constants.ANNOTATION_SOURCE_TENEO_JPA)
- || extraAnnotationsSources[i]
- .startsWith(Constants.ANNOTATION_SOURCE_TENEO_MAPPING)) {
+ if (extraAnnotationsSources[i].startsWith(Constants.ANNOTATION_SOURCE_TENEO_JPA)
+ || extraAnnotationsSources[i].startsWith(Constants.ANNOTATION_SOURCE_TENEO_MAPPING)) {
log.warn("Extra annotation source ("
+ extraAnnotationsSources[i]
+ ") starts with the default Teneo annotation source: "
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/NamedParserNode.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/NamedParserNode.java
index 59cd322b4..2937fa29f 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/NamedParserNode.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/NamedParserNode.java
@@ -35,7 +35,7 @@ abstract class NamedParserNode {
/**
* @param name
- * the name to set
+ * the name to set
*/
public void setName(String name) {
this.name = name;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ParserUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ParserUtil.java
index 4e4555e85..b0d018b6a 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ParserUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ParserUtil.java
@@ -43,11 +43,12 @@ public class ParserUtil {
try {
return EcoreUtil.createFromString(eType, value.substring(1 + value.indexOf('.')));
} catch (IllegalArgumentException x) {
- throw new AnnotationParserException("Cannot convert '" + value + "' to '" + eType.getName() +
- "' type", e);
+ throw new AnnotationParserException("Cannot convert '" + value + "' to '"
+ + eType.getName() + "' type", e);
}
}
- throw new AnnotationParserException("Cannot convert '" + value + "' to '" + eType.getName() + "' type", e);
+ throw new AnnotationParserException("Cannot convert '" + value + "' to '" + eType.getName()
+ + "' type", e);
}
}
@@ -55,12 +56,13 @@ public class ParserUtil {
public static EStructuralFeature getEStructuralFeature(EClass eClass, String name) {
try {
for (EStructuralFeature ef : eClass.getEAllStructuralFeatures()) {
- if (ef.getName().compareToIgnoreCase(name) == 0) return ef;
+ if (ef.getName().compareToIgnoreCase(name) == 0)
+ return ef;
}
throw new AnnotationParserException("No efeature " + name + " for eclass " + eClass.getName());
} catch (IllegalArgumentException e) {
- throw new AnnotationParserException("Cannot convert '" + name + "' to an efeature for eclass " +
- eClass.getName());
+ throw new AnnotationParserException("Cannot convert '" + name
+ + "' to an efeature for eclass " + eClass.getName());
}
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/PrimitiveValueNode.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/PrimitiveValueNode.java
index afa5fd48e..81650c62b 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/PrimitiveValueNode.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/PrimitiveValueNode.java
@@ -35,14 +35,15 @@ class PrimitiveValueNode extends NamedParserNode {
/**
* @param value
- * the value to set
+ * the value to set
*/
public void setValue(String value) {
value = value.replaceAll("&gt;", ">");
value = value.replaceAll("&lt;", "<");
// correct a small mistake in the tokenizer
- if (value != null && value.length() > 1 && value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') {
+ if (value != null && value.length() > 1 && value.charAt(0) == '"'
+ && value.charAt(value.length() - 1) == '"') {
this.value = value.substring(1, value.length() - 1);
} else {
this.value = value;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ReferenceValueNode.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ReferenceValueNode.java
index 66c6d84cd..428df98f8 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ReferenceValueNode.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/parser/ReferenceValueNode.java
@@ -40,7 +40,7 @@ class ReferenceValueNode extends NamedParserNode {
/**
* @param value
- * the value to set
+ * the value to set
*/
public void setValue(NamedParserNode value) {
this.value = value;
@@ -50,7 +50,8 @@ class ReferenceValueNode extends NamedParserNode {
Object convert(EClassResolver ecr) {
log.debug("Converting reference node " + getName());
if (!(value instanceof ComplexNode)) {
- throw new AnnotationParserException("A reference annotation value may only " + "contain a typename");
+ throw new AnnotationParserException("A reference annotation value may only "
+ + "contain a typename");
}
final ComplexNode cn = (ComplexNode) value;
return cn.convert(ecr);
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/PersistenceMappingSchemaGenerator.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/PersistenceMappingSchemaGenerator.java
index 8015a4ddc..692c86423 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/PersistenceMappingSchemaGenerator.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/PersistenceMappingSchemaGenerator.java
@@ -103,20 +103,23 @@ public class PersistenceMappingSchemaGenerator {
final Document doc = new Document();
// The root Element
- final Element root = new Element("xsd:schema").addAttribute("targetNamespace", nameSpace).addAttribute(
- "elementFormDefault", "qualified").addAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema")
+ final Element root = new Element("xsd:schema").addAttribute("targetNamespace", nameSpace)
+ .addAttribute("elementFormDefault", "qualified")
+ .addAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema")
.addAttribute("xmlns", nameSpace);
- root.addElement("xsd:element").addAttribute("name", "persistence-mapping").addAttribute("type",
- "PersistenceMapping");
- root.addElement("xsd:complexType").addAttribute("name", "PersistenceMapping").addElement("xsd:sequence")
- .addAttribute("minOccurs", "1").addAttribute("maxOccurs", "unbounded").addElement("xsd:element")
+ root.addElement("xsd:element").addAttribute("name", "persistence-mapping")
+ .addAttribute("type", "PersistenceMapping");
+ root.addElement("xsd:complexType").addAttribute("name", "PersistenceMapping")
+ .addElement("xsd:sequence").addAttribute("minOccurs", "1")
+ .addAttribute("maxOccurs", "unbounded").addElement("xsd:element")
.addAttribute("name", "epackage").addAttribute("type", "EPackage");
// first determine which types have only one string field, these are handled
// slightly different because this makes the xml easier
for (EPackage annotationEPackage : annotationEPackages) {
- final List<EClassifier> eclassifiers = new ArrayList<EClassifier>(annotationEPackage.getEClassifiers());
+ final List<EClassifier> eclassifiers = new ArrayList<EClassifier>(
+ annotationEPackage.getEClassifiers());
for (EClassifier eClassifier : eclassifiers) {
String schemaTypeName = eClassifier.getName();
if (eClassifier instanceof EClass) {
@@ -180,14 +183,16 @@ public class PersistenceMappingSchemaGenerator {
continue;
}
- // Annotation types with a single feature are converted to simple type references in
+ // Annotation types with a single feature are converted to simple type
+ // references in
// the schema.
if (oneMappableFeature(eClass)) {
/*
* final EStructuralFeature eStructuralFeature = (EStructuralFeature)
- * eClass.getEStructuralFeatures().get(0); final EClassifier eType = eStructuralFeature.getEType();
- * schemaTypeName = (String) schemaTypeNamesByAnnotationType.get(eType.getName()); if
- * (schemaTypeName == null) { schemaTypeName = eType.getName(); }
+ * eClass.getEStructuralFeatures().get(0); final EClassifier eType =
+ * eStructuralFeature.getEType(); schemaTypeName = (String)
+ * schemaTypeNamesByAnnotationType.get(eType.getName()); if (schemaTypeName == null) {
+ * schemaTypeName = eType.getName(); }
* schemaTypeNamesByAnnotationType.put(eClassifier.getName(), schemaTypeName);
*/
continue;
@@ -251,14 +256,16 @@ public class PersistenceMappingSchemaGenerator {
final Element epackElement = new Element("xsd:complexType").addAttribute("name", "EPackage");
final Element choiceElement = epackElement.addElement("xsd:choice");
processStructuralFeatures(choiceElement, getPAnnotatedEPackage().getEAllStructuralFeatures());
- choiceElement.addElement("xsd:element").addAttribute("name", "eclass").addAttribute("type", "EClass");
- choiceElement.addElement("xsd:element").addAttribute("name", "edatatype").addAttribute("type", "EDataType");
+ choiceElement.addElement("xsd:element").addAttribute("name", "eclass")
+ .addAttribute("type", "EClass");
+ choiceElement.addElement("xsd:element").addAttribute("name", "edatatype")
+ .addAttribute("type", "EDataType");
addMinMaxOccurs(choiceElement, "0", "unbounded");
// add the namespace-uri attribute
- epackElement.addElement("xsd:attribute").addAttribute("name", "namespace-uri").addAttribute("type",
- "xsd:anyURI").addAttribute("use", "required");
+ epackElement.addElement("xsd:attribute").addAttribute("name", "namespace-uri")
+ .addAttribute("type", "xsd:anyURI").addAttribute("use", "required");
return epackElement;
}
@@ -268,15 +275,19 @@ public class PersistenceMappingSchemaGenerator {
final Element choiceElement = eclassElement.addElement("xsd:choice");
processStructuralFeatures(choiceElement, getPAnnotatedEClass().getEAllStructuralFeatures());
- choiceElement.addElement("xsd:element").addAttribute("name", "eattribute").addAttribute("type", "EAttribute");
- choiceElement.addElement("xsd:element").addAttribute("name", "ereference").addAttribute("type", "EReference");
- choiceElement.addElement("xsd:element").addAttribute("name", "property").addAttribute("type", "Property");
- choiceElement.addElement("xsd:element").addAttribute("name", "edatatype").addAttribute("type", "EDataType");
+ choiceElement.addElement("xsd:element").addAttribute("name", "eattribute")
+ .addAttribute("type", "EAttribute");
+ choiceElement.addElement("xsd:element").addAttribute("name", "ereference")
+ .addAttribute("type", "EReference");
+ choiceElement.addElement("xsd:element").addAttribute("name", "property")
+ .addAttribute("type", "Property");
+ choiceElement.addElement("xsd:element").addAttribute("name", "edatatype")
+ .addAttribute("type", "EDataType");
addMinMaxOccurs(choiceElement, "0", "unbounded");
- eclassElement.addElement("xsd:attribute").addAttribute("name", "name").addAttribute("type", "xsd:token")
- .addAttribute("use", "required");
+ eclassElement.addElement("xsd:attribute").addAttribute("name", "name")
+ .addAttribute("type", "xsd:token").addAttribute("use", "required");
return eclassElement;
}
@@ -286,8 +297,8 @@ public class PersistenceMappingSchemaGenerator {
final Element choiceElement = erefElement.addElement("xsd:choice");
processStructuralFeatures(choiceElement, getPAnnotatedEReference().getEAllStructuralFeatures());
addMinMaxOccurs(choiceElement, "0", "unbounded");
- erefElement.addElement("xsd:attribute").addAttribute("name", "name").addAttribute("type", "xsd:token")
- .addAttribute("use", "required");
+ erefElement.addElement("xsd:attribute").addAttribute("name", "name")
+ .addAttribute("type", "xsd:token").addAttribute("use", "required");
return erefElement;
}
@@ -297,8 +308,8 @@ public class PersistenceMappingSchemaGenerator {
final Element choiceElement = eattrElement.addElement("xsd:choice");
processStructuralFeatures(choiceElement, getPAnnotatedEAttribute().getEAllStructuralFeatures());
addMinMaxOccurs(choiceElement, "0", "unbounded");
- eattrElement.addElement("xsd:attribute").addAttribute("name", "name").addAttribute("type", "xsd:token")
- .addAttribute("use", "required");
+ eattrElement.addElement("xsd:attribute").addAttribute("name", "name")
+ .addAttribute("type", "xsd:token").addAttribute("use", "required");
return eattrElement;
}
@@ -308,8 +319,8 @@ public class PersistenceMappingSchemaGenerator {
final Element choiceElement = eattrElement.addElement("xsd:choice");
processStructuralFeatures(choiceElement, getPAnnotatedEDataType().getEAllStructuralFeatures());
addMinMaxOccurs(choiceElement, "0", "unbounded");
- eattrElement.addElement("xsd:attribute").addAttribute("name", "name").addAttribute("type", "xsd:token")
- .addAttribute("use", "required");
+ eattrElement.addElement("xsd:attribute").addAttribute("name", "name")
+ .addAttribute("type", "xsd:token").addAttribute("use", "required");
return eattrElement;
}
@@ -317,21 +328,25 @@ public class PersistenceMappingSchemaGenerator {
private Element createPropertyElement() {
final Element propertyElement = new Element("xsd:complexType").addAttribute("name", "Property");
final Element choiceElement = propertyElement.addElement("xsd:choice");
- final List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(getPAnnotatedEAttribute()
- .getEAllStructuralFeatures());
+ final List<EStructuralFeature> features = new ArrayList<EStructuralFeature>(
+ getPAnnotatedEAttribute().getEAllStructuralFeatures());
features.removeAll(getPAnnotatedEReference().getEAllStructuralFeatures());
features.addAll(getPAnnotatedEReference().getEAllStructuralFeatures());
processStructuralFeatures(choiceElement, features);
addMinMaxOccurs(choiceElement, "0", "unbounded");
- propertyElement.addElement("xsd:attribute").addAttribute("name", "name").addAttribute("type", "xsd:token")
- .addAttribute("use", "required");
+ propertyElement.addElement("xsd:attribute").addAttribute("name", "name")
+ .addAttribute("type", "xsd:token").addAttribute("use", "required");
return propertyElement;
}
- /** Walk through a pamodel type and add references to each type to the passed element */
- private void processStructuralFeatures(Element mainElement, List<EStructuralFeature> eStructuralFeatures) {
- final List<EStructuralFeature> eFeatures = new ArrayList<EStructuralFeature>(eStructuralFeatures);
+ /**
+ * Walk through a pamodel type and add references to each type to the passed element
+ */
+ private void processStructuralFeatures(Element mainElement,
+ List<EStructuralFeature> eStructuralFeatures) {
+ final List<EStructuralFeature> eFeatures = new ArrayList<EStructuralFeature>(
+ eStructuralFeatures);
Collections.sort(eFeatures, new ENamedElementComparator());
for (EStructuralFeature ef : eFeatures) {
processStructuralFeature(mainElement, ef);
@@ -357,7 +372,8 @@ public class PersistenceMappingSchemaGenerator {
elementName = eAnnotation.getDetails().get("elementName");
}
if (elementName == null) {
- // No explicit XML element name specified, so derive from the name instead.
+ // No explicit XML element name specified, so derive from the name
+ // instead.
elementName = eStructuralFeature.getName();
if (eStructuralFeature.isMany() && elementName.endsWith("s")) {
elementName = elementName.substring(0, elementName.length() - 1);
@@ -384,22 +400,25 @@ public class PersistenceMappingSchemaGenerator {
if (eStructuralFeature instanceof EReference) {
// EReferences are represented by child elements.
- final Element element = createSchemaElement(elementName, typeName, eStructuralFeature.getName());
+ final Element element = createSchemaElement(elementName, typeName,
+ eStructuralFeature.getName());
element.addAttribute(new Attribute("minOccurs", String.valueOf(minOccurs)));
if (eStructuralFeature.isMany()) {
element.addAttribute(new Attribute("maxOccurs", "unbounded"));
}
parentElement.addElement(element);
} else {
- // EAttributes are represented by attributes and optional child elements in case of many
+ // EAttributes are represented by attributes and optional child elements
+ // in case of many
// multiplicity.
- final Element attributeElement = createSchemaAttribute(eStructuralFeature.getName(), typeName,
- eStructuralFeature.getName());
- attributeElement.addAttribute(new Attribute("use", (minOccurs == 0 ? "optional" : "required")));
+ final Element attributeElement = createSchemaAttribute(eStructuralFeature.getName(),
+ typeName, eStructuralFeature.getName());
+ attributeElement
+ .addAttribute(new Attribute("use", (minOccurs == 0 ? "optional" : "required")));
parentElement.getParent().addElement(attributeElement);
if (eStructuralFeature.isMany()) {
- final Element element = createSchemaElement(eStructuralFeature.getName(), typeName, eStructuralFeature
- .getName());
+ final Element element = createSchemaElement(eStructuralFeature.getName(), typeName,
+ eStructuralFeature.getName());
parentElement.addElement(element);
element.addAttribute(new Attribute("minOccurs", "0"));
element.addAttribute(new Attribute("maxOccurs", "unbounded"));
@@ -554,7 +573,7 @@ public class PersistenceMappingSchemaGenerator {
/**
* @param annotationEPackages
- * the annotationEPackages to set
+ * the annotationEPackages to set
*/
public void setAnnotationEPackages(EPackage[] annotationEPackages) {
this.annotationEPackages = annotationEPackages;
@@ -569,7 +588,7 @@ public class PersistenceMappingSchemaGenerator {
/**
* @param modelEPackage
- * the modelEPackage to set
+ * the modelEPackage to set
*/
public void setModelEPackage(EPackage modelEPackage) {
this.modelEPackage = modelEPackage;
@@ -584,7 +603,7 @@ public class PersistenceMappingSchemaGenerator {
/**
* @param nameSpace
- * the nameSpace to set
+ * the nameSpace to set
*/
public void setNameSpace(String nameSpace) {
this.nameSpace = nameSpace;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlElementToEStructuralFeatureMapper.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlElementToEStructuralFeatureMapper.java
index 0c74259f9..bb7963fe0 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlElementToEStructuralFeatureMapper.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlElementToEStructuralFeatureMapper.java
@@ -44,7 +44,8 @@ public class XmlElementToEStructuralFeatureMapper implements ExtensionPoint {
final SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
saxParserFactory.setNamespaceAware(true);
final SAXParser saxParser = saxParserFactory.newSAXParser();
- saxParser.parse(this.getClass().getResourceAsStream("persistence-mapping.xsd"), new XmlContentHandler());
+ saxParser.parse(this.getClass().getResourceAsStream("persistence-mapping.xsd"),
+ new XmlContentHandler());
} catch (Exception e) {
throw new StoreAnnotationsException("Exception while parsing xsd", e);
}
@@ -53,12 +54,13 @@ public class XmlElementToEStructuralFeatureMapper implements ExtensionPoint {
public class XmlContentHandler extends DefaultHandler {
@Override
- public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
if (localName.equals("attribute") || localName.equals("element")) {
xmlElementName = attributes.getValue("name");
- } else if (localName.equals("appinfo") &&
- PersistenceMappingSchemaGenerator.ESTRUCTURAL_FEATURE_SOURCE_NAME.equals(attributes
- .getValue("source"))) {
+ } else if (localName.equals("appinfo")
+ && PersistenceMappingSchemaGenerator.ESTRUCTURAL_FEATURE_SOURCE_NAME.equals(attributes
+ .getValue("source"))) {
appInfoValue = true;
}
}
@@ -67,8 +69,8 @@ public class XmlElementToEStructuralFeatureMapper implements ExtensionPoint {
public void characters(char[] ch, int start, int length) throws SAXException {
if (appInfoValue && xmlElementName != null) {
final String eStructuralFeatureName = new String(ch, start, length).trim();
- if (eStructuralFeatureName.length() > 0 &&
- !eStructuralFeatureNamesByXmlElementName.containsKey(xmlElementName)) {
+ if (eStructuralFeatureName.length() > 0
+ && !eStructuralFeatureNamesByXmlElementName.containsKey(xmlElementName)) {
eStructuralFeatureNamesByXmlElementName.put(xmlElementName, eStructuralFeatureName);
appInfoValue = false;
xmlElementName = null;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceContentHandler.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceContentHandler.java
index 757f47508..47192176e 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceContentHandler.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceContentHandler.java
@@ -50,8 +50,8 @@ import org.xml.sax.helpers.DefaultHandler;
* SAX ContentHandler for processing XML persistence mapping. Used internally by
* {@link XmlPersistenceMapper}.
*/
-public class XmlPersistenceContentHandler extends DefaultHandler implements
- ExtensionPoint, ExtensionManagerAware {
+public class XmlPersistenceContentHandler extends DefaultHandler implements ExtensionPoint,
+ ExtensionManagerAware {
// Parse states
@@ -147,8 +147,8 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
/** Set the schema */
public void setSchema(InputStream schema) {
- xmlElementToEStructuralFeatureMapper = getExtensionManager()
- .getExtension(XmlElementToEStructuralFeatureMapper.class);
+ xmlElementToEStructuralFeatureMapper = getExtensionManager().getExtension(
+ XmlElementToEStructuralFeatureMapper.class);
xmlElementToEStructuralFeatureMapper.parseSchema(schema);
}
@@ -169,13 +169,12 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
*
*/
@SuppressWarnings("unchecked")
- protected void applyAnnotation(EObject pAnnotatedEModelElement,
- String elementName, Attributes attributes) throws SAXException {
+ protected void applyAnnotation(EObject pAnnotatedEModelElement, String elementName,
+ Attributes attributes) throws SAXException {
final EStructuralFeature annotationEStructuralFeature = getEStructuralFeature(
pAnnotatedEModelElement, elementName);
if (annotationEStructuralFeature == null) {
- throw new SAXException("Cannot handle element <" + elementName
- + ">");
+ throw new SAXException("Cannot handle element <" + elementName + ">");
}
final PAnnotation pAnnotation = (PAnnotation) EcoreUtil
@@ -184,20 +183,18 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
pAnnotations.push(pAnnotation);
if (annotationEStructuralFeature.isMany()) {
- ((List<PAnnotation>) pAnnotatedEModelElement
- .eGet(annotationEStructuralFeature)).add(pAnnotation);
+ ((List<PAnnotation>) pAnnotatedEModelElement.eGet(annotationEStructuralFeature))
+ .add(pAnnotation);
} else {
- pAnnotatedEModelElement.eSet(annotationEStructuralFeature,
- pAnnotation);
+ pAnnotatedEModelElement.eSet(annotationEStructuralFeature, pAnnotation);
}
// Apply attributes to pAnnotation
for (int i = 0, n = attributes.getLength(); i < n; i++) {
- final EAttribute eAttribute = (EAttribute) getEStructuralFeature(
- pAnnotation, attributes.getLocalName(i));
+ final EAttribute eAttribute = (EAttribute) getEStructuralFeature(pAnnotation,
+ attributes.getLocalName(i));
final EDataType eDataType = eAttribute.getEAttributeType();
- final Object valueObject = eDataType.getEPackage()
- .getEFactoryInstance()
+ final Object valueObject = eDataType.getEPackage().getEFactoryInstance()
.createFromString(eDataType, attributes.getValue(i));
if (eAttribute.isMany()) {
((List<Object>) pAnnotation.eGet(eAttribute)).add(valueObject);
@@ -209,22 +206,19 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
}
/**
- * Returns an estructuralfeature on the basis of the name, mainly does
- * conversion of the xmlName to the efeaturename, the prefix returned from
- * getPrefix is also used. todo: move prefix handling to
- * XmlElementToEStructuralFeatureMapper.
+ * Returns an estructuralfeature on the basis of the name, mainly does conversion of the xmlName
+ * to the efeaturename, the prefix returned from getPrefix is also used. todo: move prefix
+ * handling to XmlElementToEStructuralFeatureMapper.
*/
- protected EStructuralFeature getEStructuralFeature(
- EObject pAnnotatedEModelElement, String xmlName) {
+ protected EStructuralFeature getEStructuralFeature(EObject pAnnotatedEModelElement, String xmlName) {
String annotationEStructuralFeatureName = convertXmlNameToEStructuralFeatureName(xmlName);
- EStructuralFeature annotationEStructuralFeature = pAnnotatedEModelElement
- .eClass().getEStructuralFeature(
- annotationEStructuralFeatureName);
+ EStructuralFeature annotationEStructuralFeature = pAnnotatedEModelElement.eClass()
+ .getEStructuralFeature(annotationEStructuralFeatureName);
if (annotationEStructuralFeature == null) {
annotationEStructuralFeatureName = xmlElementToEStructuralFeatureMapper
.getEStructuralFeatureName(xmlName);
- annotationEStructuralFeature = pAnnotatedEModelElement.eClass()
- .getEStructuralFeature(annotationEStructuralFeatureName);
+ annotationEStructuralFeature = pAnnotatedEModelElement.eClass().getEStructuralFeature(
+ annotationEStructuralFeatureName);
}
// if still null then try with the prefix
if (annotationEStructuralFeature == null) {
@@ -232,11 +226,11 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
// part has to be
// upper-cased
String name = convertXmlNameToEStructuralFeatureName(xmlName);
- annotationEStructuralFeatureName = prefix
- + name.substring(0, 1).toUpperCase() + name.substring(1);
+ annotationEStructuralFeatureName = prefix + name.substring(0, 1).toUpperCase()
+ + name.substring(1);
;
- annotationEStructuralFeature = pAnnotatedEModelElement.eClass()
- .getEStructuralFeature(annotationEStructuralFeatureName);
+ annotationEStructuralFeature = pAnnotatedEModelElement.eClass().getEStructuralFeature(
+ annotationEStructuralFeatureName);
}
return annotationEStructuralFeature;
}
@@ -245,8 +239,8 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
// Implementation of ContentHandler interface.
// --------------------------------------------------------------------
@Override
- public void startElement(String uri, String localName, String qName,
- Attributes attributes) throws SAXException {
+ public void startElement(String uri, String localName, String qName, Attributes attributes)
+ throws SAXException {
// Change parse state.
int newParseState;
switch (getParseState()) {
@@ -267,8 +261,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
}
break;
case ECLASS:
- if (localName.equals("eattribute")
- || localName.equals("ereference")
+ if (localName.equals("eattribute") || localName.equals("ereference")
|| localName.equals("property")) {
newParseState = ESTRUCTURALFEATURE;
} else {
@@ -295,8 +288,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
break;
}
default:
- throw new ParseXMLAnnotationsException(
- "Invalid parse state encountered.");
+ throw new ParseXMLAnnotationsException("Invalid parse state encountered.");
}
parseStates.push(new Integer(newParseState));
@@ -304,42 +296,36 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
switch (getParseState()) {
case EPACKAGE: {
final String namespaceUri = attributes.getValue("namespace-uri");
- final EPackage ePackage = PackageRegistryProvider.getInstance()
- .getPackageRegistry().getEPackage(namespaceUri);
+ final EPackage ePackage = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(namespaceUri);
if (ePackage == null) {
- throw new SAXException("Could not find EPackage \""
- + namespaceUri + "\".");
+ throw new SAXException("Could not find EPackage \"" + namespaceUri + "\".");
}
pAnnotatedEPackage = pAnnotatedModel.getPAnnotated(ePackage);
if (pAnnotatedEPackage == null) {
- throw new SAXException("Could not find PAnnotatedEPackage \""
- + namespaceUri + "\".");
+ throw new SAXException("Could not find PAnnotatedEPackage \"" + namespaceUri + "\".");
}
break;
}
case ECLASS: {
final String eClassName = attributes.getValue("name");
- final EClassifier eClassifier = pAnnotatedEPackage
- .getModelEPackage().getEClassifier(eClassName);
+ final EClassifier eClassifier = pAnnotatedEPackage.getModelEPackage().getEClassifier(
+ eClassName);
if (eClassifier == null) {
- throw new SAXException("Could not find EClass \"" + eClassName
- + "\"");
+ throw new SAXException("Could not find EClass \"" + eClassName + "\"");
}
if (!(eClassifier instanceof EClass)) {
- throw new SAXException("EClassifier \"" + eClassName
- + "\" is not an EClass.");
+ throw new SAXException("EClassifier \"" + eClassName + "\" is not an EClass.");
}
- pAnnotatedEClass = pAnnotatedModel
- .getPAnnotated((EClass) eClassifier);
+ pAnnotatedEClass = pAnnotatedModel.getPAnnotated((EClass) eClassifier);
break;
}
case EDATATYPE: {
final String eDataTypeName = attributes.getValue("name");
- final EDataType et = (EDataType) pAnnotatedEPackage
- .getModelEPackage().getEClassifier(eDataTypeName);
+ final EDataType et = (EDataType) pAnnotatedEPackage.getModelEPackage().getEClassifier(
+ eDataTypeName);
if (et == null) {
- throw new SAXException("Could not find EClass \""
- + eDataTypeName + "\"");
+ throw new SAXException("Could not find EClass \"" + eDataTypeName + "\"");
}
pAnnotatedEDataType = pAnnotatedModel.getPAnnotated(et);
break;
@@ -350,22 +336,16 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
final EStructuralFeature eStructuralFeature = eClass
.getEStructuralFeature(eStructuralFeatureName);
if (eStructuralFeature == null) {
- throw new SAXException("Could not find EStructuralFeature \""
- + eStructuralFeatureName + "\" in EClass \""
- + eClass.getName() + "\".");
- } else if (localName.equals("eattribute")
- && !(eStructuralFeature instanceof EAttribute)) {
- throw new SAXException("EStructuralFeature \""
- + eStructuralFeatureName + "\" in EClass \""
+ throw new SAXException("Could not find EStructuralFeature \"" + eStructuralFeatureName
+ + "\" in EClass \"" + eClass.getName() + "\".");
+ } else if (localName.equals("eattribute") && !(eStructuralFeature instanceof EAttribute)) {
+ throw new SAXException("EStructuralFeature \"" + eStructuralFeatureName + "\" in EClass \""
+ eClass.getName() + "\" is not an EAttribute.");
- } else if (localName.equals("ereference")
- && !(eStructuralFeature instanceof EReference)) {
- throw new SAXException("EStructuralFeature \""
- + eStructuralFeatureName + "\" in EClass \""
+ } else if (localName.equals("ereference") && !(eStructuralFeature instanceof EReference)) {
+ throw new SAXException("EStructuralFeature \"" + eStructuralFeatureName + "\" in EClass \""
+ eClass.getName() + "\" is not an EReference.");
}
- pAnnotatedEStructuralFeature = pAnnotatedModel
- .getPAnnotated(eStructuralFeature);
+ pAnnotatedEStructuralFeature = pAnnotatedModel.getPAnnotated(eStructuralFeature);
break;
}
case EPACKAGE_ANNOTATION:
@@ -391,8 +371,8 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
}
case ANNOTATION_ATTRIBUTE: {
final String eStructuralFeatureName = convertXmlNameToEStructuralFeatureName(localName);
- pAnnotationEAttribute = (EAttribute) getPAnnotation().eClass()
- .getEStructuralFeature(eStructuralFeatureName);
+ pAnnotationEAttribute = (EAttribute) getPAnnotation().eClass().getEStructuralFeature(
+ eStructuralFeatureName);
break;
}
}
@@ -400,8 +380,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
@Override
@SuppressWarnings("unchecked")
- public void characters(char[] ch, int start, int length)
- throws SAXException {
+ public void characters(char[] ch, int start, int length) throws SAXException {
final String value = new String(ch, start, length).trim();
if (value.length() == 0) {
return;
@@ -418,11 +397,10 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
// <discriminator-value>MyObject</discriminator-value>
final PAnnotation pAnnotation = getPAnnotation();
assert (pAnnotation.eClass().getEStructuralFeatures().size() == 1);
- final EAttribute eAttribute = (EAttribute) pAnnotation.eClass()
- .getEStructuralFeatures().get(0);
+ final EAttribute eAttribute = (EAttribute) pAnnotation.eClass().getEStructuralFeatures()
+ .get(0);
final EDataType eAttributeType = eAttribute.getEAttributeType();
- final Object valueObject = eAttributeType.getEPackage()
- .getEFactoryInstance()
+ final Object valueObject = eAttributeType.getEPackage().getEFactoryInstance()
.createFromString(eAttributeType, value);
if (eAttribute.isMany() && valueObject instanceof String) {
final String[] vals = ((String) valueObject).split(",");
@@ -437,13 +415,11 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
break;
}
case ANNOTATION_ATTRIBUTE: {
- final EDataType eDataType = pAnnotationEAttribute
- .getEAttributeType();
- final Object valueObject = eDataType.getEPackage()
- .getEFactoryInstance().createFromString(eDataType, value);
+ final EDataType eDataType = pAnnotationEAttribute.getEAttributeType();
+ final Object valueObject = eDataType.getEPackage().getEFactoryInstance()
+ .createFromString(eDataType, value);
if (pAnnotationEAttribute.isMany()) {
- ((List<Object>) getPAnnotation().eGet(pAnnotationEAttribute))
- .add(valueObject);
+ ((List<Object>) getPAnnotation().eGet(pAnnotationEAttribute)).add(valueObject);
} else {
getPAnnotation().eSet(pAnnotationEAttribute, valueObject);
}
@@ -453,8 +429,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
}
@Override
- public void endElement(String uri, String localName, String qName)
- throws SAXException {
+ public void endElement(String uri, String localName, String qName) throws SAXException {
switch (getParseState()) {
case EPACKAGE_ANNOTATION:
case ECLASS_ANNOTATION:
@@ -492,7 +467,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
/**
* @param extensionManager
- * the extensionManager to set
+ * the extensionManager to set
*/
public void setExtensionManager(ExtensionManager extensionManager) {
this.extensionManager = extensionManager;
@@ -507,7 +482,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
/**
* @param annotatedModel
- * the pAnnotatedModel to set
+ * the pAnnotatedModel to set
*/
public void setPAnnotatedModel(PAnnotatedModel annotatedModel) {
pAnnotatedModel = annotatedModel;
@@ -522,7 +497,7 @@ public class XmlPersistenceContentHandler extends DefaultHandler implements
/**
* @param prefix
- * the prefix to set
+ * the prefix to set
*/
public void setPrefix(String prefix) {
this.prefix = prefix;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceMapper.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceMapper.java
index f029ec7f3..f2e4c4780 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceMapper.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/annotations/xml/XmlPersistenceMapper.java
@@ -49,8 +49,8 @@ public class XmlPersistenceMapper implements ExtensionPoint, ExtensionManagerAwa
* Sets the InputStream containing the XML mapping.
*
* @param xmlMapping
- * The InputStream containing the XML persistence mapping. Closed automatically by
- * {@link #applyPersistenceMapping(PAnnotatedModel)}.
+ * The InputStream containing the XML persistence mapping. Closed automatically by
+ * {@link #applyPersistenceMapping(PAnnotatedModel)} .
*/
public void setXmlMapping(InputStream xmlMapping) {
if (xmlMapping == null) {
@@ -63,9 +63,9 @@ public class XmlPersistenceMapper implements ExtensionPoint, ExtensionManagerAwa
* Applies the XML persistence mapping to a PAnnotatedModel.
*
* @throws IllegalStateException
- * if the XML mapping was not configured.
+ * if the XML mapping was not configured.
* @throws RuntimeException
- * If there was an error reading or parsing the XML file.
+ * If there was an error reading or parsing the XML file.
*/
public void applyPersistenceMapping(PAnnotatedModel pAnnotatedModel) {
if (xmlMapping == null) {
@@ -88,9 +88,9 @@ public class XmlPersistenceMapper implements ExtensionPoint, ExtensionManagerAwa
try {
try {
saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage",
- "http://www.w3.org/2001/XMLSchema");
- saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", this.getClass()
- .getResourceAsStream("persistence-mapping.xsd"));
+ "http://www.w3.org/2001/XMLSchema");
+ saxParser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", this
+ .getClass().getResourceAsStream("persistence-mapping.xsd"));
} catch (SAXNotRecognizedException s) {
log.warn("Properties schemaSource and/or schemaLanguage are not supported, setvalidating=false. "
+ "Probably running 1.4 with an old crimson sax parser. Ignoring this and continuing with "
@@ -101,8 +101,8 @@ public class XmlPersistenceMapper implements ExtensionPoint, ExtensionManagerAwa
saxParser = saxParserFactory.newSAXParser();
}
- final XmlPersistenceContentHandler xmlContentHandler =
- extensionManager.getExtension(XmlPersistenceContentHandler.class);
+ final XmlPersistenceContentHandler xmlContentHandler = extensionManager
+ .getExtension(XmlPersistenceContentHandler.class);
xmlContentHandler.setPAnnotatedModel(pAnnotatedModel);
xmlContentHandler.setPrefix(getPrefix());
xmlContentHandler.setSchema(this.getClass().getResourceAsStream("persistence-mapping.xsd"));
@@ -136,7 +136,7 @@ public class XmlPersistenceMapper implements ExtensionPoint, ExtensionManagerAwa
/**
* @param extensionManager
- * the extensionManager to set
+ * the extensionManager to set
*/
public void setExtensionManager(ExtensionManager extensionManager) {
this.extensionManager = extensionManager;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassClassLoaderStrategy.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassClassLoaderStrategy.java
index c2e620180..0e0ea86db 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassClassLoaderStrategy.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassClassLoaderStrategy.java
@@ -42,8 +42,10 @@ public class ClassClassLoaderStrategy implements ClassLoaderStrategy {
callerResolver = new CallerResolver();
} catch (SecurityException se) {
// set callerResolver to null and log
- log.error("Class class loader resolver could not be created because of SecurityException " +
- " just using the class loader of the classclassloader class, error msg: " + se.getMessage(), se);
+ log.error(
+ "Class class loader resolver could not be created because of SecurityException "
+ + " just using the class loader of the classclassloader class, error msg: "
+ + se.getMessage(), se);
callerResolver = null;
}
}
@@ -59,12 +61,11 @@ public class ClassClassLoaderStrategy implements ClassLoaderStrategy {
}
/**
- * Based on examples in
- * http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load-p2.html
+ * Based on examples in http://www.javaworld.com/javaworld/javaqa/2003-06/01-qa-0606-load-p2.html
*
- * A helper class to get the call context. It subclasses SecurityManager to make
- * getClassContext() accessible. An instance of CallerResolver only needs to be created, not
- * installed as an actual security manager.
+ * A helper class to get the call context. It subclasses SecurityManager to make getClassContext()
+ * accessible. An instance of CallerResolver only needs to be created, not installed as an actual
+ * security manager.
*/
private static final class CallerResolver extends SecurityManager {
protected Class<?>[] getClassContext() {
@@ -78,8 +79,8 @@ public class ClassClassLoaderStrategy implements ClassLoaderStrategy {
*/
public ClassLoader getClassLoader() {
/*
- * 0: SecurityManager.getClassContext 1: getClassContext 2: getCallerClass 3: getClassLoader
- * 4: ClassLoaderResolver.getClassLoader 5: app class
+ * 0: SecurityManager.getClassContext 1: getClassContext 2: getCallerClass 3: getClassLoader 4:
+ * ClassLoaderResolver.getClassLoader 5: app class
*/
final Class<?> clazz = getCallerClass(5);
return clazz.getClassLoader();
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassLoaderResolver.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassLoaderResolver.java
index 26e48f475..71be390d5 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassLoaderResolver.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/classloader/ClassLoaderResolver.java
@@ -67,7 +67,7 @@ public class ClassLoaderResolver {
/**
* @param classLoaderStrategy
- * The classLoaderStrategy to set.
+ * The classLoaderStrategy to set.
*/
public static void setClassLoaderStrategy(ClassLoaderStrategy classLoaderStrategy) {
ClassLoaderResolver.classLoaderStrategy = classLoaderStrategy;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ecore/EModelResolver.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ecore/EModelResolver.java
index daee989da..0602eb3a2 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ecore/EModelResolver.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/ecore/EModelResolver.java
@@ -54,13 +54,12 @@ public abstract class EModelResolver {
}
private Map<EPackage, List<DataStore>> ePackageRegistration = new HashMap<EPackage, List<DataStore>>();
-
+
/** Clear all internal datastructures */
public abstract void clear();
/**
- * @return the EClass for a java class, if not found then the superclass of the javaclass is
- * tried
+ * @return the EClass for a java class, if not found then the superclass of the javaclass is tried
*/
public abstract EClass getEClass(Class<?> javaClass);
@@ -71,7 +70,7 @@ public abstract class EModelResolver {
public abstract void register(EPackage[] epacks);
/** Register that a set of epackages is owned by a datastore */
- public synchronized void registerOwnerShip(DataStore dataStore, EPackage[] epacks) {
+ public synchronized void registerOwnerShip(DataStore dataStore, EPackage[] epacks) {
for (EPackage ePackage : epacks) {
List<DataStore> stores = ePackageRegistration.get(ePackage);
if (stores == null) {
@@ -83,7 +82,7 @@ public abstract class EModelResolver {
}
}
}
-
+
/** Unregister an epackage */
public synchronized void unregisterOwnerShip(DataStore dataStore, EPackage[] epacks) {
final List<EPackage> toRemove = new ArrayList<EPackage>();
@@ -99,12 +98,12 @@ public abstract class EModelResolver {
}
removeEPackages(toRemove);
}
-
+
/** Remove an epackage from the internal lists */
protected void removeEPackages(List<EPackage> ePackages) {
-
+
}
-
+
/** @return all java classes and interfaces */
public abstract List<Class<?>> getAllClassesAndInterfaces();
@@ -127,7 +126,8 @@ public abstract class EModelResolver {
public Object create(EPackage epackage, String eclassName) {
final EClass eclass = (EClass) epackage.getEClassifier(eclassName);
if (eclass == null) {
- throw new IllegalArgumentException("No EClass " + eclassName + " found in epackage " + epackage.getName());
+ throw new IllegalArgumentException("No EClass " + eclassName + " found in epackage "
+ + epackage.getName());
}
return create(eclass);
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/DefaultExtensionManager.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/DefaultExtensionManager.java
index 0dad6e3ba..80eb965e0 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/DefaultExtensionManager.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/DefaultExtensionManager.java
@@ -25,7 +25,8 @@ import org.apache.commons.logging.LogFactory;
import org.eclipse.emf.teneo.classloader.ClassLoaderResolver;
/**
- * Manages a set of extensions. Currently for each extension point there will always be only one extension instance.
+ * Manages a set of extensions. Currently for each extension point there will always be only one
+ * extension instance.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.9 $
@@ -71,7 +72,8 @@ public class DefaultExtensionManager implements ExtensionManager {
throw new TeneoExtensionException("Point of extension may not be null");
}
if (extension.getClassName() == null) {
- throw new TeneoExtensionException("Classname of extension: " + extension.getPoint() + " may not be null");
+ throw new TeneoExtensionException("Classname of extension: " + extension.getPoint()
+ + " may not be null");
}
if (log.isDebugEnabled()) {
log.debug("Registering " + extension);
@@ -179,17 +181,20 @@ public class DefaultExtensionManager implements ExtensionManager {
// disabled as it is not so meaningfull
// log.warn("The extension: " + extension.getPoint() +
// " is declared as a singleton but this getInstance call " +
- // " passed initialization parameters so it is not cached, " + clz.getName());
+ // " passed initialization parameters so it is not cached, " +
+ // clz.getName());
}
return extensionInstance;
} catch (Exception e) {
- throw new TeneoExtensionException("Exception while instantiating: " + extension.getClassName(), e);
+ throw new TeneoExtensionException("Exception while instantiating: "
+ + extension.getClassName(), e);
}
}
/** Return the constructor for a class and initialization arguments */
- protected Constructor<?> getConstructor(Class<?> clz, Object[] initArgs) throws NoSuchMethodException {
+ protected Constructor<?> getConstructor(Class<?> clz, Object[] initArgs)
+ throws NoSuchMethodException {
Constructor<?> result = null;
final Class<?>[] initTypes = new Class<?>[initArgs.length];
int i = 0;
@@ -265,8 +270,8 @@ public class DefaultExtensionManager implements ExtensionManager {
}
/**
- * Registers an instance for all other extensionpoints it implements if no other instance was already registered for
- * it.
+ * Registers an instance for all other extensionpoints it implements if no other instance was
+ * already registered for it.
*/
private void registerForAllExtensionPoints(Class<?> cls, ExtensionPoint extensionInstance) {
if (cls == null) {
@@ -292,11 +297,11 @@ public class DefaultExtensionManager implements ExtensionManager {
if (extension == null) {
return;
}
- if (extension.getClassName().compareTo(extensionInstance.getClass().getName()) == 0 && extension.isSingleton()
- && extensionInstances.get(extension.getPoint()) == null) {
+ if (extension.getClassName().compareTo(extensionInstance.getClass().getName()) == 0
+ && extension.isSingleton() && extensionInstances.get(extension.getPoint()) == null) {
if (log.isDebugEnabled()) {
log.debug("Also registering extensioninstance: " + extensionInstance.getClass().getName()
- + " for extension " + extension.getPoint());
+ + " for extension " + extension.getPoint());
}
extensionInstances.put(extension.getPoint(), extensionInstance);
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/Extension.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/Extension.java
index 8f85e3e6c..75fb382d9 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/Extension.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/Extension.java
@@ -48,7 +48,7 @@ public class Extension {
/**
* @param point
- * the point to set
+ * the point to set
*/
public void setPoint(String point) {
this.point = point;
@@ -63,7 +63,7 @@ public class Extension {
/**
* @param className
- * the className to set
+ * the className to set
*/
public void setClassName(String className) {
this.className = className;
@@ -81,7 +81,7 @@ public class Extension {
* normally this method does not need to be called.
*
* @param defaultExtension
- * the defaultExtension to set
+ * the defaultExtension to set
*/
public void setDefaultExtension(boolean defaultExtension) {
this.defaultExtension = defaultExtension;
@@ -89,7 +89,8 @@ public class Extension {
@Override
public String toString() {
- return " point: " + getPoint() + " classname: " + getClassName() + " default: " + isDefaultExtension();
+ return " point: " + getPoint() + " classname: " + getClassName() + " default: "
+ + isDefaultExtension();
}
/**
@@ -101,7 +102,7 @@ public class Extension {
/**
* @param singleton
- * the singleton to set
+ * the singleton to set
*/
public void setSingleton(boolean singleton) {
this.singleton = singleton;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManager.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManager.java
index a8357a779..0b27da1f1 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManager.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManager.java
@@ -33,8 +33,8 @@ public interface ExtensionManager {
public abstract void registerExtension(Extension extension);
/**
- * Return an instance of an extension, pass null if no constructor arguments are required for
- * this extension
+ * Return an instance of an extension, pass null if no constructor arguments are required for this
+ * extension
*/
public abstract ExtensionPoint getExtension(String point, Object[] initArgs);
@@ -51,10 +51,10 @@ public interface ExtensionManager {
public abstract <T> T getExtension(Class<T> clz, Object[] initArgs);
/**
- * Convenience method to register a user extension overriding a current extension. It will
- * search for an existing extension using the point. If not found then an exception is thrown.
- * In case a completely new extension is to be registered then use the registerExtension method.
- * The singleton value from the existing extension is used. value is used from that extension.
+ * Convenience method to register a user extension overriding a current extension. It will search
+ * for an existing extension using the point. If not found then an exception is thrown. In case a
+ * completely new extension is to be registered then use the registerExtension method. The
+ * singleton value from the existing extension is used. value is used from that extension.
*/
public void registerExtension(String point, String className);
} \ No newline at end of file
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManagerFactory.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManagerFactory.java
index 04675124b..f410e6548 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManagerFactory.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionManagerFactory.java
@@ -36,7 +36,7 @@ public class ExtensionManagerFactory {
/**
* @param instance
- * the instance to set
+ * the instance to set
*/
public static void setInstance(ExtensionManagerFactory instance) {
ExtensionManagerFactory.instance = instance;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionUtil.java
index 77e3d53f7..0580bfb14 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/extension/ExtensionUtil.java
@@ -51,13 +51,12 @@ import org.eclipse.emf.teneo.mapping.strategy.impl.TeneoSQLNameStrategy;
public class ExtensionUtil {
/** Creates a default extension */
- public static Extension createExtension(Class<?> extensionPoint,
- Class<?> clz) {
+ public static Extension createExtension(Class<?> extensionPoint, Class<?> clz) {
return createExtension(extensionPoint, clz, true);
}
- public static Extension createExtension(Class<?> extensionPoint,
- Class<?> clz, boolean defaultExtension) {
+ public static Extension createExtension(Class<?> extensionPoint, Class<?> clz,
+ boolean defaultExtension) {
final Extension extension = new Extension();
extension.setPoint(extensionPoint.getName());
extension.setClassName(clz.getName());
@@ -65,8 +64,7 @@ public class ExtensionUtil {
return extension;
}
- public static Extension createExtension(String pointClassName,
- boolean singleton) {
+ public static Extension createExtension(String pointClassName, boolean singleton) {
final Extension extension = new Extension();
extension.setPoint(pointClassName);
extension.setClassName(pointClassName);
@@ -75,8 +73,7 @@ public class ExtensionUtil {
return extension;
}
- public static Extension createExtension(String pointClassName,
- String className, boolean singleton) {
+ public static Extension createExtension(String pointClassName, String className, boolean singleton) {
final Extension extension = new Extension();
extension.setPoint(pointClassName);
extension.setClassName(className);
@@ -89,16 +86,13 @@ public class ExtensionUtil {
public static void registerDefaultExtensions(ExtensionManager em) {
// the ones coming from this plugin
- em.registerExtension(createExtension(BasicPamodelBuilder.class,
- BasicPamodelBuilder.class));
- em.registerExtension(createExtension(AnnotationGenerator.class,
- AnnotationGenerator.class));
+ em.registerExtension(createExtension(BasicPamodelBuilder.class, BasicPamodelBuilder.class));
+ em.registerExtension(createExtension(AnnotationGenerator.class, AnnotationGenerator.class));
em.registerExtension(createExtension(EAnnotationParserImporter.class,
EAnnotationParserImporter.class));
em.registerExtension(createExtension(PersistenceMappingBuilder.class,
PersistenceMappingBuilder.class));
- em.registerExtension(createExtension(XmlPersistenceMapper.class,
- XmlPersistenceMapper.class));
+ em.registerExtension(createExtension(XmlPersistenceMapper.class, XmlPersistenceMapper.class));
em.registerExtension(createExtension(PersistenceFileProvider.class,
PersistenceFileProvider.class));
@@ -108,34 +102,25 @@ public class ExtensionUtil {
// ContextClassLoaderStrategy.class));
em.registerExtension(createExtension(EntityNameStrategy.class,
EntityResolvingNameStrategy.class));
- em.registerExtension(createExtension(SQLNameStrategy.class,
- TeneoSQLNameStrategy.class));
- em.registerExtension(createExtension(
- XmlPersistenceContentHandler.class,
+ em.registerExtension(createExtension(SQLNameStrategy.class, TeneoSQLNameStrategy.class));
+ em.registerExtension(createExtension(XmlPersistenceContentHandler.class,
XmlPersistenceContentHandler.class));
- em.registerExtension(createExtension(
- XmlElementToEStructuralFeatureMapper.class,
+ em.registerExtension(createExtension(XmlElementToEStructuralFeatureMapper.class,
XmlElementToEStructuralFeatureMapper.class));
- em.registerExtension(createExtension(PersistenceOptions.class,
- PersistenceOptions.class));
+ em.registerExtension(createExtension(PersistenceOptions.class, PersistenceOptions.class));
// annotator related
- em.registerExtension(createExtension(EClassAnnotator.class,
- EClassAnnotator.class));
- em.registerExtension(createExtension(EFeatureAnnotator.class,
- EFeatureAnnotator.class));
+ em.registerExtension(createExtension(EClassAnnotator.class, EClassAnnotator.class));
+ em.registerExtension(createExtension(EFeatureAnnotator.class, EFeatureAnnotator.class));
em.registerExtension(createExtension(OneToManyAttributeAnnotator.class,
OneToManyAttributeAnnotator.class));
em.registerExtension(createExtension(SingleAttributeAnnotator.class,
SingleAttributeAnnotator.class));
- em.registerExtension(createExtension(
- BidirectionalManyToManyAnnotator.class,
+ em.registerExtension(createExtension(BidirectionalManyToManyAnnotator.class,
BidirectionalManyToManyAnnotator.class));
- em.registerExtension(createExtension(
- UnidirectionalManyToManyAnnotator.class,
+ em.registerExtension(createExtension(UnidirectionalManyToManyAnnotator.class,
UnidirectionalManyToManyAnnotator.class));
- em.registerExtension(createExtension(EDataTypeAnnotator.class,
- EDataTypeAnnotator.class));
+ em.registerExtension(createExtension(EDataTypeAnnotator.class, EDataTypeAnnotator.class));
em.registerExtension(createExtension(OneToManyReferenceAnnotator.class,
OneToManyReferenceAnnotator.class));
em.registerExtension(createExtension(OneToOneReferenceAnnotator.class,
@@ -144,162 +129,123 @@ public class ExtensionUtil {
ManyToOneReferenceAnnotator.class));
// from the hibernate plugin
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.HbContext", true));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.HbContext", true));
+ "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerAccessor", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerAccessor",
- false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerFeatureIDAccessor",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerFeatureIDAccessor", false));
em.registerExtension(createExtension(
"org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerFeatureIDPropertyHandler",
false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerPropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.econtainer.EContainerPropertyHandler", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.EListPropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.EListPropertyHandler", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.EReferencePropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.EReferencePropertyHandler", false));
em.registerExtension(createExtension(
"org.eclipse.emf.teneo.hibernate.mapping.property.FeatureMapEntryFeatureURIPropertyHandler",
false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.WildCardAttributePropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.WildCardAttributePropertyHandler", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.WildCardReferencePropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.WildCardReferencePropertyHandler", false));
em.registerExtension(createExtension(
"org.eclipse.emf.teneo.hibernate.mapping.econtainer.NewEContainerFeatureIDPropertyHandler",
false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.FeatureMapEntryPropertyHandler",
- false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.FeatureMapPropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.FeatureMapEntryPropertyHandler", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.FeatureMapPropertyHandler", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.EMFInterceptor", false));
+ "org.eclipse.emf.teneo.hibernate.mapping.property.VersionPropertyHandler", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.EMFInterceptor", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.tuplizer.EMFEntityNameResolver",
- false));
+ "org.eclipse.emf.teneo.hibernate.tuplizer.EMFEntityNameResolver", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableEList",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableEList", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableEMap",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableEMap", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableFeatureMap",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.HibernatePersistableFeatureMap", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.HbExtraLazyPersistableEList",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.HbExtraLazyPersistableEList", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.HbExtraLazyPersistableEMap",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.HbExtraLazyPersistableEMap", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.elist.MapHibernatePersistableEMap",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.elist.MapHibernatePersistableEMap", false));
// hibernate mapper
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.HibernateMappingGenerator",
+ "org.eclipse.emf.teneo.hibernate.mapper.HibernateMappingGenerator", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.MappingContext",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.MappingContext", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.BasicMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.EmbeddedMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.EntityMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.FeatureMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.IdMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.ManyAttributeMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.BasicMapper",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.EmbeddedMapper",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.ManyToOneMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.MappingContext", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.OneToManyMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.OneToOneMapper", false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.TypedEReferenceMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.EntityMapper",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapper.ManyExternalReferenceMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.FeatureMapper",
false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.IdMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollectionEventListener",
+ "org.eclipse.emf.teneo.hibernate.mapper.ManyAttributeMapper", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.ManyToManyMapper",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.hibernate.mapping.eav.EAVMergeEventListener",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.ManyToOneMapper",
false));
-
- // jpox mapping
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.association.EmbeddedMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.MappingContext",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.association.ManyToManyMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.OneToManyMapper",
false));
- em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.association.ManyToOneMapper",
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.hibernate.mapper.OneToOneMapper",
false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.association.OneToManyMapper",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapper.TypedEReferenceMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.association.OneToOneMapper",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapper.ManyExternalReferenceMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.BasicMapper", false));
+ "org.eclipse.emf.teneo.hibernate.mapping.EMFInitializeCollectionEventListener", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.ColumnMapper",
- false));
+ "org.eclipse.emf.teneo.hibernate.mapping.eav.EAVMergeEventListener", false));
+
+ // jpox mapping
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.EClassFeatureMapper",
- false));
+ "org.eclipse.emf.teneo.jpox.mapper.association.EmbeddedMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.IdMapper", false));
+ "org.eclipse.emf.teneo.jpox.mapper.association.ManyToManyMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.InheritanceMapper",
- false));
+ "org.eclipse.emf.teneo.jpox.mapper.association.ManyToOneMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.JoinColumnMapper",
- false));
+ "org.eclipse.emf.teneo.jpox.mapper.association.OneToManyMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.ManyBasicMapper",
+ "org.eclipse.emf.teneo.jpox.mapper.association.OneToOneMapper", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.property.BasicMapper",
+ false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.property.ColumnMapper",
false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.property.TableMapper", false));
+ "org.eclipse.emf.teneo.jpox.mapper.property.EClassFeatureMapper", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.property.IdMapper",
+ false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.JPOXMappingGenerator", false));
+ "org.eclipse.emf.teneo.jpox.mapper.property.InheritanceMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.MappingContext", false));
+ "org.eclipse.emf.teneo.jpox.mapper.property.JoinColumnMapper", false));
em.registerExtension(createExtension(
- "org.eclipse.emf.teneo.jpox.mapper.NamingHandler", false));
+ "org.eclipse.emf.teneo.jpox.mapper.property.ManyBasicMapper", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.property.TableMapper",
+ false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.JPOXMappingGenerator",
+ false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.MappingContext", false));
+ em.registerExtension(createExtension("org.eclipse.emf.teneo.jpox.mapper.NamingHandler", false));
}
} \ No newline at end of file
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/MapPersistableEMap.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/MapPersistableEMap.java
index eccadfe19..edc7c289e 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/MapPersistableEMap.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/MapPersistableEMap.java
@@ -66,7 +66,8 @@ public abstract class MapPersistableEMap<K, V> extends PersistableEMap<K, V> imp
}
/** Constructor */
- public MapPersistableEMap(EClass entryEClass, Class<?> entryClass, InternalEObject owner, EStructuralFeature feature) {
+ public MapPersistableEMap(EClass entryEClass, Class<?> entryClass, InternalEObject owner,
+ EStructuralFeature feature) {
// invoke constructor with no lazyLoadMapDelegate
this(entryEClass, owner, feature, (java.util.Map<K, V>) null);
}
@@ -80,8 +81,8 @@ public abstract class MapPersistableEMap<K, V> extends PersistableEMap<K, V> imp
* @param owner
* @param featureID
* @param lazyLoadDelegate
- * a java.util.map that is a proxy collection taht will be used when lazy load is
- * invoked. if it is null, then the map is considered as loaded
+ * a java.util.map that is a proxy collection taht will be used when lazy load is
+ * invoked. if it is null, then the map is considered as loaded
*/
public MapPersistableEMap(EClass entryEClass, InternalEObject owner, EStructuralFeature feature,
Map<K, V> ormMapDelegate) {
@@ -114,8 +115,8 @@ public abstract class MapPersistableEMap<K, V> extends PersistableEMap<K, V> imp
* @param owner
* @param featureID
* @param ormMapDelegate
- * a java.util.map that is a proxy collection taht will be used when lazy load is
- * invoked. if it is null, then the map is considered as loaded
+ * a java.util.map that is a proxy collection taht will be used when lazy load is
+ * invoked. if it is null, then the map is considered as loaded
*/
public MapPersistableEMap(EClass entryEClass, InternalEObject owner, EStructuralFeature feature,
List<BasicEMap.Entry<K, V>> list) {
@@ -143,8 +144,8 @@ public abstract class MapPersistableEMap<K, V> extends PersistableEMap<K, V> imp
/** Needs to be implemented by concrete subclass, does nothing here */
@Override
- protected EList<BasicEMap.Entry<K, V>> createDelegateEList(InternalEObject owner, EStructuralFeature feature,
- List<BasicEMap.Entry<K, V>> delegateORMList) {
+ protected EList<BasicEMap.Entry<K, V>> createDelegateEList(InternalEObject owner,
+ EStructuralFeature feature, List<BasicEMap.Entry<K, V>> delegateORMList) {
throw new UnsupportedOperationException("This method should not be called!");
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableDelegateList.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableDelegateList.java
index a8bd4be8c..44251b318 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableDelegateList.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableDelegateList.java
@@ -35,6 +35,6 @@ public interface PersistableDelegateList<E> {
/** If the delegate has been initialized */
public boolean isInitialized();
-
+
public EStructuralFeature getEStructuralFeature();
} \ No newline at end of file
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEList.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEList.java
index 006ed40ae..1a65ace8d 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEList.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEList.java
@@ -35,24 +35,23 @@ import org.eclipse.emf.ecore.util.DelegatingEcoreEList;
import org.eclipse.emf.teneo.util.StoreUtil;
/**
- * A persistable elist which can be used by different or mappers. This
- * persistable elist works around the idea that the persisted list (e.g.
- * PersistentList in Hibernate) is the delegate for this elist.
+ * A persistable elist which can be used by different or mappers. This persistable elist works
+ * around the idea that the persisted list (e.g. PersistentList in Hibernate) is the delegate for
+ * this elist.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.26 $
*/
-public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
- implements PersistableDelegateList<E> {
+public abstract class PersistableEList<E> extends DelegatingEcoreEList<E> implements
+ PersistableDelegateList<E> {
private static final long serialVersionUID = 1L;
/** The logger */
private static Log log = LogFactory.getLog(PersistableEList.class);
/**
- * The actual list, must never be an elist as notifications etc. are done by
- * this list
+ * The actual list, must never be an elist as notifications etc. are done by this list
*/
protected List<E> delegate;
@@ -74,8 +73,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
protected Boolean isThisListWrapped;
/** Constructor */
- public PersistableEList(InternalEObject owner, EStructuralFeature feature,
- List<E> list) {
+ public PersistableEList(InternalEObject owner, EStructuralFeature feature, List<E> list) {
super(owner);
estructuralFeature = feature;
if (list == null) {
@@ -93,9 +91,8 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
if (log.isDebugEnabled()) {
- logString = "EList of type: " + this.getClass().getName()
- + " of member " + estructuralFeature.getName()
- + " owned by " + owner.getClass().getName()
+ logString = "EList of type: " + this.getClass().getName() + " of member "
+ + estructuralFeature.getName() + " owned by " + owner.getClass().getName()
+ " with delegate list " + delegate.getClass().getName();
if (log.isDebugEnabled()) {
@@ -121,8 +118,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/** Takes care of deserializing the efeature */
- private void readObject(java.io.ObjectInputStream in) throws IOException,
- ClassNotFoundException {
+ private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
estructuralFeature = StoreUtil.stringToStructureFeature(eFeaturePath);
}
@@ -130,8 +126,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* Get the underlying efeature
*
- * @see
- * org.eclipse.emf.ecore.util.DelegatingEcoreEList#getEStructuralFeature()
+ * @see org.eclipse.emf.ecore.util.DelegatingEcoreEList#getEStructuralFeature()
*/
@Override
public EStructuralFeature getEStructuralFeature() {
@@ -181,13 +176,11 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * If this instance is again wrapped by a NotifyingList then assume that the
- * wrapper will be smart enough to do all the inverse things.... Note that
- * the check if a list is wrapped is done once and then the result is
- * cached. So this assumes that a list will not be re-wrapped.
+ * If this instance is again wrapped by a NotifyingList then assume that the wrapper will be smart
+ * enough to do all the inverse things.... Note that the check if a list is wrapped is done once
+ * and then the result is cached. So this assumes that a list will not be re-wrapped.
*
- * @return false if the list is wrapped, otherwise the super hasInverse is
- * called.
+ * @return false if the list is wrapped, otherwise the super hasInverse is called.
*/
@Override
protected boolean hasInverse() {
@@ -210,8 +203,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
private boolean isWrapped() {
if (isThisListWrapped == null) {
final Object value = getEObject().eGet(getEStructuralFeature());
- isThisListWrapped = value != this
- && value instanceof NotifyingList<?>;
+ isThisListWrapped = value != this && value instanceof NotifyingList<?>;
}
return isThisListWrapped;
}
@@ -234,8 +226,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * Performs the load action if not yet oaded and sends out the load
- * notification.
+ * Performs the load action if not yet oaded and sends out the load notification.
*/
protected void load() {
if (isLoaded) {
@@ -260,8 +251,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
// only set to false if it was true
if (eDeliver) {
if (log.isDebugEnabled()) {
- log.debug("Owner " + owner.getClass()
- + " set eDeliver to false");
+ log.debug("Owner " + owner.getClass() + " set eDeliver to false");
}
owner.eSetDeliver(false);
setDeliver = true;
@@ -319,8 +309,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * The load method which should be overridden by the subclass to add
- * lazyloading
+ * The load method which should be overridden by the subclass to add lazyloading
*/
protected abstract void doLoad();
@@ -336,8 +325,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.util.DelegatingEList#delegateAdd(int,
- * java.lang.Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateAdd(int, java.lang.Object)
*/
@Override
protected void delegateAdd(int index, E object) {
@@ -348,8 +336,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateAdd(java.lang.Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateAdd(java.lang.Object)
*/
@Override
protected void delegateAdd(E object) {
@@ -382,9 +369,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateContains(java.lang
- * .Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateContains(java.lang .Object)
*/
@Override
protected boolean delegateContains(Object object) {
@@ -395,9 +380,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateContainsAll(java.
- * util.Collection)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateContainsAll(java. util.Collection)
*/
@Override
protected boolean delegateContainsAll(Collection<?> collection) {
@@ -408,9 +391,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateEquals(java.lang.
- * Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateEquals(java.lang. Object)
*/
@Override
protected boolean delegateEquals(Object object) {
@@ -443,9 +424,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateIndexOf(java.lang
- * .Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateIndexOf(java.lang .Object)
*/
@Override
protected int delegateIndexOf(Object object) {
@@ -478,9 +457,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateLastIndexOf(java.
- * lang.Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateLastIndexOf(java. lang.Object)
*/
@Override
protected int delegateLastIndexOf(Object object) {
@@ -512,8 +489,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.util.DelegatingEList#delegateSet(int,
- * java.lang.Object)
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateSet(int, java.lang.Object)
*/
@Override
protected E delegateSet(int index, E object) {
@@ -546,9 +522,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.util.DelegatingEList#delegateToArray(java.lang
- * .Object[])
+ * @see org.eclipse.emf.common.util.DelegatingEList#delegateToArray(java.lang .Object[])
*/
@Override
protected <T> T[] delegateToArray(T[] array) {
@@ -585,8 +559,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * If not loaded then basicIterator will always return a false for
- * hasNext/hasPrevious
+ * If not loaded then basicIterator will always return a false for hasNext/hasPrevious
*/
@Override
@SuppressWarnings("deprecation")
@@ -611,8 +584,7 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * If not loaded then basicIterator will always return a false for
- * hasNext/hasPrevious
+ * If not loaded then basicIterator will always return a false for hasNext/hasPrevious
*/
@Override
@SuppressWarnings("deprecation")
@@ -638,12 +610,11 @@ public abstract class PersistableEList<E> extends DelegatingEcoreEList<E>
}
/**
- * Is overridden because it can't use delegates for equality because the
- * delegate (a hibernate or jpox list) will try to be equal with this
- * persistable elist.
+ * Is overridden because it can't use delegates for equality because the delegate (a hibernate or
+ * jpox list) will try to be equal with this persistable elist.
*
- * This method does jvm instance equality because doing a full-fledge equal
- * would result in a load of the list.
+ * This method does jvm instance equality because doing a full-fledge equal would result in a load
+ * of the list.
*/
@Override
public boolean equals(Object object) {
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEMap.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEMap.java
index 699453036..24ec285bc 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEMap.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableEMap.java
@@ -37,9 +37,9 @@ import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.EcoreEMap;
/**
- * A persistable emap which uses the PersistableEList as its delegate. Note that this implementation is based on the
- * implementation of the superclass. The superclass makes use of a delegate list to store its content. This
- * implementation puts a persistent list in this member.
+ * A persistable emap which uses the PersistableEList as its delegate. Note that this implementation
+ * is based on the implementation of the superclass. The superclass makes use of a delegate list to
+ * store its content. This implementation puts a persistent list in this member.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @author <a href="mailto:jdboudreault@gmail.com">Jean-Denis Boudreault</a>
@@ -67,8 +67,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
private boolean isLoading = false;
/**
- * The owner of the objet. we must keep a copy since emap does not have one and the delegate EList does not expose
- * this field publicly
+ * The owner of the objet. we must keep a copy since emap does not have one and the delegate EList
+ * does not expose this field publicly
*/
private InternalEObject owner;
@@ -79,7 +79,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
}
/** Constructor */
- public PersistableEMap(EClass entryEClass, Class<?> entryClass, InternalEObject owner, EStructuralFeature feature) {
+ public PersistableEMap(EClass entryEClass, Class<?> entryClass, InternalEObject owner,
+ EStructuralFeature feature) {
// invoke constructor with no lazyLoadMapDelegate
super(entryEClass, BasicEMap.Entry.class, owner, owner.eClass().getFeatureID(feature));
@@ -126,8 +127,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
// NOTE BEWARE: the delegateEList is a member of the superclass!
delegateEList = createDelegateEList(owner, feature, delegateORMList);
- logString = "EMap with entry eclass: " + entryEClass.getName() + " of member " + feature.getName()
- + " owned by " + owner.getClass().getName() + " with delegate list "
+ logString = "EMap with entry eclass: " + entryEClass.getName() + " of member "
+ + feature.getName() + " owned by " + owner.getClass().getName() + " with delegate list "
+ delegateORMList.getClass().getName();
if (log.isDebugEnabled()) {
@@ -143,7 +144,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
setLoaded(delegateORMList.size() > 0);
}
if (isLoaded) {
- // force the map to be computed, this sets the internal entrydata/size member
+ // force the map to be computed, this sets the internal entrydata/size
+ // member
get(null);
}
}
@@ -203,7 +205,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
try {
doLoad();
- // force the map to be computed, this sets the internal entrydata/size member
+ // force the map to be computed, this sets the internal entrydata/size
+ // member
get(null);
// set the size
@@ -382,7 +385,8 @@ public abstract class PersistableEMap<K, V> extends EcoreEMap<K, V> implements
}
@Override
- public NotificationChain basicAdd(java.util.Map.Entry<K, V> object, NotificationChain notifications) {
+ public NotificationChain basicAdd(java.util.Map.Entry<K, V> object,
+ NotificationChain notifications) {
load();
return super.basicAdd(object, notifications);
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableFeatureMap.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableFeatureMap.java
index 31546d095..1ee30f1f8 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableFeatureMap.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/elist/PersistableFeatureMap.java
@@ -35,12 +35,13 @@ import org.eclipse.emf.teneo.type.FeatureMapEntry;
import org.eclipse.emf.teneo.util.AssertUtil;
/**
- * A persistable elist which can be used by different or mappers. This persistable elist works around the idea that the
- * persisted list (e.g. PersistentList in Hibernate) is the delegate for this elist.
+ * A persistable elist which can be used by different or mappers. This persistable elist works
+ * around the idea that the persisted list (e.g. PersistentList in Hibernate) is the delegate for
+ * this elist.
*
- * Note the delegate**() methods are overridden to force a load before anything else happens with the delegated list.
- * The addUnique. addSet methods are overridden to ensure that the featuremap entries of the right type are passed to
- * the persistent store.
+ * Note the delegate**() methods are overridden to force a load before anything else happens with
+ * the delegated list. The addUnique. addSet methods are overridden to ensure that the featuremap
+ * entries of the right type are passed to the persistent store.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.15 $
@@ -72,7 +73,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
private final Class<? extends FeatureMap.Entry> elementType;
/** Constructor */
- public PersistableFeatureMap(InternalEObject owner, EStructuralFeature feature, List<FeatureMap.Entry> list) {
+ public PersistableFeatureMap(InternalEObject owner, EStructuralFeature feature,
+ List<FeatureMap.Entry> list) {
super(owner, feature);
elementType = determineElementType();
@@ -80,8 +82,9 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
delegate = new ArrayList<FeatureMap.Entry>();
isLoaded = true;
} else if (list instanceof EList<?>) {
- AssertUtil.assertTrue("The passed elist is not a featuremap but a : " + list.getClass().getName()
- + ". Error in featureMap: " + getLogString(), list instanceof FeatureMap);
+ AssertUtil.assertTrue("The passed elist is not a featuremap but a : "
+ + list.getClass().getName() + ". Error in featureMap: " + getLogString(),
+ list instanceof FeatureMap);
delegate = replaceEntryAll(list);
isLoaded = true;
@@ -150,8 +153,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/** Replace the delegating list */
public void replaceDelegate(List<FeatureMap.Entry> newDelegate) {
- AssertUtil.assertTrue("This featuremap " + logString + " already wraps an or specific featuremap",
- !isPersistencyWrapped());
+ AssertUtil.assertTrue("This featuremap " + logString
+ + " already wraps an or specific featuremap", !isPersistencyWrapped());
delegate = newDelegate;
isLoaded = false;
@@ -252,7 +255,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
// accessed.
/** OVerridden to create the correct featuremap entry */
@Override
- protected abstract FeatureMap.Entry createEntry(EStructuralFeature eStructuralFeature, Object value);
+ protected abstract FeatureMap.Entry createEntry(EStructuralFeature eStructuralFeature,
+ Object value);
/*
* (non-Javadoc)
@@ -279,7 +283,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addAllUnique (java.util.Collection )
+ * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addAllUnique
+ * (java.util.Collection )
*/
@Override
public boolean addAllUnique(Collection<? extends FeatureMap.Entry> collection) {
@@ -289,7 +294,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addAllUnique (int, java.util.Collection)
+ * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addAllUnique (int,
+ * java.util.Collection)
*/
@Override
public boolean addAllUnique(int index, Collection<? extends FeatureMap.Entry> collection) {
@@ -299,7 +305,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addUnique (int, java.lang.Object)
+ * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addUnique (int,
+ * java.lang.Object)
*/
@Override
public void addUnique(int index, FeatureMap.Entry object) {
@@ -309,7 +316,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addUnique (java.lang.Object)
+ * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#addUnique
+ * (java.lang.Object)
*/
@Override
public void addUnique(FeatureMap.Entry object) {
@@ -319,7 +327,8 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
/*
* (non-Javadoc)
*
- * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#setUnique (int, java.lang.Object)
+ * @see org.eclipse.emf.common.notify.impl.DelegatingNotifyingListImpl#setUnique (int,
+ * java.lang.Object)
*/
@Override
public FeatureMap.Entry setUnique(int index, FeatureMap.Entry object) {
@@ -529,10 +538,11 @@ public abstract class PersistableFeatureMap extends DelegatingFeatureMap impleme
}
/**
- * Is overridden because it can't use delegates for equality because the delegate (a hibernate or jpox list) will
- * try to be equal with this persistable elist.
+ * Is overridden because it can't use delegates for equality because the delegate (a hibernate or
+ * jpox list) will try to be equal with this persistable elist.
*
- * This method does jvm instance equality because doing a full-fledge equal would result in a load of the list.
+ * This method does jvm instance equality because doing a full-fledge equal would result in a load
+ * of the list.
*/
@Override
public boolean equals(Object object) {
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/EntityNameStrategy.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/EntityNameStrategy.java
index 049353296..d1efb51d8 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/EntityNameStrategy.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/EntityNameStrategy.java
@@ -24,29 +24,24 @@ import org.eclipse.emf.teneo.extension.ExtensionManagerAware;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
/**
- * Converter from entityname to and from an eclass. The entityname is used in
- * the hql, etc.
+ * Converter from entityname to and from an eclass. The entityname is used in the hql, etc.
*
* @author <a href="mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.7 $
*/
-public interface EntityNameStrategy extends ExtensionPoint,
- ExtensionManagerAware {
+public interface EntityNameStrategy extends ExtensionPoint, ExtensionManagerAware {
/** The EObject eclass */
- public static EClass EOBJECT_ECLASS = (EClass) EcorePackage.eINSTANCE
- .getEClassifier("EObject");
+ public static EClass EOBJECT_ECLASS = (EClass) EcorePackage.eINSTANCE.getEClassifier("EObject");
/** The EObject eclass name */
- public static String EOBJECT_ECLASS_NAME = EcorePackage.eINSTANCE.getName()
- + "_" + EOBJECT_ECLASS.getName();
+ public static String EOBJECT_ECLASS_NAME = EcorePackage.eINSTANCE.getName() + "_"
+ + EOBJECT_ECLASS.getName();
/**
- * Determines the name for a given EClass. This name can be used in jsf
- * pages and queries.
+ * Determines the name for a given EClass. This name can be used in jsf pages and queries.
*
- * Note if the eClass is the EObject eclass then the string
- * EOBJECT_ECLASS_NAME must be returned.
+ * Note if the eClass is the EObject eclass then the string EOBJECT_ECLASS_NAME must be returned.
*/
public String toEntityName(EClass eClass);
@@ -57,7 +52,7 @@ public interface EntityNameStrategy extends ExtensionPoint,
/**
* @param paModel
- * the paModel to set
+ * the paModel to set
*/
public void setPaModel(PAnnotatedModel paModel);
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/SQLNameStrategy.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/SQLNameStrategy.java
index b053d159a..71690dd67 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/SQLNameStrategy.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/SQLNameStrategy.java
@@ -27,11 +27,10 @@ import org.eclipse.emf.teneo.annotations.pamodel.PAnnotatedEStructuralFeature;
import org.eclipse.emf.teneo.extension.ExtensionPoint;
/**
- * Takes care of creating correct names for sql artifacts such as tables,
- * columns, foreign keys, etc.
+ * Takes care of creating correct names for sql artifacts such as tables, columns, foreign keys,
+ * etc.
*
- * Note that strategies are normally created once for each instance of
- * persistenceoptions.
+ * Note that strategies are normally created once for each instance of persistenceoptions.
*
* @author <a href="mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.11 $
@@ -39,27 +38,23 @@ import org.eclipse.emf.teneo.extension.ExtensionPoint;
public interface SQLNameStrategy extends ExtensionPoint {
/**
- * Converts the name to the required sql setting (length and case). If the
- * name is too long (see option maximum sql name length) then the prefix is
- * trunced away.
+ * Converts the name to the required sql setting (length and case). If the name is too long (see
+ * option maximum sql name length) then the prefix is trunced away.
*/
public abstract String convert(String name);
/**
- * Converts the name to the required sql setting (length and case). If the
- * name is too long (see the option maximum sql name length) then: if
- * truncPrefix = false then the part after the _ is trunced. if truncPrefix
- * = true then the part before the _ is trunced. An underscore often occurs
- * in the name of a join table.
+ * Converts the name to the required sql setting (length and case). If the name is too long (see
+ * the option maximum sql name length) then: if truncPrefix = false then the part after the _ is
+ * trunced. if truncPrefix = true then the part before the _ is trunced. An underscore often
+ * occurs in the name of a join table.
*/
public String convert(String name, boolean truncPrefix);
/**
- * The join column name used to join a joined-subclass table with its parent
- * table
+ * The join column name used to join a joined-subclass table with its parent table
*/
- public abstract String getPrimaryKeyJoinColumnName(
- PAnnotatedEClass aSuperClass, String idFeature);
+ public abstract String getPrimaryKeyJoinColumnName(PAnnotatedEClass aSuperClass, String idFeature);
/** The join colum name for the secondary table */
public abstract String getSecondaryTablePrimaryKeyJoinColumnName(
@@ -69,42 +64,36 @@ public interface SQLNameStrategy extends ExtensionPoint {
public abstract String getTableName(PAnnotatedEClass aClass);
/** Simple column name with optional prefix */
- public abstract String getColumnName(
- PAnnotatedEStructuralFeature aStructuralFeature, String prefix);
+ public abstract String getColumnName(PAnnotatedEStructuralFeature aStructuralFeature,
+ String prefix);
/**
- * Return the name of the foreign key used for this aReference. If null is
- * returned then the name of the foreign key is not set. Returns the
- * concatenation of the entityname of the aclass to which the areference
- * belongs.
+ * Return the name of the foreign key used for this aReference. If null is returned then the name
+ * of the foreign key is not set. Returns the concatenation of the entityname of the aclass to
+ * which the areference belongs.
*
- * This method is normally called when the PersistenceOption
- * CREATE_READABLE_FOREIGN_KEY_NAMES is true.
+ * This method is normally called when the PersistenceOption CREATE_READABLE_FOREIGN_KEY_NAMES is
+ * true.
*/
- public abstract String getForeignKeyName(
- PAnnotatedEStructuralFeature aFeature);
+ public abstract String getForeignKeyName(PAnnotatedEStructuralFeature aFeature);
- public abstract String getForeignKeyName(
- PAnnotatedEClass aOwningClass,
+ public abstract String getForeignKeyName(PAnnotatedEClass aOwningClass,
PAnnotatedEStructuralFeature aFeature);
/** Return joincolumn names for many-to-one */
- public abstract List<String> getManyToOneJoinColumnNames(
- PAnnotatedEReference aReference);
+ public abstract List<String> getManyToOneJoinColumnNames(PAnnotatedEReference aReference);
/** Return a list of join columns for a many is eAttribute */
- public abstract List<String> getOneToManyEAttributeJoinColumns(
- PAnnotatedEAttribute aAttribute);
+ public abstract List<String> getOneToManyEAttributeJoinColumns(PAnnotatedEAttribute aAttribute);
/** Return a list of join columns for a many is eReference */
- public abstract List<String> getOneToManyEReferenceJoinColumns(
- PAnnotatedEReference aReference);
+ public abstract List<String> getOneToManyEReferenceJoinColumns(PAnnotatedEReference aReference);
/**
* Return a list of join columns for a join table for a many to many
*/
- public abstract List<String> getJoinTableJoinColumns(
- PAnnotatedEReference aReference, boolean inverse);
+ public abstract List<String> getJoinTableJoinColumns(PAnnotatedEReference aReference,
+ boolean inverse);
/** Return the name of the join table in case of a list of simpletypes */
public abstract String getJoinTableName(PAnnotatedEAttribute aAttribute);
@@ -131,9 +120,8 @@ public interface SQLNameStrategy extends ExtensionPoint {
public abstract String getSyntheticIDColumnName();
/**
- * Sets the PersistenceOptions used. This is mainly to support backward
- * compatibility with older version in which the naming strategy was
- * controlled by options.
+ * Sets the PersistenceOptions used. This is mainly to support backward compatibility with older
+ * version in which the naming strategy was controlled by options.
*/
public abstract void setPersistenceOptions(PersistenceOptions po);
} \ No newline at end of file
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/StrategyUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/StrategyUtil.java
index aad9761c0..4f555ba33 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/StrategyUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/mapping/strategy/StrategyUtil.java
@@ -32,8 +32,8 @@ import org.eclipse.emf.teneo.util.StoreUtil;
public class StrategyUtil {
/** Returns the entity name based on a specific logic */
- public static String getEntityName(EntityNameStrategy ens,
- PersistenceOptions po, PAnnotatedModel paModel, EClass eclass) {
+ public static String getEntityName(EntityNameStrategy ens, PersistenceOptions po,
+ PAnnotatedModel paModel, EClass eclass) {
if (eclass == null) {
throw new IllegalArgumentException(
"Passed eclass is null."
@@ -44,18 +44,16 @@ public class StrategyUtil {
// ok, here we figure out if it is an EMap. if so, we return the
// destination child name, not the keyToValueEntry wrapper
- final PAnnotatedEClass aclass = (paModel != null ? paModel
- .getPAnnotated(eclass) : null);
+ final PAnnotatedEClass aclass = (paModel != null ? paModel.getPAnnotated(eclass) : null);
if (aclass == null && paModel != null) { // happens when the eclass is
- // EObject itself
+ // EObject itself
return ens.toEntityName(eclass);
}
if (po.isMapEMapAsTrueMap() && StoreUtil.isMapEntry(eclass)) {
// ok, it is an EMAp, get the annotaetd class of the child
EStructuralFeature feature = eclass.getEStructuralFeature("value");
if (feature instanceof EReference) {
- return getEntityName(ens, po, paModel, ((EReference) feature)
- .getEReferenceType());
+ return getEntityName(ens, po, paModel, ((EReference) feature).getEReferenceType());
}
return ((EAttribute) feature).getEType().getInstanceClassName();
}
@@ -75,9 +73,9 @@ public class StrategyUtil {
return getIDFeaturesNames(aClass, optionDefaultIDFeatureName, null);
}
- /**
- * Returns the list of names of id props of the eclass, walks the
- * inheritance tree to find the id feature, if none is found then the
+ /**
+ * Returns the list of names of id props of the eclass, walks the inheritance tree to find the id
+ * feature, if none is found then the
*/
public static List<String> getIDFeaturesNames(PAnnotatedEClass aClass,
String optionDefaultIDFeatureName, PersistenceOptions po) {
@@ -90,19 +88,17 @@ public class StrategyUtil {
}
/** Internal will walk the inheritance tree to find the id feature */
- private static List<String> getIDFeaturesNamesRecurse(
- PAnnotatedEClass aClass, PersistenceOptions po) {
+ private static List<String> getIDFeaturesNamesRecurse(PAnnotatedEClass aClass,
+ PersistenceOptions po) {
final boolean useIDFeatures = po != null ? po.isIDFeatureAsPrimaryKey() : false;
-
+
final ArrayList<String> list = new ArrayList<String>();
- for (EStructuralFeature feature : aClass.getModelEClass()
- .getEStructuralFeatures()) {
- final PAnnotatedEStructuralFeature aStructuralFeature = aClass
- .getPaModel().getPAnnotated(feature);
+ for (EStructuralFeature feature : aClass.getModelEClass().getEStructuralFeatures()) {
+ final PAnnotatedEStructuralFeature aStructuralFeature = aClass.getPaModel().getPAnnotated(
+ feature);
if (aStructuralFeature instanceof PAnnotatedEAttribute) {
final PAnnotatedEAttribute aAttribute = (PAnnotatedEAttribute) aStructuralFeature;
- final String attrName = aAttribute.getModelEAttribute()
- .getName();
+ final String attrName = aAttribute.getModelEAttribute().getName();
if (list.contains(attrName)) {
continue;
}
@@ -114,11 +110,9 @@ public class StrategyUtil {
}
}
- if (list.isEmpty()
- && aClass.getModelEClass().getESuperTypes().size() > 0) {
+ if (list.isEmpty() && aClass.getModelEClass().getESuperTypes().size() > 0) {
for (EClass eClass : aClass.getModelEClass().getESuperTypes()) {
- final PAnnotatedEClass aSuperClass = aClass.getPaModel()
- .getPAnnotated(eClass);
+ final PAnnotatedEClass aSuperClass = aClass.getPaModel().getPAnnotated(eClass);
if (aSuperClass != null) {
final List<String> superList = getIDFeaturesNamesRecurse(aSuperClass, po);
list.removeAll(superList);
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingDiagnostician.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingDiagnostician.java
index 68b07ada7..e2018206a 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingDiagnostician.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingDiagnostician.java
@@ -39,7 +39,8 @@ public class NonLoadingDiagnostician extends Diagnostician {
/** Overriden to prevent loading of complete content */
@Override
- protected boolean doValidateContents(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ protected boolean doValidateContents(EObject eObject, DiagnosticChain diagnostics,
+ Map<Object, Object> context) {
List<EObject> eContents = NonLoadingEContentsEList.create(eObject, true);
if (!eContents.isEmpty()) {
Iterator<EObject> i = eContents.iterator();
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingEContentsEList.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingEContentsEList.java
index 060628144..96fa0f9b2 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingEContentsEList.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/NonLoadingEContentsEList.java
@@ -60,15 +60,17 @@ public class NonLoadingEContentsEList<E> extends EContentsEList<E> {
if ((list instanceof PersistableEList<?>) && ((PersistableEList<?>) list).isLoaded()) {
result.add(eref);
- } else if ((list instanceof PersistableEMap<?,?>) && ((PersistableEMap<?, ?>) list).isLoaded()) {
+ } else if ((list instanceof PersistableEMap<?, ?>)
+ && ((PersistableEMap<?, ?>) list).isLoaded()) {
result.add(eref);
- } else if ((list instanceof PersistableFeatureMap) && ((PersistableFeatureMap) list).isLoaded()) {
+ } else if ((list instanceof PersistableFeatureMap)
+ && ((PersistableFeatureMap) list).isLoaded()) {
result.add(eref);
} else if (eref.getLowerBound() > 0 && forValidation) {
result.add(eref);
}
- if (!(list instanceof PersistableEList<?>) && !(list instanceof PersistableFeatureMap) &&
- !(list instanceof PersistableEMap<?,?>)) {
+ if (!(list instanceof PersistableEList<?>) && !(list instanceof PersistableFeatureMap)
+ && !(list instanceof PersistableEMap<?, ?>)) {
result.add(eref);
}
@@ -79,7 +81,8 @@ public class NonLoadingEContentsEList<E> extends EContentsEList<E> {
return new NonLoadingEContentsEList<EObject>(eObject, result);
}
- private NonLoadingEContentsEList(EObject eObject, List<? extends EStructuralFeature> eStructuralFeatures) {
+ private NonLoadingEContentsEList(EObject eObject,
+ List<? extends EStructuralFeature> eStructuralFeatures) {
super(eObject, eStructuralFeatures);
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
index e5783f615..f74292b07 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/resource/StoreResource.java
@@ -54,9 +54,8 @@ import org.eclipse.emf.teneo.StoreValidationException;
import org.eclipse.emf.teneo.util.FieldUtil;
/**
- * General part of Store Resources. Main feature is that it keeps track of
- * changes to the resource content and that settrackingmodification will not
- * load unloaded elists.
+ * General part of Store Resources. Main feature is that it keeps track of changes to the resource
+ * content and that settrackingmodification will not load unloaded elists.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.44 $
@@ -68,8 +67,7 @@ public abstract class StoreResource extends ResourceImpl {
public static final String DS_NAME_PARAM = "dsname";
/**
- * Prefix to use when specifying query parameters in the uri or in the
- * property file
+ * Prefix to use when specifying query parameters in the uri or in the property file
*/
public static final String QUERY_PREFIX = "query";
@@ -83,8 +81,8 @@ public abstract class StoreResource extends ResourceImpl {
public static final String SET_ERESOURCE = "setEResource";
/**
- * Don't do anything, risk of dangling_references but is better if objects
- * get added to other resources anyway.
+ * Don't do anything, risk of dangling_references but is better if objects get added to other
+ * resources anyway.
*/
public static final String NOT_SET_ERESOURCE = "notSetEResource";
@@ -92,40 +90,37 @@ public abstract class StoreResource extends ResourceImpl {
private static Log log = LogFactory.getLog(StoreResource.class);
/**
- * The list of objects which will be deleted at commit time. Needs to be a
- * list because of the order of deletion.
+ * The list of objects which will be deleted at commit time. Needs to be a list because of the
+ * order of deletion.
*/
protected List<EObject> removedEObjects = new ArrayList<EObject>();
/**
- * The set of objects loaded from the backend. objects which have been
- * removed are still part of this list. This is to prevent them from being
- * added to the newEObjects set.
+ * The set of objects loaded from the backend. objects which have been removed are still part of
+ * this list. This is to prevent them from being added to the newEObjects set.
*/
protected HashSet<EObject> loadedEObjects = new HashSet<EObject>();
// is used for more efficient access
protected HashSet<EObject> loadedEObjectSet = new HashSet<EObject>();
/**
- * The set of new objects new EObjects are never part of the loadedEObjects,
- * when a newEObject is removed it is just removed from this set and not
- * added to the removed EObjects. new eobjects are never part of the
- * modifiedEObjects set.
+ * The set of new objects new EObjects are never part of the loadedEObjects, when a newEObject is
+ * removed it is just removed from this set and not added to the removed EObjects. new eobjects
+ * are never part of the modifiedEObjects set.
*/
protected List<EObject> newEObjects = new ArrayList<EObject>();
// is used for more efficient access
protected HashSet<EObject> newEObjectSet = new HashSet<EObject>();
/**
- * The set of changed objects, this contains the loadedEObjects which have
- * changed new EObjects are never part of this set
+ * The set of changed objects, this contains the loadedEObjects which have changed new EObjects
+ * are never part of this set
*/
protected HashSet<EObject> modifiedEObjects = new HashSet<EObject>();
/**
- * Apparently the super EMF resource classes have a different idea of loaded
- * During the unload action they again start loading from the db, this
- * should be prevented.
+ * Apparently the super EMF resource classes have a different idea of loaded During the unload
+ * action they again start loading from the db, this should be prevented.
*/
protected boolean isUnLoading = false;
@@ -133,9 +128,8 @@ public abstract class StoreResource extends ResourceImpl {
protected String[] topClassNames;
/**
- * The list of queries if they are defined for this resource. If not set
- * (length is 0) then the resource will as default behavior read the
- * topclasses of the database.
+ * The list of queries if they are defined for this resource. If not set (length is 0) then the
+ * resource will as default behavior read the topclasses of the database.
*/
private String[] definedQueries = new String[0];
@@ -160,8 +154,7 @@ public abstract class StoreResource extends ResourceImpl {
}
if (log.isDebugEnabled()) {
- log.debug("Created " + this.getClass().getName() + " using uri: "
- + uri.toString());
+ log.debug("Created " + this.getClass().getName() + " using uri: " + uri.toString());
}
if (params.get(XMLResource.OPTION_DISABLE_NOTIFY) != null) {
@@ -202,8 +195,8 @@ public abstract class StoreResource extends ResourceImpl {
/** Sets the defined queries */
public void setDefinedQueries(String[] qrys) {
if (log.isDebugEnabled()) {
- log.debug("Setting defined queries of resource " + getURI().toString()
- + "/" + this.getClass().getName());
+ log.debug("Setting defined queries of resource " + getURI().toString() + "/"
+ + this.getClass().getName());
for (String element : qrys) {
log.debug("Adding query: " + element);
}
@@ -218,8 +211,8 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Returns the current array of defined queries. Note if there are no
- * definedQueries then an array of length 0 is returned.
+ * Returns the current array of defined queries. Note if there are no definedQueries then an array
+ * of length 0 is returned.
*/
public String[] getDefinedQueries() {
return definedQueries;
@@ -237,12 +230,11 @@ public abstract class StoreResource extends ResourceImpl {
}
/** Get the parameter from the hashmap, if not found then throw an exception */
- protected String getParam(Map<String, String> params, String paramName,
- String report) {
+ protected String getParam(Map<String, String> params, String paramName, String report) {
final String param = params.get(paramName);
if (param == null) {
- throw new StoreResourceException("Parameter " + paramName
- + " missing in querystring: " + report);
+ throw new StoreResourceException("Parameter " + paramName + " missing in querystring: "
+ + report);
}
return param;
}
@@ -258,8 +250,7 @@ public abstract class StoreResource extends ResourceImpl {
final String[] qryParts = qryStr.split("&");
for (final String qryPart : qryParts) {
final String fieldName = qryPart.substring(0, qryPart.indexOf('='));
- final String fieldValue = URI.decode(qryPart.substring(qryPart
- .indexOf('=') + 1));
+ final String fieldValue = URI.decode(qryPart.substring(qryPart.indexOf('=') + 1));
result.put(fieldName, fieldValue);
}
return result;
@@ -269,8 +260,8 @@ public abstract class StoreResource extends ResourceImpl {
// ---------------------------------
/**
- * Returns an array of EObjects which refer to a certain EObject, note if
- * the array is of length zero then no refering EObjects where found.
+ * Returns an array of EObjects which refer to a certain EObject, note if the array is of length
+ * zero then no refering EObjects where found.
*/
public abstract Object[] getCrossReferencers(EObject referedTo);
@@ -303,12 +294,10 @@ public abstract class StoreResource extends ResourceImpl {
String option;
if (options != null
- && (option = (String) options
- .get(XMLResource.OPTION_DISABLE_NOTIFY)) != null) {
+ && (option = (String) options.get(XMLResource.OPTION_DISABLE_NOTIFY)) != null) {
sendNotificationsOnLoad = "false".compareToIgnoreCase(option) == 0;
} else if (options != null
- && (option = (String) options
- .get(XMIResource.OPTION_DISABLE_NOTIFY)) != null) {
+ && (option = (String) options.get(XMIResource.OPTION_DISABLE_NOTIFY)) != null) {
sendNotificationsOnLoad = "false".compareToIgnoreCase(option) == 0;
} else if (!sendNotificationSetByParam) {
sendNotificationsOnLoad = true;
@@ -340,8 +329,7 @@ public abstract class StoreResource extends ResourceImpl {
protected void addToContent(InternalEObject eObject) {
// note direct access to super member
if (!getLocalContents().contains(eObject)) {
- final NotificationChain notifications = getLocalContents()
- .basicAdd(eObject, null);
+ final NotificationChain notifications = getLocalContents().basicAdd(eObject, null);
if (notifications != null && sendNotificationsOnLoad) {
notifications.dispatch();
}
@@ -362,8 +350,7 @@ public abstract class StoreResource extends ResourceImpl {
}
// if the topcontainer is not yet part of the resource then add it
if (!loadedEObjectSet.contains(currentEObject)) {
- final NotificationChain notifications = getLocalContents()
- .basicAdd(eObject, null);
+ final NotificationChain notifications = getLocalContents().basicAdd(eObject, null);
if (notifications != null && sendNotificationsOnLoad) {
notifications.dispatch();
}
@@ -381,8 +368,7 @@ public abstract class StoreResource extends ResourceImpl {
}
// This method is called when ereferences are resolved.
- public void addToContentOrAttach(InternalEObject eObject,
- EReference eReference) {
+ public void addToContentOrAttach(InternalEObject eObject, EReference eReference) {
final boolean oldLoading = isLoading();
try {
if (loadStrategy.compareTo(ADD_TO_CONTENTS) == 0) {
@@ -396,8 +382,7 @@ public abstract class StoreResource extends ResourceImpl {
// if resolve proxies then it is allowed to have child objects
// in other
// resources
- if (eReference.isResolveProxies()
- && eObject.eResource() != null
+ if (eReference.isResolveProxies() && eObject.eResource() != null
&& eObject.eResource() != this) {
return;
}
@@ -490,8 +475,7 @@ public abstract class StoreResource extends ResourceImpl {
private static final long serialVersionUID = 1L;
@Override
- public NotificationChain inverseRemove(EObject object,
- NotificationChain notifications) {
+ public NotificationChain inverseRemove(EObject object, NotificationChain notifications) {
if (!isUnLoading()) {
return super.inverseRemove(object, notifications);
}
@@ -528,10 +512,9 @@ public abstract class StoreResource extends ResourceImpl {
if (isLoaded) {
detached(eObject);
}
- notifications = ((InternalEList<?>) oldResource.getContents())
- .basicRemove(this, notifications);
- FieldUtil.callMethod(eObject, "eSetDirectResource",
- new Object[] { null });
+ notifications = ((InternalEList<?>) oldResource.getContents()).basicRemove(this,
+ notifications);
+ FieldUtil.callMethod(eObject, "eSetDirectResource", new Object[] { null });
}
return notifications;
@@ -562,24 +545,21 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Validate the contents of the resource, only the changed/new EObjects are
- * checked
+ * Validate the contents of the resource, only the changed/new EObjects are checked
*/
protected void validateContents() throws StoreValidationException {
// get the changed or new eobjects
- final ArrayList<EObject> newOrChangedObjects = new ArrayList<EObject>(
- newEObjects);
+ final ArrayList<EObject> newOrChangedObjects = new ArrayList<EObject>(newEObjects);
newOrChangedObjects.addAll(modifiedEObjects);
if (log.isDebugEnabled()) {
- log.debug("Validating contents of resource " + uri + " approx. "
- + newOrChangedObjects.size() + " will be checked");
+ log.debug("Validating contents of resource " + uri + " approx. " + newOrChangedObjects.size()
+ + " will be checked");
}
-
+
final ArrayList<org.eclipse.emf.common.util.Diagnostic> diags = new ArrayList<org.eclipse.emf.common.util.Diagnostic>();
for (int i = 0; i < newOrChangedObjects.size(); i++) {
- final InternalEObject obj = (InternalEObject) newOrChangedObjects
- .get(i);
+ final InternalEObject obj = (InternalEObject) newOrChangedObjects.get(i);
// ensure that the resource is set correctly before validating
if (obj.eResource() != this) {
@@ -591,8 +571,7 @@ public abstract class StoreResource extends ResourceImpl {
continue; // they will be checked as part of their container
}
- final org.eclipse.emf.common.util.Diagnostic diag = validateObject(newOrChangedObjects
- .get(i));
+ final org.eclipse.emf.common.util.Diagnostic diag = validateObject(newOrChangedObjects.get(i));
if (diag != null) {
diags.add(diag);
}
@@ -602,8 +581,7 @@ public abstract class StoreResource extends ResourceImpl {
}
if (diags.size() > 0) {
throw new StoreValidationException(
- diags.toArray(new org.eclipse.emf.common.util.Diagnostic[diags
- .size()]));
+ diags.toArray(new org.eclipse.emf.common.util.Diagnostic[diags.size()]));
}
}
@@ -658,11 +636,10 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Keeps track of changed objects, CHECK: currently if a tree of objects has
- * been added to this resource and afterwards a child in the tree is changed
- * then the child is added to the modifiedEObjects list while its containing
- * parent is part of the addedEObjects list. This should maybe be prevented
- * here but this can come at some cost as it means that the complete
+ * Keeps track of changed objects, CHECK: currently if a tree of objects has been added to this
+ * resource and afterwards a child in the tree is changed then the child is added to the
+ * modifiedEObjects list while its containing parent is part of the addedEObjects list. This
+ * should maybe be prevented here but this can come at some cost as it means that the complete
* container path has to be loaded for each modification.
*/
public void modifiedEObject(EObject eObject) {
@@ -670,8 +647,7 @@ public abstract class StoreResource extends ResourceImpl {
// childs are added to the modified list
// then childs also
- if (loadedEObjectSet.contains(eObject)
- && !modifiedEObjects.contains(eObject)) {
+ if (loadedEObjectSet.contains(eObject) && !modifiedEObjects.contains(eObject)) {
assert (!newEObjectSet.contains(eObject));
modifiedEObjects.add(eObject);
}
@@ -731,8 +707,7 @@ public abstract class StoreResource extends ResourceImpl {
@Override
public void attached(EObject eObject) {
attachedHelper(eObject);
- for (Iterator<EObject> tree = getNonResolvingContent(eObject)
- .basicIterator(); tree.hasNext();) {
+ for (Iterator<EObject> tree = getNonResolvingContent(eObject).basicIterator(); tree.hasNext();) {
final Object obj = tree.next();
// before this called:
// attachedHelper((EObject) obj);
@@ -753,13 +728,11 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Attached the object to this resource, This object will be stored at the
- * next save action. Also handles the specific id generation used for
- * different resource impl.
+ * Attached the object to this resource, This object will be stored at the next save action. Also
+ * handles the specific id generation used for different resource impl.
*
- * Note that this method does not add the object to the
- * resource.getContents(). It just adds the object to the internal lists of
- * this resource.
+ * Note that this method does not add the object to the resource.getContents(). It just adds the
+ * object to the internal lists of this resource.
*/
// 20 April 2008: cleaned up side-effects of this method, add to contents,
// setting
@@ -778,8 +751,7 @@ public abstract class StoreResource extends ResourceImpl {
// adds an object to a resource directly and then later add this same
// object as a child
// to a container
- if (newEObjectSet.contains(eObject)
- || loadedEObjectSet.contains(eObject)) {
+ if (newEObjectSet.contains(eObject) || loadedEObjectSet.contains(eObject)) {
return;
}
@@ -845,8 +817,7 @@ public abstract class StoreResource extends ResourceImpl {
final Resource res = ((EObject) eObject.eGet(eref)).eResource();
if (res == null) { // attach it to this resource because it has
// no other
- final InternalEObject referedTo = (InternalEObject) eObject
- .eGet(eref);
+ final InternalEObject referedTo = (InternalEObject) eObject.eGet(eref);
addToContentOrAttach(referedTo, eref);
}
}
@@ -854,45 +825,38 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Add to the contents of this resource and dispatch if send notification.
- * It also takes care of attaching this object and its contained children to
- * the internal lists and setting the eResource.
+ * Add to the contents of this resource and dispatch if send notification. It also takes care of
+ * attaching this object and its contained children to the internal lists and setting the
+ * eResource.
*
- * Approaches: - Set eResource and add to contents (if no econtainer) - Just
- * set eResource and add to contents if it does not have a container public
- * void addToResource(InternalEObject eObject, boolean forceAddToContents) {
- * // if it has an econtainer then also add the econtainer if
- * (eObject.eContainer() != null && eObject.eContainer().eResource() ==
- * null) { addToResource((InternalEObject)eObject.eContainer(), false); } //
- * if the econtainer is already part of this resource then just attach if
- * (!forceAddToContents && eObject.eContainer() != null &&
- * eObject.eContainer().eResource() == this) { attached(eObject); return; }
- * // probably lazy load action of non-containment, already part of this
- * just return if (!forceAddToContents && eObject.eResource() == this &&
- * !loadedEObjects.contains(eObject) && !removedEObjects.contains(eObject)
- * && !newEObjects.contains(eObject)) { attached(eObject); return; } //
- * already part of another resource if (!forceAddToContents &&
- * eObject.eResource() != null) { return; }
+ * Approaches: - Set eResource and add to contents (if no econtainer) - Just set eResource and add
+ * to contents if it does not have a container public void addToResource(InternalEObject eObject,
+ * boolean forceAddToContents) { // if it has an econtainer then also add the econtainer if
+ * (eObject.eContainer() != null && eObject.eContainer().eResource() == null) {
+ * addToResource((InternalEObject)eObject.eContainer(), false); } // if the econtainer is already
+ * part of this resource then just attach if (!forceAddToContents && eObject.eContainer() != null
+ * && eObject.eContainer().eResource() == this) { attached(eObject); return; } // probably lazy
+ * load action of non-containment, already part of this just return if (!forceAddToContents &&
+ * eObject.eResource() == this && !loadedEObjects.contains(eObject) &&
+ * !removedEObjects.contains(eObject) && !newEObjects.contains(eObject)) { attached(eObject);
+ * return; } // already part of another resource if (!forceAddToContents && eObject.eResource() !=
+ * null) { return; }
*
- * final ContentsEList elist = (ContentsEList) super.getContents(); if
- * (elist.contains(eObject)) { // can happen because of extends,
- * polymorphism return; } // fill in the resource, do not use the normal add
- * method because it // is possible that a child of a container is loaded,
- * in that case // the normal add will remove the container of the object
- * when the // resource is set in the child object, this issue can happen
- * with // direct reads using queries. NotificationChain notification =
- * null; if (loadStrategy.compareToIgnoreCase(ADD_TO_CONTENTS) == 0 ||
- * forceAddToContents) { notification = elist.basicAdd(eObject, null); } if
- * (eObject.eResource() == null || (forceAddToContents &&
- * eObject.eResource() != this)) { setEResource(eObject,
- * forceAddToContents); } // attached(eObject); if (sendNotificationsOnLoad
- * && notification != null) { notification.dispatch(); } }
+ * final ContentsEList elist = (ContentsEList) super.getContents(); if (elist.contains(eObject)) {
+ * // can happen because of extends, polymorphism return; } // fill in the resource, do not use
+ * the normal add method because it // is possible that a child of a container is loaded, in that
+ * case // the normal add will remove the container of the object when the // resource is set in
+ * the child object, this issue can happen with // direct reads using queries. NotificationChain
+ * notification = null; if (loadStrategy.compareToIgnoreCase(ADD_TO_CONTENTS) == 0 ||
+ * forceAddToContents) { notification = elist.basicAdd(eObject, null); } if (eObject.eResource()
+ * == null || (forceAddToContents && eObject.eResource() != this)) { setEResource(eObject,
+ * forceAddToContents); } // attached(eObject); if (sendNotificationsOnLoad && notification !=
+ * null) { notification.dispatch(); } }
*/
/**
- * Sets the eresource by walking up the containment structure and finding
- * the highest parent. There the resource is set.If the resource is already
- * set nothing is done.
+ * Sets the eresource by walking up the containment structure and finding the highest parent.
+ * There the resource is set.If the resource is already set nothing is done.
*/
public void setEResource(InternalEObject eobj, boolean force) {
if (eobj.eResource() != null && eobj.eResource() != this && !force) {
@@ -916,18 +880,15 @@ public abstract class StoreResource extends ResourceImpl {
// the original object can be loaded in the root of the old resource
// it is not removed automatically in this approach, do that now
for (EObject toMoveEObject : toMove) {
- if (prevResource != null
- && toMoveEObject.eResource() != prevResource) {
- ((ContentsEList<?>) prevResource.getContents()).basicRemove(
- toMoveEObject, null);
+ if (prevResource != null && toMoveEObject.eResource() != prevResource) {
+ ((ContentsEList<?>) prevResource.getContents()).basicRemove(toMoveEObject, null);
}
}
}
/**
- * Overridden to also support persistence specific id instead of single emf
- * id
+ * Overridden to also support persistence specific id instead of single emf id
*/
@Override
protected void detachedHelper(EObject eObject) {
@@ -983,8 +944,7 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Overridden to make it non resolving for not loaded elists and proxy
- * eobjects
+ * Overridden to make it non resolving for not loaded elists and proxy eobjects
*/
@Override
public void setTrackingModification(boolean isTrackingModification) {
@@ -1003,8 +963,7 @@ public abstract class StoreResource extends ResourceImpl {
// check within
// for loop
final Adapter adapter = createModificationTrackingAdapter();
- for (Iterator<EObject> i = getNonResolvingAllContents(); i
- .hasNext();) {
+ for (Iterator<EObject> i = getNonResolvingAllContents(); i.hasNext();) {
EObject eObject = i.next();
assert (!eObject.eAdapters().contains(adapter));
eObject.eAdapters().add(adapter);
@@ -1013,11 +972,9 @@ public abstract class StoreResource extends ResourceImpl {
} else {
Adapter oldModificationTrackingAdapter = modificationTrackingAdapter;
- for (Iterator<EObject> i = getNonResolvingAllContents(); i
- .hasNext();) {
+ for (Iterator<EObject> i = getNonResolvingAllContents(); i.hasNext();) {
EObject eObject = i.next();
- assert (eObject.eAdapters()
- .contains(modificationTrackingAdapter));
+ assert (eObject.eAdapters().contains(modificationTrackingAdapter));
eObject.eAdapters().remove(oldModificationTrackingAdapter);
}
modificationTrackingAdapter = null;
@@ -1025,8 +982,8 @@ public abstract class StoreResource extends ResourceImpl {
}
if (eNotificationRequired()) {
- Notification notification = new NotificationImpl(Notification.SET,
- oldIsTrackingModification, isTrackingModification) {
+ Notification notification = new NotificationImpl(Notification.SET, oldIsTrackingModification,
+ isTrackingModification) {
@Override
public Object getNotifier() {
return StoreResource.this;
@@ -1042,17 +999,16 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * Always returns a non-resolving iterator because resolving is defined on
- * model level and the resource should adhere to that
+ * Always returns a non-resolving iterator because resolving is defined on model level and the
+ * resource should adhere to that
*/
@SuppressWarnings("serial")
protected TreeIterator<EObject> getNonResolvingAllContents() {
return new AbstractTreeIterator<EObject>(this, false) {
@Override
public Iterator<EObject> getChildren(Object object) {
- return object == StoreResource.this ? getLocalContents()
- .basicIterator() : getNonResolvingContent(
- (EObject) object).basicIterator();
+ return object == StoreResource.this ? getLocalContents().basicIterator()
+ : getNonResolvingContent((EObject) object).basicIterator();
}
};
}
@@ -1071,8 +1027,7 @@ public abstract class StoreResource extends ResourceImpl {
/*
* (non-Javadoc)
*
- * @seeorg.eclipse.emf.ecore.resource.impl.ResourceImpl#
- * createModificationTrackingAdapter()
+ * @seeorg.eclipse.emf.ecore.resource.impl.ResourceImpl# createModificationTrackingAdapter()
*/
@Override
protected Adapter createModificationTrackingAdapter() {
@@ -1088,8 +1043,7 @@ public abstract class StoreResource extends ResourceImpl {
}
/**
- * An adapter implementation for tracking resource modification, registers
- * changed objects
+ * An adapter implementation for tracking resource modification, registers changed objects
*/
protected class StoreModificationTrackingAdapter extends AdapterImpl {
@Override
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Element.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Element.java
index 0e4135e9b..44b2f4030 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Element.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Element.java
@@ -111,7 +111,7 @@ public class Element extends Node {
/**
* @param text
- * the text to set
+ * the text to set
*/
public void addText(String text) {
setText(getText() + text);
@@ -160,7 +160,7 @@ public class Element extends Node {
/**
* @param parent
- * the parent to set
+ * the parent to set
*/
public void setParent(Element parent) {
this.parent = parent;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Node.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Node.java
index d58bfb6d6..99649384a 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Node.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/simpledom/Node.java
@@ -41,7 +41,7 @@ public abstract class Node {
/**
* @param name
- * the name to set
+ * the name to set
*/
public void setName(String name) {
this.name = name;
@@ -56,7 +56,7 @@ public abstract class Node {
/**
* @param text
- * the text to set
+ * the text to set
*/
public void setText(String text) {
this.text = text;
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/FeatureMapEntry.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/FeatureMapEntry.java
index b55b19acb..072c7a816 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/FeatureMapEntry.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/FeatureMapEntry.java
@@ -216,8 +216,8 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
}
/**
- * Checks if a certain feature has a certain name or that its group (if present) has this name,
- * in which case it is also set to true.
+ * Checks if a certain feature has a certain name or that its group (if present) has this name, in
+ * which case it is also set to true.
*/
protected boolean featureForField(String name) {
if (eStructuralFeature.getName().compareTo(name) == 0) {
@@ -230,7 +230,8 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
return true;
}
- final EStructuralFeature affiliatedFeature = ExtendedMetaData.INSTANCE.getAffiliation(eStructuralFeature);
+ final EStructuralFeature affiliatedFeature = ExtendedMetaData.INSTANCE
+ .getAffiliation(eStructuralFeature);
if (affiliatedFeature != null && affiliatedFeature.getName().compareTo(name) == 0) {
return true;
}
@@ -246,8 +247,9 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
initialize();
}
- if (value != null && value instanceof InternalEObject && eStructuralFeature instanceof EReference &&
- ((EReference) eStructuralFeature).isContainment()) {
+ if (value != null && value instanceof InternalEObject
+ && eStructuralFeature instanceof EReference
+ && ((EReference) eStructuralFeature).isContainment()) {
EContainerRepairControl.setContainer(owner, (InternalEObject) value, eStructuralFeature);
}
}
@@ -265,8 +267,8 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
return false;
} else {
FeatureMap.Entry entry = (FeatureMap.Entry) that;
- return entry.getEStructuralFeature() == eStructuralFeature &&
- (value == null ? entry.getValue() == null : value.equals(entry.getValue()));
+ return entry.getEStructuralFeature() == eStructuralFeature
+ && (value == null ? entry.getValue() == null : value.equals(entry.getValue()));
}
}
@@ -297,8 +299,7 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
String prefix = eStructuralFeature.getEContainingClass().getEPackage().getNsPrefix();
eStructuralFeature.getName();
return (prefix != null && prefix.length() != 0 ? prefix + ":" + eStructuralFeature.getName()
- : eStructuralFeature.getName()) +
- "=" + value;
+ : eStructuralFeature.getName()) + "=" + value;
}
/** Create copy with same feature and different value */
@@ -310,7 +311,8 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
public abstract Internal createEntry(Object value);
/** Do inverse action */
- public NotificationChain inverseAdd(InternalEObject owner, int featureID, NotificationChain notifications) {
+ public NotificationChain inverseAdd(InternalEObject owner, int featureID,
+ NotificationChain notifications) {
return inverseAction.inverseAdd(owner, featureID, notifications);
}
@@ -321,7 +323,8 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
}
/** Do inverse action */
- public NotificationChain inverseRemove(InternalEObject owner, int featureID, NotificationChain notifications) {
+ public NotificationChain inverseRemove(InternalEObject owner, int featureID,
+ NotificationChain notifications) {
return inverseAction.inverseRemove(owner, featureID, notifications);
}
@@ -334,10 +337,11 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
/** Validate type of object against the type of the efeature */
public void validate(Object value) {
if (value != null && !eStructuralFeature.getEType().isInstance(value)) {
- String valueClass =
- value instanceof EObject ? ((EObject) value).eClass().getName() : value.getClass().getName();
- throw new ClassCastException("The feature '" + eStructuralFeature.getName() + "'s type '" +
- eStructuralFeature.getEType().getName() + "' does not permit a value of type '" + valueClass + "'");
+ String valueClass = value instanceof EObject ? ((EObject) value).eClass().getName() : value
+ .getClass().getName();
+ throw new ClassCastException("The feature '" + eStructuralFeature.getName() + "'s type '"
+ + eStructuralFeature.getEType().getName() + "' does not permit a value of type '"
+ + valueClass + "'");
}
}
@@ -345,12 +349,14 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
private class InverseAction {
/** Handles inverse action, differs on the basis of the feature type */
- public NotificationChain inverseAdd(InternalEObject owner, int featureID, NotificationChain notifications) {
+ public NotificationChain inverseAdd(InternalEObject owner, int featureID,
+ NotificationChain notifications) {
return inverseAdd(owner, value, featureID, notifications);
}
/** Handles inverse action, differs on the basis of the feature type */
- public NotificationChain inverseRemove(InternalEObject owner, int featureID, NotificationChain notifications) {
+ public NotificationChain inverseRemove(InternalEObject owner, int featureID,
+ NotificationChain notifications) {
return inverseRemove(owner, value, featureID, notifications);
}
@@ -365,19 +371,22 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
NotificationChain notifications) {
return notifications;
}
-//
-// /**
-// * validate the type of the value with the type expected by the efeature
-// */
-// public void validate(Object value) {
-// if (value != null && !eStructuralFeature.getEType().isInstance(value)) {
-// String valueClass =
-// value instanceof EObject ? ((EObject) value).eClass().getName() : value.getClass().getName();
-// throw new ClassCastException("The feature '" + eStructuralFeature.getName() + "'s type '" +
-// eStructuralFeature.getEType().getName() + "' does not permit a value of type '" + valueClass +
-// "'");
-// }
-// }
+ //
+ // /**
+ // * validate the type of the value with the type expected by the efeature
+ // */
+ // public void validate(Object value) {
+ // if (value != null && !eStructuralFeature.getEType().isInstance(value)) {
+ // String valueClass =
+ // value instanceof EObject ? ((EObject) value).eClass().getName() :
+ // value.getClass().getName();
+ // throw new ClassCastException("The feature '" +
+ // eStructuralFeature.getName() + "'s type '" +
+ // eStructuralFeature.getEType().getName() +
+ // "' does not permit a value of type '" + valueClass +
+ // "'");
+ // }
+ // }
}
/** Containment Inverse Action */
@@ -398,26 +407,24 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
}
/** Does inverse action on other end */
- private NotificationChain inverseAdd(InternalEObject owner, InternalEObject otherEnd, int featureID,
- NotificationChain notifications) {
+ private NotificationChain inverseAdd(InternalEObject owner, InternalEObject otherEnd,
+ int featureID, NotificationChain notifications) {
if (otherEnd != null) {
int containmentFeatureID = owner.eClass().getFeatureID(eStructuralFeature);
- notifications =
- otherEnd.eInverseAdd(owner, InternalEObject.EOPPOSITE_FEATURE_BASE -
- (containmentFeatureID == -1 ? featureID : containmentFeatureID), null, notifications);
+ notifications = otherEnd.eInverseAdd(owner, InternalEObject.EOPPOSITE_FEATURE_BASE
+ - (containmentFeatureID == -1 ? featureID : containmentFeatureID), null, notifications);
}
return notifications;
}
/** Does inverse action on other end */
- private NotificationChain inverseRemove(InternalEObject owner, InternalEObject otherEnd, int featureID,
- NotificationChain notifications) {
+ private NotificationChain inverseRemove(InternalEObject owner, InternalEObject otherEnd,
+ int featureID, NotificationChain notifications) {
if (otherEnd != null) {
int containmentFeatureID = owner.eClass().getFeatureID(eStructuralFeature);
- notifications =
- otherEnd.eInverseRemove(owner, InternalEObject.EOPPOSITE_FEATURE_BASE -
- (containmentFeatureID == -1 ? featureID : containmentFeatureID), null, notifications);
+ notifications = otherEnd.eInverseRemove(owner, InternalEObject.EOPPOSITE_FEATURE_BASE
+ - (containmentFeatureID == -1 ? featureID : containmentFeatureID), null, notifications);
}
return notifications;
@@ -442,24 +449,24 @@ public abstract class FeatureMapEntry implements FeatureMap.Entry.Internal, Seri
}
/** Does inverse action on other end */
- private final NotificationChain inverseAdd(InternalEObject owner, InternalEObject otherEnd, int featureID,
- NotificationChain notifications) {
+ private final NotificationChain inverseAdd(InternalEObject owner, InternalEObject otherEnd,
+ int featureID, NotificationChain notifications) {
if (otherEnd != null) {
- notifications =
- otherEnd.eInverseAdd(owner, otherEnd.eClass().getFeatureID(
- ((EReference) eStructuralFeature).getEOpposite()), null, notifications);
+ notifications = otherEnd.eInverseAdd(owner,
+ otherEnd.eClass().getFeatureID(((EReference) eStructuralFeature).getEOpposite()), null,
+ notifications);
}
return notifications;
}
/** Does inverse action on other end */
- private final NotificationChain inverseRemove(InternalEObject owner, InternalEObject otherEnd, int featureID,
- NotificationChain notifications) {
+ private final NotificationChain inverseRemove(InternalEObject owner, InternalEObject otherEnd,
+ int featureID, NotificationChain notifications) {
if (otherEnd != null) {
- notifications =
- otherEnd.eInverseRemove(owner, otherEnd.eClass().getFeatureID(
- ((EReference) eStructuralFeature).getEOpposite()), null, notifications);
+ notifications = otherEnd.eInverseRemove(owner,
+ otherEnd.eClass().getFeatureID(((EReference) eStructuralFeature).getEOpposite()), null,
+ notifications);
}
return notifications;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/MixedFeatureMapEntry.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/MixedFeatureMapEntry.java
index b35b99eb8..2cd9d38b7 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/MixedFeatureMapEntry.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/MixedFeatureMapEntry.java
@@ -74,7 +74,7 @@ public abstract class MixedFeatureMapEntry extends FeatureMapEntry {
/** Returns true if the feature is a TEXT, CDATA or COMMENT */
protected boolean isMixedFeature() {
final EStructuralFeature structuralFeature = getEStructuralFeature();
- return structuralFeature == Constants.TEXT || structuralFeature == Constants.CDATA ||
- structuralFeature == Constants.COMMENT;
+ return structuralFeature == Constants.TEXT || structuralFeature == Constants.CDATA
+ || structuralFeature == Constants.COMMENT;
}
} \ No newline at end of file
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/PersistentStoreAdapter.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/PersistentStoreAdapter.java
index 2c8525cc3..df61a7bd1 100644
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/PersistentStoreAdapter.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/type/PersistentStoreAdapter.java
@@ -29,14 +29,14 @@ import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.teneo.util.StoreUtil;
/**
- * Keeps a list of PersistentLists by efeature. Is used when a new object is
- * persisted and the OR-layer wants to replace the list implementation.
+ * Keeps a list of PersistentLists by efeature. Is used when a new object is persisted and the
+ * OR-layer wants to replace the list implementation.
*
- * This adapter keeps the PersistentList and ensures that any updates in the
- * original list are also done in the persistent store.
+ * This adapter keeps the PersistentList and ensures that any updates in the original list are also
+ * done in the persistent store.
*
- * This adapter only operates in case the target object is not read from the
- * persistent store but is persisted there for the first time.
+ * This adapter only operates in case the target object is not read from the persistent store but is
+ * persisted there for the first time.
*
* @author <a href="mailto:mtaal@elver.org">Martin Taal</a>
* @version $Revision: 1.15 $
@@ -52,8 +52,7 @@ public class PersistentStoreAdapter implements Adapter {
private Map<String, Object> syntheticProperties = new HashMap<String, Object>();
- public void addStoreCollection(EStructuralFeature eFeature,
- Object storeCollection) {
+ public void addStoreCollection(EStructuralFeature eFeature, Object storeCollection) {
// note that when refresh is called on a persisted object
// then this call replaces the current collection
storeCollections.put(eFeature, storeCollection);
@@ -75,8 +74,7 @@ public class PersistentStoreAdapter implements Adapter {
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
+ * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
*/
public boolean isAdapterForType(Object type) {
return false;
@@ -85,14 +83,12 @@ public class PersistentStoreAdapter implements Adapter {
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common
+ * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common
* .notify.Notification)
*/
@SuppressWarnings("unchecked")
public void notifyChanged(Notification notification) {
- final EStructuralFeature eFeature = (EStructuralFeature) notification
- .getFeature();
+ final EStructuralFeature eFeature = (EStructuralFeature) notification.getFeature();
final Object collectionObject = storeCollections.get(eFeature);
if (collectionObject == null) {
@@ -111,16 +107,14 @@ public class PersistentStoreAdapter implements Adapter {
if (list != null) {
if (notification.getPosition() != Notification.NO_INDEX) {
changedPosition = notification.getPosition();
- list.add(notification.getPosition(),
- replaceValue(notification.getNewValue(), eFeature));
+ list.add(notification.getPosition(), replaceValue(notification.getNewValue(), eFeature));
} else {
changedPosition = list.size();
list.add(replaceValue(notification.getNewValue(), eFeature));
}
}
if (map != null) {
- final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) notification
- .getNewValue();
+ final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) notification.getNewValue();
map.put(entry.getKey(), entry.getValue());
}
break;
@@ -128,16 +122,12 @@ public class PersistentStoreAdapter implements Adapter {
if (list != null) {
if (notification.getPosition() != Notification.NO_INDEX) {
changedPosition = notification.getPosition();
- list.addAll(
- notification.getPosition(),
- replaceValues(
- (List<Object>) notification.getNewValue(),
- eFeature));
+ list.addAll(notification.getPosition(),
+ replaceValues((List<Object>) notification.getNewValue(), eFeature));
} else {
changedPosition = list.size();
- list.addAll(replaceValues(
- (List<Object>) notification.getNewValue(), eFeature));
+ list.addAll(replaceValues((List<Object>) notification.getNewValue(), eFeature));
}
}
if (map != null) {
@@ -163,20 +153,17 @@ public class PersistentStoreAdapter implements Adapter {
}
}
if (map != null) {
- final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) notification
- .getOldValue();
+ final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) notification.getOldValue();
map.remove(entry.getKey());
}
break;
case Notification.REMOVE_MANY:
if (list != null) {
- final List<?> removed = replaceValues(
- (List<Object>) notification.getOldValue(), eFeature);
+ final List<?> removed = replaceValues((List<Object>) notification.getOldValue(), eFeature);
list.removeAll(removed);
if (isEReference) {
for (Object removedObject : removed) {
- StoreUtil.resetSyntheticListInfo(eFeature,
- removedObject);
+ StoreUtil.resetSyntheticListInfo(eFeature, removedObject);
}
}
changedPosition = 0;
@@ -194,8 +181,7 @@ public class PersistentStoreAdapter implements Adapter {
final int newPosition = notification.getPosition();
final Object o = list.remove(oldPosition);
if (o != notification.getNewValue()) {
- throw new IllegalStateException(
- "Persistent list and EList are out of sync");
+ throw new IllegalStateException("Persistent list and EList are out of sync");
}
list.add(newPosition, o);
if (newPosition < oldPosition) {
@@ -208,8 +194,7 @@ public class PersistentStoreAdapter implements Adapter {
case Notification.SET:
if (list != null) {
final int position = notification.getPosition();
- Object removed = list.set(position,
- replaceValue(notification.getNewValue(), eFeature));
+ Object removed = list.set(position, replaceValue(notification.getNewValue(), eFeature));
changedPosition = position;
if (isEReference) {
StoreUtil.resetSyntheticListInfo(eFeature, removed);
@@ -221,8 +206,7 @@ public class PersistentStoreAdapter implements Adapter {
if (changedPosition > -1 && isEReference) {
int newIndex = changedPosition;
for (Object element : list.subList(changedPosition, list.size())) {
- StoreUtil.setSyntheticListOwner(eFeature, element,
- notification.getNotifier());
+ StoreUtil.setSyntheticListOwner(eFeature, element, notification.getNotifier());
StoreUtil.setSyntheticListIndex(eFeature, element, newIndex++);
}
}
@@ -231,9 +215,7 @@ public class PersistentStoreAdapter implements Adapter {
/*
* (non-Javadoc)
*
- * @see
- * org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common
- * .notify.Notifier)
+ * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common .notify.Notifier)
*/
public void setTarget(Notifier newTarget) {
target = newTarget;
@@ -248,7 +230,7 @@ public class PersistentStoreAdapter implements Adapter {
/**
* @param targetCreatedByORM
- * the targetCreatedByORM to set
+ * the targetCreatedByORM to set
*/
public void setTargetCreatedByORM(boolean targetCreatedByORM) {
this.targetCreatedByORM = targetCreatedByORM;
@@ -265,8 +247,7 @@ public class PersistentStoreAdapter implements Adapter {
return value;
}
- protected List<Object> replaceValues(List<Object> values,
- EStructuralFeature eFeature) {
+ protected List<Object> replaceValues(List<Object> values, EStructuralFeature eFeature) {
return values;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/AssertUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/AssertUtil.java
index 0fc384050..0b6e06a7a 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/AssertUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/AssertUtil.java
@@ -36,26 +36,27 @@ public class AssertUtil {
/** Same resource check */
public static void assertResource(EObject obj1, EObject obj2) {
- if (obj1.eResource() == null && ((EObject) obj2).eResource() == null) return;
+ if (obj1.eResource() == null && ((EObject) obj2).eResource() == null)
+ return;
if (obj1.eResource() != ((EObject) obj2).eResource()) {
- throw new AssertionError("The resources are different: " + obj1.getClass().getName() + "/" +
- obj2.getClass().getName());
+ throw new AssertionError("The resources are different: " + obj1.getClass().getName() + "/"
+ + obj2.getClass().getName());
}
}
/** Checks for correct container relations */
public static void assertContainer(EObject parent, EObject child) {
if (parent != child.eContainer()) {
- throw new AssertionError("The child's container is incorrect! parent/child: " +
- parent.getClass().getName() + "/" + child.getClass().getName());
+ throw new AssertionError("The child's container is incorrect! parent/child: "
+ + parent.getClass().getName() + "/" + child.getClass().getName());
}
}
/** Asserts that the passed entry is null */
public static void assertIsNull(Object obj) {
if (obj != null) {
- throw new AssertionError("Passed object: " + obj.getClass().getName() +
- " is not null while this was expected");
+ throw new AssertionError("Passed object: " + obj.getClass().getName()
+ + " is not null while this was expected");
}
}
@@ -63,10 +64,11 @@ public class AssertUtil {
* Checks if the passed object is of the class specified, null values are ignored
*/
public static void assertInstanceOf(Object obj, Class<?> expClass) {
- if (obj == null) return;
+ if (obj == null)
+ return;
if (!(expClass.isAssignableFrom(obj.getClass()))) {
- throw new AssertionError("Expected class: " + expClass.getName() + " but object has class: " +
- obj.getClass().getName());
+ throw new AssertionError("Expected class: " + expClass.getName() + " but object has class: "
+ + obj.getClass().getName());
}
}
@@ -75,11 +77,12 @@ public class AssertUtil {
*/
public static void assertInstanceOfNotNull(Object obj, Class<?> expClass) {
if (obj == null) {
- throw new AssertionError("Checking instanceof but object is null, expecting class: " + expClass.getName());
+ throw new AssertionError("Checking instanceof but object is null, expecting class: "
+ + expClass.getName());
}
if (!(expClass.isAssignableFrom(obj.getClass()))) {
- throw new AssertionError("Expected class: " + expClass.getName() + " but object has class: " +
- obj.getClass().getName());
+ throw new AssertionError("Expected class: " + expClass.getName() + " but object has class: "
+ + obj.getClass().getName());
}
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/EcoreDataTypes.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/EcoreDataTypes.java
index 69e5ae6d2..5042b5368 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/EcoreDataTypes.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/EcoreDataTypes.java
@@ -53,8 +53,7 @@ public class EcoreDataTypes {
// The xml types
private static XMLTypePackage xmlTypePackage = XMLTypePackage.eINSTANCE;
private static EDataType xmlDateEDataType = xmlTypePackage.getDate();
- private static EDataType xmlDateTimeEDataType = xmlTypePackage
- .getDateTime();
+ private static EDataType xmlDateTimeEDataType = xmlTypePackage.getDateTime();
private static EDataType xmlTimeEDataType = xmlTypePackage.getTime();
// The source of the annotations of extended metadata used by emf
@@ -63,33 +62,24 @@ public class EcoreDataTypes {
// XML datatype factory instance
private final DatatypeFactory dataTypeFactory;
- private static final List<EDataType> PRIMITIVES_ETYPES_LIST = Collections
- .unmodifiableList(Arrays.asList(new EDataType[] {
- EcorePackage.eINSTANCE.getEBoolean(),
- EcorePackage.eINSTANCE.getEByte(),
- EcorePackage.eINSTANCE.getEChar(),
- EcorePackage.eINSTANCE.getEDouble(),
- EcorePackage.eINSTANCE.getEFloat(),
- EcorePackage.eINSTANCE.getEInt(),
- EcorePackage.eINSTANCE.getELong(),
+ private static final List<EDataType> PRIMITIVES_ETYPES_LIST = Collections.unmodifiableList(Arrays
+ .asList(new EDataType[] { EcorePackage.eINSTANCE.getEBoolean(),
+ EcorePackage.eINSTANCE.getEByte(), EcorePackage.eINSTANCE.getEChar(),
+ EcorePackage.eINSTANCE.getEDouble(), EcorePackage.eINSTANCE.getEFloat(),
+ EcorePackage.eINSTANCE.getEInt(), EcorePackage.eINSTANCE.getELong(),
EcorePackage.eINSTANCE.getEShort(), }));
private static final List<Class<?>> PRIMITIVE_OBJECT_TYPE_LIST = Collections
- .unmodifiableList(Arrays.asList(new Class<?>[] {
- java.lang.Boolean.class, java.lang.Byte.class,
- java.lang.Double.class, java.lang.Float.class,
- java.lang.Integer.class, java.lang.Long.class,
- java.math.BigDecimal.class, java.math.BigInteger.class }));
-
- private static final List<EDataType> WRAPPERS_ETYPES_LIST = Collections
- .unmodifiableList(Arrays.asList(new EDataType[] {
- EcorePackage.eINSTANCE.getEBooleanObject(),
- EcorePackage.eINSTANCE.getEByteObject(),
- EcorePackage.eINSTANCE.getECharacterObject(),
- EcorePackage.eINSTANCE.getEDoubleObject(),
- EcorePackage.eINSTANCE.getEFloatObject(),
- EcorePackage.eINSTANCE.getEIntegerObject(),
- EcorePackage.eINSTANCE.getELongObject(),
+ .unmodifiableList(Arrays.asList(new Class<?>[] { java.lang.Boolean.class,
+ java.lang.Byte.class, java.lang.Double.class, java.lang.Float.class,
+ java.lang.Integer.class, java.lang.Long.class, java.math.BigDecimal.class,
+ java.math.BigInteger.class }));
+
+ private static final List<EDataType> WRAPPERS_ETYPES_LIST = Collections.unmodifiableList(Arrays
+ .asList(new EDataType[] { EcorePackage.eINSTANCE.getEBooleanObject(),
+ EcorePackage.eINSTANCE.getEByteObject(), EcorePackage.eINSTANCE.getECharacterObject(),
+ EcorePackage.eINSTANCE.getEDoubleObject(), EcorePackage.eINSTANCE.getEFloatObject(),
+ EcorePackage.eINSTANCE.getEIntegerObject(), EcorePackage.eINSTANCE.getELongObject(),
EcorePackage.eINSTANCE.getEShortObject(), }));
public static EcoreDataTypes INSTANCE = new EcoreDataTypes();
@@ -106,19 +96,13 @@ public class EcoreDataTypes {
public String getTargetTypeName(PAnnotatedEAttribute aAttribute) {
final EAttribute eAttribute = aAttribute.getModelEAttribute();
// check on equality on object.class is used for listunion simpleunions
- final Class<?> instanceClass = eAttribute.getEAttributeType()
- .getInstanceClass();
+ final Class<?> instanceClass = eAttribute.getEAttributeType().getInstanceClass();
if (instanceClass != null && !Object.class.equals(instanceClass)
&& !List.class.equals(instanceClass)) {
if (instanceClass.isArray()) {
// get rid of the [] at the end
- return eAttribute
- .getEType()
- .getInstanceClassName()
- .substring(
- 0,
- eAttribute.getEType().getInstanceClassName()
- .length() - 2);
+ return eAttribute.getEType().getInstanceClassName()
+ .substring(0, eAttribute.getEType().getInstanceClassName().length() - 2);
}
return instanceClass.getName();
}
@@ -131,8 +115,7 @@ public class EcoreDataTypes {
// of target
// entities this is required for listunion types but is not
// according to the ejb3 spec!
- ArrayList<EClassifier> eclassifiers = getItemTypes((EDataType) eAttribute
- .getEType());
+ ArrayList<EClassifier> eclassifiers = getItemTypes((EDataType) eAttribute.getEType());
if (eclassifiers.size() > 0) {
StringBuffer result = new StringBuffer();
for (int i = 0; i < eclassifiers.size(); i++) {
@@ -153,11 +136,9 @@ public class EcoreDataTypes {
if (eDataType == null) {
return result;
}
- final String itemType = getEAnnotationValue(eDataType,
- ANNOTATION_SOURCE_METADATA, "itemType");
+ final String itemType = getEAnnotationValue(eDataType, ANNOTATION_SOURCE_METADATA, "itemType");
if (itemType != null) {
- final EClassifier eClassifier = getEClassifier(
- eDataType.getEPackage(), itemType);
+ final EClassifier eClassifier = getEClassifier(eDataType.getEPackage(), itemType);
if (eClassifier != null) {
result.add(eClassifier);
}
@@ -165,13 +146,12 @@ public class EcoreDataTypes {
return result;
}
- final String memberTypes = getEAnnotationValue(eDataType,
- ANNOTATION_SOURCE_METADATA, "memberTypes");
+ final String memberTypes = getEAnnotationValue(eDataType, ANNOTATION_SOURCE_METADATA,
+ "memberTypes");
if (memberTypes != null) {
String[] mtypes = memberTypes.split(" ");
for (String element : mtypes) {
- final EClassifier eclassifier = getEClassifier(
- eDataType.getEPackage(), element);
+ final EClassifier eclassifier = getEClassifier(eDataType.getEPackage(), element);
if (eclassifier != null) {
result.addAll(getItemTypes((EDataType) eclassifier));
}
@@ -179,11 +159,9 @@ public class EcoreDataTypes {
return result;
}
- final String baseType = getEAnnotationValue(eDataType,
- ANNOTATION_SOURCE_METADATA, "baseType");
+ final String baseType = getEAnnotationValue(eDataType, ANNOTATION_SOURCE_METADATA, "baseType");
if (baseType != null) {
- final EClassifier eClassifier = getEClassifier(
- eDataType.getEPackage(), baseType);
+ final EClassifier eClassifier = getEClassifier(eDataType.getEPackage(), baseType);
if (eClassifier != null) {
final ArrayList<EClassifier> tmpResult = getItemTypes((EDataType) eClassifier);
if (tmpResult.size() > 0) {
@@ -199,18 +177,15 @@ public class EcoreDataTypes {
}
/**
- * Returns the eclassifier using either the name of the eclassifier or the
- * name element
+ * Returns the eclassifier using either the name of the eclassifier or the name element
*/
public EClassifier getEClassifier(EPackage epackage, String searchName) {
for (EClassifier eclassifier : epackage.getEClassifiers()) {
if (eclassifier.getName().compareTo(searchName) == 0) {
return eclassifier;
}
- String nameAnnotation = getEAnnotationValue(eclassifier,
- ANNOTATION_SOURCE_METADATA, "name");
- if (nameAnnotation != null
- && searchName.compareTo(nameAnnotation) == 0) {
+ String nameAnnotation = getEAnnotationValue(eclassifier, ANNOTATION_SOURCE_METADATA, "name");
+ if (nameAnnotation != null && searchName.compareTo(nameAnnotation) == 0) {
return eclassifier;
}
}
@@ -218,8 +193,7 @@ public class EcoreDataTypes {
}
/** Returns the value of an annotation with a certain key */
- public String getEAnnotationValue(EModelElement eModelElement,
- String source, String key) {
+ public String getEAnnotationValue(EModelElement eModelElement, String source, String key) {
final EAnnotation eAnnotation = eModelElement.getEAnnotation(source);
if (eAnnotation == null) {
return null;
@@ -231,8 +205,7 @@ public class EcoreDataTypes {
/** Return a XMLGregorianCalendar on the basis of the date */
public XMLGregorianCalendar getXMLGregorianCalendar(Date date) {
- final XMLGregorianCalendar gregCalendar = dataTypeFactory
- .newXMLGregorianCalendar();
+ final XMLGregorianCalendar gregCalendar = dataTypeFactory.newXMLGregorianCalendar();
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
gregCalendar.setYear(calendar.get(Calendar.YEAR));
@@ -245,8 +218,7 @@ public class EcoreDataTypes {
/** Return a XMLGregorianCalendar on datetime level (milliseconds) */
public XMLGregorianCalendar getXMLGregorianCalendarDateTime(Date date) {
- final XMLGregorianCalendar gregCalendar = dataTypeFactory
- .newXMLGregorianCalendar();
+ final XMLGregorianCalendar gregCalendar = dataTypeFactory.newXMLGregorianCalendar();
final Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
gregCalendar.setYear(calendar.get(Calendar.YEAR));
@@ -262,16 +234,15 @@ public class EcoreDataTypes {
}
/**
- * @return Returns an immutable list of the Ecore EDataType for java
- * primitives.
+ * @return Returns an immutable list of the Ecore EDataType for java primitives.
*/
public List<EDataType> getEPrimitives() {
return PRIMITIVES_ETYPES_LIST;
}
/**
- * @return Returns true if and only if the the given eDataType is the Ecore
- * EDataType for a primitive type.
+ * @return Returns true if and only if the the given eDataType is the Ecore EDataType for a
+ * primitive type.
*/
public boolean isEPrimitive(EDataType eDataType) {
return eDataType != null && isPrimitive(eDataType.getInstanceClass());
@@ -285,16 +256,15 @@ public class EcoreDataTypes {
}
/**
- * @return Returns an immutable list of the Ecore EDataType for java
- * primitive wrapper classes.
+ * @return Returns an immutable list of the Ecore EDataType for java primitive wrapper classes.
*/
public List<EDataType> getEWrappers() {
return WRAPPERS_ETYPES_LIST;
}
/**
- * @return Returns true if and only if the the given eDataType is the Ecore
- * EDataType for a primitive wrapper class.
+ * @return Returns true if and only if the the given eDataType is the Ecore EDataType for a
+ * primitive wrapper class.
*/
public boolean isEWrapper(EDataType eDataType) {
return WRAPPERS_ETYPES_LIST.contains(eDataType);
@@ -331,15 +301,14 @@ public class EcoreDataTypes {
return true;
}
/*
- * There is some ambiguity around the Java Date class since it can also
- * hold time - a conflict with the DateTime class
+ * There is some ambiguity around the Java Date class since it can also hold time - a conflict
+ * with the DateTime class
*/
Class<?> ic = eDataType.getInstanceClass();
// do a string comparison to prevent another dependency for this teneo
// library.
if (eDataType.getInstanceClassName() != null
- && eDataType.getInstanceClassName().compareTo(
- po.getXSDDateClass()) == 0) {
+ && eDataType.getInstanceClassName().compareTo(po.getXSDDateClass()) == 0) {
return true;
}
return java.util.Date.class == ic || java.util.Calendar.class == ic
@@ -347,17 +316,15 @@ public class EcoreDataTypes {
}
/**
- * @return true if and only if the given dataType is a datetime/timestamp
- * datatype.
+ * @return true if and only if the given dataType is a datetime/timestamp datatype.
*/
public boolean isETime(EDataType eDataType) {
if (eDataType.equals(xmlTimeEDataType)) {
return true;
}
/*
- * the InstanceClass for date type can be "Object" for XSD types. I'm
- * not sure about ecore itself so I have kept the original check against
- * the java classes.
+ * the InstanceClass for date type can be "Object" for XSD types. I'm not sure about ecore
+ * itself so I have kept the original check against the java classes.
*/
Class<?> ic = eDataType.getInstanceClass();
// already handled through the first if
@@ -369,17 +336,15 @@ public class EcoreDataTypes {
}
/**
- * @return true if and only if the given dataType is a datetime/timestamp
- * datatype.
+ * @return true if and only if the given dataType is a datetime/timestamp datatype.
*/
public boolean isEDateTime(EDataType eDataType) {
if (eDataType.equals(xmlDateTimeEDataType)) {
return true;
}
/*
- * the InstanceClass for date type can be "Object" for XSD types. I'm
- * not sure about ecore itself so I have kept the original check against
- * the java classes.
+ * the InstanceClass for date type can be "Object" for XSD types. I'm not sure about ecore
+ * itself so I have kept the original check against the java classes.
*/
Class<?> ic = eDataType.getInstanceClass();
// already handled through the first if
@@ -391,13 +356,13 @@ public class EcoreDataTypes {
}
/**
- * @return Returns true if and only if the given type is either a primitive
- * or a wrapper or string or a date.
+ * @return Returns true if and only if the given type is either a primitive or a wrapper or string
+ * or a date.
*/
public boolean isSimpleType(EDataType eType, PersistenceOptions po) {
// TODO move elsewhere
- return isEPrimitive(eType) || isEWrapper(eType) || isEString(eType)
- || isEDate(eType, po) || isEDateTime(eType);
+ return isEPrimitive(eType) || isEWrapper(eType) || isEString(eType) || isEDate(eType, po)
+ || isEDateTime(eType);
}
/**
@@ -427,8 +392,7 @@ public class EcoreDataTypes {
public boolean isByteArray(EDataType eType) {
final Class<?> clazz = eType.getInstanceClass();
if (clazz != null) {
- return (clazz.isArray() && clazz.getComponentType().equals(
- Byte.TYPE));
+ return (clazz.isArray() && clazz.getComponentType().equals(Byte.TYPE));
}
return false;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/FieldUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/FieldUtil.java
index fc58f5a9f..ddec40db3 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/FieldUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/FieldUtil.java
@@ -63,7 +63,8 @@ public class FieldUtil {
}
/**
- * Get the value for a field, first the field is accessed directly if not found then the getter is called.
+ * Get the value for a field, first the field is accessed directly if not found then the getter is
+ * called.
*/
public static Object callGetter(Object target, String fieldName) {
try {
@@ -77,7 +78,8 @@ public class FieldUtil {
}
return callMethod(target, method.getName(), new Object[0]);
} catch (Exception e) {
- throw new TeneoException("Exception getting " + fieldName + " from " + target.getClass().getName(), e);
+ throw new TeneoException("Exception getting " + fieldName + " from "
+ + target.getClass().getName(), e);
}
}
@@ -92,15 +94,16 @@ public class FieldUtil {
final Field field = getField(target.getClass(), fieldName);
field.set(target, value);
} catch (Exception e) {
- throw new TeneoException("Exception setting " + fieldName + " from " + target.getClass().getName()
- + " to value " + value + " of type " + (value != null ? value.getClass().getName() : ""), e);
+ throw new TeneoException("Exception setting " + fieldName + " from "
+ + target.getClass().getName() + " to value " + value + " of type "
+ + (value != null ? value.getClass().getName() : ""), e);
}
}
/**
- * Returns a field using a certain name, walks up the class hierarchy to find the field, will make the field
- * accessible also. Is a bit rough because it does a case insensitive search. Note if the field is not found an
- * exception is thrown.
+ * Returns a field using a certain name, walks up the class hierarchy to find the field, will make
+ * the field accessible also. Is a bit rough because it does a case insensitive search. Note if
+ * the field is not found an exception is thrown.
*/
public static Field getField(Class<?> clazz, String fieldName) {
Field field = (Field) fieldMethodCache.get(clazz.getName() + "." + fieldName);
@@ -119,7 +122,8 @@ public class FieldUtil {
}
} catch (Exception e) // todo replace with specific exception
{
- throw new TeneoException("Field " + fieldName + " not accessible for class: " + clazz.getName(), e);
+ throw new TeneoException("Field " + fieldName + " not accessible for class: "
+ + clazz.getName(), e);
}
if (field == null) {
return null;
@@ -148,12 +152,14 @@ public class FieldUtil {
}
/** Does the actual search for the method */
- private static Method getMethodInternal(Class<?> clazz, String methodName, int numOfParams) throws Exception {
+ private static Method getMethodInternal(Class<?> clazz, String methodName, int numOfParams)
+ throws Exception {
if (clazz == null) {
return null;
}
- final Method method = (Method) fieldMethodCache.get(clazz.getName() + "." + methodName + "." + numOfParams);
+ final Method method = (Method) fieldMethodCache.get(clazz.getName() + "." + methodName + "."
+ + numOfParams);
if (method != null) {
return method;
}
diff --git a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/StoreUtil.java b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/StoreUtil.java
index 6e2669e0f..c7100cf96 100755
--- a/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/StoreUtil.java
+++ b/core/org.eclipse.emf.teneo/src/org/eclipse/emf/teneo/util/StoreUtil.java
@@ -77,49 +77,43 @@ public class StoreUtil {
/** The Annotation source name */
public static final String ANNOTATION_SOURCE = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
- public static void resetSyntheticListInfo(EStructuralFeature eFeature,
- Object target) {
+ public static void resetSyntheticListInfo(EStructuralFeature eFeature, Object target) {
if (target == null || eFeature instanceof EAttribute) {
return;
}
PersistentStoreAdapter persistentStoreAdapter = StoreUtil
.getPersistentStoreAdapter((EObject) target);
- persistentStoreAdapter.setSyntheticProperty(StoreUtil
- .getExtraLazyInverseIndexPropertyName(eFeature), null);
- persistentStoreAdapter.setSyntheticProperty(StoreUtil
- .getExtraLazyInversePropertyName(eFeature), null);
+ persistentStoreAdapter.setSyntheticProperty(
+ StoreUtil.getExtraLazyInverseIndexPropertyName(eFeature), null);
+ persistentStoreAdapter.setSyntheticProperty(
+ StoreUtil.getExtraLazyInversePropertyName(eFeature), null);
}
- public static void setSyntheticListIndex(EStructuralFeature eFeature,
- Object target, Integer value) {
+ public static void setSyntheticListIndex(EStructuralFeature eFeature, Object target, Integer value) {
if (eFeature instanceof EAttribute) {
return;
}
PersistentStoreAdapter persistentStoreAdapter = StoreUtil
.getPersistentStoreAdapter((EObject) target);
- persistentStoreAdapter.setSyntheticProperty(StoreUtil
- .getExtraLazyInverseIndexPropertyName(eFeature), value);
+ persistentStoreAdapter.setSyntheticProperty(
+ StoreUtil.getExtraLazyInverseIndexPropertyName(eFeature), value);
}
- public static void setSyntheticListOwner(EStructuralFeature eFeature,
- Object target, Object owner) {
+ public static void setSyntheticListOwner(EStructuralFeature eFeature, Object target, Object owner) {
if (eFeature instanceof EAttribute) {
return;
}
PersistentStoreAdapter persistentStoreAdapter = StoreUtil
.getPersistentStoreAdapter((EObject) target);
- persistentStoreAdapter.setSyntheticProperty(StoreUtil
- .getExtraLazyInversePropertyName(eFeature), owner);
+ persistentStoreAdapter.setSyntheticProperty(
+ StoreUtil.getExtraLazyInversePropertyName(eFeature), owner);
}
- public static String getExtraLazyInversePropertyName(
- EStructuralFeature eFeature) {
- return eFeature.getEContainingClass().getName()
- + eFeature.getName();
+ public static String getExtraLazyInversePropertyName(EStructuralFeature eFeature) {
+ return eFeature.getEContainingClass().getName() + eFeature.getName();
}
- public static String getExtraLazyInverseIndexPropertyName(
- EStructuralFeature eFeature) {
+ public static String getExtraLazyInverseIndexPropertyName(EStructuralFeature eFeature) {
return getExtraLazyInversePropertyName(eFeature) + "idx";
}
@@ -132,7 +126,8 @@ public class StoreUtil {
/** Reads the epackages present in the passed ecore files. */
public static List<EPackage> readEPackages(String[] ecoreFiles) {
final ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("*", new EcoreResourceFactoryImpl());
+ resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
+ .put("*", new EcoreResourceFactoryImpl());
final ArrayList<EPackage> epackages = new ArrayList<EPackage>();
for (String element : ecoreFiles) {
@@ -147,8 +142,8 @@ public class StoreUtil {
final EObject obj = it.next();
if (obj instanceof EPackage) {
final EPackage epack = (EPackage) obj;
- final EPackage currentEPackage = PackageRegistryProvider.getInstance().getPackageRegistry()
- .getEPackage(epack.getNsURI());
+ final EPackage currentEPackage = PackageRegistryProvider.getInstance()
+ .getPackageRegistry().getEPackage(epack.getNsURI());
if (currentEPackage != null) { // use the existing epackage
if (!epackages.contains(currentEPackage)) {
epackages.add(currentEPackage);
@@ -164,8 +159,8 @@ public class StoreUtil {
}
/**
- * Returns true if the passed EStructuralFeature represents a map. Note that the method also handles EAttribute
- * (returns false) for convenience reasons.
+ * Returns true if the passed EStructuralFeature represents a map. Note that the method also
+ * handles EAttribute (returns false) for convenience reasons.
*/
public static boolean isMap(EStructuralFeature eStructuralFeature) {
if (eStructuralFeature instanceof EAttribute) {
@@ -179,7 +174,8 @@ public class StoreUtil {
public static boolean isMapEntry(EClass eclass) {
return eclass != null && eclass.getInstanceClass() != null
&& Map.Entry.class.isAssignableFrom(eclass.getInstanceClass())
- && eclass.getEStructuralFeatures().size() == 2 && eclass.getEStructuralFeature("key") != null
+ && eclass.getEStructuralFeatures().size() == 2
+ && eclass.getEStructuralFeature("key") != null
&& eclass.getEStructuralFeature("value") != null;
}
@@ -213,44 +209,52 @@ public class StoreUtil {
}
/**
- * Translates an ECLass to a string representation public static String getEClassURI(EClass eclass, String qualify)
- * { if (eclass == EOBJECT_ECLASS) { return EOBJECT_ECLASS_URI; } if (qualify == null ||
- * qualify.compareTo(PersistenceOptions.QUALIFY_ENTITY_NAME_NO) == 0) { return eclass.getName(); } else if
- * (qualify.compareTo(PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX) == 0) { return
- * eclass.getEPackage().getNsPrefix() + "." + eclass.getName(); } throw new StoreException("Qualify type " + qualify
- * + " unknown"); } /** Returns an estructuralfeature on the basis of the name of the eclass and the name of the
- * feature itself. public static EStructuralFeature getEStructuralFeature(String eclassURI, String featureName,
- * EPackage[] epackages) { EClass eclass = getEClassFromURI(eclassURI, epackages); if (eclass == null) return null;
- * return eclass.getEStructuralFeature(featureName); } /* /** Translates an eclass uri back to an eclass / public
- * static EClass getEClassFromURI(String theEClassURI) { final Registry packageRegistry = Registry.INSTANCE; final
- * EPackage[] epacks = new EPackage[packageRegistry.size()]; int cnt = 0; for (Iterator it =
- * packageRegistry.values().iterator(); it.hasNext();) { final EPackage epack = (EPackage) it.next(); epacks[cnt++]
- * = epack; } return getEClassFromURI(theEClassURI, epacks); } /** Translates an eclass uri back to an eclass /
- * public static EClass getEClassFromURI(String theEClassURI, EPackage[] epackages, EClassNameStrategy nameStrategy)
- * { if (theEClassURI.compareTo(EOBJECT_ECLASS_URI) == 0) { return EcorePackage.eINSTANCE.getEObject(); } String
- * nsPrefix = null; String eClassName = theEClassURI; if (eClassName.indexOf(NSPREFIX_ECLASS_SEPARATOR) != -1) {
- * nsPrefix = theEClassURI.substring(0, eClassName.lastIndexOf(NSPREFIX_ECLASS_SEPARATOR)); eClassName =
- * theEClassURI.substring(1 + eClassName.lastIndexOf(NSPREFIX_ECLASS_SEPARATOR)); } ArrayList eclasses = new
- * ArrayList(); for (int i = 0; i < epackages.length; i++) { EPackage epack = epackages[i]; if (nsPrefix != null &&
- * epack.getNsPrefix() != null && epack.getNsPrefix().compareTo(nsPrefix) != 0) { continue; } EClassifier
- * eclassifier = epack.getEClassifier(eClassName); if (eclassifier instanceof EClass) { eclasses.add(eclassifier); }
- * } if (eclasses.size() == 1) { return (EClass) eclasses.get(0); } else if (eclasses.size() == 0) { return null; //
- * throw new StoreException("The uri " + eclassURI + " can not be translated to an eclass"); } else { StringBuffer
- * eclassList = new StringBuffer(); for (Iterator it = eclasses.iterator(); it.hasNext();) { EClass eclass =
- * (EClass) it.next(); eclassList.append(eclass.getEPackage().getNsURI() + "/" + eclass.getName()); } throw new
- * StoreException("The uri " + eClassName + " maps to multiple eclasses: " + eclassList.toString()); } /* int
- * lastIndex = eclassURI.lastIndexOf(PATH_SEPARATOR); if (lastIndex == -1) { throw new
- * StoreAnnotationsException("The uri: " + eclassURI + " has an illegal format, it can not parsed to an eclass."); }
- * final String nsuri = eclassURI.substring(0, lastIndex); final String name = eclassURI.substring(lastIndex + 1);
- * final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry().getEPackage(nsuri); if (epack
- * == null) { throw new StoreAnnotationsException("No package found for the nsuri: " + nsuri +
- * " using the eclassURI " + eclassURI); } final EClass eclass = (EClass)epack.getEClassifier(name); if (eclass ==
- * null) { throw new StoreAnnotationsException("The nsuri " + nsuri + " and eclassname: " + name +
+ * Translates an ECLass to a string representation public static String getEClassURI(EClass
+ * eclass, String qualify) { if (eclass == EOBJECT_ECLASS) { return EOBJECT_ECLASS_URI; } if
+ * (qualify == null || qualify.compareTo(PersistenceOptions.QUALIFY_ENTITY_NAME_NO) == 0) { return
+ * eclass.getName(); } else if (qualify.compareTo(PersistenceOptions.QUALIFY_ENTITY_NAME_NSPREFIX)
+ * == 0) { return eclass.getEPackage().getNsPrefix() + "." + eclass.getName(); } throw new
+ * StoreException("Qualify type " + qualify + " unknown"); } /** Returns an estructuralfeature on
+ * the basis of the name of the eclass and the name of the feature itself. public static
+ * EStructuralFeature getEStructuralFeature(String eclassURI, String featureName, EPackage[]
+ * epackages) { EClass eclass = getEClassFromURI(eclassURI, epackages); if (eclass == null) return
+ * null; return eclass.getEStructuralFeature(featureName); } /* /** Translates an eclass uri back
+ * to an eclass / public static EClass getEClassFromURI(String theEClassURI) { final Registry
+ * packageRegistry = Registry.INSTANCE; final EPackage[] epacks = new
+ * EPackage[packageRegistry.size()]; int cnt = 0; for (Iterator it =
+ * packageRegistry.values().iterator(); it.hasNext();) { final EPackage epack = (EPackage)
+ * it.next(); epacks[cnt++] = epack; } return getEClassFromURI(theEClassURI, epacks); } /**
+ * Translates an eclass uri back to an eclass / public static EClass getEClassFromURI(String
+ * theEClassURI, EPackage[] epackages, EClassNameStrategy nameStrategy) { if
+ * (theEClassURI.compareTo(EOBJECT_ECLASS_URI) == 0) { return EcorePackage.eINSTANCE.getEObject();
+ * } String nsPrefix = null; String eClassName = theEClassURI; if
+ * (eClassName.indexOf(NSPREFIX_ECLASS_SEPARATOR) != -1) { nsPrefix = theEClassURI.substring(0,
+ * eClassName.lastIndexOf(NSPREFIX_ECLASS_SEPARATOR)); eClassName = theEClassURI.substring(1 +
+ * eClassName.lastIndexOf(NSPREFIX_ECLASS_SEPARATOR)); } ArrayList eclasses = new ArrayList(); for
+ * (int i = 0; i < epackages.length; i++) { EPackage epack = epackages[i]; if (nsPrefix != null &&
+ * epack.getNsPrefix() != null && epack.getNsPrefix().compareTo(nsPrefix) != 0) { continue; }
+ * EClassifier eclassifier = epack.getEClassifier(eClassName); if (eclassifier instanceof EClass)
+ * { eclasses.add(eclassifier); } } if (eclasses.size() == 1) { return (EClass) eclasses.get(0); }
+ * else if (eclasses.size() == 0) { return null; // throw new StoreException("The uri " +
+ * eclassURI + " can not be translated to an eclass"); } else { StringBuffer eclassList = new
+ * StringBuffer(); for (Iterator it = eclasses.iterator(); it.hasNext();) { EClass eclass =
+ * (EClass) it.next(); eclassList.append(eclass.getEPackage().getNsURI() + "/" +
+ * eclass.getName()); } throw new StoreException("The uri " + eClassName +
+ * " maps to multiple eclasses: " + eclassList.toString()); } /* int lastIndex =
+ * eclassURI.lastIndexOf(PATH_SEPARATOR); if (lastIndex == -1) { throw new
+ * StoreAnnotationsException("The uri: " + eclassURI +
+ * " has an illegal format, it can not parsed to an eclass."); } final String nsuri =
+ * eclassURI.substring(0, lastIndex); final String name = eclassURI.substring(lastIndex + 1);
+ * final EPackage epack = PackageRegistryProvider
+ * .getInstance().getPackageRegistry().getEPackage(nsuri); if (epack == null) { throw new
+ * StoreAnnotationsException("No package found for the nsuri: " + nsuri + " using the eclassURI "
+ * + eclassURI); } final EClass eclass = (EClass)epack.getEClassifier(name); if (eclass == null) {
+ * throw new StoreAnnotationsException("The nsuri " + nsuri + " and eclassname: " + name +
* " does not resolve to an EClass"); } return eclass; / }
*/
/** Sends out a notification of an elist load */
- public static void dispatchEListLoadNotification(final EObject notifier, final EList<? extends EObject> elist,
- final EStructuralFeature feature) {
+ public static void dispatchEListLoadNotification(final EObject notifier,
+ final EList<? extends EObject> elist, final EStructuralFeature feature) {
notifier.eNotify(new NotificationImpl(Constants.ELIST_LOAD_NOTIFICATION, null, elist) {
@Override
public Object getNotifier() {
@@ -270,7 +274,18 @@ public class StoreUtil {
}
/**
- * Returns the string which is used to store the unique identification of this structuralfeature in the db
+ * Returns a unique string for an eclass
+ */
+ public static String eClassToString(EClass eClass) {
+ final String nsuri = eClass.getEPackage().getNsURI();
+ final String eclassName = eClass.getName();
+
+ return nsuri + PATH_SEPARATOR + eclassName;
+ }
+
+ /**
+ * Returns the string which is used to store the unique identification of this structuralfeature
+ * in the db
*/
public static String structuralFeatureToString(EStructuralFeature structuralFeature) {
// the unique id will consist of three part: 1) package NSURI, 2) EClass
@@ -284,7 +299,8 @@ public class StoreUtil {
/** Returns true if the passed feature is a wildcard feature */
public static boolean isWildCard(EStructuralFeature feature) {
- EAnnotation eAnnotation = feature.getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
+ EAnnotation eAnnotation = feature
+ .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
if (eAnnotation == null) {
return false;
}
@@ -293,28 +309,30 @@ public class StoreUtil {
return kind != null && kind.compareTo("elementWildcard") == 0 && wildcards != null;
/*
* // todo optimise this with a cache final EAnnotation eannotation = feature
- * .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData" ); if (eannotation != null) { final
- * String kind = (String)eannotation.getDetails().get("kind"); final String wildcards =
- * (String)eannotation.getDetails().get("wildcards"); if (wildcards != null && kind != null &&
- * "elementWildcard".compareTo(kind) == 0) { return true; } } return false;
+ * .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData" ); if (eannotation !=
+ * null) { final String kind = (String)eannotation.getDetails().get("kind"); final String
+ * wildcards = (String)eannotation.getDetails().get("wildcards"); if (wildcards != null && kind
+ * != null && "elementWildcard".compareTo(kind) == 0) { return true; } } return false;
*/
}
/** Returns true if the passed feature is a wildcard feature */
public static boolean isMixed(EStructuralFeature feature) {
- EAnnotation eAnnotation = feature.getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
+ EAnnotation eAnnotation = feature
+ .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData");
if (eAnnotation == null) {
return false;
}
final String kind = eAnnotation.getDetails().get("kind");
final String name = eAnnotation.getDetails().get("name");
- return kind != null && kind.compareTo("elementWildcard") == 0 && name != null && name.compareTo(":mixed") == 0;
+ return kind != null && kind.compareTo("elementWildcard") == 0 && name != null
+ && name.compareTo(":mixed") == 0;
/*
* // todo optimise this with a cache final EAnnotation eannotation = feature
- * .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData" ); if (eannotation != null) { final
- * String kind = (String)eannotation.getDetails().get("kind"); final String wildcards =
- * (String)eannotation.getDetails().get("wildcards"); if (wildcards != null && kind != null &&
- * "elementWildcard".compareTo(kind) == 0) { return true; } } return false;
+ * .getEAnnotation("http:///org/eclipse/emf/ecore/util/ExtendedMetaData" ); if (eannotation !=
+ * null) { final String kind = (String)eannotation.getDetails().get("kind"); final String
+ * wildcards = (String)eannotation.getDetails().get("wildcards"); if (wildcards != null && kind
+ * != null && "elementWildcard".compareTo(kind) == 0) { return true; } } return false;
*/
}
@@ -334,9 +352,11 @@ public class StoreUtil {
final String eclassName = strid.substring(beforeLastIndex + 1, lastIndex);
final String featureName = strid.substring(lastIndex + 1);
- final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry().getEPackage(nsuri);
+ final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(nsuri);
if (epack == null) {
- throw new TeneoException("The dbid " + strid + " and nsuri: " + nsuri + " does not resolve to an epackage");
+ throw new TeneoException("The dbid " + strid + " and nsuri: " + nsuri
+ + " does not resolve to an epackage");
}
final EClass eclass = (EClass) epack.getEClassifier(eclassName);
@@ -354,6 +374,32 @@ public class StoreUtil {
return structFeature;
}
+ /** Translates a string to a eclass */
+ public static EClass stringToEClass(String strid) {
+ int lastIndex = strid.lastIndexOf(PATH_SEPARATOR);
+
+ if (lastIndex == -1) {
+ throw new TeneoException("Invalid eclass string " + strid);
+ }
+
+ final String nsuri = strid.substring(0, lastIndex);
+ final String eclassName = strid.substring(lastIndex + 1);
+
+ final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(nsuri);
+ if (epack == null) {
+ throw new TeneoException("The strid " + strid + " and nsuri: " + nsuri
+ + " does not resolve to an epackage");
+ }
+
+ final EClass eClass = (EClass) epack.getEClassifier(eclassName);
+ if (eClass == null) {
+ throw new TeneoException("The strid " + strid + " and eclassname: " + eclassName
+ + " does not resolve to an eclass");
+ }
+ return eClass;
+ }
+
/**
* Returns the string which is used to store the unique identification of the passed edatatype
*/
@@ -376,9 +422,11 @@ public class StoreUtil {
final String nsuri = strid.substring(0, lastIndex);
final String name = strid.substring(lastIndex + 1);
- final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry().getEPackage(nsuri);
+ final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(nsuri);
if (epack == null) {
- throw new TeneoException("The dbid " + strid + " and nsuri: " + nsuri + " does not resolve to an epackage");
+ throw new TeneoException("The dbid " + strid + " and nsuri: " + nsuri
+ + " does not resolve to an epackage");
}
final EDataType edatatype = (EDataType) epack.getEClassifier(name);
@@ -390,7 +438,8 @@ public class StoreUtil {
}
/**
- * Based on the eobject and the fieldname returns the structural feature. Caching should be added here.
+ * Based on the eobject and the fieldname returns the structural feature. Caching should be added
+ * here.
*/
public static EStructuralFeature getEStructuralFeature(EObject emfObj, String fieldName) {
return getEStructuralFeature(emfObj.eClass(), fieldName);
@@ -411,7 +460,8 @@ public class StoreUtil {
}
/**
- * Based on the eclass and the fieldname returns the structural feature. Caching should be added here.
+ * Based on the eclass and the fieldname returns the structural feature. Caching should be added
+ * here.
*/
public static EStructuralFeature getEStructuralFeature(EClass eclass, String fieldName) {
EStructuralFeature reserve = null;
@@ -472,7 +522,8 @@ public class StoreUtil {
}
/**
- * Returns the name used for the group feature, if the feature is not a group then null is returned
+ * Returns the name used for the group feature, if the feature is not a group then null is
+ * returned
*/
public static String getGroupName(EStructuralFeature estruct) {
final EAnnotation annotation = estruct.getEAnnotation(ANNOTATION_SOURCE);
@@ -509,12 +560,13 @@ public class StoreUtil {
final EStructuralFeature ef = ExtendedMetaData.INSTANCE.getGroup(estruct);
return ef == groupFeature;
/*
- * final EAnnotation annotation = estruct.getEAnnotation(ANNOTATION_SOURCE); if (annotation == null) return
- * false; final EMap map = annotation.getDetails(); final Iterator keys = map.keySet().iterator(); while
- * (keys.hasNext()) { final String key = (String)keys.next(); final String value = (String)map.get(key); // for
- * a choice the groupName in the group element starts with # for substitution it // doesn't therefore the
- * endsWith if ("group".compareTo(key) == 0 && value != null && groupName.endsWith(value)) { return true; } }
- * return false;
+ * final EAnnotation annotation = estruct.getEAnnotation(ANNOTATION_SOURCE); if (annotation ==
+ * null) return false; final EMap map = annotation.getDetails(); final Iterator keys =
+ * map.keySet().iterator(); while (keys.hasNext()) { final String key = (String)keys.next();
+ * final String value = (String)map.get(key); // for a choice the groupName in the group element
+ * starts with # for substitution it // doesn't therefore the endsWith if
+ * ("group".compareTo(key) == 0 && value != null && groupName.endsWith(value)) { return true; }
+ * } return false;
*/
}
@@ -523,11 +575,12 @@ public class StoreUtil {
final EStructuralFeature ef = ExtendedMetaData.INSTANCE.getGroup(estruct);
return ef != null && ef != estruct;
/*
- * // group elements are always transient if (!estruct.isTransient()) return false; final EAnnotation annotation
- * = estruct.getEAnnotation(ANNOTATION_SOURCE); if (annotation == null) return false; final EMap map =
- * annotation.getDetails(); final Iterator keys = map.keySet().iterator(); while (keys.hasNext()) { final String
- * key = (String)keys.next(); final String value = (String)map.get(key); if ("group".compareTo(key) == 0 &&
- * value != null) return true; } return false;
+ * // group elements are always transient if (!estruct.isTransient()) return false; final
+ * EAnnotation annotation = estruct.getEAnnotation(ANNOTATION_SOURCE); if (annotation == null)
+ * return false; final EMap map = annotation.getDetails(); final Iterator keys =
+ * map.keySet().iterator(); while (keys.hasNext()) { final String key = (String)keys.next();
+ * final String value = (String)map.get(key); if ("group".compareTo(key) == 0 && value != null)
+ * return true; } return false;
*/
}
@@ -551,8 +604,8 @@ public class StoreUtil {
final String[] epacknsuris = nsuris.split(",");
final EPackage[] epacks = new EPackage[epacknsuris.length];
for (int i = 0; i < epacknsuris.length; i++) {
- final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry().getEPackage(
- epacknsuris[i]);
+ final EPackage epack = PackageRegistryProvider.getInstance().getPackageRegistry()
+ .getEPackage(epacknsuris[i]);
if (epack == null) {
throw new TeneoException("EPackage with nsuri: " + epacknsuris[i] + " can not be found,");
}
@@ -615,7 +668,8 @@ public class StoreUtil {
final String className = clazz.getName();
final int classNameIndex = className.lastIndexOf(PACKAGE_SEPARATOR);
final String trunkClassName = className.substring(0, classNameIndex);
- final String startPath = PATH_SEPARATOR + trunkClassName.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
+ final String startPath = PATH_SEPARATOR
+ + trunkClassName.replace(PACKAGE_SEPARATOR, PATH_SEPARATOR);
buildPackagePathFromClassName(startPath, newPackagePathList);
}
@@ -623,7 +677,8 @@ public class StoreUtil {
}
/** Take care of one class */
- private static void buildPackagePathFromClassName(String path, ArrayList<String> newPackagePathList) {
+ private static void buildPackagePathFromClassName(String path,
+ ArrayList<String> newPackagePathList) {
if (newPackagePathList.contains(path + PATH_SEPARATOR)) {
return;
}
@@ -660,7 +715,8 @@ public class StoreUtil {
}
/**
- * Checks if an object has a HibernatePersistentStoreAdapter and if it doesn't creates one and returns it.
+ * Checks if an object has a HibernatePersistentStoreAdapter and if it doesn't creates one and
+ * returns it.
*/
public static PersistentStoreAdapter getPersistentStoreAdapter(EObject eObject) {
for (Adapter adapter : eObject.eAdapters()) {

Back to the top