Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Taal2012-12-30 03:29:57 -0500
committerMartin Taal2012-12-30 03:29:57 -0500
commitdf8fe2c89d0c1daab47505e860cdc5989aeb291f (patch)
tree2e863525d4682041c8c8a0a9f8710554f4fa833e /generator/org.eclipse.emf.texo.orm
parentcb0ac221d3b6cc9d3657ab25753d523052673fa1 (diff)
downloadorg.eclipse.emf.texo-df8fe2c89d0c1daab47505e860cdc5989aeb291f.tar.gz
org.eclipse.emf.texo-df8fe2c89d0c1daab47505e860cdc5989aeb291f.tar.xz
org.eclipse.emf.texo-df8fe2c89d0c1daab47505e860cdc5989aeb291f.zip
Fixes issue 397220, Entity Listener annotation not generated correctly
Diffstat (limited to 'generator/org.eclipse.emf.texo.orm')
-rwxr-xr-xgenerator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/EntityListenersImpl.java167
1 files changed, 95 insertions, 72 deletions
diff --git a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/EntityListenersImpl.java b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/EntityListenersImpl.java
index bc29f137..b6ca217d 100755
--- a/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/EntityListenersImpl.java
+++ b/generator/org.eclipse.emf.texo.orm/src/org/eclipse/emf/texo/orm/annotations/model/orm/impl/EntityListenersImpl.java
@@ -9,17 +9,11 @@ package org.eclipse.emf.texo.orm.annotations.model.orm.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
-
import org.eclipse.emf.common.util.EList;
-
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
-
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
-
import org.eclipse.emf.texo.orm.annotations.model.orm.EntityListener;
import org.eclipse.emf.texo.orm.annotations.model.orm.EntityListeners;
import org.eclipse.emf.texo.orm.annotations.model.orm.OrmPackage;
@@ -50,100 +44,129 @@ public class EntityListenersImpl extends BaseOrmAnnotationImpl implements Entity
protected EList<EntityListener> entityListener;
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
protected EntityListenersImpl() {
- super();
- }
+ super();
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
protected EClass eStaticClass() {
- return OrmPackage.eINSTANCE.getEntityListeners();
- }
+ return OrmPackage.eINSTANCE.getEntityListeners();
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
public EList<EntityListener> getEntityListener() {
- if (entityListener == null) {
- entityListener = new EObjectContainmentEList<EntityListener>(EntityListener.class, this, OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER);
- }
- return entityListener;
- }
+ if (entityListener == null) {
+ entityListener = new EObjectContainmentEList<EntityListener>(EntityListener.class, this,
+ OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER);
+ }
+ return entityListener;
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
- switch (featureID) {
- case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
- return ((InternalEList<?>)getEntityListener()).basicRemove(otherEnd, msgs);
- }
- return super.eInverseRemove(otherEnd, featureID, msgs);
- }
+ switch (featureID) {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
+ return ((InternalEList<?>) getEntityListener()).basicRemove(otherEnd, msgs);
+ }
+ return super.eInverseRemove(otherEnd, featureID, msgs);
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
- return getEntityListener();
- }
- return super.eGet(featureID, resolve, coreType);
- }
+ switch (featureID) {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
+ return getEntityListener();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
- getEntityListener().clear();
- getEntityListener().addAll((Collection<? extends EntityListener>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
+ switch (featureID) {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
+ getEntityListener().clear();
+ getEntityListener().addAll((Collection<? extends EntityListener>) newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public void eUnset(int featureID) {
- switch (featureID) {
- case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
- getEntityListener().clear();
- return;
- }
- super.eUnset(featureID);
- }
+ switch (featureID) {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
+ getEntityListener().clear();
+ return;
+ }
+ super.eUnset(featureID);
+ }
/**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
+ * <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
@Override
public boolean eIsSet(int featureID) {
- switch (featureID) {
- case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
- return entityListener != null && !entityListener.isEmpty();
- }
- return super.eIsSet(featureID);
- }
+ switch (featureID) {
+ case OrmPackage.ENTITY_LISTENERS__ENTITY_LISTENER:
+ return entityListener != null && !entityListener.isEmpty();
+ }
+ return super.eIsSet(featureID);
+ }
+ @Override
+ public String getJavaAnnotation(String identifier) {
+ final StringBuilder sb = new StringBuilder("@javax.persistence.EntityListeners");
+ if (getEntityListener().size() > 0) {
+ sb.append("(value={");
+ boolean addComma = false;
+ for (EntityListener el : getEntityListener()) {
+ if (el.getClass_() != null && el.getClass_().trim().length() > 0) {
+ if (addComma) {
+ sb.append(",");
+ }
+ sb.append(el.getClass_() + ".class");
+ addComma = true;
+ }
+ }
+ sb.append("}");
+ }
+ sb.append(")");
+ return sb.toString();
+ }
} // EntityListenersImpl

Back to the top