From tchemit@users.nuiton.org Mon Jun  3 08:38:58 2013
From: tchemit@users.nuiton.org
To: sandbox-commits@list.nuiton.org
Subject: [Sandbox-commits] r647 -
	nuiton-jpa/nuiton-jpa-templates/src/main/java/org/nuiton/jpa/templates
Date: Mon, 03 Jun 2013 08:38:58 +0200
Message-ID: <20130603063858.2DC381582D@nuiton.codelutin.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============6825540136211915195=="

--===============6825540136211915195==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Author: tchemit
Date: 2013-06-03 08:38:58 +0200 (Mon, 03 Jun 2013)
New Revision: 647

Url: http://nuiton.org/projects/sandbox/repository/revisions/647

Log:
can add a user contract on persistence context

Modified:
   nuiton-jpa/nuiton-jpa-templates/src/main/java/org/nuiton/jpa/templates/Jpa=
PersistenceContextTransformer.java

Modified: nuiton-jpa/nuiton-jpa-templates/src/main/java/org/nuiton/jpa/templa=
tes/JpaPersistenceContextTransformer.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- nuiton-jpa/nuiton-jpa-templates/src/main/java/org/nuiton/jpa/templates/Jp=
aPersistenceContextTransformer.java	2013-06-03 06:38:34 UTC (rev 646)
+++ nuiton-jpa/nuiton-jpa-templates/src/main/java/org/nuiton/jpa/templates/Jp=
aPersistenceContextTransformer.java	2013-06-03 06:38:58 UTC (rev 647)
@@ -30,7 +30,6 @@
 import org.nuiton.eugene.models.object.ObjectModelJavaModifier;
 import org.nuiton.eugene.models.object.ObjectModelOperation;
 import org.nuiton.jpa.api.AbstractJpaPersistenceContext;
-import org.nuiton.jpa.api.JpaEntityIdGenerator;
=20
 import javax.persistence.EntityManager;
 import java.util.List;
@@ -95,6 +94,15 @@
=20
         setSuperClass(output, superClass);
=20
+        // detect if there is a contract to set on abstract
+        String contractName =3D packageName + "." + model.getName() + "Persi=
stenceContext";
+
+        boolean addPersistenceContextContract =3D isInClassPath(contractName=
);
+
+        if (addPersistenceContextContract) {
+            addInterface(output, contractName);
+        }
+
         String idGenerator =3D
                 JpaTemplatesGeneratorUtil.getIdGeneratorTagValue(getModel());
=20


--===============6825540136211915195==--


