Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
August 2013
- 4 participants
- 17 discussions
r2800 - trunk/topia-persistence/src/main/java/org/nuiton/topia/generator
by tchemit@users.nuiton.org 15 Aug '13
by tchemit@users.nuiton.org 15 Aug '13
15 Aug '13
Author: tchemit
Date: 2013-08-15 12:50:33 +0200 (Thu, 15 Aug 2013)
New Revision: 2800
Url: http://nuiton.org/projects/topia/repository/revisions/2800
Log:
refs #1468: Make DAOHelper instantiable and not static anymore (adding a new template)
Added:
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java
Added: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java (rev 0)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java 2013-08-15 10:50:33 UTC (rev 2800)
@@ -0,0 +1,295 @@
+package org.nuiton.topia.generator;
+
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2010 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Lesser Public License for more details.
+ *
+ * You should have received a copy of the GNU General Lesser Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+ * #L%
+ */
+
+/*{generator option: parentheses = false}*/
+
+/*{generator option: writeString = +}*/
+
+import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.models.object.ObjectModel;
+import org.nuiton.eugene.models.object.ObjectModelClass;
+import org.nuiton.eugene.models.object.ObjectModelJavaModifier;
+import org.nuiton.eugene.models.object.ObjectModelOperation;
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.util.EntityOperator;
+import org.nuiton.topia.persistence.util.EntityOperatorStore;
+
+import java.lang.reflect.Array;
+import java.util.List;
+
+/**
+ * To generate PersistenceHelper
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role="org.nuiton.eugene.Template" role-hint="org.nuiton.topia.generator.PersistenceContextTransformer"
+ * @since 3.0
+ */
+public class PersistenceContextTransformer extends ObjectModelTransformerToJava {
+
+ @Override
+ public void transformFromModel(ObjectModel input) {
+
+ String packageName = TopiaGeneratorUtil.getPersistenceContextPackage(this, model);
+
+ String entityAbstractName = TopiaGeneratorUtil.getPersistenceContextAbstractName(model);
+
+ String entityConcreteName = TopiaGeneratorUtil.getPersistenceContextConcreteName(model);
+
+ boolean generateAbstract = !isInClassPath(packageName, entityAbstractName);
+
+ boolean generateConcrete = !isInClassPath(packageName, entityConcreteName);
+
+
+ if (generateAbstract) {
+
+ generateAbstract(packageName,
+ entityAbstractName);
+ }
+
+ if (generateConcrete) {
+
+ generateImpl(packageName,
+ entityAbstractName,
+ entityConcreteName);
+ }
+
+ }
+
+ protected void generateAbstract(String packageName,
+ String className) {
+
+// // try to find a super class by tag-value
+// String superClass = TopiaGeneratorUtil.getPersistenceContextSuperClassTagValue(
+// model);
+//
+// if (superClass == null) {
+//
+// // no super-class, use default one
+// superClass = AbstractTopiaPersistenceContext.class.getName();
+// }
+
+ ObjectModelClass output = createAbstractClass(className, packageName);
+
+// setSuperClass(output, superClass);
+
+ // detect if there is a contract to set on abstract
+ String contractName = TopiaGeneratorUtil.getPersistenceContextInterfaceName(model);
+
+// addInterface(output, TopiaPersistenceContext.class);
+
+ boolean addPersistenceContextContract = isInClassPath(packageName, contractName);
+
+ if (addPersistenceContextContract) {
+ addInterface(output, packageName + "." + contractName);
+ }
+
+ String modelName = model.getName();
+ String daoHelperClazzName = modelName + "DAOHelper";
+
+ String entityEnumName = modelName + "EntityEnum";
+
+ List<ObjectModelClass> entityClasses =
+ TopiaGeneratorUtil.getEntityClasses(model, true);
+
+ boolean generateOperator =
+ TopiaGeneratorUtil.shouldGenerateOperatorForDAOHelper(model);
+
+ boolean generateStandaloneEnum =
+ TopiaGeneratorUtil.shouldGenerateStandaloneEnumForDAOHelper(model);
+
+ if (!generateStandaloneEnum) {
+
+ addImport(output, packageName + "." + daoHelperClazzName + "." + entityEnumName);
+
+ }
+
+// addImport(output, TopiaDAO.class);
+ addImport(output, TopiaEntity.class);
+// addImport(output, TopiaContext.class);
+ addImport(output, Array.class);
+ addImport(output, Array.class);
+
+ if (generateOperator) {
+ addImport(output, EntityOperator.class);
+ addImport(output, EntityOperatorStore.class);
+ }
+
+ // add context field
+ addAttribute(output, "context", TopiaContext.class, null,
+ ObjectModelJavaModifier.PROTECTED);
+
+ // add public constructor
+ ObjectModelOperation constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, TopiaContext.class, "context");
+ setOperationBody(constructor, ""
+/*{
+ this.context = context;
+ }*/
+ );
+
+ ObjectModelOperation op;
+
+ // getModelVersion method
+ String modelVersion = model.getVersion();
+ op = addOperation(output, "getModelVersion", "String", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ return "<%=modelVersion%>";
+ }*/
+ );
+
+ // getModelName method
+ op = addOperation(output, "getModelName", "String", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ return "<%=modelName%>";
+ }*/
+ );
+
+ for (ObjectModelClass clazz : entityClasses) {
+ String clazzName = clazz.getName();
+ String daoClazzName = clazzName + "DAO";
+
+ // specialized getXXXDao method
+ op = addOperation(output, "get" + daoClazzName, clazz.getPackageName() + '.' + daoClazzName);
+ addImport(output, clazz);
+ addException(op, TopiaException.class);
+ setOperationBody(op, ""
+/*{
+ <%=daoClazzName%> result = context.getDAO(<%=clazzName%>.class, <%=daoClazzName%>.class);
+ return result;
+ }*/
+ );
+
+ }
+
+ // getContractClass method
+ op = addOperation(output, "getContractClass", "<T extends TopiaEntity> Class<T>", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return (Class<T>) constant.getContract();
+ }*/
+ );
+
+ // getImplementationClass method
+ op = addOperation(output, "getImplementationClass", "<T extends TopiaEntity> Class<T>", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return (Class<T>) constant.getImplementation();
+ }*/
+ );
+
+ // getContractClasses method
+ op = addOperation(output, "getContractClasses", "Class<? extends TopiaEntity>[]", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%>[] values = <%=entityEnumName%>.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getContract();
+ }
+ return result;
+ }*/
+ );
+
+ // getImplementationClasses method
+ op = addOperation(output, "getImplementationClasses", "Class<? extends TopiaEntity>[]", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%>[] values = <%=entityEnumName%>.values();
+ Class<? extends TopiaEntity>[] result = (Class<? extends TopiaEntity>[]) Array.newInstance(Class.class, values.length);
+ for (int i = 0; i < values.length; i++) {
+ result[i] = values[i].getImplementation();
+ }
+ return result;
+ }*/
+ );
+
+ // getImplementationClassesAsString method
+ op = addOperation(output, "getImplementationClassesAsString", "String", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ StringBuilder buffer = new StringBuilder();
+ for (Class<? extends TopiaEntity> aClass : getImplementationClasses()) {
+ buffer.append(',').append(aClass.getName());
+ }
+ return buffer.substring(1);
+ }*/
+ );
+
+ // getContracts method
+ op = addOperation(output, "getContracts", entityEnumName + "[]", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ setOperationBody(op, ""
+/*{
+ return <%=entityEnumName%>.values();
+ }*/
+ );
+
+ if (generateOperator) {
+ // getOperator method
+ op = addOperation(output, "getOperator", "<T extends TopiaEntity> EntityOperator<T>", ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
+ addParameter(op, "Class<T>", "klass");
+ setOperationBody(op, ""
+/*{
+ <%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
+ return EntityOperatorStore.getOperator(constant);
+ }*/
+ );
+ }
+
+ }
+
+ protected ObjectModelClass generateImpl(String packageName,
+ String entityAbstractName,
+ String entityConcreteName) {
+
+ ObjectModelClass output = createClass(entityConcreteName, packageName);
+
+ setSuperClass(output, entityAbstractName);
+
+ ObjectModelOperation constructor = addConstructor(
+ output,
+ ObjectModelJavaModifier.PUBLIC);
+ addParameter(constructor, TopiaContext.class, "context");
+ setOperationBody(constructor, ""
+ /*{
+ super(context);
+ }*/
+ );
+
+ return output;
+ }
+
+}
Property changes on: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/PersistenceContextTransformer.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-08-15 10:47:30 UTC (rev 2799)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-08-15 10:50:33 UTC (rev 2800)
@@ -25,6 +25,7 @@
package org.nuiton.topia.generator;
+import com.google.common.base.Preconditions;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
@@ -33,6 +34,7 @@
import org.nuiton.eugene.GeneratorUtil;
import org.nuiton.eugene.ModelPropertiesUtil;
import org.nuiton.eugene.java.JavaGeneratorUtil;
+import org.nuiton.eugene.java.ObjectModelTransformerToJava;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelAssociationClass;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
@@ -124,12 +126,70 @@
*/
public static String getDefaultPackage(AbstractGenerator<?> generator) {
String packageName = generator.getProperty(PROPERTY_DEFAULT_PACKAGE);
- if (packageName == null || "".equals(packageName)) {
+ if (StringUtils.isBlank(packageName)) {
packageName = DEFAULT_PACKAGE;
}
return packageName;
}
+ public static String getPersistenceContextPackage(ObjectModelTransformerToJava transformer,
+ ObjectModel model) {
+
+ String result = transformer.getDefaultPackageName();
+
+ return result;
+ }
+
+ public static String getDaoPackage(ObjectModelTransformerToJava transformer,
+ ObjectModel model,
+ ObjectModelClassifier input) {
+
+ Preconditions.checkState(isEntity(input), "Cant' find dao package name for a none entity " + input);
+ String result = input.getPackageName();
+ return result;
+ }
+
+ public static String getPersistenceContextAbstractName(ObjectModel model) {
+ return "AbstractTopia" + model.getName() + "PersistenceContext";
+ }
+
+ public static String getPersistenceContextConcreteName(ObjectModel model) {
+ return "Topia" + model.getName() + "PersistenceContext";
+ }
+
+ public static String getPersistenceContextInterfaceName(ObjectModel model) {
+ return model.getName() + "PersistenceContext";
+ }
+
+ public static String getEntityAbstractName(ObjectModelClass input) {
+ return "AbstractTopia" + input.getName();
+ }
+
+ public static String getEntityConcreteName(ObjectModelClass input) {
+ return input.getName();
+ }
+
+ public static String getDaoAbstractName(ObjectModelClass input) {
+ return "Abstract" + input.getName() + "TopiaDao";
+ }
+
+ public static String getDaoGeneratedName(ObjectModelClass input) {
+ return "Generated" + input.getName() + "TopiaDao";
+ }
+
+ public static String getDaoConcreteName(ObjectModelClass input) {
+// return input.getName() + "TopiaDao";
+ return input.getName() + "DAO";
+ }
+
+ public static String getEntityPackage(ObjectModelTransformerToJava transformer,
+ ObjectModel model,
+ ObjectModelClassifier input) {
+
+ String result = input.getPackageName();
+ return result;
+ }
+
/**
* Renvoie l'interface DAO associée à la classe passée en paramètre
*
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java 2013-08-15 10:47:30 UTC (rev 2799)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaMetaTransformer.java 2013-08-15 10:50:33 UTC (rev 2800)
@@ -61,6 +61,7 @@
// );
setTemplateTypes(
+ PersistenceContextTransformer.class,
EntityTransformer.class,
EntityDAOTransformer.class,
// DAOTransformer.class,
1
0
Author: tchemit
Date: 2013-08-15 12:47:30 +0200 (Thu, 15 Aug 2013)
New Revision: 2799
Url: http://nuiton.org/projects/topia/repository/revisions/2799
Log:
refs #2828: Updates eugene to 2.7.1
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-08-14 13:09:05 UTC (rev 2798)
+++ trunk/pom.xml 2013-08-15 10:47:30 UTC (rev 2799)
@@ -228,7 +228,7 @@
<relativizeDecorationLinks>false</relativizeDecorationLinks>
<!-- libs version -->
- <eugeneVersion>2.7</eugeneVersion>
+ <eugeneVersion>2.7.1-SNAPSHOT</eugeneVersion>
<nuitonUtilsVersion>2.7</nuitonUtilsVersion>
<nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
<nuitonDecoratorVersion>3.0-alpha-1</nuitonDecoratorVersion>
1
0
r2798 - trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence
by tchemit@users.nuiton.org 14 Aug '13
by tchemit@users.nuiton.org 14 Aug '13
14 Aug '13
Author: tchemit
Date: 2013-08-14 15:09:05 +0200 (Wed, 14 Aug 2013)
New Revision: 2798
Url: http://nuiton.org/projects/topia/repository/revisions/2798
Log:
fixes #2825: Improve TopiaIdFactory
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java 2013-08-08 15:27:29 UTC (rev 2797)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/DefaultTopiaIdFactory.java 2013-08-14 13:09:05 UTC (rev 2798)
@@ -24,12 +24,10 @@
* #L%
*/
-import java.util.UUID;
-
+import org.apache.commons.lang3.StringUtils;
import org.nuiton.topia.TopiaException;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Iterables;
+import java.util.UUID;
/**
* Default implementation of {@link TopiaIdFactory}. Generates an FQN followed
@@ -46,13 +44,14 @@
throw new IllegalArgumentException(
"Only interface is permit to create id: " + entityClass);
}
- String result = entityClass.getName() + '_' + UUID.randomUUID().toString();
+ String result = entityClass.getName() + getSeparator() + UUID.randomUUID().toString();
return result;
}
@Override
public <E extends TopiaEntity> Class<E> getClassName(String topiaId) {
- String className = Iterables.get(Splitter.on('_').split(topiaId), 0);
+// String className = Iterables.get(Splitter.on(getSeparator()).split(topiaId), 0);
+ String className = StringUtils.substringBefore(topiaId, getSeparator());
try {
Class<E> entityClass = (Class<E>) Class.forName(className);
return entityClass;
@@ -61,4 +60,14 @@
}
}
+ @Override
+ public String getSeparator() {
+ return "_";
+ }
+
+ @Override
+ public String getRandomPart(String topiaId) {
+ return StringUtils.substringBefore(topiaId, getSeparator());
+ }
+
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java 2013-08-08 15:27:29 UTC (rev 2797)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/LegacyTopiaIdFactory.java 2013-08-14 13:09:05 UTC (rev 2798)
@@ -24,6 +24,7 @@
* #L%
*/
+import org.apache.commons.lang3.StringUtils;
import org.nuiton.topia.TopiaNotFoundException;
/**
@@ -45,7 +46,7 @@
while (Double.toString(random).contains("E-")) {
random = Math.random();
}
- return entityClass.getName() + '#' + System.currentTimeMillis() + '#' + random;
+ return entityClass.getName() + getSeparator() + System.currentTimeMillis() + '#' + random;
}
/**
@@ -57,18 +58,27 @@
*/
@Override
public <E extends TopiaEntity> Class<E> getClassName(String topiaId) {
- String className = "";
- int i = topiaId.indexOf('#');
- if (i > 0) {
- className = topiaId.substring(0, i);
- }
+ String className = StringUtils.substringBefore(topiaId, getSeparator());
+// int i = topiaId.indexOf('#');
+// if (i > 0) {
+// className = topiaId.substring(0, i);
+// }
try {
Class result = Class.forName(className);
return result;
} catch (ClassNotFoundException eee) {
throw new TopiaNotFoundException("Can't find class for " + topiaId,
- eee);
+ eee);
}
}
+ @Override
+ public String getSeparator() {
+ return "#";
+ }
+
+ @Override
+ public String getRandomPart(String topiaId) {
+ return StringUtils.substringBefore(topiaId, getSeparator());
+ }
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-08-08 15:27:29 UTC (rev 2797)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaIdFactory.java 2013-08-14 13:09:05 UTC (rev 2798)
@@ -26,16 +26,40 @@
/**
* This API represents an ID generation strategy
+ * <p/>
+ * // TODO AThimel 20/07/13 Javadoc (finish this javadoc)
*
- * @author bleny
+ * @author bleny <leny(a)codelutin.com/>
+ * @author tchemit <chemit(a)codelutin.com/>
* @since 3.0
*/
public interface TopiaIdFactory {
- // TODO AThimel 20/07/13 Javadoc
+ /**
+ * Generates a new topia id for the given entity type and the given entity.
+ *
+ * @param entityClass type of entity (must be a not null interface)
+ * @param topiaEntity the entity on which we want to generate the id (must be not null)
+ * @param <E> type of entity
+ * @return the new topia id for the given entity
+ */
<E extends TopiaEntity> String newTopiaId(Class<E> entityClass, TopiaEntity topiaEntity);
- // TODO AThimel 20/07/13 Javadoc
+ /**
+ * @param topiaId the topia id to inspect
+ * @param <E> type of the entity
+ * @return the fqn part of the topia id
+ */
<E extends TopiaEntity> Class<E> getClassName(String topiaId);
+ /**
+ * @param topiaId the topia id to inspect
+ * @return the random poart of the topia id.
+ */
+ String getRandomPart(String topiaId);
+
+ /**
+ * @return the separator between the fqn and the random part of any topia id.
+ */
+ String getSeparator();
}
1
0
The ToPIA team is pleased to announce the topia-3.0-alpha-2 release!
Tools for Portable and Independent Architecture :
Framework de persistance et de distribution d'application.
Documentation of the project can be found here:
http://maven-site.nuiton.org/topia
Changes
-------
Changes in this version include:
Fixed Bugs:
o Any association-class participant should be considered as non-null attribute Issue: 2802. Thanks to Arnaud Thimel. Resolved by athimel.
Changes:
o Update to nuiton-utils 2.7 Issue: 2796. Thanks to Tony Chemit. Resolved by tchemit.
o Updates mavenpom to 4.0 Issue: 2824. Thanks to Tony Chemit. Resolved by tchemit.
Downloads
---------
No release file deployed. (all files are deployed in the maven repository)
Maven artifacts
---------------
Artifacts are deployed in Maven Central Repository
http://repo1.maven.org/maven2/
Find us at
* http://search.maven.org/#artifactdetails|org.nuiton.topia|topia-service-sec…
Have fun!
-ToPIA team
1
0
r2797 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 08 Aug '13
by maven-release@users.nuiton.org 08 Aug '13
08 Aug '13
Author: maven-release
Date: 2013-08-08 17:27:29 +0200 (Thu, 08 Aug 2013)
New Revision: 2797
Url: http://nuiton.org/projects/topia/repository/revisions/2797
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-08-08 15:27:26 UTC (rev 2796)
+++ trunk/pom.xml 2013-08-08 15:27:29 UTC (rev 2797)
@@ -33,7 +33,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-alpha-2</version>
+ <version>3.0-alpha-3-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ToPIA</name>
@@ -208,10 +208,10 @@
</modules>
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-2</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-2
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk
</developerConnection>
- <url>http://nuiton.org/projects/topia/repository/show/branches/tags/topia-3.0-al…</url>
+ <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
</scm>
<distributionManagement>
<site>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-08-08 15:27:26 UTC (rev 2796)
+++ trunk/topia-persistence/pom.xml 2013-08-08 15:27:29 UTC (rev 2797)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-2</version>
+ <version>3.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-08-08 15:27:26 UTC (rev 2796)
+++ trunk/topia-service-migration/pom.xml 2013-08-08 15:27:29 UTC (rev 2797)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-2</version>
+ <version>3.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-08-08 15:27:26 UTC (rev 2796)
+++ trunk/topia-service-replication/pom.xml 2013-08-08 15:27:29 UTC (rev 2797)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-2</version>
+ <version>3.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-08-08 15:27:26 UTC (rev 2796)
+++ trunk/topia-service-security/pom.xml 2013-08-08 15:27:29 UTC (rev 2797)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-alpha-2</version>
+ <version>3.0-alpha-3-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2013-08-08 17:27:26 +0200 (Thu, 08 Aug 2013)
New Revision: 2796
Url: http://nuiton.org/projects/topia/repository/revisions/2796
Log:
[maven-release-plugin] copy for tag topia-3.0-alpha-2
Added:
tags/topia-3.0-alpha-2/
Property changes on: tags/topia-3.0-alpha-2
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0
r2795 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by maven-release@users.nuiton.org 08 Aug '13
by maven-release@users.nuiton.org 08 Aug '13
08 Aug '13
Author: maven-release
Date: 2013-08-08 17:27:23 +0200 (Thu, 08 Aug 2013)
New Revision: 2795
Url: http://nuiton.org/projects/topia/repository/revisions/2795
Log:
[maven-release-plugin] prepare release topia-3.0-alpha-2
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
+++ trunk/pom.xml 2013-08-08 15:27:23 UTC (rev 2795)
@@ -23,9 +23,7 @@
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
@@ -35,7 +33,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2</version>
<packaging>pom</packaging>
<name>ToPIA</name>
@@ -210,10 +208,10 @@
</modules>
<scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-2</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/tags/topia-3.0-alpha-2
</developerConnection>
- <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
+ <url>http://nuiton.org/projects/topia/repository/show/branches/tags/topia-3.0-al…</url>
</scm>
<distributionManagement>
<site>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
+++ trunk/topia-persistence/pom.xml 2013-08-08 15:27:23 UTC (rev 2795)
@@ -24,15 +24,13 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
+++ trunk/topia-service-migration/pom.xml 2013-08-08 15:27:23 UTC (rev 2795)
@@ -24,15 +24,13 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
+++ trunk/topia-service-replication/pom.xml 2013-08-08 15:27:23 UTC (rev 2795)
@@ -24,15 +24,13 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
+++ trunk/topia-service-security/pom.xml 2013-08-08 15:27:23 UTC (rev 2795)
@@ -24,15 +24,13 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-alpha-2</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
r2794 - in trunk: . topia-persistence topia-service-migration topia-service-replication topia-service-security
by tchemit@users.nuiton.org 08 Aug '13
by tchemit@users.nuiton.org 08 Aug '13
08 Aug '13
Author: tchemit
Date: 2013-08-08 17:13:28 +0200 (Thu, 08 Aug 2013)
New Revision: 2794
Url: http://nuiton.org/projects/topia/repository/revisions/2794
Log:
fixes #2824: Updates mavenpom to 4.0
apply tidy on poms + clean them
Modified:
trunk/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-08-05 16:54:23 UTC (rev 2793)
+++ trunk/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
@@ -23,197 +23,31 @@
<http://www.gnu.org/licenses/lgpl-3.0.html>.
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmineAndCentral</artifactId>
- <version>3.4.13</version>
+ <version>4.0</version>
</parent>
<artifactId>topia</artifactId>
<version>3.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
- <modules>
- <module>topia-persistence</module>
- <module>topia-service-replication</module>
- <module>topia-service-migration</module>
- <module>topia-service-security</module>
- </modules>
-
<name>ToPIA</name>
<description>
Tools for Portable and Independent Architecture :
Framework de persistance et de distribution d'application.
</description>
- <inceptionYear>2004</inceptionYear>
<url>http://maven-site.nuiton.org/topia</url>
-
- <properties>
- <!-- pour un muli module on doit fixer le projectId -->
- <projectId>topia</projectId>
+ <inceptionYear>2004</inceptionYear>
- <!-- do not relativize links in generated site -->
- <relativizeDecorationLinks>false</relativizeDecorationLinks>
-
- <!-- libs version -->
- <eugeneVersion>2.7</eugeneVersion>
- <nuitonUtilsVersion>2.7</nuitonUtilsVersion>
- <nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
- <nuitonDecoratorVersion>3.0-alpha-1</nuitonDecoratorVersion>
- <nuitonI18nVersion>2.5.2</nuitonI18nVersion>
- <processorPluginVersion>1.3</processorPluginVersion>
- <xmlrpcVersion>3.1.2</xmlrpcVersion>
- <hibernateVersion>4.2.3.Final</hibernateVersion>
- <sl4jVersion>1.7.5</sl4jVersion>
- <h2Version>1.3.172</h2Version>
- <hamcrestVersion>1.3</hamcrestVersion>
-
- </properties>
-
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
-
- <scm>
- <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
- <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</developerConnection>
- <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
- </scm>
-
- <distributionManagement>
- <site>
- <id>${platform}</id>
- <url>${our.site.repository}/${projectId}</url>
- </site>
- </distributionManagement>
-
-
- <dependencyManagement>
- <dependencies>
-
- <dependency>
- <groupId>org.nuiton.eugene</groupId>
- <artifactId>eugene</artifactId>
- <version>${eugeneVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton.eugene</groupId>
- <artifactId>eugene-java-templates</artifactId>
- <version>${eugeneVersion}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils</artifactId>
- <version>${nuitonUtilsVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-csv</artifactId>
- <version>${nuitonCsvVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-decorator</artifactId>
- <version>${nuitonDecoratorVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>nuiton-i18n</artifactId>
- <version>${nuitonI18nVersion}</version>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-core</artifactId>
- <version>${hibernateVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-ehcache</artifactId>
- <version>${hibernateVersion}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- </exclusions>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.12.1.GA</version>
- <scope>runtime</scope>
- </dependency>
-
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.8</version>
- </dependency>
-
- <!-- hibernate-core only include api, need implementation,
- binding with log4j will be used
- -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${sl4jVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${sl4jVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- BD H2 for testing -->
- <dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <version>${h2Version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hamcrest</groupId>
- <artifactId>hamcrest-core</artifactId>
- <version>${hamcrestVersion}</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
-
<developers>
-
+
<developer>
<name>Benjamin Poussin</name>
<id>bpoussin</id>
@@ -323,7 +157,6 @@
</roles>
</developer>
</developers>
-
<contributors>
<contributor>
<name>Nicolas Dupont</name>
@@ -368,15 +201,163 @@
<timezone>Europe/Paris</timezone>
</contributor>
</contributors>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
- <packaging>pom</packaging>
+ <modules>
+ <module>topia-persistence</module>
+ <module>topia-service-replication</module>
+ <module>topia-service-migration</module>
+ <module>topia-service-security</module>
+ </modules>
- <build>
+ <scm>
+ <connection>scm:svn:http://svn.nuiton.org/svn/topia/trunk</connection>
+ <developerConnection>scm:svn:http://svn.nuiton.org/svn/topia/trunk
+ </developerConnection>
+ <url>http://nuiton.org/projects/topia/repository/show/branches/trunk</url>
+ </scm>
+ <distributionManagement>
+ <site>
+ <id>${platform}</id>
+ <url>${our.site.repository}/${projectId}</url>
+ </site>
+ </distributionManagement>
+ <properties>
+ <!-- pour un muli module on doit fixer le projectId -->
+ <projectId>topia</projectId>
+
+ <!-- do not relativize links in generated site -->
+ <relativizeDecorationLinks>false</relativizeDecorationLinks>
+
+ <!-- libs version -->
+ <eugeneVersion>2.7</eugeneVersion>
+ <nuitonUtilsVersion>2.7</nuitonUtilsVersion>
+ <nuitonCsvVersion>3.0-alpha-1</nuitonCsvVersion>
+ <nuitonDecoratorVersion>3.0-alpha-1</nuitonDecoratorVersion>
+ <nuitonI18nVersion>2.5.2</nuitonI18nVersion>
+ <processorPluginVersion>1.3</processorPluginVersion>
+ <xmlrpcVersion>3.1.2</xmlrpcVersion>
+ <hibernateVersion>4.2.3.Final</hibernateVersion>
+ <sl4jVersion>1.7.5</sl4jVersion>
+ <h2Version>1.3.172</h2Version>
+ <hamcrestVersion>1.3</hamcrestVersion>
+
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene</artifactId>
+ <version>${eugeneVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene-java-templates</artifactId>
+ <version>${eugeneVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>${nuitonUtilsVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-csv</artifactId>
+ <version>${nuitonCsvVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-decorator</artifactId>
+ <version>${nuitonDecoratorVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.i18n</groupId>
+ <artifactId>nuiton-i18n</artifactId>
+ <version>${nuitonI18nVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernateVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-ehcache</artifactId>
+ <version>${hibernateVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.12.1.GA</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.8</version>
+ </dependency>
+
+ <!-- hibernate-core only include api, need implementation,
+ binding with log4j will be used
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${sl4jVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${sl4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- BD H2 for testing -->
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2Version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-core</artifactId>
+ <version>${hamcrestVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
<pluginManagement>
<plugins>
@@ -436,7 +417,6 @@
</plugins>
</pluginManagement>
-
</build>
<reporting>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2013-08-05 16:54:23 UTC (rev 2793)
+++ trunk/topia-persistence/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
@@ -24,14 +24,11 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
@@ -40,7 +37,11 @@
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-persistence</artifactId>
+ <packaging>jar</packaging>
+ <name>ToPIA :: Persistence</name>
+ <description>Hibernate based persistence module</description>
+
<dependencies>
<dependency>
@@ -147,21 +148,7 @@
</dependencies>
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
- <name>ToPIA :: Persistence</name>
- <description>Hibernate based persistence module</description>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <packaging>jar</packaging>
-
<build>
-
<testResources>
<testResource>
@@ -186,7 +173,6 @@
</testResource>
</testResources>
-
<plugins>
<plugin>
@@ -252,9 +238,6 @@
</plugins>
</build>
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
<profiles>
<!-- perform only on a release stage when using the maven-release-plugin -->
@@ -367,5 +350,4 @@
</profile>
</profiles>
-
</project>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2013-08-05 16:54:23 UTC (rev 2793)
+++ trunk/topia-service-migration/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
@@ -24,14 +24,11 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
@@ -40,6 +37,8 @@
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-service-migration</artifactId>
+ <name>ToPIA :: Service Migration</name>
+ <description>Hibernate based migration service</description>
<dependencies>
@@ -100,21 +99,7 @@
</dependencies>
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
- <name>ToPIA :: Service Migration</name>
- <description>Hibernate based migration service</description>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <packaging>jar</packaging>
-
<build>
-
<resources>
<resource>
@@ -126,9 +111,9 @@
</resource>
</resources>
-
<plugins>
</plugins>
</build>
+
</project>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2013-08-05 16:54:23 UTC (rev 2793)
+++ trunk/topia-service-replication/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
@@ -24,14 +24,11 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
@@ -40,6 +37,8 @@
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-service-replication</artifactId>
+ <name>ToPIA :: Service Replication</name>
+ <description>Hibernate based replication service</description>
<dependencies>
@@ -90,7 +89,7 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
-
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -98,19 +97,6 @@
</dependencies>
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
- <name>ToPIA :: Service Replication</name>
- <description>Hibernate based replication service</description>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <packaging>jar</packaging>
-
<build>
<plugins>
@@ -128,9 +114,6 @@
</plugins>
</build>
- <!-- ************************************************************* -->
- <!-- *** Build Environment ************************************** -->
- <!-- ************************************************************* -->
<profiles>
<!-- perform only on a release stage when using the maven-release-plugin -->
<profile>
@@ -197,5 +180,4 @@
</profile>
</profiles>
-
</project>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2013-08-05 16:54:23 UTC (rev 2793)
+++ trunk/topia-service-security/pom.xml 2013-08-08 15:13:28 UTC (rev 2794)
@@ -24,14 +24,11 @@
#L%
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <!-- ************************************************************* -->
- <!-- *** POM Relationships *************************************** -->
- <!-- ************************************************************* -->
-
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
@@ -41,6 +38,20 @@
<groupId>org.nuiton.topia</groupId>
<artifactId>topia-service-security</artifactId>
+ <name>ToPIA :: Service Security</name>
+ <description>Hibernate based security service</description>
+
+ <properties>
+
+ <!-- Post Release configuration -->
+ <!-- TODO Put this in last module (when we will remove this module) -->
+ <skipPostRelease>false</skipPostRelease>
+
+ <!-- TopiaSecurityutil uses some sun.xxx classes -->
+ <signatureArtifactId>java16-sun</signatureArtifactId>
+ <signatureVersion>1.10</signatureVersion>
+ </properties>
+
<dependencies>
<!-- Sibling dependencies -->
@@ -86,7 +97,7 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
-
+
<!-- Depencies for test-->
<dependency>
<groupId>com.h2database</groupId>
@@ -103,25 +114,7 @@
</dependencies>
- <!-- ************************************************************* -->
- <!-- *** Project Information ************************************* -->
- <!-- ************************************************************* -->
-
- <name>ToPIA :: Service Security</name>
- <description>Hibernate based security service</description>
-
- <!-- ************************************************************* -->
- <!-- *** Build Settings ****************************************** -->
- <!-- ************************************************************* -->
-
- <properties>
-
- <!-- TopiaSecurityutil uses some sun.xxx classes -->
- <signatureArtifactId>java16-sun</signatureArtifactId>
- <signatureVersion>1.10</signatureVersion>
- </properties>
<build>
-
<resources>
<resource>
@@ -132,7 +125,6 @@
</resource>
</resources>
-
<plugins>
<plugin>
@@ -145,7 +137,7 @@
<configuration>
<templates>
org.nuiton.topia.generator.TopiaMetaTransformer
- </templates>
+ </templates>
<defaultPackage>org.nuiton.topia</defaultPackage>
<fullPackagePath>org.nuiton.topia</fullPackagePath>
<overwrite>true</overwrite>
1
0
r2793 - trunk/topia-persistence/src/main/java/org/nuiton/topia/generator
by athimel@users.nuiton.org 05 Aug '13
by athimel@users.nuiton.org 05 Aug '13
05 Aug '13
Author: athimel
Date: 2013-08-05 18:54:23 +0200 (Mon, 05 Aug 2013)
New Revision: 2793
Url: http://nuiton.org/projects/topia/repository/revisions/2793
Log:
fixes #2802 Any association-class participant should be considered as non-null attribute
Modified:
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java 2013-08-05 10:41:12 UTC (rev 2792)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java 2013-08-05 16:54:23 UTC (rev 2793)
@@ -1198,7 +1198,7 @@
addException(createByNotNull, TopiaException.class);
- String searchProperties = "";
+ String createProperties = "";
// String params = "";
String clazzName = clazz.getName();
for (ObjectModelAttribute attr : props) {
@@ -1206,17 +1206,17 @@
// add property as param in both methods
addParameter(createByNotNull, attr.getType(), propName);
- searchProperties +=
+ createProperties +=
", " + clazzName + '.' + getConstantName(propName) +
", " + propName;
//params += ", " + propName;
}
- searchProperties = searchProperties.substring(2);
+ createProperties = createProperties.substring(2);
//params = params.substring(2);
setOperationBody(createByNotNull, ""
/*{
- return create(<%=searchProperties%>);
+ return create(<%=createProperties%>);
}*/
);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-08-05 10:41:12 UTC (rev 2792)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java 2013-08-05 16:54:23 UTC (rev 2793)
@@ -286,6 +286,13 @@
Set<ObjectModelAttribute> notNullOfSuperClass = getNotNullAttributes(superClass);
results.addAll(notNullOfSuperClass);
}
+
+ // Association class participants are obviously not null
+ if (clazz instanceof ObjectModelAssociationClass) {
+ List<ObjectModelAttribute> participantsAttributes = ((ObjectModelAssociationClass) clazz).getParticipantsAttributes();
+ results.addAll(participantsAttributes);
+ }
+
return results;
}
1
0
r2792 - in trunk: src/site/rst topia-persistence/src/main/java/org/nuiton/topia/framework topia-persistence/src/main/java/org/nuiton/topia/generator topia-service-migration/src/main/java/org/nuiton/topia/migration topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings
by tchemit@users.nuiton.org 05 Aug '13
by tchemit@users.nuiton.org 05 Aug '13
05 Aug '13
Author: tchemit
Date: 2013-08-05 12:41:12 +0200 (Mon, 05 Aug 2013)
New Revision: 2792
Url: http://nuiton.org/projects/topia/repository/revisions/2792
Log:
refs #2748: Improve TopiaContext if necessary (do not use any longer internal TopiaContextImplementor)
Modified:
trunk/src/site/rst/migrate_to_3.0.rst
trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/DAOHelperTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java
trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/AbstractTopiaMigrationCallback.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClass.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClassNG.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByMethod.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
Modified: trunk/src/site/rst/migrate_to_3.0.rst
===================================================================
--- trunk/src/site/rst/migrate_to_3.0.rst 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/src/site/rst/migrate_to_3.0.rst 2013-08-05 10:41:12 UTC (rev 2792)
@@ -94,7 +94,17 @@
Les méthodes ``preInit(TopiaContextImplementor)`` et ``postInit(TopiaContextImplementor)`` doivent être remplacées par
``preInit(TopiaContext)`` et ``postInit(TopiaContext)``
+Service de migration
+--------------------
+|MANDATORY|
+
+Toute référence à **TopiaContextImplementor** a été supprimé et remplacée par
+**TopiaContext**, cela change donc les signatures et rend le code incompatible,
+il faut donc bien effectuer le remplacement dans les callbacks que vous avez
+écrits.
+
+
Gestion des exceptions
----------------------
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaSQLQuery.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -25,6 +25,7 @@
package org.nuiton.topia.framework;
import org.hibernate.jdbc.Work;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import java.sql.Connection;
@@ -39,8 +40,8 @@
/**
* An executor of sql query which permits to obtain a single result via
- * the method {@link #findSingleResult(TopiaContextImplementor)}
- * or a multiple result with method {@link #findMultipleResult(TopiaContextImplementor)}.
+ * the method {@link #findSingleResult(TopiaContext)}
+ * or a multiple result with method {@link #findMultipleResult(TopiaContext)}.
*
* @param <O> the type of result data
* @since 2.5
@@ -71,11 +72,24 @@
* @param tx the transaction used to execute the query.
* @return the single result or {@code null} if none found.
* @throws TopiaException for any pb
+ * @deprecated since 3.0, use now {@link #findSingleResult(TopiaContext)}.
*/
+ @Deprecated
public O findSingleResult(TopiaContextImplementor tx) throws TopiaException {
+ return findSingleResult((TopiaContext) tx);
+ }
+
+ /**
+ * Obtain a single result from the builded sql query.
+ *
+ * @param tx the transaction used to execute the query.
+ * @return the single result or {@code null} if none found.
+ * @throws TopiaException for any pb
+ */
+ public O findSingleResult(TopiaContext tx) throws TopiaException {
final List<O> result = new ArrayList<O>();
- tx.getHibernate().doWork(new Work() {
+ tx.getHibernateSession().doWork(new Work() {
@Override
public void execute(Connection connection) throws SQLException {
@@ -103,11 +117,24 @@
* @param tx the transaction used to execute the query.
* @return the list of results (the list is empty if non result is found).
* @throws TopiaException for any pb
+ * @deprecated since 3.0, use now {@link #findMultipleResult(TopiaContext)}.
*/
+ @Deprecated
public List<O> findMultipleResult(TopiaContextImplementor tx) throws TopiaException {
+ return findMultipleResult((TopiaContext) tx);
+ }
+
+ /**
+ * Obtain a multiple results fro the builded sql query.
+ *
+ * @param tx the transaction used to execute the query.
+ * @return the list of results (the list is empty if non result is found).
+ * @throws TopiaException for any pb
+ */
+ public List<O> findMultipleResult(TopiaContext tx) throws TopiaException {
final List<O> result = new ArrayList<O>();
- tx.getHibernate().doWork(new Work() {
+ tx.getHibernateSession().doWork(new Work() {
@Override
public void execute(Connection connection) throws SQLException {
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/DAOHelperTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/DAOHelperTransformer.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/DAOHelperTransformer.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -40,7 +40,6 @@
import org.nuiton.eugene.models.object.xml.ObjectModelEnumerationImpl;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
@@ -144,7 +143,6 @@
String modelName = model.getName();
String modelVersion = model.getVersion();
- addImport(daoHelper, TopiaContextImplementor.class);
addImport(daoHelper, TopiaDAO.class);
addImport(daoHelper, TopiaEntity.class);
addImport(daoHelper, TopiaContext.class);
@@ -190,8 +188,7 @@
addException(op, TopiaException.class);
setOperationBody(op, ""
/*{
- TopiaContextImplementor ci = (TopiaContextImplementor) context;
- <%=daoClazzName%> result = ci.getDAO(<%=clazzName%>.class, <%=daoClazzName%>.class);
+ <%=daoClazzName%> result = context.getDAO(<%=clazzName%>.class, <%=daoClazzName%>.class);
return result;
}*/
);
@@ -205,9 +202,8 @@
addException(op, TopiaException.class);
setOperationBody(op, ""
/*{
- TopiaContextImplementor ci = (TopiaContextImplementor) context;
<%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(klass);
- D dao = (D) ci.getDAO(constant.getContract());
+ D dao = (D) context.getDAO(constant.getContract());
return dao;
}*/
);
@@ -218,9 +214,8 @@
addException(op, TopiaException.class);
setOperationBody(op, ""
/*{
- TopiaContextImplementor ci = (TopiaContextImplementor) context;
<%=entityEnumName%> constant = <%=entityEnumName%>.valueOf(entity);
- D dao = (D) ci.getDAO(constant.getContract());
+ D dao = (D) context.getDAO(constant.getContract());
return dao;
}*/
);
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityDAOTransformer.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -43,7 +43,6 @@
import org.nuiton.eugene.models.object.ObjectModelJavaModifier;
import org.nuiton.eugene.models.object.ObjectModelOperation;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.persistence.TopiaDAO;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.util.StringUtil;
@@ -365,7 +364,6 @@
boolean enableSecurity = TopiaGeneratorUtil.isClassWithSecurity(clazz);
if (enableSecurity) {
- addImport(daoAbstractClass, TopiaContextImplementor.class);
addImport(daoAbstractClass, ArrayList.class);
addImport(daoAbstractClass, Permission.class);
addImport(daoAbstractClass, "org.nuiton.topia.taas.entities.TaasAuthorizationImpl");
@@ -514,7 +512,7 @@
// setDocumentation(op, "Retourne les permissions a verifier pour " +
// "l'acces a l'entite pour le service Taas");
setOperationBody(op, ""
-/*{ TopiaContextImplementor context = getContext();
+/*{ TopiaContext context = getTopiaContext();
List<String> result = context.findAll(query, "id", topiaId);
List<Permission> resultPermissions = new ArrayList<Permission>();
@@ -601,7 +599,7 @@
// attrType + "." + getConstantName(reverseAttrName);
//
//
-// <%=entityDAO%> dao = <%=daoHelper%>.get<%=entityDAO%>(getContext());
+// <%=entityDAO%> dao = <%=daoHelper%>.get<%=entityDAO%>(getTopiaContext());
// TopiaQuery query = dao.createQuery("B").
// addFrom(entity.getClass(), "A").
// add("A", entity).
@@ -614,7 +612,7 @@
body.append(""
/*{
{
- List<<%=attrType%>> list = getContext().getHibernateSession().createSQLQuery(
+ List<<%=attrType%>> list = getTopiaContext().getHibernateSession().createSQLQuery(
"SELECT main.topiaid " +
"from <%=attrClassifierDBName%> main, <%=attrJoinTableName%> secondary " +
"where main.topiaid=secondary.<%=attrDBName%>" +
@@ -640,7 +638,7 @@
body.append(""
/*{
{
- List<<%=attrSimpleType%>> list = getContext()
+ List<<%=attrSimpleType%>> list = getTopiaContext()
.getDAO(<%=attrSimpleType%>.class)
.findAllByProperties(<%=attrSimpleType%>.<%=getConstantName(reverseAttrName)%>, entity);
for (<%=attrSimpleType%> item : list) {
@@ -654,7 +652,7 @@
if (attr.isAggregate()) {
body.append(""
/*{
- getContext().getDAO(<%=attrSimpleType%>.class).delete(item);
+ getTopiaContext().getDAO(<%=attrSimpleType%>.class).delete(item);
//item.delete();
}*/
);
@@ -812,7 +810,7 @@
/*{
if (type == <%=usageSimpleType%>.class) {
<%=daoName%> dao = (<%=daoName%>)
- getContext().getDAO(<%=usageSimpleType%>.class);
+ getTopiaContext().getDAO(<%=usageSimpleType%>.class);
tmp = dao.<%=methodName%>(entity);
result.addAll(tmp);
}
Modified: trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java
===================================================================
--- trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityTransformer.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -41,7 +41,6 @@
import org.nuiton.eugene.models.object.ObjectModelParameter;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.persistence.EntityVisitor;
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityAbstract;
@@ -344,7 +343,6 @@
if (TopiaGeneratorUtil.isContextable(input)) {
addImport(outputAbstract, TopiaContext.class);
- addImport(outputAbstract, TopiaContextImplementor.class);
// topiaContext attribute
ObjectModelAttribute topiaContextAttribute = addAttribute(
@@ -380,7 +378,7 @@
if (topiaContext == null) {
topiaContext = context;
// } else {
-// throw new TopiaRuntimeException("TopiaContext replacement is forbidden");
+// throw new TopiaException("TopiaContext replacement is forbidden");
}
}*/
);
@@ -392,7 +390,7 @@
addAnnotation(outputAbstract, op, Override.class);
setOperationBody(op, ""
/*{
- ((TopiaContextImplementor)getTopiaContext()).getDAO(<%=input.getName()%>.class).update(this);
+ getTopiaContext().getDAO(<%=input.getName()%>.class).update(this);
}*/
);
@@ -402,7 +400,7 @@
addAnnotation(outputAbstract, op, Override.class);
setOperationBody(op, ""
/*{
- ((TopiaContextImplementor)getTopiaContext()).getDAO(<%=input.getName()%>.class).delete(this);
+ getTopiaContext().getDAO(<%=input.getName()%>.class).delete(this);
}*/
);
}
@@ -1410,11 +1408,10 @@
// tmp.addAll(<%=ref%>);
// }
- addImport(outputAbstract, TopiaContextImplementor.class);
body.append(""
/*{
{
- org.nuiton.topia.persistence.TopiaDAO<<%=assocClassFQN%>> dao = ((TopiaContextImplementor) getTopiaContext()).getDAO(<%=assocClassFQN%>.class);
+ org.nuiton.topia.persistence.TopiaDAO<<%=assocClassFQN%>> dao = getTopiaContext().getDAO(<%=assocClassFQN%>.class);
List<<%=assocClassFQN%>> findAllByProperties = dao.findAllByProperties("<%=reverseAttrName%>", this);
if (findAllByProperties != null) {
tmp.addAll(findAllByProperties);
@@ -1454,39 +1451,48 @@
addException(operation, TopiaException.class);
addAnnotation(outputAbstract, operation, Override.class);
- addImport(outputAbstract, ArrayList.class);
- addImport(outputAbstract, List.class);
- StringBuilder body = new StringBuilder(""
+ StringBuilder body = new StringBuilder();
+ if (!TopiaGeneratorUtil.isContextable(input)) {
+ body = new StringBuilder(""
/*{
+ throw new UnsupportedOperationException("Since ToPIA 3.0, 'getComposite' is only available for contextable entities");
+ }*/
+ );
+ } else {
+
+ addImport(outputAbstract, ArrayList.class);
+ addImport(outputAbstract, List.class);
+ body .append(""
+/*{
List<TopiaEntity> tmp = new ArrayList<TopiaEntity>();
// pour tous les attributs rechecher les composites et les class d'asso
// on les ajoute dans tmp
}*/
- );
- for (ObjectModelAttribute attr : input.getAttributes()) {
+ );
+ for (ObjectModelAttribute attr : input.getAttributes()) {
- if (attr.referenceClassifier() &&
- TopiaGeneratorUtil.isEntity(attr.getClassifier()) &&
- attr.isAggregate()) {
+ if (attr.referenceClassifier() &&
+ TopiaGeneratorUtil.isEntity(attr.getClassifier()) &&
+ attr.isAggregate()) {
- String attrName = attr.getName();
- String getterName = getJavaBeanMethodName("get", attrName);
- if (TopiaGeneratorUtil.isNMultiplicity(attr)) {
- body.append(""
+ String attrName = attr.getName();
+ String getterName = getJavaBeanMethodName("get", attrName);
+ if (TopiaGeneratorUtil.isNMultiplicity(attr)) {
+ body.append(""
/*{ tmp.addAll(<%=getterName%>());
}*/
- );
- } else {
- body.append(""
+ );
+ } else {
+ body.append(""
/*{ tmp.add(<%=getterName%>());
}*/
- );
+ );
+ }
}
}
- }
- body.append(""
+ body.append(""
/*{
// on refait un tour sur chaque entity de tmp pour recuperer leur
// composite
@@ -1497,8 +1503,8 @@
}
return result;
}*/
- );
-
+ );
+ }
setOperationBody(operation, body.length() == 0 ? " " : body.toString());
}
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/AbstractTopiaMigrationCallback.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/AbstractTopiaMigrationCallback.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/AbstractTopiaMigrationCallback.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -29,7 +29,6 @@
import org.hibernate.jdbc.Work;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.util.StringUtil;
import org.nuiton.util.Version;
@@ -67,7 +66,7 @@
List<Version> versions);
protected abstract void migrateForVersion(Version version,
- TopiaContextImplementor tx,
+ TopiaContext tx,
boolean showSql,
boolean showProgression) throws Exception;
@@ -103,13 +102,12 @@
// l'utilisateur a refuse la migration
return false;
}
- TopiaContextImplementor tx;
for (Version v : versions) {
// ouverture d'une connexion direct JDBC sur la base
try {
- tx = (TopiaContextImplementor) ctxt.beginTransaction();
+ TopiaContext tx = ctxt.beginTransaction();
try {
@@ -144,7 +142,7 @@
return doMigrate;
}
- public void executeSQL(TopiaContextImplementor tx, String... sqls)
+ public void executeSQL(TopiaContext tx, String... sqls)
throws TopiaException {
executeSQL(tx, false, false, sqls);
}
@@ -159,7 +157,7 @@
* @throws TopiaException if any pb
* @since 2.3.0
*/
- public void executeSQL(TopiaContextImplementor tx,
+ public void executeSQL(TopiaContext tx,
final boolean showSql,
final boolean showProgression,
final String... sqls) throws TopiaException {
@@ -181,7 +179,7 @@
"--------------------------------------------------------------------------------\n"
);
}
- tx.getHibernate().doWork(new Work() {
+ tx.getHibernateSession().doWork(new Work() {
@Override
public void execute(Connection connection) throws SQLException {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClass.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClass.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClass.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -24,8 +24,8 @@
*/
package org.nuiton.topia.migration;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.util.ObjectUtil;
import org.nuiton.util.Version;
@@ -67,7 +67,7 @@
@Override
protected void migrateForVersion(Version version,
- TopiaContextImplementor tx,
+ TopiaContext tx,
boolean showSql,
boolean showProgression) throws Exception {
@@ -100,7 +100,7 @@
}
- protected String[] prepareMigration(TopiaContextImplementor tx,
+ protected String[] prepareMigration(TopiaContext tx,
boolean showSql,
boolean showProgression) throws TopiaException {
@@ -111,17 +111,17 @@
return queries.toArray(new String[queries.size()]);
}
- protected abstract void prepareMigrationScript(TopiaContextImplementor tx,
+ protected abstract void prepareMigrationScript(TopiaContext tx,
List<String> queries,
boolean showSql,
boolean showProgression) throws TopiaException;
- public void executeSQL(TopiaContextImplementor tx,
+ public void executeSQL(TopiaContext tx,
String... sqls) throws TopiaException {
callBack.executeSQL(tx, sqls);
}
- public void executeSQL(TopiaContextImplementor tx,
+ public void executeSQL(TopiaContext tx,
boolean showSql,
boolean showProgression,
String... sqls) throws TopiaException {
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClassNG.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClassNG.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByClassNG.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -26,8 +26,8 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
@@ -73,7 +73,7 @@
@Override
protected void migrateForVersion(Version version,
- TopiaContextImplementor tx,
+ TopiaContext tx,
boolean showSql,
boolean showProgression) throws Exception {
@@ -103,7 +103,7 @@
this.callBack = callBack;
}
- protected String[] prepareMigration(TopiaContextImplementor tx,
+ protected String[] prepareMigration(TopiaContext tx,
boolean showSql,
boolean showProgression) throws TopiaException {
@@ -114,17 +114,17 @@
return queries.toArray(new String[queries.size()]);
}
- protected abstract void prepareMigrationScript(TopiaContextImplementor tx,
+ protected abstract void prepareMigrationScript(TopiaContext tx,
List<String> queries,
boolean showSql,
boolean showProgression) throws TopiaException;
- public void executeSQL(TopiaContextImplementor tx,
+ public void executeSQL(TopiaContext tx,
String... sqls) throws TopiaException {
callBack.executeSQL(tx, sqls);
}
- public void executeSQL(TopiaContextImplementor tx,
+ public void executeSQL(TopiaContext tx,
boolean showSql,
boolean showProgression,
String... sqls) throws TopiaException {
@@ -152,7 +152,7 @@
*
* @param version the version to migrate
* @return the migration call for the given version, or {@code null}
- * if no such migration callback exists for the version
+ * if no such migration callback exists for the version
*/
MigrationCallBackForVersion getCallBack(Version version);
}
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByMethod.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByMethod.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationCallbackByMethod.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -26,7 +26,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.framework.TopiaContextImplementor;
+import org.nuiton.topia.TopiaContext;
import org.nuiton.util.Version;
import java.lang.reflect.Method;
@@ -51,14 +51,14 @@
@Override
protected void migrateForVersion(Version version,
- TopiaContextImplementor tx,
+ TopiaContext tx,
boolean showSql,
boolean showProgression) throws Exception {
String methodName = "migrateTo_" + version.getValidName();
Method m = getClass().getMethod(methodName,
- TopiaContextImplementor.class,
+ TopiaContext.class,
boolean.class,
boolean.class
);
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/TopiaMigrationEngine.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -131,8 +131,8 @@
@Override
public void beginTransaction(TopiaTransactionEvent event) {
- TopiaContextImplementor context =
- (TopiaContextImplementor) event.getSource();
+ TopiaContext context =
+ event.getSource();
// add topia context listener
context.addTopiaContextListener(contextListener);
Modified: trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java
===================================================================
--- trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2013-08-05 09:30:26 UTC (rev 2791)
+++ trunk/topia-service-migration/src/main/java/org/nuiton/topia/migration/mappings/TMSVersionDAO.java 2013-08-05 10:41:12 UTC (rev 2792)
@@ -34,7 +34,6 @@
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaUtil;
import org.nuiton.util.Version;
import org.nuiton.util.VersionUtil;
@@ -63,7 +62,7 @@
public static TMSVersion get(TopiaContext tx) throws TopiaException {
try {
- Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Session session = tx.getHibernateSession();
Criteria criteria = session.createCriteria(TMSVersion.class);
List<?> list = criteria.list();
TMSVersion result = list.isEmpty() ? null : (TMSVersion) list.get(0);
@@ -90,7 +89,7 @@
public static TMSVersion create(TopiaContext tx, String version) throws TopiaException {
try {
- Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Session session = tx.getHibernateSession();
TMSVersion result = TMSVersion.valueOf(version);
// save entity
@@ -103,7 +102,7 @@
public static void update(TopiaContext tx, TMSVersion version) throws TopiaException {
try {
- Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Session session = tx.getHibernateSession();
session.saveOrUpdate(version);
tx.commitTransaction();
} catch (HibernateException e) {
@@ -113,7 +112,7 @@
public static void deleteAll(TopiaContext tx) throws TopiaException {
try {
- Session session = ((TopiaContextImplementor) tx).getHibernate();
+ Session session = tx.getHibernateSession();
Criteria criteria = session.createCriteria(TMSVersion.class);
List<?> list = criteria.list();
for (Object o : list) {
@@ -135,14 +134,13 @@
public static Version getVersion(TopiaContext tx, String tableName) {
try {
- TopiaContextImplementor txImpl = (TopiaContextImplementor) tx;
- Configuration hibernateConfiguration = txImpl.getHibernateConfiguration();
+ Configuration hibernateConfiguration = tx.getHibernateConfiguration();
// Get schema name
String schemaName = TopiaUtil.getSchemaName(hibernateConfiguration);
GetVersionWork work = new GetVersionWork(schemaName, tableName);
- txImpl.getHibernate().doWork(work);
+ tx.getHibernateSession().doWork(work);
Version v = work.getVersion();
return v;
} catch (TopiaException e) {
@@ -155,6 +153,7 @@
protected Version version;
private final String tableName;
+
private final String schemaName;
public GetVersionWork(String schemaName, String tableName) {
@@ -166,7 +165,7 @@
public void execute(Connection connection) throws SQLException {
String fullTableName = schemaName == null ?
- tableName : schemaName + "." + tableName;
+ tableName : schemaName + "." + tableName;
PreparedStatement st = connection.prepareStatement("select " + TMSVersion.PROPERTY_VERSION + " from " + fullTableName + ";");
1
0