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 2012
- 3 participants
- 47 discussions
r2634 - in branches/topia-2.6.x/topia-persistence/src: main/java/org/nuiton/topia main/java/org/nuiton/topia/framework main/java/org/nuiton/topia/persistence test/java/org/nuiton/topia/test/ano1991
by tchemit@users.nuiton.org 19 Aug '12
by tchemit@users.nuiton.org 19 Aug '12
19 Aug '12
Author: tchemit
Date: 2012-08-19 13:11:48 +0200 (Sun, 19 Aug 2012)
New Revision: 2634
Url: http://nuiton.org/repositories/revision/topia/2634
Log:
fixes #2271: Deprecate TopiaQuery
refs #2274: Improve TopiaDAO javadoc
refs #2272: Add new methods to TopiaDAO to do search without using TopiaQuery
Added:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java
branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/TopiaContext.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -182,7 +182,9 @@
* @param query TopiaQuery to execute
* @return a List of results as hibernate give us
* @throws TopiaException
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
List findByQuery(TopiaQuery query) throws TopiaException;
/**
@@ -192,7 +194,9 @@
* @param alias alias of the entity in the Query
* @return a new TopiaQuery
* @see TopiaQuery
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
TopiaQuery createQuery(Class<?> entityClass, String alias);
/**
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -62,39 +62,39 @@
* addGroup, ...
* - execution of the query, using executeToEntityList, executeToEntity,
* executeToInteger, ...
- * <p/>
+ *
* Construction
* ============
- * <p/>
+ *
* This class make easier the way to construct a HQL query.
- * <p/>
+ *
* Example 1 :
* -----------
- * <p/>
+ *
* SQL :
* "SELECT * FROM PersonImpl WHERE firstName LIKE 'M%' AND year > 1980"
- * <p/>
+ *
* HQL using {@link TopiaContext#findAll(String, Object...) } :
* TopiaContext context = rootContext.beginTransaction();
* context.find("FROM " + Person.class.getName() + " WHERE firstName LIKE
* :firstName AND year > :year",
* "firstName", "M%", year, 1980);
- * <p/>
+ *
* TopiaQuery :
* TopiaQuery query = TopiaQuery.createQuery(Person.class).add(
* Person.FIRST_NAME, Op.LIKE, "M%").add(Person.YEAR, Op.GT, 1980);
- * <p/>
+ *
* But the real advantage is when you have some parameters to test before
* adding
* them to the query. With the older method, it was tidious to construct
* and add parameters to finally use the find method from TopiaContext.
- * <p/>
+ *
* Example 2 :
* -----------
- * <p/>
+ *
* HQL using {@link TopiaContext#findAll(String, Object...) } :
* TopiaContext context = rootContext.beginTransaction();
- * <p/>
+ *
* String query = "FROM " + Person.class.getName();
* List<Object> params = new ArrayList<Object>();
* String separator = " WHERE ";
@@ -105,7 +105,7 @@
* params.add(company);
* separator = " AND ";
* }
- * <p/>
+ *
* // contact paramater can be null
* if (contact != null) {
* query += separator + "contact = :contact";
@@ -113,33 +113,33 @@
* params.add(contact);
* separator = " AND ";
* }
- * <p/>
+ *
* context.findAll(query, params.toArray());
- * <p/>
+ *
* Here we have only two non obligatory params, but imagine if we must have
* almost 6 or 7 parameters like this !
- * <p/>
+ *
* TopiaQuery :
* TopiaQuery query = TopiaQuery.createQuery(Person.class);
- * <p/>
+ *
* if (company != null) {
* query.add(Person.COMPANY, company);
* }
- * <p/>
+ *
* if (contact != null) {
* query.add(Person.CONTACT, contact);
* }
- * <p/>
+ *
* Many ways to create the same query :
* ------------------------------------
- * <p/>
+ *
* You can use multiple different manners to create a query, it depends on the
* complexicity. More complex is the query, more easier is to construct it.
- * <p/>
+ *
* HQL : "FROM PersonImpl AS P WHERE (P.company IS NULL OR P.company =
* :company)
* AND P.firstName LIKE :firstName"
- * <p/>
+ *
* Using TopiaQuery and an Alias (these different queries are equivalent) :
* query = TopiaQuery.createQuery(Person.class, "P");
* 1- query.add("(P.company IS NULL OR P.company = :company") AND P.firstName
@@ -153,72 +153,72 @@
* .addParam("company", company);
* 4- query.addNullOr("P.company", Op.EQ, company).
* add("P.firstName", Op.LIKE, firstName + "%");
- * <p/>
+ *
* You can use TopiaQuery to create a subquery in an other TopiaQuery, you have
* to use the method {@link #fullQuery() } to get the full query in HQL and
* give
* it as a string in the other TopiaQuery.
- * <p/>
+ *
* Execution
* =========
- * <p/>
+ *
* After construction, you can execute the query in different ways.
- * <p/>
+ *
* Default method :
* ----------------
- * <p/>
+ *
* - execute : as the same result as
* {@link TopiaContext#findAll(String, Object...) }
- * <p/>
+ *
* Depends on entity type ;
* ------------------------
- * <p/>
+ *
* - executeToEntity : only one result, the first one
* - executeToEntityList : all results returned in a List
* - executeToEntityMap : all results returned in a Map with key defined by
* user
* or topiaId by default
- * <p/>
+ *
* For aggregate :
* ---------------
- * <p/>
+ *
* These methods have in argument the SELECT to execute the query. The previous
* SELECT (if defined) will not be deleted, but temporarly not used.
- * <p/>
+ *
* - executeToInteger : for example for "SUM", "COUNT"
* - executeToString : for example for "MAX"
* - executeCount : directly a "count(*)"
* - executeToObject : for other type of possible result (Long, Boolean,
* Double,
* ...)
- * <p/>
+ *
* Property loading
* ================
- * <p/>
+ *
* When using Hibernate, some times, Entities linked to the main one will be
* lazy initialized, but you want them directly when the query will be executed
* to avoid problems when closing context. You can use the method
* {@link #addLoad(String...) } to tell the TopiaQuery to load some
* properties when executing the query. After that, you don't need to call them
* for loading them in Hibernate.
- * <p/>
+ *
* The syntax is the same as a property in HQL query using delegation :
* "person.company" where person and company are entities.
- * <p/>
+ *
* Note : loading only available on collection or entities but not property
* on a collection of entities which must be made manually.
- * <p/>
+ *
* For a Contact which is linked to a person (entity) and the person linked to
* company (entity) you can add to a TopiaQuery<Contact> :
* query.addLoad("person.company")
- * <p/>
+ *
* For a list of addresses (entity) in the contact you can do :
* query.addLoad("addresses")
- * <p/>
+ *
* But it's not possible to do for example with meeting (entity) linked to the
* contact and responsible (entity) linked to a meeting :
* query.addLoad("meetings.responsible")
- * <p/>
+ *
* </pre>
* <p/>
* Created: 21 déc. 2009
@@ -227,9 +227,6 @@
* @version $Revision$
* @since 2.3.0
* @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
- * <p/>
- * Mise a jour: $Date$ par
- * : $Author$
*/
@Deprecated
public class TopiaQuery {
@@ -250,7 +247,7 @@
/**
* To keep SELECT part of the query filled by user.
- *
+ *
* @since 2.6.7
*/
protected List<String> userSelects;
@@ -279,6 +276,7 @@
protected boolean distinct;
//TODO tchemit-2012-02-01 Remove this (see Evol #1931)
+
/** From part of the query. */
protected StringBuilder from;
@@ -411,7 +409,7 @@
* @param str the element to add
* @return the TopiaQuery
* @see #addFrom(Class, String)
- * @see #addJoin(String, String, boolean)
+ * @see #addJoin(String, String, boolean)
* @see #addLeftJoin(String, String, boolean)
* @deprecated since 2.3.4 use correct addFrom or addJoin or addLeftJoin
*/
@@ -425,7 +423,7 @@
* the query or for join as specific {@code separator}.
*
* @param property the property to add
- * @param alias alias of the property to add in form part of the query
+ * @param alias alias of the property to add in form part of the query
* @param separator The separator to use before adding the element (if null
* the {@link #FROM_SEPARATOR_DEFAULT} will be used).
* @return the TopiaQuery
@@ -545,7 +543,7 @@
// result.append(selectStatement).append(mainAlias);
// }
result.append(from);
-
+
if (CollectionUtils.isNotEmpty(wheres)) {
result.append(" WHERE ");
boolean first = true;
@@ -673,7 +671,7 @@
boolean needAlias = false;
if (StringUtils.isEmpty(mainAlias)) {
mainAlias = RandomStringUtils.randomAlphabetic(4);
- from.append(' ').append(mainAlias);
+ from.append(' ').append(mainAlias);
needAlias = true;
}
@@ -687,8 +685,8 @@
for (String current : properties) {
// Add missing alias if needed
- String property = needAlias ?
- getProperty(mainAlias, current) : current;
+ String property = needAlias ?
+ getProperty(mainAlias, current) : current;
// Split property on .
String[] parts = property.split("\\.");
@@ -709,7 +707,7 @@
}
// Add the property in left join with fetch to true
- addLeftJoin(propertyToJoin, alias, true);
+ addLeftJoin(propertyToJoin, alias, true);
}
}
return this;
@@ -767,7 +765,7 @@
}
/**
- * @param paramName name of the parameter to add
+ * @param paramName name of the parameter to add
* @param constraint constraint to use
* @param paramValue value of this parameter
* @return TopiaQuery
@@ -804,7 +802,7 @@
result.append(Op.NULL);
} else {
String valueName = getValueName(paramName);
- if (Op.IN ==operator || Op.NOT_IN == operator) {
+ if (Op.IN == operator || Op.NOT_IN == operator) {
result.append(operator).append(" (:").append(valueName).append(')');
} else {
@@ -830,13 +828,13 @@
if (getParams().contains(valueName)) {
valueName = valueName + "_" +
- RandomStringUtils.randomAlphanumeric(4);
+ RandomStringUtils.randomAlphanumeric(4);
}
return valueName;
}
/**
- * @param paramName name of the parameter to add
+ * @param paramName name of the parameter to add
* @param paramValue value of this parameter
* @return TopiaQuery
* @since 2.3.1
@@ -1025,7 +1023,7 @@
* Add link constraint between two properties. {@code elementProperty} is in
* elements of {@code containerProperty} which is a collection with same type
* than {@code elementProperty}. (HQL : elementProperty IN elements
- * (containerProperty))
+ * (containerProperty))
*
* @param elementProperty contains in containerProperty collection
* @param containerProperty collection which contains elementProperty
@@ -1090,7 +1088,7 @@
// Replace old paramName in subquery
subqueryString =
subqueryString.replace(":" + paramName,
- ":" + newParamName);
+ ":" + newParamName);
// Add the param to the current query
addParam(newParamName, paramValue);
@@ -1137,9 +1135,9 @@
userSelects.add(mainAlias);
}
}
-
+
userSelects.addAll(Arrays.asList(select));
-
+
// // if select is not null, add the new element to the select
// if (this.select != null) {
// this.select.append(", ");
@@ -1185,7 +1183,7 @@
* @return the TopiaQuery
*/
public TopiaQuery addOrder(String... order) {
- if (orderBys==null) {
+ if (orderBys == null) {
orderBys = new ArrayList<String>();
}
Collections.addAll(orderBys, order);
@@ -1210,7 +1208,7 @@
* @return the TopiaQuery
*/
public TopiaQuery addGroup(String... group) {
- if (groupBys==null) {
+ if (groupBys == null) {
groupBys = new ArrayList<String>();
}
Collections.addAll(groupBys, group);
@@ -1287,10 +1285,10 @@
* recent in first)
*
* @param filter Filter to apply on the query
- * @see #addFilter(EntityFilter, String)
* @return the TopiaQuery
* @throws IllegalArgumentException if referenceId is defined but no
* referenceProperty was set
+ * @see #addFilter(EntityFilter, String)
*/
public TopiaQuery addFilter(EntityFilter filter)
throws IllegalArgumentException {
@@ -1360,8 +1358,8 @@
if (filter.hasReference()) {
if (referenceProperty == null) {
throw new IllegalArgumentException("Reference property need" +
- " to be defined in filter to use referenceId = " +
- referenceId);
+ " to be defined in filter to use referenceId = " +
+ referenceId);
}
addEquals(getPropertyId(referenceProperty), referenceId);
}
@@ -1386,7 +1384,7 @@
List result;
if (startIndex != null && endIndex != null) {
result = transaction.find(query, startIndex, endIndex,
- getParams().toArray());
+ getParams().toArray());
} else {
result = transaction.findAll(query, getParams().toArray());
}
@@ -1425,8 +1423,8 @@
}
if (!entityClass.isAssignableFrom(o.getClass())) {
throw new ClassCastException(o.getClass().getName() +
- " can't be cast to " + entityClass.getName() +
- " o : " + o);
+ " can't be cast to " + entityClass.getName() +
+ " o : " + o);
}
E entity = (E) o;
// Check distinct constraint for complex query where o is firstly an
@@ -1469,7 +1467,7 @@
Object value = loadProperty(elmt, keyName);
if (value != null && !keyClass.isAssignableFrom(value.getClass())) {
throw new ClassCastException(value.getClass().getName() +
- " can't be cast to " + keyClass.getName());
+ " can't be cast to " + keyClass.getName());
}
results.put((K) value, elmt);
}
@@ -1492,7 +1490,7 @@
TopiaContext transaction, Class<E> entityClass)
throws TopiaException, ClassCastException {
return executeToEntityMap(transaction, entityClass,
- TopiaEntity.TOPIA_ID, String.class);
+ TopiaEntity.TOPIA_ID, String.class);
}
/**
@@ -1589,7 +1587,7 @@
*/
public int executeCount(TopiaContext transaction) throws TopiaException {
List<String> oldOrderBys = orderBys;
- orderBys=null;
+ orderBys = null;
// StringBuilder oldOrder = orderBy;
// orderBy = null;
StringBuilder count = new StringBuilder("COUNT(");
@@ -1639,10 +1637,10 @@
// orderBy = oldOrder;
return result;
}
-
+
protected boolean isUserSelectEqualsMainAlias() {
boolean result = !CollectionUtils.isEmpty(userSelects) &&
- userSelects.size()==1 &&
+ userSelects.size() == 1 &&
userSelects.get(0).equals(mainAlias);
return result;
}
@@ -1672,7 +1670,7 @@
}
if (log.isTraceEnabled()) {
log.trace("Current entity : " +
- currEntity.getClass().getSimpleName());
+ currEntity.getClass().getSimpleName());
log.trace("Current loading : " + s);
}
if (it.hasNext()) {
@@ -1717,7 +1715,7 @@
Object res = PropertyUtils.getProperty(entity, property);
if (log.isDebugEnabled()) {
log.debug("load property '" + property + "' for '" +
- entity.getClass().getSimpleName() + "'");
+ entity.getClass().getSimpleName() + "'");
}
if (res != null && Collection.class.isAssignableFrom(res.getClass())) {
Collection<?> list = (Collection<?>) res;
@@ -1726,16 +1724,16 @@
return res;
} catch (IllegalAccessException eee) {
throw new TopiaException("Illegal access on property " +
- property + " from entity " +
- entity.getClass().getName(), eee);
+ property + " from entity " +
+ entity.getClass().getName(), eee);
} catch (InvocationTargetException eee) {
throw new TopiaException("Invocation error on entity " +
- entity.getClass().getName() + " for property " +
- property, eee);
+ entity.getClass().getName() + " for property " +
+ property, eee);
} catch (NoSuchMethodException eee) {
throw new TopiaException("Getter method does not exist for" +
- " property " + property + " from entity " +
- entity.getClass().getName(), eee);
+ " property " + property + " from entity " +
+ entity.getClass().getName(), eee);
}
}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -36,12 +36,10 @@
*/
package org.nuiton.topia.persistence;
-import org.nuiton.topia.TopiaContext;
import org.nuiton.topia.TopiaException;
import org.nuiton.topia.event.TopiaEntityListener;
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
-import org.nuiton.topia.framework.TopiaQuery;
import org.nuiton.topia.generator.EntityDAOTransformer;
import java.security.Permission;
@@ -50,37 +48,27 @@
/**
* TopiaDAO is used to manipulate entities corresponding to {@code E} type :
- * create, delete, update or find entities using properties of {@link
- * TopiaQuery}.
+ * create, delete, update or find entities.
* <p/>
* This interface is implemented by {@link TopiaDAOImpl} overridden by generation
* from {@link EntityDAOTransformer}.
* <p/>
*
- * @param <E> the entity type linked with the dao
+ * @param <E> the entity type managed by the dao
* @author bpoussin <poussin(a)codelutin.com>
* @author fdesbois <fdesbois(a)codelutin.com>
* @author tchemit <chemit(a)codelutin.com>
* @version $Id$
*/
-public interface TopiaDAO<E extends TopiaEntity> {
+public interface TopiaDAO<E extends TopiaEntity> extends TopiaDAODeprecated<E> {
- TopiaEntityEnum getTopiaEntityEnum();
+ //------------------------------------------------------------------------//
+ //-- Create - update - delete methods ------------------------------------//
+ //------------------------------------------------------------------------//
/**
- * When TopiaContextImpl create the TopiaDAOHibernate, it must call this
- * method just after.
+ * Create a new instance of managed entity <strong>not persisted</strong>.
*
- * @param context context
- * @param entityClass entity class
- * @throws TopiaException if any pb while init
- */
- void init(TopiaContextImplementor context, Class<E> entityClass)
- throws TopiaException;
-
- /**
- * Create a new instance of managed entity.
- *
* @return new entity instance
* @throws TopiaException if any pb while creating the entity
* @since 2.3.1
@@ -88,73 +76,6 @@
E newInstance() throws TopiaException;
/**
- * Return class of entity managed by this DAO.
- *
- * @return entity managed by this DAO
- */
- Class<E> getEntityClass();
-
- /**
- * Return context used by this DAO.
- *
- * @return Returns the context.
- */
- TopiaContextImplementor getContext();
-
- /**
- * Find usages of the given {@code entity} in the entities of the given
- * {@code type}.
- *
- * @param type the type of entity to search
- * @param entity the entity
- * @param <U> tthe type of entity to search
- * @return the list of entities of the given type which uses the given
- * entity
- * @throws TopiaException if any problem while getting data
- * @since 2.3.0
- */
- <U extends TopiaEntity> List<U> findUsages(Class<U> type, E entity)
- throws TopiaException;
-
- /**
- * Find all usages of the given {@code entity}.
- *
- * @param entity the entity
- * @return the dictionnary of usages of the given entities (keys are entity
- * usage container, values are the list of this type of entity to
- * use the given entity).
- * @throws TopiaException if any pb while getting data
- * @since 2.3.0
- */
-
- Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity)
- throws TopiaException;
-
- /**
- * Retourne les permissions a verifier pour l'acces a l'entite pour le
- * service Taas.
- *
- * @param topiaId topiaId d'une entite
- * @param actions encoded actions
- * @return la liste des permissions
- * @throws TopiaException if any pb while getting datas
- */
- List<Permission> getRequestPermission(String topiaId, int actions)
- throws TopiaException;
-
- /* Adders */
-
- void addTopiaEntityListener(TopiaEntityListener listener);
-
- void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
-
- /* Removers */
-
- void removeTopiaEntityListener(TopiaEntityListener listener);
-
- void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
-
- /**
* Construit une nouvelle instance de l'objet géré par ce DAO
*
* @param properties la liste des propriétés que doit avoir l'objet créé les
@@ -212,36 +133,13 @@
*/
void delete(E e) throws TopiaException;
- /**
- * Crée une requete basé sur l'entité lié au DAO. Résultat attendu : "FROM
- * E"
- *
- * @return une nouvelle TopiaQuery vide. (uniquement avec le From sur le
- * type d'entité)
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
- */
- @Deprecated
- TopiaQuery createQuery();
+ //------------------------------------------------------------------------//
+ //-- findByXXX methods ---------------------------------------------------//
+ //------------------------------------------------------------------------//
/**
- * Crée une requête basé sur l'entité lié au DAO et lui assigne un alias
- * valable dans la requête..
- * <p/>
- * Résultat attendu : "FROM E AS entityAlias"
- *
- * @param entityAlias alias permettant de manipuler l'entité dans la
- * requête
- * @return une nouvelle TopiaQuery
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
- */
- @Deprecated
- TopiaQuery createQuery(String entityAlias);
-
- /**
* Find an entity corresponding to the {@code id}. If the {@code id} is
- * null, nothing will be search.
+ * null, nothing will be searched.
*
* @param id topiaId of the entity to found
* @return the entity found or null if not
@@ -249,8 +147,15 @@
*/
E findByTopiaId(String id) throws TopiaException;
- E findByProperty(String propertyName, Object value)
- throws TopiaException;
+ /**
+ * Find an entity matching {@code value} for the given {@code propertyName}.
+ *
+ * @param propertyName property name to filter
+ * @param value value of the property to math
+ * @return the first entity matching the request
+ * @throws TopiaException
+ */
+ E findByProperty(String propertyName, Object value) throws TopiaException;
/**
* @param propertyName le nom de la propriété
@@ -260,26 +165,88 @@
* @return l'entité trouvé
* @throws TopiaException if any pb while getting datas
*/
- E findByProperties(String propertyName, Object value,
- Object... others) throws TopiaException;
+ E findByProperties(String propertyName, Object value, Object... others) throws TopiaException;
+ /**
+ * Find an entity matching {@code properties}.
+ *
+ * @param properties les propriétés à matcher
+ * @return l'entité trouvé
+ * @throws TopiaException if any pb while getting datas
+ */
E findByProperties(Map<String, Object> properties) throws TopiaException;
/**
* Execute une requête basé sur l'entité du DAO. Permet de récupérer une
* entité correspondant à la requête.
*
- * @param query la requête
+ * @param hql la requête hql à executer
+ * @param params les paramètres de la requète
* @return l'entité correspondant à la recherche ou null si aucune entité
* n'a été trouvée
* @throws TopiaException if any pb while getting datas
- * @see TopiaQuery#executeToEntity(TopiaContext, Class)
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- E findByQuery(TopiaQuery query) throws TopiaException;
+ E findByQuery(String hql, Object... params) throws TopiaException;
+ /**
+ * Execute une requête basé sur le {@code type} donné.
+ * <p/>
+ * Permet de récupérer une entité correspondant à la requête.
+ *
+ * @param hql la requête hql à executer
+ * @param params les paramètres de la requète
+ * @return l'entité correspondant à la recherche ou null si aucune entité
+ * n'a été trouvée
+ * @throws TopiaException if any pb while getting datas
+ * @since 2.6.12
+ */
+ <R> R findByQuery(Class<R> type, String hql, Object... params) throws TopiaException;
+
+ /**
+ * Recherche la classe en utilisant la cle naturelle, chaque champs de la
+ * cle naturelle est une entre de la map passe en argument.
+ *
+ * @param keys la liste des champs de la cle naturelle avec leur valeur
+ * @return l'entite trouvé
+ * @throws TopiaException if any pb while getting datas
+ */
+ E findByPrimaryKey(Map<String, Object> keys) throws TopiaException;
+
+ /**
+ * Recherche la classe en utilisant la cle naturelle, si la cle naturelle
+ * est composé de plusieurs champs alors les arguments passés doivent être
+ * dans l'ordre de declaration dans le fichier de mapping
+ *
+ * @param k l'objet cle naturelle de la classe
+ * @return l'entité trouvé
+ * @throws TopiaException if any pb while getting datas
+ */
+ E findByPrimaryKey(Object... k) throws TopiaException;
+
+ /**
+ * Récupère la première entité (du type géré par ce dao) dont la
+ * collection nommée {@code propertyName} contient la {@code property}
+ * donnée.
+ *
+ * @param propertyName le nom de la propriété
+ * @param property la propriété recherchée
+ * @return la première entité recherchée
+ * @throws TopiaException pour tout erreur lors de la recherche
+ * @since 2.5.4
+ */
+ E findContains(String propertyName, Object property) throws TopiaException;
+
+ //------------------------------------------------------------------------//
+ //-- findAllXXX methods --------------------------------------------------//
+ //------------------------------------------------------------------------//
+
+ /**
+ * Gets all entitys of the dao type in db.
+ *
+ * @return all entities of the dao type in db
+ * @throws TopiaException
+ */
List<E> findAll() throws TopiaException;
/**
@@ -290,71 +257,112 @@
*/
List<String> findAllIds() throws TopiaException;
+ /**
+ * Gets all entities of the dao type matching the {@code value} for the
+ * given {@code propertyName}.
+ *
+ * @param propertyName property name to filter
+ * @param value value to match
+ * @return matching entities
+ * @throws TopiaException if any pb while getting datas
+ */
List<E> findAllByProperty(String propertyName, Object value)
throws TopiaException;
/**
+ * Gets all entities of the dao type matching the {@code value} for the
+ * given {@code propertyName} and {@code others}.
+ *
* @param propertyName le nom de la propriété
* @param value la valeur à tester
* @param others les autres proprietes doivent aller par 2
* propertyName, value
- * @return l'entité trouvé
+ * @return matching entities
* @throws TopiaException if any pb while getting datas
*/
List<E> findAllByProperties(String propertyName, Object value,
Object... others) throws TopiaException;
+ /**
+ * Gets all entities of the dao type matching all the {@code properties}.
+ *
+ * @param properties properties to match
+ * @return matching entities
+ * @throws TopiaException if any pb while getting datas
+ */
List<E> findAllByProperties(Map<String, Object> properties)
throws TopiaException;
/**
- * Execute une requête basé sur l'entité du DAO. Permet de récupérer une
- * liste d'entités correspondant à la requête.
+ * Gets all entities when executing the given select query for the dao
+ * entity type.
*
- * @param query la requête
- * @return la liste d'entités correspondant à la recherche
+ * @param hql hql query
+ * @param params query params
+ * @return entites of the query result
* @throws TopiaException if any pb while getting datas
- * @see TopiaQuery#executeToEntityList(TopiaContext, Class)
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- List<E> findAllByQuery(TopiaQuery query) throws TopiaException;
+ List<E> findAllByQuery(String hql, Object... params) throws TopiaException;
/**
- * Execute une requête basé sur l'entité du DAO. Permet de récupérer une map
- * d'entités correspondant à la requête. La clé de la map étant le topiaId
- * de l'entité.
+ * Gets all entities when executing the given select query for the given
+ * {@code type} which may not be a entity type (int, long, map,...).
*
- * @param query la requête
- * @return la map d'entités correspondant à la recherche
+ * @param hql hql query
+ * @param params query params
+ * @return entites of the query result
* @throws TopiaException if any pb while getting datas
- * @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- Map<String, E> findAllMappedByQuery(TopiaQuery query) throws TopiaException;
+ <R> List<R> findAllByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException;
/**
- * Execute une requête basé sur l'entité du DAO. Permet de récupérer une map
- * d'entités correspondant à la requête. Le type et le nom de la propriété
- * utilisé comme clé de la map doit être passé en argument.
+ * Gets a page of entities when executing the given select query for the dao
+ * entity type (will only return the window of {@code startIndex -
+ * endIndex} entities).
*
- * @param <K> type de la clé de la map
- * @param query la requête
- * @param keyName nom de la propriété de l'entité utilisée comme clé
- * @param keyClass type de la propriété de l'entité utilisée comme clé
- * @return la map d'entités correspondant à la recherche
+ * @param hql hql query to execute
+ * @param startIndex first index of entity to return
+ * @param endIndex last index of entity to return
+ * @param params query params
+ * @return entites of the paginated query result
* @throws TopiaException if any pb while getting datas
- * @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
- * @since 2.3
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- <K> Map<K, E> findAllMappedByQuery(TopiaQuery query,
- String keyName, Class<K> keyClass) throws TopiaException;
+ List<E> findAllByQueryWithBound(String hql,
+ int startIndex,
+ int endIndex,
+ Object... params) throws TopiaException;
+ /**
+ * Gets a page of entities of the given select {@code hql} query using the
+ * {@code pager} to obtain the window of entities to return.
+ *
+ * @param hql hql query to execute
+ * @param pager pager to obtan the correct window of data
+ * @param params params of the query
+ * @return entities of the paginated query result
+ * @throws TopiaException if any pb while getting datas
+ * @see TopiaFilterPagerUtil.FilterPagerBean
+ * @since 2.6.12
+ */
+ List<E> findAllByQueryAndPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException;
+
+ /**
+ * Gets all entites for the dao entity type order by given {@code propertyNames}.
+ * <p/>
+ * You can add on each {@code property} {@code ASC} ou {@code DESC} to
+ * fix order way (by default is {@code ASC}).
+ *
+ * @param propertyNames property names of order to apply
+ * @return all entities of the dao entity type with given order
+ * @throws TopiaException if any pb while getting datas
+ */
List<E> findAllWithOrder(String... propertyNames)
throws TopiaException;
@@ -372,19 +380,9 @@
List<E> findAllContains(String propertyName,
Object property) throws TopiaException;
- /**
- * Récupère la première entité (du type géré par ce dao) dont la
- * collection nommée {@code propertyName} contient la {@code property}
- * donnée.
- *
- * @param propertyName le nom de la propriété
- * @param property la propriété recherchée
- * @return la première entité recherchée
- * @throws TopiaException pour tout erreur lors de la recherche
- * @since 2.5.4
- */
- E findContains(String propertyName,
- Object property) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- existsByXXX methods -------------------------------------------------//
+ //------------------------------------------------------------------------//
/**
* Check the existence of an entity with technical {@code id}.
@@ -411,19 +409,21 @@
boolean existByProperties(String propertyName, Object propertyValue,
Object... others) throws TopiaException;
-
/**
- * Check the existence of an entity using a {@code query}.
+ * Check the existence of an entity using a {@code hql} query.
*
- * @param query query used to test existence
+ * @param hql query used to test existence
+ * @param params params used by the query
* @return true if entity exists, false otherwise
* @throws TopiaException
- * @since 2.3.4
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- boolean existByQuery(TopiaQuery query) throws TopiaException;
+ boolean existsByQuery(String hql, Object... params) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- countXXX methods ----------------------------------------------------//
+ //------------------------------------------------------------------------//
+
/**
* Count the number of existing entities.
*
@@ -434,70 +434,124 @@
long count() throws TopiaException;
/**
- * Count the number of entities based on {@code query}.
+ * Count the number of entities based on a {@code hql}.
*
- * @param query query
+ * @param hql hql query to use
* @return number of entities filtered by the query
* @throws TopiaException if any pb while getting datas
- * @since 2.3.4
- * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ * @since 2.6.12
*/
- @Deprecated
- int countByQuery(TopiaQuery query) throws TopiaException;
+ long countByQuery(String hql, Object... params) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- other request methods -----------------------------------------------//
+ //------------------------------------------------------------------------//
+
/**
- * Recherche la classe en utilisant la cle naturelle, chaque champs de la
- * cle naturelle est une entre de la map passe en argument.
+ * Find usages of the given {@code entity} in the entities of the given
+ * {@code type}.
*
- * @param keys la liste des champs de la cle naturelle avec leur valeur
- * @return l'entite trouvé
- * @throws TopiaException if any pb while getting datas
+ * @param type the type of entity to search
+ * @param entity the entity on which search is done
+ * @param <R> type of entity to search
+ * @return the list of entities of the given type which uses the given
+ * entity
+ * @throws TopiaException if any problem while getting data
+ * @since 2.3.0
*/
- E findByPrimaryKey(Map<String, Object> keys) throws TopiaException;
+ <R extends TopiaEntity> List<R> findUsages(Class<R> type, E entity)
+ throws TopiaException;
/**
- * Recherche la classe en utilisant la cle naturelle, si la cle naturelle
- * est composé de plusieurs champs alors les arguments passés doivent être
- * dans l'ordre de declaration dans le fichier de mapping
+ * Find all usages of the given {@code entity}.
*
- * @param k l'objet cle naturelle de la classe
- * @return l'entité trouvé
+ * @param entity the entity
+ * @return the dictionnary of usages of the given entities (keys are entity
+ * usage container, values are the list of this type of entity to
+ * use the given entity).
+ * @throws TopiaException if any pb while getting data
+ * @since 2.3.0
+ */
+
+ Map<Class<? extends TopiaEntity>, List<? extends TopiaEntity>> findAllUsages(E entity)
+ throws TopiaException;
+
+ /**
+ * Execute the count {@code hql} query and then synch the pager to this
+ * result (says fill the
+ * {@link TopiaFilterPagerUtil.FilterPagerBean#records} field and then adapt
+ * the number of pages available and the current number page).
+ *
+ * @param hql the count hql to execute
+ * @param pager the page to synch
+ * @param params params of the count query
* @throws TopiaException if any pb while getting datas
+ * @see TopiaFilterPagerUtil.FilterPagerBean
+ * @since 2.6.12
*/
- E findByPrimaryKey(Object... k) throws TopiaException;
+ void computeAndAddRecordsToPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException;
- boolean existsByQuery(String hql,
- Object... params) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- Misc methods --------------------------------------------------------//
+ //------------------------------------------------------------------------//
- long countByQuery(String hql,
- Object... params) throws TopiaException;
+ /**
+ * Get the entityEnum of the type of entity managed by this DAO.
+ *
+ * @return entity type enum managed by this DAO
+ */
+ TopiaEntityEnum getTopiaEntityEnum();
- E findUniqueByQuery(String hql,
- Object... params) throws TopiaException;
+ /**
+ * Get the type of entity managed by this DAO.
+ *
+ * @return entity type managed by this DAO
+ */
+ Class<E> getEntityClass();
- <R> R findUniqueByQuery(Class<R> type,
- String hql,
- Object... params) throws TopiaException;
+ /**
+ * When TopiaContextImpl create the TopiaDAOHibernate, it must call this
+ * method just after.
+ *
+ * @param context context
+ * @param entityClass entity class
+ * @throws TopiaException if any pb while init
+ */
+ void init(TopiaContextImplementor context, Class<E> entityClass)
+ throws TopiaException;
- List<E> findAllByQuery(String hql,
- Object... params) throws TopiaException;
+ /**
+ * Return context used by this DAO.
+ *
+ * @return the context.
+ */
+ TopiaContextImplementor getContext();
- <R> List<R> findAllByQuery(Class<R> type,
- String hql,
- Object... params) throws TopiaException;
+ /**
+ * Retourne les permissions a verifier pour l'acces a l'entite pour le
+ * service Taas.
+ *
+ * @param topiaId topiaId d'une entite
+ * @param actions encoded actions
+ * @return la liste des permissions
+ * @throws TopiaException if any pb while getting datas
+ */
+ List<Permission> getRequestPermission(String topiaId, int actions)
+ throws TopiaException;
- List<E> findAllByQueryWithBound(String hql,
- int startIndex,
- int endIndex,
- Object... params) throws TopiaException;
+ //------------------------------------------------------------------------//
+ //-- Listener methods ----------------------------------------------------//
+ //------------------------------------------------------------------------//
- List<E> findByQueryAndPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
- Object... params) throws TopiaException;
+ void addTopiaEntityListener(TopiaEntityListener listener);
- void computeAndAddRecordsToPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
- Object... params) throws TopiaException;
+ void addTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+ void removeTopiaEntityListener(TopiaEntityListener listener);
+
+ void removeTopiaEntityVetoable(TopiaEntityVetoable vetoable);
+
} //TopiaDAO
Added: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -0,0 +1,155 @@
+package org.nuiton.topia.persistence;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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%
+ */
+
+import org.nuiton.topia.TopiaContext;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.framework.TopiaQuery;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Contains all method that are deprecated from {@link TopiaDAO} in version
+ * {@code 2.6.12} and then will be removed in next major version ({@code 3.0}).
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 2.6.12
+ */
+public interface TopiaDAODeprecated<E extends TopiaEntity> {
+
+ /**
+ * Crée une requete basé sur l'entité lié au DAO. Résultat attendu : "FROM
+ * E"
+ *
+ * @return une nouvelle TopiaQuery vide. (uniquement avec le From sur le
+ * type d'entité)
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ TopiaQuery createQuery();
+
+ /**
+ * Crée une requête basé sur l'entité lié au DAO et lui assigne un alias
+ * valable dans la requête..
+ * <p/>
+ * Résultat attendu : "FROM E AS entityAlias"
+ *
+ * @param entityAlias alias permettant de manipuler l'entité dans la
+ * requête
+ * @return une nouvelle TopiaQuery
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ TopiaQuery createQuery(String entityAlias);
+
+ /**
+ * Execute une requête basé sur l'entité du DAO. Permet de récupérer une
+ * entité correspondant à la requête.
+ *
+ * @param query la requête
+ * @return l'entité correspondant à la recherche ou null si aucune entité
+ * n'a été trouvée
+ * @throws TopiaException if any pb while getting datas
+ * @see TopiaQuery#executeToEntity(TopiaContext, Class)
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ E findByQuery(TopiaQuery query) throws TopiaException;
+
+ /**
+ * Execute une requête basé sur l'entité du DAO. Permet de récupérer une
+ * liste d'entités correspondant à la requête.
+ *
+ * @param query la requête
+ * @return la liste d'entités correspondant à la recherche
+ * @throws TopiaException if any pb while getting datas
+ * @see TopiaQuery#executeToEntityList(TopiaContext, Class)
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ List<E> findAllByQuery(TopiaQuery query) throws TopiaException;
+
+ /**
+ * Execute une requête basé sur l'entité du DAO. Permet de récupérer une map
+ * d'entités correspondant à la requête. La clé de la map étant le topiaId
+ * de l'entité.
+ *
+ * @param query la requête
+ * @return la map d'entités correspondant à la recherche
+ * @throws TopiaException if any pb while getting datas
+ * @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ Map<String, E> findAllMappedByQuery(TopiaQuery query) throws TopiaException;
+
+ /**
+ * Execute une requête basé sur l'entité du DAO. Permet de récupérer une map
+ * d'entités correspondant à la requête. Le type et le nom de la propriété
+ * utilisé comme clé de la map doit être passé en argument.
+ *
+ * @param <K> type de la clé de la map
+ * @param query la requête
+ * @param keyName nom de la propriété de l'entité utilisée comme clé
+ * @param keyClass type de la propriété de l'entité utilisée comme clé
+ * @return la map d'entités correspondant à la recherche
+ * @throws TopiaException if any pb while getting datas
+ * @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
+ * @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ <K> Map<K, E> findAllMappedByQuery(TopiaQuery query,
+ String keyName, Class<K> keyClass) throws TopiaException;
+
+ /**
+ * Check the existence of an entity using a {@code query}.
+ *
+ * @param query query used to test existence
+ * @return true if entity exists, false otherwise
+ * @throws TopiaException
+ * @since 2.3.4
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ boolean existByQuery(TopiaQuery query) throws TopiaException;
+
+ /**
+ * Count the number of entities based on {@code query}.
+ *
+ * @param query query
+ * @return number of entities filtered by the query
+ * @throws TopiaException if any pb while getting datas
+ * @since 2.3.4
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
+ */
+ @Deprecated
+ int countByQuery(TopiaQuery query) throws TopiaException;
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAODeprecated.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -594,20 +594,20 @@
public long countByQuery(String hql,
Object... params) throws TopiaException {
- Preconditions.checkNotNull(hql);
- Preconditions.checkArgument(hql.startsWith("SELECT COUNT("));
+ Preconditions.checkNotNull(StringUtils.isNotBlank(hql));
+ Preconditions.checkArgument(hql.toUpperCase().trim().startsWith("SELECT COUNT("));
- return findUniqueByQuery(Long.class, hql, params);
+ return findByQuery(Long.class, hql, params);
}
- public E findUniqueByQuery(String hql,
- Object... params) throws TopiaException {
- return findUniqueByQuery(getEntityClass(), hql, params);
+ public E findByQuery(String hql,
+ Object... params) throws TopiaException {
+ return findByQuery(getEntityClass(), hql, params);
}
- public <R> R findUniqueByQuery(Class<R> type,
- String hql,
- Object... params) throws TopiaException {
+ public <R> R findByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException {
Preconditions.checkNotNull(type);
Preconditions.checkNotNull(hql);
@@ -646,9 +646,9 @@
return result;
}
- public List<E> findByQueryAndPager(String hql,
- TopiaFilterPagerUtil.FilterPagerBean pager,
- Object... params) throws TopiaException {
+ public List<E> findAllByQueryAndPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException {
Preconditions.checkNotNull(pager);
Preconditions.checkNotNull(hql);
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOLegacy.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -63,14 +63,15 @@
/**
* Surcharge du {@link TopiaDAOImpl} pour utiliser l'api criteria au lieu du hql
* pour tout ce qui est requétage.
- *
+ * <p/>
* Created: 31 déc. 2005 13:10:34
*
* @param <E> le type de l'entite
* @author bpoussin <poussin(a)codelutin.com>
* @author tchemit <chemit(a)codelutin.com>
+ * @deprecated since 2.6.12 Using the hibernate Criteria api is not a good idea as we wants to use in ToPIA next generation (version 3.0) jpa api.
*/
-
+@Deprecated
public class TopiaDAOLegacy<E extends TopiaEntity> extends TopiaDAOImpl<E> { // TopiaDAOLegacy
/** Logger. */
@@ -88,20 +89,20 @@
Object propertyName = null;
Object value = null;
try {
- for (int i = 0; i < properties.length;) {
+ for (int i = 0; i < properties.length; ) {
propertyName = properties[i++];
value = properties[i++];
map.put((String) propertyName, value);
}
} catch (ArrayIndexOutOfBoundsException eee) {
throw new IllegalArgumentException("Wrong number of argument "
- + properties.length
- + ", you must have even number. Last property name read: "
- + propertyName);
+ + properties.length
+ + ", you must have even number. Last property name read: "
+ + propertyName);
} catch (ClassCastException eee) {
throw new IllegalArgumentException(
"Wrong argument type, wait property name as String and have "
- + propertyName.getClass().getName());
+ + propertyName.getClass().getName());
}
E result = create(map);
@@ -123,7 +124,7 @@
throw new TopiaException(eee);
}
throw new TopiaException("La classe " + entityClass.getName()
- + " n'a pas de cle primaire naturelle");
+ + " n'a pas de cle primaire naturelle");
}
@@ -150,17 +151,17 @@
throw new TopiaException(eee);
}
throw new TopiaException("La classe " + entityClass.getName()
- + " n'a pas de cle primaire naturelle");
+ + " n'a pas de cle primaire naturelle");
}
@Override
public E findByProperties(String propertyName, Object value,
- Object... others) throws TopiaException {
+ Object... others) throws TopiaException {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(propertyName, value);
Object name = null;
- for (int i = 0; i < others.length;) {
+ for (int i = 0; i < others.length; ) {
try {
name = others[i++];
value = others[i++];
@@ -168,12 +169,12 @@
} catch (ClassCastException eee) {
throw new IllegalArgumentException(
"Les noms des propriétés doivent être des chaines et non pas "
- + propertyName.getClass().getName(), eee);
+ + propertyName.getClass().getName(), eee);
} catch (ArrayIndexOutOfBoundsException eee) {
throw new IllegalArgumentException(
"Le nombre d'argument n'est pas un nombre pair: "
- + (others.length + 2)
- + " La dernière propriété était: " + name, eee);
+ + (others.length + 2)
+ + " La dernière propriété était: " + name, eee);
}
}
E result = findByProperties(properties);
@@ -182,11 +183,11 @@
@Override
public List<E> findAllByProperties(String propertyName, Object value,
- Object... others) throws TopiaException {
+ Object... others) throws TopiaException {
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(propertyName, value);
Object name = null;
- for (int i = 0; i < others.length;) {
+ for (int i = 0; i < others.length; ) {
try {
name = others[i++];
value = others[i++];
@@ -194,12 +195,12 @@
} catch (ClassCastException eee) {
throw new IllegalArgumentException(
"Les noms des propriétés doivent être des chaines et non pas "
- + propertyName.getClass().getName(), eee);
+ + propertyName.getClass().getName(), eee);
} catch (ArrayIndexOutOfBoundsException eee) {
throw new IllegalArgumentException(
"Le nombre d'argument n'est pas un nombre pair: "
- + (others.length + 2)
- + " La dernière propriété était: " + name, eee);
+ + (others.length + 2)
+ + " La dernière propriété était: " + name, eee);
}
}
List<E> result = findAllByProperties(properties);
@@ -384,7 +385,7 @@
String[] numFields = fields.numFields();
for (String propName : numFields) {
criterion = or(criterion, Restrictions.sqlRestriction(propName
- + " like '" + textValue + "'"));
+ + " like '" + textValue + "'"));
}
}
//boolFields
@@ -403,14 +404,14 @@
String[] boolFields = fields.numFields();
for (String propName : boolFields) {
criterion = or(criterion, Restrictions.eq(propName,
- booleanValue));
+ booleanValue));
}
}
//timeFields
String[] timeFields = fields.dateFields();
for (String propName : timeFields) {
criterion = or(criterion, Restrictions.sqlRestriction(propName
- + " like '" + textValue + "'"));
+ + " like '" + textValue + "'"));
}
return criterion;
}
@@ -480,7 +481,7 @@
Criteria criteria = createCriteria(FlushMode.AUTO);
List<E> result = (List<E>) criteria.list();
result = getContext().getFiresSupport().fireEntitiesLoad(context,
- result);
+ result);
return result;
} catch (HibernateException eee) {
throw new TopiaException(eee);
@@ -495,7 +496,6 @@
}
-
@Override
public List<E> findAllWithOrder(String... propertyNames)
throws TopiaException {
@@ -506,7 +506,7 @@
}
List<E> result = (List<E>) criteria.list();
result = getContext().getFiresSupport().fireEntitiesLoad(context,
- result);
+ result);
return result;
} catch (HibernateException eee) {
throw new TopiaException(eee);
@@ -531,7 +531,7 @@
criteria.add(criterion);
List<E> result = (List<E>) criteria.list();
result = getContext().getFiresSupport().fireEntitiesLoad(context,
- result);
+ result);
return result;
} catch (HibernateException eee) {
throw new TopiaException(eee);
@@ -546,14 +546,14 @@
List<E> result = (List<E>) criteria.list();
int sizeBefore = result != null ? result.size() : 0;
result = getContext().getFiresSupport().fireEntitiesLoad(context,
- result);
+ result);
int sizeAfter = result != null ? result.size() : 0;
if (sizeAfter < sizeBefore) {
if (log.isDebugEnabled()) {
log.debug((sizeBefore - sizeAfter)
- + " element(s) removed. Filter entity: "
- + entityClass.getName() + " - criterion: "
- + criterion);
+ + " element(s) removed. Filter entity: "
+ + entityClass.getName() + " - criterion: "
+ + criterion);
}
}
if (result != null && result.size() > 0) {
@@ -612,6 +612,7 @@
/**
* Renvoie un Criteria créé avec l'entityClass
+ *
* @param mode le FlushMode du Criteria
* @return le Criteria nouvellement créé
* @throws TopiaException if any pb
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaFilterPagerUtil.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -48,6 +48,13 @@
protected TopiaFilterPagerUtil() {
}
+ /**
+ * @param query
+ * @param pager
+ * @return
+ * @deprecated since 2.6.12 TopiaQuery will be removed in version 3.0 of ToPIA
+ */
+ @Deprecated
public static TopiaQuery addPagerToQuery(TopiaQuery query,
FilterPagerBean pager) {
PagerUtil.computeRecordIndexesAndPagesNumber(pager);
Modified: branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java 2012-08-19 11:11:32 UTC (rev 2633)
+++ branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/test/ano1991/TopiaQueryTest.java 2012-08-19 11:11:48 UTC (rev 2634)
@@ -46,6 +46,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.8
*/
+@Deprecated
public class TopiaQueryTest {
@Rule
1
0
r2633 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out
by tchemit@users.nuiton.org 19 Aug '12
by tchemit@users.nuiton.org 19 Aug '12
19 Aug '12
Author: tchemit
Date: 2012-08-19 13:11:32 +0200 (Sun, 19 Aug 2012)
New Revision: 2633
Url: http://nuiton.org/repositories/revision/topia/2633
Log:
refs #2266: Add some api about import / export in csv format (improve export stuff)
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-08-18 12:11:22 UTC (rev 2632)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-08-19 11:11:32 UTC (rev 2633)
@@ -59,11 +59,27 @@
protected final TopiaEntityEnumProvider<T> entityEnumProvider;
- public ExportEntityVisitor(TopiaEntityEnumProvider<T> entityEnumProvider, Map<T, TopiaCsvExports.EntityExportContext<T>> entityExporters) {
+ public static <T extends TopiaEntityEnum> ExportEntityVisitor<T> newVisitor(
+ TopiaEntityEnumProvider<T> entityEnumProvider,
+ Map<T, TopiaCsvExports.EntityExportContext<T>> entityExporters) {
+ return new ExportEntityVisitor<T>(
+ entityEnumProvider,
+ entityExporters
+ );
+ }
+
+ public ExportEntityVisitor(TopiaEntityEnumProvider<T> entityEnumProvider,
+ Map<T, TopiaCsvExports.EntityExportContext<T>> entityExporters) {
this.entityEnumProvider = entityEnumProvider;
this.entityExporters = entityExporters;
}
+ public <E extends TopiaEntity> void export(Iterable<E> entities) {
+ for (E entity : entities) {
+ export(entity);
+ }
+ }
+
public void export(TopiaEntity entity) {
Preconditions.checkNotNull(entity);
long s1 = TimeLog.getTime();
1
0
r2632 - in branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia: framework persistence
by tchemit@users.nuiton.org 18 Aug '12
by tchemit@users.nuiton.org 18 Aug '12
18 Aug '12
Author: tchemit
Date: 2012-08-18 14:11:22 +0200 (Sat, 18 Aug 2012)
New Revision: 2632
Url: http://nuiton.org/repositories/revision/topia/2632
Log:
refs #2271: Deprecate TopiaQuery
refs #2272: Add new methods to TopiaDAO to help hql query
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2012-08-18 10:37:13 UTC (rev 2631)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/framework/TopiaQuery.java 2012-08-18 12:11:22 UTC (rev 2632)
@@ -226,10 +226,12 @@
* @author fdesbois
* @version $Revision$
* @since 2.3.0
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
* <p/>
* Mise a jour: $Date$ par
* : $Author$
*/
+@Deprecated
public class TopiaQuery {
private static final Log log = LogFactory.getLog(TopiaQuery.class);
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-08-18 10:37:13 UTC (rev 2631)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAO.java 2012-08-18 12:11:22 UTC (rev 2632)
@@ -42,9 +42,7 @@
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaQuery;
-import org.nuiton.topia.generator.DAOAbstractTransformer;
-import org.nuiton.topia.generator.DAOImplTransformer;
-import org.nuiton.topia.generator.DAOTransformer;
+import org.nuiton.topia.generator.EntityDAOTransformer;
import java.security.Permission;
import java.util.List;
@@ -56,9 +54,7 @@
* TopiaQuery}.
* <p/>
* This interface is implemented by {@link TopiaDAOImpl} overridden by generation
- * from {@link DAOTransformer} for specific entity interface, {@link
- * DAOAbstractTransformer} for abstract implementation and {@link
- * DAOImplTransformer} for final implementation class.
+ * from {@link EntityDAOTransformer}.
* <p/>
*
* @param <E> the entity type linked with the dao
@@ -223,7 +219,9 @@
* @return une nouvelle TopiaQuery vide. (uniquement avec le From sur le
* type d'entité)
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
TopiaQuery createQuery();
/**
@@ -236,7 +234,9 @@
* requête
* @return une nouvelle TopiaQuery
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
TopiaQuery createQuery(String entityAlias);
/**
@@ -275,7 +275,9 @@
* @throws TopiaException if any pb while getting datas
* @see TopiaQuery#executeToEntity(TopiaContext, Class)
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
E findByQuery(TopiaQuery query) throws TopiaException;
List<E> findAll() throws TopiaException;
@@ -314,7 +316,9 @@
* @throws TopiaException if any pb while getting datas
* @see TopiaQuery#executeToEntityList(TopiaContext, Class)
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
List<E> findAllByQuery(TopiaQuery query) throws TopiaException;
/**
@@ -327,7 +331,9 @@
* @throws TopiaException if any pb while getting datas
* @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
Map<String, E> findAllMappedByQuery(TopiaQuery query) throws TopiaException;
/**
@@ -343,7 +349,9 @@
* @throws TopiaException if any pb while getting datas
* @see TopiaQuery#executeToEntityMap(TopiaContext, Class)
* @since 2.3
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
<K> Map<K, E> findAllMappedByQuery(TopiaQuery query,
String keyName, Class<K> keyClass) throws TopiaException;
@@ -411,7 +419,9 @@
* @return true if entity exists, false otherwise
* @throws TopiaException
* @since 2.3.4
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
boolean existByQuery(TopiaQuery query) throws TopiaException;
/**
@@ -430,7 +440,9 @@
* @return number of entities filtered by the query
* @throws TopiaException if any pb while getting datas
* @since 2.3.4
+ * @deprecated since 2.6.12, {@link TopiaQuery} will be removed in version 3.0
*/
+ @Deprecated
int countByQuery(TopiaQuery query) throws TopiaException;
/**
@@ -454,5 +466,38 @@
*/
E findByPrimaryKey(Object... k) throws TopiaException;
+ boolean existsByQuery(String hql,
+ Object... params) throws TopiaException;
+
+ long countByQuery(String hql,
+ Object... params) throws TopiaException;
+
+ E findUniqueByQuery(String hql,
+ Object... params) throws TopiaException;
+
+ <R> R findUniqueByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException;
+
+ List<E> findAllByQuery(String hql,
+ Object... params) throws TopiaException;
+
+ <R> List<R> findAllByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException;
+
+ List<E> findAllByQueryWithBound(String hql,
+ int startIndex,
+ int endIndex,
+ Object... params) throws TopiaException;
+
+ List<E> findByQueryAndPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException;
+
+ void computeAndAddRecordsToPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException;
+
} //TopiaDAO
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-08-18 10:37:13 UTC (rev 2631)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/TopiaDAOImpl.java 2012-08-18 12:11:22 UTC (rev 2632)
@@ -37,7 +37,9 @@
package org.nuiton.topia.persistence;
+import com.google.common.base.Preconditions;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
@@ -48,6 +50,7 @@
import org.nuiton.topia.event.TopiaEntityVetoable;
import org.nuiton.topia.framework.TopiaContextImplementor;
import org.nuiton.topia.framework.TopiaQuery;
+import org.nuiton.util.PagerUtil;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
@@ -237,7 +240,7 @@
Object propertyName = null;
Object value;
try {
- for (int i = 0; i < properties.length;) {
+ for (int i = 0; i < properties.length; ) {
propertyName = properties[i++];
value = properties[i++];
map.put((String) propertyName, value);
@@ -517,7 +520,7 @@
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(propertyName, propertyValue);
Object name = null;
- for (int i = 0; i < others.length;) {
+ for (int i = 0; i < others.length; ) {
try {
name = others[i++];
propertyValue = others[i++];
@@ -580,9 +583,98 @@
}
throw new TopiaException("La classe " + entityClass.getName()
+ " n'a pas de cle primaire naturelle");
+ }
+ public boolean existsByQuery(String hql,
+ Object... params) throws TopiaException {
+ long count = countByQuery(hql, params);
+ return count > 0;
}
+ public long countByQuery(String hql,
+ Object... params) throws TopiaException {
+
+ Preconditions.checkNotNull(hql);
+ Preconditions.checkArgument(hql.startsWith("SELECT COUNT("));
+
+ return findUniqueByQuery(Long.class, hql, params);
+ }
+
+ public E findUniqueByQuery(String hql,
+ Object... params) throws TopiaException {
+ return findUniqueByQuery(getEntityClass(), hql, params);
+ }
+
+ public <R> R findUniqueByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException {
+
+ Preconditions.checkNotNull(type);
+ Preconditions.checkNotNull(hql);
+
+ Object unique = getContext().findUnique(hql, params);
+ Preconditions.checkState(unique == null ||
+ type.isAssignableFrom(unique.getClass()));
+ return (R) unique;
+ }
+
+ public List<E> findAllByQuery(String hql,
+ Object... params) throws TopiaException {
+
+ return findAllByQuery(getEntityClass(), hql, params);
+ }
+
+ public <R> List<R> findAllByQuery(Class<R> type,
+ String hql,
+ Object... params) throws TopiaException {
+
+ Preconditions.checkNotNull(type);
+ Preconditions.checkNotNull(hql);
+
+ List<R> result = getContext().findAll(hql, params);
+ return result;
+ }
+
+ public List<E> findAllByQueryWithBound(String hql,
+ int startIndex,
+ int endIndex,
+ Object... params) throws TopiaException {
+
+ Preconditions.checkNotNull(hql);
+
+ List<E> result = getContext().find(hql, startIndex, endIndex, params);
+ return result;
+ }
+
+ public List<E> findByQueryAndPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException {
+ Preconditions.checkNotNull(pager);
+ Preconditions.checkNotNull(hql);
+
+ if (StringUtils.isNotBlank(pager.getSortColumn())) {
+ hql += " ORDER BY " + pager.getSortColumn();
+ if (!pager.isSortAscendant()) {
+ hql += " DESC";
+ }
+ }
+ List<E> result = findAllByQueryWithBound(hql,
+ pager.getRecordStartIndex(),
+ pager.getRecordEndIndex() - 1,
+ params);
+ return result;
+ }
+
+ public void computeAndAddRecordsToPager(String hql,
+ TopiaFilterPagerUtil.FilterPagerBean pager,
+ Object... params) throws TopiaException {
+
+ long records = countByQuery(hql, params);
+
+ pager.setRecords((int) records);
+ PagerUtil.computeRecordIndexesAndPagesNumber(pager);
+ }
+
/**
* Renvoie la Session contenue dans le contexte
*
@@ -609,5 +701,5 @@
}
return meta;
}
-
+
} //TopiaDAOImpl
1
0
r2631 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out
by tchemit@users.nuiton.org 18 Aug '12
by tchemit@users.nuiton.org 18 Aug '12
18 Aug '12
Author: tchemit
Date: 2012-08-18 12:37:13 +0200 (Sat, 18 Aug 2012)
New Revision: 2631
Url: http://nuiton.org/repositories/revision/topia/2631
Log:
fix since
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-08-18 10:02:32 UTC (rev 2630)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-08-18 10:37:13 UTC (rev 2631)
@@ -44,7 +44,7 @@
* Entity visitor to export data to csv files.
*
* @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
+ * @since 2.6.12
*/
public class ExportEntityVisitor<T extends TopiaEntityEnum> implements EntityVisitor, Closeable {
1
0
r2630 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out
by tchemit@users.nuiton.org 18 Aug '12
by tchemit@users.nuiton.org 18 Aug '12
18 Aug '12
Author: tchemit
Date: 2012-08-18 12:02:32 +0200 (Sat, 18 Aug 2012)
New Revision: 2630
Url: http://nuiton.org/repositories/revision/topia/2630
Log:
refs #2266: Add some api about import / export in csv format (improve export api)
Added:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
Removed:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
Deleted: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java 2012-08-18 09:57:33 UTC (rev 2629)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java 2012-08-18 10:02:32 UTC (rev 2630)
@@ -1,181 +0,0 @@
-package org.nuiton.topia.persistence.csv.out;
-/*
- * #%L
- * ToPIA :: Persistence
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2004 - 2012 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%
- */
-
-import com.google.common.base.Preconditions;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.nuiton.topia.TopiaException;
-import org.nuiton.topia.TopiaRuntimeException;
-import org.nuiton.topia.persistence.EntityVisitor;
-import org.nuiton.topia.persistence.TopiaEntity;
-import org.nuiton.topia.persistence.TopiaEntityEnum;
-import org.nuiton.util.TimeLog;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * entity visitor to export data to csv files.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public abstract class AbstractExportEntityVisitor<T extends TopiaEntityEnum> implements EntityVisitor {
-
- /** Logger. */
- private static final Log log =
- LogFactory.getLog(AbstractExportEntityVisitor.class);
-
- public static final TimeLog TIME_LOG =
- new TimeLog(AbstractExportEntityVisitor.class);
-
-
- protected abstract boolean isNoChildVisit(String propertyName, TopiaEntity entity);
-
-
- /** Export for simple entity. */
- protected final Map<Class<?>, TopiaCsvExports.EntityExportContext> entityExporters;
-
- public AbstractExportEntityVisitor(Map<Class<?>, TopiaCsvExports.EntityExportContext> entityExporters) {
- this.entityExporters = entityExporters;
- }
-
- public void export(TopiaEntity entity) {
- Preconditions.checkNotNull(entity);
- long s1 = TimeLog.getTime();
- try {
- entity.accept(this);
- } catch (TopiaException e) {
- throw new TopiaRuntimeException(
- "Could not export entity " + entity.getTopiaId(), e);
- } finally {
- TIME_LOG.log(s1, "export::" + entity.getTopiaId());
- }
- }
-
- @Override
- public void start(TopiaEntity entity) {
- String topiaId = entity.getTopiaId();
- try {
- if (log.isDebugEnabled()) {
- log.debug("Starts export of entity " + topiaId);
- }
- TopiaCsvExports.EntityExportContext entityExporter =
- entityExporters.get(entity.getClass());
- entityExporter.write(entity);
- } catch (Exception e) {
- throw new TopiaRuntimeException(
- "Could not export entity " + entity, e);
- } finally {
- if (log.isDebugEnabled()) {
- log.debug("Ends export of entity " + topiaId);
- }
- }
- }
-
- @Override
- public void end(TopiaEntity entity) {
- try {
- if (log.isDebugEnabled()) {
- log.debug("Starts export of association of entity " +
- entity.getTopiaId());
- }
- TopiaCsvExports.EntityExportContext entityExporter =
- entityExporters.get(entity.getClass());
- entityExporter.writeAssociations(entity);
- } catch (Exception e) {
- throw new TopiaRuntimeException(
- "Could not export associations of entity " + entity, e);
- } finally {
- if (log.isDebugEnabled()) {
- log.debug("Ends export of association of entity " +
- entity.getTopiaId());
- }
- }
- }
-
- @Override
- public void visit(TopiaEntity entity, String propertyName,
- Class<?> type, Object value) {
- }
-
- @Override
- public void visit(TopiaEntity entity,
- String propertyName,
- Class<?> collectionType,
- Class<?> type,
- Object value) {
-
- if (TopiaEntity.class.isAssignableFrom(type) &&
- entityExporters.containsKey(type)) {
- Collection<?> cValue = (Collection<?>) value;
-
- if (CollectionUtils.isNotEmpty(cValue)) {
-
- if (isNoChildVisit(propertyName, entity) &&
- Entity2.class.isAssignableFrom(type)) {
-
- // special case, when visiting a entity with no child
- // visisting at this time...
- for (Object currentValue : cValue) {
- ((Entity2) currentValue).accept2(this);
- }
- } else {
- for (Object currentValue : cValue) {
- try {
- ((TopiaEntity) currentValue).accept(this);
- } catch (TopiaException e) {
- if (log.isErrorEnabled()) {
- log.error("Can not visit entity " + value, e);
- }
- }
- }
- }
- }
- }
- }
-
- @Override
- public void visit(TopiaEntity entity,
- String propertyName,
- Class<?> collectionType, Class<?> type,
- int index,
- Object value) {
-
- // nothing to do
- }
-
- @Override
- public void clear() {
-
- // use at the end of visit (or later)
-
- for (TopiaCsvExports.EntityExportContext exportContext : entityExporters.values()) {
- IOUtils.closeQuietly(exportContext);
- }
- }
-}
Copied: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java (from rev 2627, branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java)
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java (rev 0)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java 2012-08-18 10:02:32 UTC (rev 2630)
@@ -0,0 +1,200 @@
+package org.nuiton.topia.persistence.csv.out;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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%
+ */
+
+import com.google.common.base.Preconditions;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.topia.TopiaException;
+import org.nuiton.topia.TopiaRuntimeException;
+import org.nuiton.topia.persistence.EntityVisitor;
+import org.nuiton.topia.persistence.TopiaEntity;
+import org.nuiton.topia.persistence.TopiaEntityEnum;
+import org.nuiton.topia.persistence.metadata.TopiaEntityEnumProvider;
+import org.nuiton.util.TimeLog;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Entity visitor to export data to csv files.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class ExportEntityVisitor<T extends TopiaEntityEnum> implements EntityVisitor, Closeable {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(ExportEntityVisitor.class);
+
+ public static final TimeLog TIME_LOG =
+ new TimeLog(ExportEntityVisitor.class);
+
+ /** Export for simple entity. */
+ protected final Map<T, TopiaCsvExports.EntityExportContext<T>> entityExporters;
+
+ protected final TopiaEntityEnumProvider<T> entityEnumProvider;
+
+ public ExportEntityVisitor(TopiaEntityEnumProvider<T> entityEnumProvider, Map<T, TopiaCsvExports.EntityExportContext<T>> entityExporters) {
+ this.entityEnumProvider = entityEnumProvider;
+ this.entityExporters = entityExporters;
+ }
+
+ public void export(TopiaEntity entity) {
+ Preconditions.checkNotNull(entity);
+ long s1 = TimeLog.getTime();
+ try {
+ entity.accept(this);
+ } catch (TopiaException e) {
+ throw new TopiaRuntimeException(
+ "Could not export entity " + entity.getTopiaId(), e);
+ } finally {
+ TIME_LOG.log(s1, "export::" + entity.getTopiaId());
+ }
+ }
+
+ @Override
+ public void start(TopiaEntity entity) {
+ String topiaId = entity.getTopiaId();
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Starts export of entity " + topiaId);
+ }
+ TopiaCsvExports.EntityExportContext entityExporter =
+ getEntityContext(entity.getClass());
+ Preconditions.checkNotNull(entityExporter);
+ entityExporter.write(entity);
+ } catch (Exception e) {
+ throw new TopiaRuntimeException(
+ "Could not export entity " + entity, e);
+ } finally {
+ if (log.isDebugEnabled()) {
+ log.debug("Ends export of entity " + topiaId);
+ }
+ }
+ }
+
+ @Override
+ public void end(TopiaEntity entity) {
+ try {
+ if (log.isDebugEnabled()) {
+ log.debug("Starts export of association of entity " +
+ entity.getTopiaId());
+ }
+ TopiaCsvExports.EntityExportContext entityExporter =
+ getEntityContext(entity.getClass());
+ Preconditions.checkNotNull(entityExporter);
+ entityExporter.writeAssociations(entity);
+ } catch (Exception e) {
+ throw new TopiaRuntimeException(
+ "Could not export associations of entity " + entity, e);
+ } finally {
+ if (log.isDebugEnabled()) {
+ log.debug("Ends export of association of entity " +
+ entity.getTopiaId());
+ }
+ }
+ }
+
+
+ @Override
+ public void visit(TopiaEntity entity, String propertyName,
+ Class<?> type, Object value) {
+ }
+
+ @Override
+ public void visit(TopiaEntity entity,
+ String propertyName,
+ Class<?> collectionType,
+ Class<?> type,
+ Object value) {
+
+ if (TopiaEntity.class.isAssignableFrom(type) &&
+ getEntityContext(type) != null) {
+ Collection<?> cValue = (Collection<?>) value;
+
+ if (CollectionUtils.isNotEmpty(cValue)) {
+
+ if (isNoChildVisit(propertyName, entity) &&
+ Entity2.class.isAssignableFrom(type)) {
+
+ // special case, when visiting a entity with no child
+ // visisting at this time...
+ for (Object currentValue : cValue) {
+ ((Entity2) currentValue).accept2(this);
+ }
+ } else {
+ for (Object currentValue : cValue) {
+ try {
+ ((TopiaEntity) currentValue).accept(this);
+ } catch (TopiaException e) {
+ if (log.isErrorEnabled()) {
+ log.error("Can not visit entity " + value, e);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public void visit(TopiaEntity entity,
+ String propertyName,
+ Class<?> collectionType, Class<?> type,
+ int index,
+ Object value) {
+
+ // nothing to do
+ }
+
+ @Override
+ public void close() throws IOException {
+
+ // use at the end of visit (or later)
+
+ for (TopiaCsvExports.EntityExportContext<T> exportContext : entityExporters.values()) {
+ exportContext.close();
+ }
+ }
+
+ @Override
+ public void clear() {
+ // prefer use the close api
+ }
+
+ protected TopiaCsvExports.EntityExportContext getEntityContext(Class<?> entityType) {
+ T entityEnum = entityEnumProvider.getEntityEnum(entityType);
+ return entityEnum == null ? null : entityExporters.get(entityEnum);
+ }
+
+ protected boolean isNoChildVisit(String propertyName, TopiaEntity entity) {
+
+ // by default accept all associations
+ return false;
+ }
+}
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportEntityVisitor.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2012-08-18 09:57:33 UTC (rev 2629)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2012-08-18 10:02:32 UTC (rev 2630)
@@ -150,24 +150,21 @@
return Export.newExport(model, datas);
}
- public static <T extends TopiaEntityEnum> Map<Class<?>, EntityExportContext> createReplicateEntityVisitorContexts(ExportModelFactory<T> modelFactory,
- MetaFilenameAware<T>[] entityMetas,
- Multimap<T, MetaFilenameAware<T>> associations,
- File container) {
+ public static <T extends TopiaEntityEnum> Map<T, EntityExportContext<T>> createReplicateEntityVisitorContexts(ExportModelFactory<T> modelFactory,
+ MetaFilenameAware<T>[] entityMetas,
+ Multimap<T, MetaFilenameAware<T>> associations,
+ File container) {
Preconditions.checkNotNull(modelFactory);
Preconditions.checkNotNull(entityMetas);
Preconditions.checkNotNull(associations);
Preconditions.checkNotNull(container);
- Map<Class<?>, EntityExportContext> contexts = Maps.newHashMap();
+ Map<T, EntityExportContext<T>> contexts = Maps.newHashMap();
for (MetaFilenameAware<T> entityMeta : entityMetas) {
TableMeta<T> meta = (TableMeta<T>) entityMeta;
- T source = meta.getSource();
- Collection<MetaFilenameAware<T>> metaFilenameAwares = associations.get(source);
-
ExportModel<TopiaEntity> model = modelFactory.buildForExport(meta);
EntityExportContext<T> exportContext = EntityExportContext.newExportContext(
@@ -175,13 +172,14 @@
meta,
container);
- // save both for contract and implementation with same context
- contexts.put(source.getContract(), exportContext);
- contexts.put(source.getImplementation(), exportContext);
+ T source = meta.getSource();
- for (MetaFilenameAware<T> metaFilenameAware : metaFilenameAwares) {
- AssociationMeta<T> associationMeta = (AssociationMeta<T>) metaFilenameAware;
+ contexts.put(source, exportContext);
+ for (MetaFilenameAware<T> metaFilenameAware : associations.get(source)) {
+ AssociationMeta<T> associationMeta =
+ (AssociationMeta<T>) metaFilenameAware;
+
ExportModel<TopiaEntity> associationModel =
modelFactory.buildForExport(associationMeta);
exportContext.addAssociationExportContext(associationMeta,
@@ -224,8 +222,7 @@
public static <T extends TopiaEntityEnum> EntityExportContext<T> newExportContext(
ExportModel<TopiaEntity> model,
TableMeta<T> meta,
- File container
- ) {
+ File container) {
return new EntityExportContext<T>(model, meta, container);
}
1
0
r2629 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata
by tchemit@users.nuiton.org 18 Aug '12
by tchemit@users.nuiton.org 18 Aug '12
18 Aug '12
Author: tchemit
Date: 2012-08-18 11:57:33 +0200 (Sat, 18 Aug 2012)
New Revision: 2629
Url: http://nuiton.org/repositories/revision/topia/2629
Log:
refs #2260: Add a metadata package in persistence (improve api)
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/DbMeta.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/Metadatas.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/TableMeta.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/DbMeta.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/DbMeta.java 2012-08-17 13:58:26 UTC (rev 2628)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/DbMeta.java 2012-08-18 09:57:33 UTC (rev 2629)
@@ -47,10 +47,13 @@
/** All types non editables. */
protected final Set<T> nonEditableTypes;
- public static <T extends TopiaEntityEnum> DbMeta<T> newDbMeta(T[] universe,
- T[] nonEditables,
- TopiaEntityEnumProvider<T> typeProvider) {
- return new DbMeta<T>(universe, nonEditables, typeProvider);
+ protected final TopiaEntityEnumProvider<T> entityEnumProvider;
+
+ public static <T extends TopiaEntityEnum> DbMeta<T> newDbMeta(
+ TopiaEntityEnumProvider<T> typeProvider,
+ T[] universe,
+ T... nonEditables) {
+ return new DbMeta<T>(typeProvider, universe, nonEditables);
}
public List<String> getTableNames() {
@@ -82,11 +85,14 @@
return getTables().iterator();
}
- protected DbMeta(T[] entityTypes, T[] nonEditableTypes, TopiaEntityEnumProvider<T> typeProvider) {
+ protected DbMeta(TopiaEntityEnumProvider<T> entityEnumProvider,
+ T[] entityTypes,
+ T... nonEditableTypes) {
+ this.entityEnumProvider = entityEnumProvider;
this.nonEditableTypes = Sets.newHashSet(nonEditableTypes);
tables = Lists.newArrayList();
for (T entityEnum : entityTypes) {
- TableMeta<T> tableMeta = TableMeta.newMeta(entityEnum, typeProvider);
+ TableMeta<T> tableMeta = TableMeta.newMeta(entityEnum, entityEnumProvider);
tables.add(tableMeta);
}
}
@@ -94,4 +100,8 @@
public boolean isEditable(TableMeta<T> meta) {
return !nonEditableTypes.contains(meta.getSource());
}
+
+ public TopiaEntityEnumProvider<T> getEntityEnumProvider() {
+ return entityEnumProvider;
+ }
}
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/Metadatas.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/Metadatas.java 2012-08-17 13:58:26 UTC (rev 2628)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/Metadatas.java 2012-08-18 09:57:33 UTC (rev 2629)
@@ -31,7 +31,7 @@
import java.util.List;
/**
- * USeful methods around metadatas.
+ * Useful methods around metadatas.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.6.12
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/TableMeta.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/TableMeta.java 2012-08-17 13:58:26 UTC (rev 2628)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/TableMeta.java 2012-08-18 09:57:33 UTC (rev 2629)
@@ -57,8 +57,8 @@
private static final long serialVersionUID = 1L;
- public static <T extends TopiaEntityEnum> TableMeta newMeta(T entityEnum,
- TopiaEntityEnumProvider<T> typeProvider) {
+ public static <T extends TopiaEntityEnum> TableMeta<T> newMeta(T entityEnum,
+ TopiaEntityEnumProvider<T> typeProvider) {
return new TableMeta<T>(entityEnum, typeProvider);
}
1
0
r2628 - branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv
by tchemit@users.nuiton.org 17 Aug '12
by tchemit@users.nuiton.org 17 Aug '12
17 Aug '12
Author: tchemit
Date: 2012-08-17 15:58:26 +0200 (Fri, 17 Aug 2012)
New Revision: 2628
Url: http://nuiton.org/repositories/revision/topia/2628
Log:
refs #2266: Add some api about import / export in csv format (can import/export enum)
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2012-08-17 09:17:17 UTC (rev 2627)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2012-08-17 13:58:26 UTC (rev 2628)
@@ -29,6 +29,7 @@
import org.nuiton.topia.persistence.TopiaEntityEnum;
import org.nuiton.topia.persistence.TopiaId;
import org.nuiton.topia.persistence.metadata.TableMeta;
+import org.nuiton.util.csv.ValueParserFormatter;
import org.nuiton.util.csv.ext.AbstractImportExportModel;
import org.nuiton.util.decorator.Decorator;
@@ -47,6 +48,8 @@
protected final TableMeta<T> tableMeta;
+ protected boolean useOrdinalForEnum;
+
public static <T extends TopiaEntityEnum, E extends TopiaEntity> EntityCsvModel<T, E> newModel(
char separator,
TableMeta<T> tableMeta) {
@@ -65,16 +68,19 @@
return (E) tableMeta.newEntity();
}
+ public void setUseOrdinalForEnum(boolean useOrdinalForEnum) {
+ this.useOrdinalForEnum = useOrdinalForEnum;
+ }
+
public void addForeignKeyForExport(String propertyName,
Class<TopiaEntity> entityType) {
Map<String, TopiaEntity> universe = Collections.emptyMap();
- newColumnForExport(
- propertyName,
- TopiaCsvCommons.newForeignKeyValue(entityType,
- propertyName,
- universe)
+ newColumnForExport(propertyName,
+ TopiaCsvCommons.newForeignKeyValue(entityType,
+ propertyName,
+ universe)
);
}
@@ -95,12 +101,11 @@
Map<String, E> universe = Maps.uniqueIndex(entities, transform);
- newMandatoryColumn(
- headerName,
- propertyName,
- TopiaCsvCommons.newForeignKeyValue(entityType,
- propertyName,
- universe)
+ newMandatoryColumn(headerName,
+ propertyName,
+ TopiaCsvCommons.newForeignKeyValue(entityType,
+ propertyName,
+ universe)
);
}
@@ -128,11 +133,10 @@
Map<String, E> universe = Maps.uniqueIndex(entities,
TopiaId.GET_TOPIA_ID);
- newMandatoryColumn(
- propertyName,
- TopiaCsvCommons.newForeignKeyValue(entityType,
- propertyName,
- universe)
+ newMandatoryColumn(propertyName,
+ TopiaCsvCommons.newForeignKeyValue(entityType,
+ propertyName,
+ universe)
);
}
@@ -148,75 +152,82 @@
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.DAY_TIME_SECOND_WITH_TIMESTAMP
- );
+ TopiaCsvCommons.DAY_TIME_SECOND_WITH_TIMESTAMP);
} else if (double.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.DOUBLE_PRIMITIVE
- );
+ TopiaCsvCommons.DOUBLE_PRIMITIVE);
} else if (Double.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.DOUBLE
- );
+ TopiaCsvCommons.DOUBLE);
} else if (long.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.PRIMITIVE_LONG
- );
+ TopiaCsvCommons.PRIMITIVE_LONG);
} else if (Long.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.LONG
- );
+ TopiaCsvCommons.LONG);
} else if (float.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.PRIMITIVE_FLOAT
- );
+ TopiaCsvCommons.PRIMITIVE_FLOAT);
} else if (Float.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.FLOAT
- );
+ TopiaCsvCommons.FLOAT);
} else if (int.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.PRIMITIVE_INTEGER
- );
+ TopiaCsvCommons.PRIMITIVE_INTEGER);
} else if (Integer.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.INTEGER
- );
+ TopiaCsvCommons.INTEGER);
} else if (boolean.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.PRIMITIVE_BOOLEAN
- );
+ TopiaCsvCommons.PRIMITIVE_BOOLEAN);
} else if (Boolean.class.equals(type)) {
newColumnForImportExport(
headerName,
propertyName,
- TopiaCsvCommons.BOOLEAN
- );
+ TopiaCsvCommons.BOOLEAN);
+ } else if (String.class.equals(type)) {
+ newColumnForImportExport(
+ headerName,
+ propertyName);
+ } else if (type.isEnum()) {
+
+ Class<Enum> enumType = (Class<Enum>) type;
+ ValueParserFormatter<Enum> valueParserFormatter;
+ if (useOrdinalForEnum) {
+ valueParserFormatter =
+ TopiaCsvCommons.newEnumByOrdinalParserFormatter(enumType);
+ } else {
+ valueParserFormatter =
+ TopiaCsvCommons.newEnumByNameParserFormatter(enumType);
+ }
+
+ newColumnForImportExport(headerName,
+ propertyName,
+ valueParserFormatter);
+
} else {
- // string
- newColumnForImportExport(
- headerName,
- propertyName
- );
+ throw new IllegalStateException(String.format(
+ "For header %s, property %s, no specific handler " +
+ "found for type %s", headerName, propertyName, type));
}
}
1
0
r2627 - in branches/topia-2.6.x/topia-persistence/src: main/java/org/nuiton/topia/persistence/csv main/java/org/nuiton/topia/persistence/csv/in main/java/org/nuiton/topia/persistence/csv/out main/java/org/nuiton/topia/persistence/metadata test/java/org/nuiton/topia/persistence
by tchemit@users.nuiton.org 17 Aug '12
by tchemit@users.nuiton.org 17 Aug '12
17 Aug '12
Author: tchemit
Date: 2012-08-17 11:17:17 +0200 (Fri, 17 Aug 2012)
New Revision: 2627
Url: http://nuiton.org/repositories/revision/topia/2627
Log:
add missing headers + svn properties
Modified:
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvFileImportResult.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/package-info.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/PrepareDataForExport.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/package-info.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/package-info.java
branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/package-info.java
branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaContextFindTest.java
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/EntityCsvModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/TopiaCsvCommons.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* EchoBase :: Entities
*
* $Id$
- * $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-entities/src/mai… $
+ * $HeadURL$
* %%
* Copyright (C) 2011 - 2012 Ifremer, Codelutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/AbstractImportModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvFileImportResult.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvFileImportResult.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvFileImportResult.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvFileImportResult.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/CsvImportResult.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/EntityAssociationImportModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/ImportModelFactory.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/TopiaCsvImports.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/in/package-info.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/AbstractExportEntityVisitor.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/Entity2.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/EntityAssociationExportModel.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/ExportModelFactory.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/PrepareDataForExport.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/PrepareDataForExport.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/PrepareDataForExport.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -1,4 +1,27 @@
package org.nuiton.topia.persistence.csv.out;
+/*
+ * #%L
+ * ToPIA :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2004 - 2012 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%
+ */
import org.nuiton.topia.persistence.TopiaEntity;
import org.nuiton.topia.persistence.TopiaEntityEnum;
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/PrepareDataForExport.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -3,7 +3,7 @@
* #%L
* ToPIA :: Persistence
* $Id$
- * $HeadURL:$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/TopiaCsvExports.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/out/package-info.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/csv/package-info.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Property changes on: branches/topia-2.6.x/topia-persistence/src/main/java/org/nuiton/topia/persistence/metadata/package-info.java
___________________________________________________________________
Modified: svn:keywords
- Author Date Id Revision
+ Author Date Id Revision HeadURL
Modified: branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaContextFindTest.java
===================================================================
--- branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaContextFindTest.java 2012-08-17 08:47:17 UTC (rev 2626)
+++ branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaContextFindTest.java 2012-08-17 09:17:17 UTC (rev 2627)
@@ -1,8 +1,8 @@
/*
* #%L
* ToPIA :: Persistence :: Test Compatibility Kit
- * $Id: IsPersistentTest.java 2570 2012-05-31 10:46:40Z athimel $
- * $HeadURL: http://svn.nuiton.org/svn/topia/trunk/topia-persistence-tck/src/test/java/o… $
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2004 - 2012 CodeLutin
* %%
Property changes on: branches/topia-2.6.x/topia-persistence/src/test/java/org/nuiton/topia/persistence/TopiaContextFindTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
1
0
r2626 - in trunk: src/site topia-persistence/src/site topia-service-migration/src/site topia-service-replication/src/site topia-service-security/src/site
by tchemit@users.nuiton.org 17 Aug '12
by tchemit@users.nuiton.org 17 Aug '12
17 Aug '12
Author: tchemit
Date: 2012-08-17 10:47:17 +0200 (Fri, 17 Aug 2012)
New Revision: 2626
Url: http://nuiton.org/repositories/revision/topia/2626
Log:
fix site scm metadata + site logos
Modified:
trunk/src/site/site_fr.xml
trunk/topia-persistence/src/site/site_fr.xml
trunk/topia-service-migration/src/site/site_fr.xml
trunk/topia-service-replication/src/site/site_fr.xml
trunk/topia-service-security/src/site/site_fr.xml
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2012-08-17 08:46:50 UTC (rev 2625)
+++ trunk/src/site/site_fr.xml 2012-08-17 08:47:17 UTC (rev 2626)
@@ -57,17 +57,17 @@
<poweredBy>
<logo href="http://maven.apache.org" name="Maven"
- img="${project.url}/images/logos/maven-feather.png"/>
+ img="http://maven-site.chorem.org/public/images/logos/maven-feather.png"/>
<logo href="http://maven-site.nuiton.org/jrst/" name="JRst"
- img="${project.url}/images/jrst-logo.png"/>
+ img="http://maven-site.chorem.org/public/images/logos/jrst-logo.png"/>
<logo href="http://docutils.sourceforge.net/rst.html"
name="ReStructuredText"
- img="${project.url}/images/restructuredtext-logo.png"/>
+ img="http://maven-site.chorem.org/public/images/logos/restructuredtext-logo.png"/>
<logo href="http://argouml.tigris.org/" name="ArgoUML"
- img="images/argouml-logo.png"/>
+ img="http://maven-site.chorem.org/public/images/logos/argouml-logo.png"/>
</poweredBy>
<body>
@@ -101,7 +101,7 @@
projectversion='${project.version}'
platform='${project.platform}'
projectid='${project.projectId}'
- scm='${project.scm.connection}'
+ scm='${project.scm.developerConnection}'
scmwebeditorenabled='${project.scmwebeditorEnabled}'
scmwebeditorurl='${project.scmwebeditorUrl}'
siteSourcesType='${project.siteSourcesType}'
Modified: trunk/topia-persistence/src/site/site_fr.xml
===================================================================
--- trunk/topia-persistence/src/site/site_fr.xml 2012-08-17 08:46:50 UTC (rev 2625)
+++ trunk/topia-persistence/src/site/site_fr.xml 2012-08-17 08:47:17 UTC (rev 2626)
@@ -93,7 +93,7 @@
projectversion='${project.version}'
platform='${project.platform}'
projectid='${project.projectId}'
- scm='${project.scm.connection}'
+ scm='${project.scm.developerConnection}'
scmwebeditorenabled='${project.scmwebeditorEnabled}'
scmwebeditorurl='${project.scmwebeditorUrl}'
siteSourcesType='${project.siteSourcesType}'
Modified: trunk/topia-service-migration/src/site/site_fr.xml
===================================================================
--- trunk/topia-service-migration/src/site/site_fr.xml 2012-08-17 08:46:50 UTC (rev 2625)
+++ trunk/topia-service-migration/src/site/site_fr.xml 2012-08-17 08:47:17 UTC (rev 2626)
@@ -65,7 +65,7 @@
projectversion='${project.version}'
platform='${project.platform}'
projectid='${project.projectId}'
- scm='${project.scm.connection}'
+ scm='${project.scm.developerConnection}'
scmwebeditorenabled='${project.scmwebeditorEnabled}'
scmwebeditorurl='${project.scmwebeditorUrl}'
siteSourcesType='${project.siteSourcesType}'
Modified: trunk/topia-service-replication/src/site/site_fr.xml
===================================================================
--- trunk/topia-service-replication/src/site/site_fr.xml 2012-08-17 08:46:50 UTC (rev 2625)
+++ trunk/topia-service-replication/src/site/site_fr.xml 2012-08-17 08:47:17 UTC (rev 2626)
@@ -62,7 +62,7 @@
projectversion='${project.version}'
platform='${project.platform}'
projectid='${project.projectId}'
- scm='${project.scm.connection}'
+ scm='${project.scm.developerConnection}'
scmwebeditorenabled='${project.scmwebeditorEnabled}'
scmwebeditorurl='${project.scmwebeditorUrl}'
siteSourcesType='${project.siteSourcesType}'
Modified: trunk/topia-service-security/src/site/site_fr.xml
===================================================================
--- trunk/topia-service-security/src/site/site_fr.xml 2012-08-17 08:46:50 UTC (rev 2625)
+++ trunk/topia-service-security/src/site/site_fr.xml 2012-08-17 08:47:17 UTC (rev 2626)
@@ -69,7 +69,7 @@
projectversion='${project.version}'
platform='${project.platform}'
projectid='${project.projectId}'
- scm='${project.scm.connection}'
+ scm='${project.scm.developerConnection}'
scmwebeditorenabled='${project.scmwebeditorEnabled}'
scmwebeditorurl='${project.scmwebeditorUrl}'
siteSourcesType='${project.siteSourcesType}'
1
0
r2625 - in trunk: . topia-persistence-tck topia-service-security
by tchemit@users.nuiton.org 17 Aug '12
by tchemit@users.nuiton.org 17 Aug '12
17 Aug '12
Author: tchemit
Date: 2012-08-17 10:46:50 +0200 (Fri, 17 Aug 2012)
New Revision: 2625
Url: http://nuiton.org/repositories/revision/topia/2625
Log:
refs #2269: Updates to eugene 2.6
Modified:
trunk/pom.xml
trunk/topia-persistence-tck/pom.xml
trunk/topia-service-security/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2012-08-17 08:46:01 UTC (rev 2624)
+++ trunk/pom.xml 2012-08-17 08:46:50 UTC (rev 2625)
@@ -68,7 +68,7 @@
<projectId>topia</projectId>
<!-- libs version -->
- <eugeneVersion>2.4.3-SNAPSHOT</eugeneVersion>
+ <eugeneVersion>2.6-SNAPSHOT</eugeneVersion>
<nuitonUtilsVersion>2.4.8</nuitonUtilsVersion>
<processorPluginVersion>1.2.2</processorPluginVersion>
<nuitonI18nVersion>2.4.1</nuitonI18nVersion>
Modified: trunk/topia-persistence-tck/pom.xml
===================================================================
--- trunk/topia-persistence-tck/pom.xml 2012-08-17 08:46:01 UTC (rev 2624)
+++ trunk/topia-persistence-tck/pom.xml 2012-08-17 08:46:50 UTC (rev 2625)
@@ -100,7 +100,7 @@
<defaultPackage>org.nuiton.topia.tck</defaultPackage>
</configuration>
<goals>
- <goal>smart-generate</goal>
+ <goal>generate</goal>
</goals>
</execution>
<execution>
@@ -122,7 +122,7 @@
<defaultPackage>org.nuiton.topia.tck.it</defaultPackage>
</configuration>
<goals>
- <goal>smart-generate</goal>
+ <goal>generate</goal>
</goals>
</execution>
<execution>
@@ -144,7 +144,7 @@
<defaultPackage>org.nuiton.topia.tck.legacy</defaultPackage>
</configuration>
<goals>
- <goal>smart-generate</goal>
+ <goal>generate</goal>
</goals>
</execution>
<execution>
@@ -161,7 +161,7 @@
<defaultPackage>org.nuiton.topia.tck.mapping</defaultPackage>
</configuration>
<goals>
- <goal>smart-generate</goal>
+ <goal>generate</goal>
</goals>
</execution>
</executions>
Modified: trunk/topia-service-security/pom.xml
===================================================================
--- trunk/topia-service-security/pom.xml 2012-08-17 08:46:01 UTC (rev 2624)
+++ trunk/topia-service-security/pom.xml 2012-08-17 08:46:50 UTC (rev 2625)
@@ -141,7 +141,7 @@
<overwrite>true</overwrite>
</configuration>
<goals>
- <goal>smart-generate</goal>
+ <goal>generate</goal>
</goals>
</execution>
</executions>
1
0