|
From: <fg...@us...> - 2008-01-04 21:22:26
|
Revision: 515
http://openutils.svn.sourceforge.net/openutils/?rev=515&view=rev
Author: fgiust
Date: 2008-01-04 13:22:28 -0800 (Fri, 04 Jan 2008)
Log Message:
-----------
update spring, ban commons-logging
Modified Paths:
--------------
trunk/openutils-backup/pom.xml
trunk/openutils-bshd5/pom.xml
trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java
trunk/openutils-configuration-dataobjects/pom.xml
trunk/openutils-configuration-services/pom.xml
trunk/openutils-configuration-services/src/test/resources/spring-dao.xml
trunk/openutils-configuration-services/src/test/resources/spring-database.xml
trunk/openutils-configuration-services/src/test/resources/spring-hibernate.xml
trunk/openutils-configuration-services/src/test/resources/spring-managers.xml
trunk/openutils-configuration-services/src/test/resources/spring-tests.xml
trunk/openutils-dbmigration/pom.xml
trunk/openutils-deployment/pom.xml
trunk/openutils-hibernate-security/pom.xml
trunk/openutils-log4j/pom.xml
trunk/openutils-mgnlspring/pom.xml
trunk/openutils-mgnlstripes/pom.xml
trunk/openutils-spring/pom.xml
trunk/openutils-spring-rmibernate/pom.xml
trunk/openutils-tags-spring/pom.xml
trunk/openutils-testing-junit/pom.xml
trunk/openutils-testing-junit-dwr/pom.xml
trunk/openutils-testing-testng/pom.xml
trunk/openutils-testing-testng-dwr/pom.xml
trunk/openutils-usermanagement/pom.xml
trunk/openutils-usermanagement-dataobjects/pom.xml
trunk/openutils-web/pom.xml
Added Paths:
-----------
trunk/openutils-configuration-services/src/test/dbunit/
trunk/openutils-configuration-services/src/test/dbunit/ConfigurationCodeDAOTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/ConfigurationDomainDAOTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/ConfigurationManagerTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/ReferenceCodeDAOTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/ReferenceDomainDAOTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/ReferenceManagerTest-load.xml
trunk/openutils-configuration-services/src/test/dbunit/dataset.dtd
Removed Paths:
-------------
trunk/openutils-configuration-services/src/test/resources/ConfigurationCodeDAOTest-load.xml
trunk/openutils-configuration-services/src/test/resources/ConfigurationDomainDAOTest-load.xml
trunk/openutils-configuration-services/src/test/resources/ConfigurationManagerTest-load.xml
trunk/openutils-configuration-services/src/test/resources/ReferenceCodeDAOTest-load.xml
trunk/openutils-configuration-services/src/test/resources/ReferenceDomainDAOTest-load.xml
trunk/openutils-configuration-services/src/test/resources/ReferenceManagerTest-load.xml
trunk/openutils-configuration-services/src/test/resources/dataset.dtd
Modified: trunk/openutils-backup/pom.xml
===================================================================
--- trunk/openutils-backup/pom.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-backup/pom.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -4,7 +4,7 @@
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
- <version>3</version>
+ <version>5</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openutils-backup</artifactId>
Modified: trunk/openutils-bshd5/pom.xml
===================================================================
--- trunk/openutils-bshd5/pom.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-bshd5/pom.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,33 +1,30 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
- <version>3</version>
+ <version>5</version>
<relativePath>..</relativePath>
</parent>
<artifactId>openutils-bshd5</artifactId>
<name>openutils base Spring-Hibernate DAO for java 5.0</name>
<version>1.0.10-SNAPSHOT</version>
<description>openutils base Spring-Hibernate DAO for java 5.0</description>
- <properties>
- <spring.version>2.0.6</spring.version>
- </properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.4.1</version>
+ <version>1.4.3</version>
</dependency>
<dependency>
- <!-- replaces commons-logging -->
<groupId>org.slf4j</groupId>
<artifactId>jcl104-over-slf4j</artifactId>
- <version>1.4.1</version>
+ <version>1.4.3</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
- <artifactId>spring-hibernate3</artifactId>
+ <artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
@@ -38,6 +35,17 @@
</dependency>
<dependency>
<groupId>org.springframework</groupId>
+ <artifactId>spring-orm</artifactId>
+ <version>${spring.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<exclusions>
@@ -56,9 +64,18 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
+ <groupId>cglib</groupId>
+ <artifactId>cglib-nodep</artifactId>
+ <version>2.1_3</version>
+ </dependency>
+ <dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
@@ -81,4 +98,7 @@
<optional>true</optional>
</dependency>
</dependencies>
+ <properties>
+ <spring.version>2.5</spring.version>
+ </properties>
</project>
\ No newline at end of file
Modified: trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java
===================================================================
--- trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-bshd5/src/main/java/it/openutils/dao/hibernate/HibernateDAOImpl.java 2008-01-04 21:22:28 UTC (rev 515)
@@ -26,521 +26,582 @@
import org.springframework.orm.hibernate3.HibernateObjectRetrievalFailureException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
+
/**
* Base Hibernate DAO.
- *
* @author Fabrizio Giustina
* @version $Id$
- * @param <T>
- * Persistence class
- * @param <K>
- * Object Key
+ * @param <T> Persistence class
+ * @param <K> Object Key
*/
-public abstract class HibernateDAOImpl<T extends Object, K extends Serializable>
- extends HibernateDaoSupport implements HibernateDAO<T, K> {
+public abstract class HibernateDAOImpl<T extends Object, K extends Serializable> extends HibernateDaoSupport
+ implements
+ HibernateDAO<T, K>
+{
- /**
- * @author carone
- * @version $Id$
- */
- private final class HibernateCallbackForExecution implements
- HibernateCallback {
+ private Class<T> referenceClass;
- /**
- *
- */
- private final T filter;
+ private boolean aopenabled;
- /**
- *
- */
- private final int page;
+ public HibernateDAOImpl()
+ {
+ super();
+ }
- /**
- *
- */
- private final int maxResults;
+ /**
+ * @param referenceClass
+ */
+ @SuppressWarnings({"unchecked" })
+ public HibernateDAOImpl(Class referenceClass)
+ {
+ super();
+ this.referenceClass = referenceClass;
+ }
- /**
- *
- */
- private final Map<String, FilterMetadata> metadata;
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> find(String query)
+ {
+ return getHibernateTemplate().find(query);
+ }
- /**
- *
- */
- private final Order[] orderProperties;
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findAll()
+ {
+ return findAll(getDefaultOrder());
+ }
- private List<Criterion> additionalCriteria;
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> findAll(final Order[] orderProperties)
+ {
+ return getThis().findAll(orderProperties, new ArrayList<Criterion>());
+ }
- /**
- * @param filter
- * @param page
- * @param maxResults
- * @param metadata
- * @param orderProperties
- */
- private HibernateCallbackForExecution(T filter, int page,
- int maxResults, Map<String, FilterMetadata> metadata,
- Order[] orderProperties, List<Criterion> additionalCriteria) {
- this.filter = filter;
- this.page = page;
- this.maxResults = maxResults;
- this.metadata = metadata;
- this.orderProperties = orderProperties;
- this.additionalCriteria = additionalCriteria;
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> findAll(final Order[] orderProperties, final List<Criterion> criteria)
+ {
+ return (List<T>) getHibernateTemplate().execute(new HibernateCallback()
+ {
- public Object doInHibernate(Session ses) throws HibernateException {
- Criteria crit = ses.createCriteria(filter.getClass());
- crit
- .setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
- crit.setMaxResults(maxResults);
- crit.setFirstResult(maxResults * page);
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ Criteria crit = ses.createCriteria(getReferenceClass());
+ if (null != orderProperties)
+ {
+ for (int j = 0; j < orderProperties.length; j++)
+ {
+ crit.addOrder(orderProperties[j]);
+ }
- if (orderProperties != null && orderProperties.length > 0) {
- for (Order order : orderProperties) {
- if (order != null) {
- crit.addOrder(order);
- }
- }
- }
- EnhancedExample.create(crit, filter, metadata);
- if (additionalCriteria != null && !additionalCriteria.isEmpty()) {
- for (Criterion criterion : additionalCriteria) {
- crit.add(criterion);
- }
- }
- return crit.list();
- }
- }
+ }
+ if (criteria != null)
+ {
+ for (Criterion criterion : criteria)
+ {
+ crit.add(criterion);
+ }
+ }
+ return crit.list();
+ }
+ });
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> find(String query) {
- return getHibernateTemplate().find(query);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> find(String query, Object obj, Type type)
+ {
+ return find(query, new Object[]{obj }, new Type[]{type });
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findAll() {
- return findAll(getDefaultOrder());
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> find(final String query, final Object[] obj, final Type[] type)
+ {
+ return (List<T>) getHibernateTemplate().execute(new HibernateCallback()
+ {
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> findAll(final Order[] orderProperties) {
- return getThis().findAll(orderProperties, new ArrayList<Criterion>());
- }
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ // hibernate 3
+ return ses.createQuery(query).setParameters(obj, type).list();
+ }
+ });
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> findAll(final Order[] orderProperties,
- final List<Criterion> criteria) {
- return (List<T>) getHibernateTemplate().execute(
- new HibernateCallback() {
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public T load(K key)
+ {
+ T result = (T) getHibernateTemplate().load(getReferenceClass(), key);
+ Hibernate.initialize(result);
+ return result;
+ }
- public Object doInHibernate(Session ses)
- throws HibernateException {
- Criteria crit = ses.createCriteria(getReferenceClass());
- if (null != orderProperties) {
- for (int j = 0; j < orderProperties.length; j++) {
- crit.addOrder(orderProperties[j]);
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public T loadIfAvailable(K key)
+ {
+ T result;
+ try
+ {
+ result = (T) getHibernateTemplate().load(getReferenceClass(), key);
+ Hibernate.initialize(result);
+ }
+ catch (ObjectNotFoundException e)
+ {
+ // during lazy initialization
+ return null;
+ }
+ catch (HibernateObjectRetrievalFailureException e)
+ {
+ // during load
+ if (e.getCause() instanceof ObjectNotFoundException)
+ {
+ return null;
+ }
+ throw e;
+ }
+ return result;
+ }
- }
- if (criteria != null) {
- for (Criterion criterion : criteria) {
- crit.add(criterion);
- }
- }
- return crit.list();
- }
- });
- }
+ /**
+ * {@inheritDoc}
+ */
+ public void saveOrUpdate(final T obj)
+ {
+ getHibernateTemplate().saveOrUpdate(obj);
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> find(String query, Object obj, Type type) {
- return find(query, new Object[] { obj }, new Type[] { type });
- }
+ /**
+ * {@inheritDoc}
+ */
+ public void update(T obj)
+ {
+ getHibernateTemplate().update(obj);
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> find(final String query, final Object[] obj,
- final Type[] type) {
- return (List<T>) getHibernateTemplate().execute(
- new HibernateCallback() {
+ /**
+ * {@inheritDoc}
+ */
+ public boolean delete(final K key)
+ {
- public Object doInHibernate(Session ses)
- throws HibernateException {
- // hibernate 3
- return ses.createQuery(query).setParameters(obj, type)
- .list();
- }
- });
- }
+ return (Boolean) getHibernateTemplate().execute(new HibernateCallback()
+ {
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public T load(K key) {
- T result = (T) getHibernateTemplate().load(getReferenceClass(), key);
- Hibernate.initialize(result);
- return result;
- }
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ ses.delete(ses.load(getReferenceClass(), key));
+ return true;
+ }
+ });
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public T loadIfAvailable(K key) {
- T result;
- try {
- result = (T) getHibernateTemplate().load(getReferenceClass(), key);
- Hibernate.initialize(result);
- } catch (ObjectNotFoundException e) {
- // during lazy initialization
- return null;
- } catch (HibernateObjectRetrievalFailureException e) {
- // during load
- if (e.getCause() instanceof ObjectNotFoundException) {
- return null;
- }
- throw e;
- }
- return result;
- }
+ }
- /**
- * {@inheritDoc}
- */
- public void saveOrUpdate(final T obj) {
- getHibernateTemplate().saveOrUpdate(obj);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public void refresh(T obj)
+ {
+ getHibernateTemplate().refresh(obj);
+ }
- /**
- * {@inheritDoc}
- */
- public void update(T obj) {
- getHibernateTemplate().update(obj);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public void evict(T obj)
+ {
+ getHibernateTemplate().evict(obj);
+ }
- /**
- * {@inheritDoc}
- */
- public boolean delete(final K key) {
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public T merge(final T obj)
+ {
+ return (T) getHibernateTemplate().execute(new HibernateCallback()
+ {
- return (Boolean) getHibernateTemplate().execute(
- new HibernateCallback() {
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ return ses.merge(obj);
+ }
+ });
- public Object doInHibernate(Session ses)
- throws HibernateException {
- ses.delete(ses.load(getReferenceClass(), key));
- return true;
- }
- });
+ }
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public K save(T obj)
+ {
+ return (K) getHibernateTemplate().save(obj);
+ }
- /**
- * {@inheritDoc}
- */
- public void refresh(T obj) {
- getHibernateTemplate().refresh(obj);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public T findFilteredFirst(final T filter)
+ {
+ return getFirstInCollection(findFiltered(filter, 1, 0));
+ }
- /**
- * {@inheritDoc}
- */
- public void evict(T obj) {
- getHibernateTemplate().evict(obj);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public T findFilteredFirst(final T filter, List<Criterion> criteria)
+ {
+ return getFirstInCollection(findFiltered(filter, null, getDefaultFilterMetadata(), 1, 0, criteria));
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public T merge(final T obj) {
- return (T) getHibernateTemplate().execute(new HibernateCallback() {
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findFiltered(final T filter)
+ {
+ return findFiltered(filter, getDefaultFilterMetadata());
+ }
- public Object doInHibernate(Session ses) throws HibernateException {
- return ses.merge(obj);
- }
- });
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findFiltered(T filter, Order[] orderProperties)
+ {
+ return findFiltered(filter, orderProperties, getDefaultFilterMetadata(), Integer.MAX_VALUE, 0);
+ }
- }
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata)
+ {
+ return findFiltered(filter, metadata, Integer.MAX_VALUE, 0);
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public K save(T obj) {
- return (K) getHibernateTemplate().save(obj);
- }
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findFiltered(final T filter, final int maxResults, final int page)
+ {
+ return findFiltered(filter, getDefaultFilterMetadata(), maxResults, page);
+ }
- /**
- * {@inheritDoc}
- */
- public T findFilteredFirst(final T filter) {
- return getFirstInCollection(findFiltered(filter, 1, 0));
- }
+ /**
+ * {@inheritDoc}
+ */
+ public List<T> findFiltered(final T filter, final Map<String, FilterMetadata> metadata, final int maxResults,
+ final int page)
+ {
+ return findFiltered(filter, null, metadata, maxResults, page);
+ }
- /**
- * {@inheritDoc}
- */
- public T findFilteredFirst(final T filter, List<Criterion> criteria) {
- return getFirstInCollection(findFiltered(filter, null,
- getDefaultFilterMetadata(), 1, 0, criteria));
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> findFiltered(final T filter, final Order[] customOrder, final Map<String, FilterMetadata> metadata,
+ final int maxResults, final int page)
+ {
+ return getThis().findFiltered(filter, customOrder, metadata, maxResults, page, new ArrayList<Criterion>());
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findFiltered(final T filter) {
- return findFiltered(filter, getDefaultFilterMetadata());
- }
+ /**
+ * {@inheritDoc}
+ */
+ @SuppressWarnings("unchecked")
+ public List<T> findFiltered(T filter, Order[] customOrder, Map<String, FilterMetadata> metadata, int maxResults,
+ int page, List<Criterion> additionalCriteria)
+ {
+ final Order[] orderProperties = customOrder != null && customOrder.length > 0 ? customOrder : this
+ .getDefaultOrder();
- /**
- * @return This is needed as for
- * http://opensource.atlassian.com/projects/spring/browse/SPR-2226
- */
- @SuppressWarnings("unchecked")
- private HibernateDAO<T, K> getThis() {
- try {
- return (HibernateDAO<T, K>) AopContext.currentProxy();
- } catch (AspectException exc) {
- logger
- .debug("Not running inside an AOP proxy, so no proxy can be returned: "
- + exc.getMessage());
- return this;
- }
- }
+ return (List<T>) getHibernateTemplate().execute(
+ new HibernateCallbackForExecution(filter, page, maxResults, metadata, orderProperties, additionalCriteria));
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findFiltered(T filter, Order[] orderProperties) {
- return findFiltered(filter, orderProperties,
- getDefaultFilterMetadata(), Integer.MAX_VALUE, 0);
- }
+ /**
+ * Return the specific Object class that will be used for class-specific implementation of this DAO.
+ * @return the reference Class
+ */
+ protected Class<T> getReferenceClass()
+ {
+ return referenceClass;
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findFiltered(final T filter,
- final Map<String, FilterMetadata> metadata) {
- return findFiltered(filter, metadata, Integer.MAX_VALUE, 0);
- }
+ public void setReferenceClass(Class<T> referenceClass)
+ {
+ this.referenceClass = referenceClass;
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findFiltered(final T filter, final int maxResults,
- final int page) {
- return findFiltered(filter, getDefaultFilterMetadata(), maxResults,
- page);
- }
+ /**
+ * Return a list of <code>Order</code> object to be used for the default ordering of the collection.
+ * @return the property name
+ */
+ protected Order[] getDefaultOrder()
+ {
+ return new Order[0];
+ }
- /**
- * {@inheritDoc}
- */
- public List<T> findFiltered(final T filter,
- final Map<String, FilterMetadata> metadata, final int maxResults,
- final int page) {
- return findFiltered(filter, null, metadata, maxResults, page);
- }
+ /**
+ * Obtain an instance of Query for a named query string defined in the mapping file.
+ * @param name the name of a query defined externally
+ * @param maxResults max number of results
+ * @return Query
+ */
+ protected List< ? > getNamedQuery(final String name, final int maxResults)
+ {
+ return (List< ? >) getHibernateTemplate().execute(new HibernateCallback()
+ {
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> findFiltered(final T filter, final Order[] customOrder,
- final Map<String, FilterMetadata> metadata, final int maxResults,
- final int page) {
- return getThis().findFiltered(filter, customOrder, metadata,
- maxResults, page, new ArrayList<Criterion>());
- }
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ Query q = ses.getNamedQuery(name);
+ q.setMaxResults(maxResults);
+ return q.list();
+ }
+ });
+ }
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public List<T> findFiltered(T filter, Order[] customOrder,
- Map<String, FilterMetadata> metadata, int maxResults, int page,
- List<Criterion> additionalCriteria) {
- final Order[] orderProperties = customOrder != null
- && customOrder.length > 0 ? customOrder : this
- .getDefaultOrder();
+ /**
+ * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.
+ * @param name the name of a query defined externally
+ * @param params the parameter array
+ * @param maxResults max number of results
+ * @return Query
+ */
+ protected List< ? > getNamedQuery(final String name, final Serializable[] params, final int maxResults)
+ {
- return (List<T>) getHibernateTemplate().execute(
- new HibernateCallbackForExecution(filter, page, maxResults,
- metadata, orderProperties, additionalCriteria));
- }
+ return (List< ? >) getHibernateTemplate().execute(new HibernateCallback()
+ {
- /**
- * Return the specific Object class that will be used for class-specific
- * implementation of this DAO.
- *
- * @return the reference Class
- */
- protected abstract Class<T> getReferenceClass();
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ Query q = ses.getNamedQuery(name);
+ q.setMaxResults(maxResults);
+ if (null != params)
+ {
+ for (int i = 0; i < params.length; i++)
+ {
+ q.setParameter(i, params[i]);
+ }
+ }
+ return q.list();
+ }
+ });
+ }
- /**
- * Return a list of <code>Order</code> object to be used for the default
- * ordering of the collection.
- *
- * @return the property name
- */
- protected Order[] getDefaultOrder() {
- return new Order[0];
- }
+ /**
+ * Obtain an instance of Query for a named query string defined in the mapping file. Use the parameters given.
+ * @param name the name of a query defined externally
+ * @param params the parameter Map
+ * @param maxResults max number of results
+ * @return Query
+ */
+ protected List< ? > getNamedQuery(final String name, final Map<String, Object> params, final int maxResults)
+ {
+ return (List< ? >) getHibernateTemplate().execute(new HibernateCallback()
+ {
- /**
- * Obtain an instance of Query for a named query string defined in the
- * mapping file.
- *
- * @param name
- * the name of a query defined externally
- * @param maxResults
- * max number of results
- * @return Query
- */
- protected List<?> getNamedQuery(final String name, final int maxResults) {
- return (List<?>) getHibernateTemplate().execute(
- new HibernateCallback() {
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ Query q = ses.getNamedQuery(name);
+ q.setMaxResults(maxResults);
+ if (params != null)
+ {
+ for (Map.Entry<String, Object> entry : params.entrySet())
+ {
+ setParameterValue(q, entry.getKey(), entry.getValue());
+ }
+ }
+ return q.list();
+ }
+ });
+ }
- public Object doInHibernate(Session ses)
- throws HibernateException {
- Query q = ses.getNamedQuery(name);
- q.setMaxResults(maxResults);
- return q.list();
- }
- });
- }
+ /**
+ * Convenience method to set paramers in the query given based on the actual object type in passed in as the value.
+ * You may need to add more functionaly to this as desired (or not use this at all).
+ * @param query the Query to set
+ * @param key the key name
+ * @param value the object to set as the parameter
+ */
+ protected void setParameterValue(Query query, String key, Object value)
+ {
+ if (null == key || null == value)
+ {
+ return;
+ }
+ query.setParameter(key, value);
+ }
- /**
- * Obtain an instance of Query for a named query string defined in the
- * mapping file. Use the parameters given.
- *
- * @param name
- * the name of a query defined externally
- * @param params
- * the parameter array
- * @param maxResults
- * max number of results
- * @return Query
- */
- protected List<?> getNamedQuery(final String name,
- final Serializable[] params, final int maxResults) {
+ /**
+ * Returns the default set of FilterMetadata that will be applied to any query. The default implementation doesn't
+ * set any default filter, subclasses may override this.
+ * @return map of property name - filter metadata
+ */
+ protected Map<String, FilterMetadata> getDefaultFilterMetadata()
+ {
+ return new HashMap<String, FilterMetadata>(0);
+ }
- return (List<?>) getHibernateTemplate().execute(
- new HibernateCallback() {
+ /**
+ * Returns the first object in the collection or null if the collection is null or empty.
+ * @param list collection
+ * @return first element in the list
+ */
+ @SuppressWarnings("unchecked")
+ private T getFirstInCollection(Collection<T> list)
+ {
+ if (list != null && !list.isEmpty())
+ {
+ Object result = list.iterator().next();
+ Hibernate.initialize(result);
+ return (T) result;
+ }
+ return null;
+ }
- public Object doInHibernate(Session ses)
- throws HibernateException {
- Query q = ses.getNamedQuery(name);
- q.setMaxResults(maxResults);
- if (null != params) {
- for (int i = 0; i < params.length; i++) {
- q.setParameter(i, params[i]);
- }
- }
- return q.list();
- }
- });
- }
+ /**
+ * Sets the aopenabled.
+ * @param aopenabled the aopenabled to set
+ */
+ public void setAopenabled(boolean aopenabled)
+ {
+ this.aopenabled = aopenabled;
+ }
- /**
- * Obtain an instance of Query for a named query string defined in the
- * mapping file. Use the parameters given.
- *
- * @param name
- * the name of a query defined externally
- * @param params
- * the parameter Map
- * @param maxResults
- * max number of results
- * @return Query
- */
- protected List<?> getNamedQuery(final String name,
- final Map<String, Object> params, final int maxResults) {
- return (List<?>) getHibernateTemplate().execute(
- new HibernateCallback() {
+ /**
+ * @return This is needed as for http://opensource.atlassian.com/projects/spring/browse/SPR-2226
+ */
+ @SuppressWarnings("unchecked")
+ private HibernateDAO<T, K> getThis()
+ {
+ if (!aopenabled)
+ {
+ return this;
+ }
- public Object doInHibernate(Session ses)
- throws HibernateException {
- Query q = ses.getNamedQuery(name);
- q.setMaxResults(maxResults);
- if (params != null) {
- for (Map.Entry<String, Object> entry : params
- .entrySet()) {
- setParameterValue(q, entry.getKey(), entry
- .getValue());
- }
- }
- return q.list();
- }
- });
- }
+ try
+ {
+ return (HibernateDAO<T, K>) AopContext.currentProxy();
+ }
+ catch (AspectException exc)
+ {
+ logger.debug("Not running inside an AOP proxy, so no proxy can be returned: " + exc.getMessage());
+ return this;
+ }
+ catch (IllegalStateException e)
+ {
+ logger.warn("Cannot access proxy: " + e.getMessage());
+ aopenabled = false;
+ return this;
+ }
+ }
- /**
- * Convenience method to set paramers in the query given based on the actual
- * object type in passed in as the value. You may need to add more
- * functionaly to this as desired (or not use this at all).
- *
- * @param query
- * the Query to set
- * @param key
- * the key name
- * @param value
- * the object to set as the parameter
- */
- protected void setParameterValue(Query query, String key, Object value) {
- if (null == key || null == value) {
- return;
- }
- query.setParameter(key, value);
- }
+ /**
+ * @author carone
+ * @version $Id$
+ */
+ private final class HibernateCallbackForExecution implements HibernateCallback
+ {
- /**
- * Returns the default set of FilterMetadata that will be applied to any
- * query. The default implementation doesn't set any default filter,
- * subclasses may override this.
- *
- * @return map of property name - filter metadata
- */
- protected Map<String, FilterMetadata> getDefaultFilterMetadata() {
- return new HashMap<String, FilterMetadata>(0);
- }
+ /**
+ *
+ */
+ private final T filter;
- /**
- * Returns the first object in the collection or null if the collection is
- * null or empty.
- *
- * @param list
- * collection
- * @return first element in the list
- */
- @SuppressWarnings("unchecked")
- private T getFirstInCollection(Collection<T> list) {
- if (list != null && !list.isEmpty()) {
- Object result = list.iterator().next();
- Hibernate.initialize(result);
- return (T) result;
- }
- return null;
- }
+ /**
+ *
+ */
+ private final int page;
+ /**
+ *
+ */
+ private final int maxResults;
+
+ /**
+ *
+ */
+ private final Map<String, FilterMetadata> metadata;
+
+ /**
+ *
+ */
+ private final Order[] orderProperties;
+
+ private List<Criterion> additionalCriteria;
+
+ /**
+ * @param filter
+ * @param page
+ * @param maxResults
+ * @param metadata
+ * @param orderProperties
+ */
+ private HibernateCallbackForExecution(
+ T filter,
+ int page,
+ int maxResults,
+ Map<String, FilterMetadata> metadata,
+ Order[] orderProperties,
+ List<Criterion> additionalCriteria)
+ {
+ this.filter = filter;
+ this.page = page;
+ this.maxResults = maxResults;
+ this.metadata = metadata;
+ this.orderProperties = orderProperties;
+ this.additionalCriteria = additionalCriteria;
+ }
+
+ public Object doInHibernate(Session ses) throws HibernateException
+ {
+ Criteria crit = ses.createCriteria(filter.getClass());
+ crit.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY);
+ crit.setMaxResults(maxResults);
+ crit.setFirstResult(maxResults * page);
+
+ if (orderProperties != null && orderProperties.length > 0)
+ {
+ for (Order order : orderProperties)
+ {
+ if (order != null)
+ {
+ crit.addOrder(order);
+ }
+ }
+ }
+ EnhancedExample.create(crit, filter, metadata);
+ if (additionalCriteria != null && !additionalCriteria.isEmpty())
+ {
+ for (Criterion criterion : additionalCriteria)
+ {
+ crit.add(criterion);
+ }
+ }
+ return crit.list();
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/openutils-configuration-dataobjects/pom.xml
===================================================================
--- trunk/openutils-configuration-dataobjects/pom.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-dataobjects/pom.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -3,7 +3,7 @@
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
- <version>3</version>
+ <version>5</version>
<relativePath>..</relativePath>
</parent>
<groupId>net.sourceforge.openutils</groupId>
Modified: trunk/openutils-configuration-services/pom.xml
===================================================================
--- trunk/openutils-configuration-services/pom.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/pom.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,9 +1,10 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils</artifactId>
- <version>3</version>
+ <version>5</version>
<relativePath>..</relativePath>
</parent>
<groupId>net.sourceforge.openutils</groupId>
@@ -12,11 +13,21 @@
<name>openutils-configuration</name>
<version>0.2-SNAPSHOT</version>
<description>Configuration services</description>
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ </testResource>
+ <testResource>
+ <directory>src/test/dbunit</directory>
+ </testResource>
+ </testResources>
+ </build>
<dependencies>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-spring</artifactId>
- <version>1.0</version>
+ <version>1.0.5-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
@@ -27,7 +38,7 @@
<dependency>
<groupId>net.sourceforge.openutils</groupId>
<artifactId>openutils-bshd5</artifactId>
- <version>1.0.5</version>
+ <version>1.0.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openutils</groupId>
@@ -38,9 +49,14 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
- <version>1.2</version>
+ <version>1.4.3</version>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl104-over-slf4j</artifactId>
+ <version>1.4.3</version>
+ </dependency>
+ <dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.13</version>
@@ -50,6 +66,16 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.2.1.ga</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>cglib</groupId>
+ <artifactId>cglib</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
@@ -75,8 +101,14 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
- <version>2.0.6</version>
+ <version>${spring.version}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
@@ -89,6 +121,15 @@
<artifactId>dbunit</artifactId>
<version>2.2</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
+ <properties>
+ <spring.version>2.5</spring.version>
+ </properties>
</project>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ConfigurationCodeDAOTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ConfigurationCodeDAOTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ConfigurationCodeDAOTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ConfigurationCodeDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,39 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_CONFIGURATION_DOMAIN">
+ <column>ID_CONFIGURATIONDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>DOMINIO1</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ <row>
+ <value>APPLTEST</value>
+ <value>Application server configuration</value>
+ </row>
+ </table>
+ <table name="APP_CONFIGURATION_CODE">
+ <column>ID_CONFIGURATIONCODE</column>
+ <column>ID_CONFIGURATIONDOMAIN</column>
+ <column>CODE</column>
+ <column>DESCRIPTION</column>
+ <column>TYPE</column>
+ <column>VALUE</column>
+ <row>
+ <value>1</value>
+ <value>DOMINIO1</value>
+ <value>CODE1</value>
+ <value>DESCRIZIONE</value>
+ <value>TIPO</value>
+ <value>VALORE</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>APPLTEST</value>
+ <value>CURVE_SEARCH_LIMIT</value>
+ <value>Maximum number of curves returned by a search operation.</value>
+ <value>INT</value>
+ <value>500</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ConfigurationDomainDAOTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ConfigurationDomainDAOTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ConfigurationDomainDAOTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ConfigurationDomainDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,11 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_CONFIGURATION_DOMAIN">
+ <column>ID_CONFIGURATIONDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>DOMINIO1</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ConfigurationManagerTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ConfigurationManagerTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ConfigurationManagerTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ConfigurationManagerTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,39 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_CONFIGURATION_DOMAIN">
+ <column>ID_CONFIGURATIONDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>CONFIG_DOMAIN</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ <row>
+ <value>CONFIG_DOMAIN_2</value>
+ <value>DESCRIZIONE_2</value>
+ </row>
+ </table>
+ <table name="APP_CONFIGURATION_CODE">
+ <column>ID_CONFIGURATIONCODE</column>
+ <column>ID_CONFIGURATIONDOMAIN</column>
+ <column>CODE</column>
+ <column>DESCRIPTION</column>
+ <column>TYPE</column>
+ <column>VALUE</column>
+ <row>
+ <value>5</value>
+ <value>CONFIG_DOMAIN</value>
+ <value>CODICE</value>
+ <value>DESCRIZIONE</value>
+ <value>TIPO</value>
+ <value>VALORE</value>
+ </row>
+ <row>
+ <value>6</value>
+ <value>CONFIG_DOMAIN_2</value>
+ <value>CODICE</value>
+ <value>DESCRIZIONE</value>
+ <value>TIPO</value>
+ <value>VALORE</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ReferenceCodeDAOTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ReferenceCodeDAOTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ReferenceCodeDAOTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ReferenceCodeDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,25 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_REFERENCE_DOMAIN">
+ <column>ID_REFERENCEDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>DOMINIO1</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ </table>
+ <table name="APP_REFERENCE_CODE">
+ <column>ID_REFERENCECODE</column>
+ <column>ID_REFERENCEDOMAIN</column>
+ <column>CODE</column>
+ <column>DESCRIPTION</column>
+ <column>ACTIVE</column>
+ <row>
+ <value>1</value>
+ <value>DOMINIO1</value>
+ <value>CODICE</value>
+ <value>DESCRIZIONE</value>
+ <value>0</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ReferenceDomainDAOTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ReferenceDomainDAOTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ReferenceDomainDAOTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ReferenceDomainDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,11 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_REFERENCE_DOMAIN">
+ <column>ID_REFERENCEDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>DOMINIO1</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/ReferenceManagerTest-load.xml (from rev 513, trunk/openutils-configuration-services/src/test/resources/ReferenceManagerTest-load.xml)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/ReferenceManagerTest-load.xml (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/ReferenceManagerTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,25 @@
+<!DOCTYPE dataset SYSTEM "dataset.dtd">
+<dataset>
+ <table name="APP_REFERENCE_DOMAIN">
+ <column>ID_REFERENCEDOMAIN</column>
+ <column>DESCRIPTION</column>
+ <row>
+ <value>CURVE_DOMAIN</value>
+ <value>DESCRIZIONE</value>
+ </row>
+ </table>
+ <table name="APP_REFERENCE_CODE">
+ <column>ID_REFERENCECODE</column>
+ <column>ID_REFERENCEDOMAIN</column>
+ <column>CODE</column>
+ <column>DESCRIPTION</column>
+ <column>ACTIVE</column>
+ <row>
+ <value>7</value>
+ <value>CURVE_DOMAIN</value>
+ <value>CODICE</value>
+ <value>DESCRIZIONE</value>
+ <value>1</value>
+ </row>
+ </table>
+</dataset>
\ No newline at end of file
Copied: trunk/openutils-configuration-services/src/test/dbunit/dataset.dtd (from rev 513, trunk/openutils-configuration-services/src/test/resources/dataset.dtd)
===================================================================
--- trunk/openutils-configuration-services/src/test/dbunit/dataset.dtd (rev 0)
+++ trunk/openutils-configuration-services/src/test/dbunit/dataset.dtd 2008-01-04 21:22:28 UTC (rev 515)
@@ -0,0 +1,13 @@
+<!ELEMENT dataset (table*)>
+<!ELEMENT table (column+,row+)>
+<!ATTLIST table
+ name CDATA #REQUIRED
+>
+<!ELEMENT row (value|null)+>
+<!ELEMENT column (#PCDATA)>
+<!ELEMENT value (#PCDATA)>
+<!ELEMENT null EMPTY>
+<!--
+nb una tabella senza righe sarebbe valida (per cancellare tutto il contenuto),
+ma NON DEVE ESISTERE NEI NOSTRI TEST IN QUANTO TUTTE LE TABELLE VENGONO SVUOTATE PRIMA DEL CARICAMENTO
+-->
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ConfigurationCodeDAOTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ConfigurationCodeDAOTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ConfigurationCodeDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,39 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_CONFIGURATION_DOMAIN">
- <column>ID_CONFIGURATIONDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>DOMINIO1</value>
- <value>DESCRIZIONE</value>
- </row>
- <row>
- <value>APPLTEST</value>
- <value>Application server configuration</value>
- </row>
- </table>
- <table name="APP_CONFIGURATION_CODE">
- <column>ID_CONFIGURATIONCODE</column>
- <column>ID_CONFIGURATIONDOMAIN</column>
- <column>CODE</column>
- <column>DESCRIPTION</column>
- <column>TYPE</column>
- <column>VALUE</column>
- <row>
- <value>1</value>
- <value>DOMINIO1</value>
- <value>CODE1</value>
- <value>DESCRIZIONE</value>
- <value>TIPO</value>
- <value>VALORE</value>
- </row>
- <row>
- <value>2</value>
- <value>APPLTEST</value>
- <value>CURVE_SEARCH_LIMIT</value>
- <value>Maximum number of curves returned by a search operation.</value>
- <value>INT</value>
- <value>500</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ConfigurationDomainDAOTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ConfigurationDomainDAOTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ConfigurationDomainDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,11 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_CONFIGURATION_DOMAIN">
- <column>ID_CONFIGURATIONDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>DOMINIO1</value>
- <value>DESCRIZIONE</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ConfigurationManagerTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ConfigurationManagerTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ConfigurationManagerTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,39 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_CONFIGURATION_DOMAIN">
- <column>ID_CONFIGURATIONDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>CONFIG_DOMAIN</value>
- <value>DESCRIZIONE</value>
- </row>
- <row>
- <value>CONFIG_DOMAIN_2</value>
- <value>DESCRIZIONE_2</value>
- </row>
- </table>
- <table name="APP_CONFIGURATION_CODE">
- <column>ID_CONFIGURATIONCODE</column>
- <column>ID_CONFIGURATIONDOMAIN</column>
- <column>CODE</column>
- <column>DESCRIPTION</column>
- <column>TYPE</column>
- <column>VALUE</column>
- <row>
- <value>5</value>
- <value>CONFIG_DOMAIN</value>
- <value>CODICE</value>
- <value>DESCRIZIONE</value>
- <value>TIPO</value>
- <value>VALORE</value>
- </row>
- <row>
- <value>6</value>
- <value>CONFIG_DOMAIN_2</value>
- <value>CODICE</value>
- <value>DESCRIZIONE</value>
- <value>TIPO</value>
- <value>VALORE</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ReferenceCodeDAOTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ReferenceCodeDAOTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ReferenceCodeDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,25 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_REFERENCE_DOMAIN">
- <column>ID_REFERENCEDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>DOMINIO1</value>
- <value>DESCRIZIONE</value>
- </row>
- </table>
- <table name="APP_REFERENCE_CODE">
- <column>ID_REFERENCECODE</column>
- <column>ID_REFERENCEDOMAIN</column>
- <column>CODE</column>
- <column>DESCRIPTION</column>
- <column>ACTIVE</column>
- <row>
- <value>1</value>
- <value>DOMINIO1</value>
- <value>CODICE</value>
- <value>DESCRIZIONE</value>
- <value>0</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ReferenceDomainDAOTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ReferenceDomainDAOTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ReferenceDomainDAOTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,11 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_REFERENCE_DOMAIN">
- <column>ID_REFERENCEDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>DOMINIO1</value>
- <value>DESCRIZIONE</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/ReferenceManagerTest-load.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/ReferenceManagerTest-load.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/ReferenceManagerTest-load.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,25 +0,0 @@
-<!DOCTYPE dataset SYSTEM "dataset.dtd">
-<dataset>
- <table name="APP_REFERENCE_DOMAIN">
- <column>ID_REFERENCEDOMAIN</column>
- <column>DESCRIPTION</column>
- <row>
- <value>CURVE_DOMAIN</value>
- <value>DESCRIZIONE</value>
- </row>
- </table>
- <table name="APP_REFERENCE_CODE">
- <column>ID_REFERENCECODE</column>
- <column>ID_REFERENCEDOMAIN</column>
- <column>CODE</column>
- <column>DESCRIPTION</column>
- <column>ACTIVE</column>
- <row>
- <value>7</value>
- <value>CURVE_DOMAIN</value>
- <value>CODICE</value>
- <value>DESCRIZIONE</value>
- <value>1</value>
- </row>
- </table>
-</dataset>
\ No newline at end of file
Deleted: trunk/openutils-configuration-services/src/test/resources/dataset.dtd
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/dataset.dtd 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/dataset.dtd 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,13 +0,0 @@
-<!ELEMENT dataset (table*)>
-<!ELEMENT table (column+,row+)>
-<!ATTLIST table
- name CDATA #REQUIRED
->
-<!ELEMENT row (value|null)+>
-<!ELEMENT column (#PCDATA)>
-<!ELEMENT value (#PCDATA)>
-<!ELEMENT null EMPTY>
-<!--
-nb una tabella senza righe sarebbe valida (per cancellare tutto il contenuto),
-ma NON DEVE ESISTERE NEI NOSTRI TEST IN QUANTO TUTTE LE TABELLE VENGONO SVUOTATE PRIMA DEL CARICAMENTO
--->
\ No newline at end of file
Modified: trunk/openutils-configuration-services/src/test/resources/spring-dao.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/spring-dao.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/spring-dao.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -2,33 +2,32 @@
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
- <bean id="configurationCodeDAO" parent="txProxyTemplate">
- <property name="target">
- <bean class="it.openutils.configuration.dao.ConfigurationCodeDAOImpl">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
- </property>
- </bean>
- <bean id="configurationDomainDAO" parent="txProxyTemplate">
- <property name="target">
- <bean class="it.openutils.configuration.dao.ConfigurationDomainDAOImpl">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
- </property>
- </bean>
- <bean id="referenceCodeDAO" parent="txProxyTemplate">
- <property name="target">
- <bean class="it.openutils.configuration.dao.ReferenceCodeDAOImpl">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
- </property>
- </bean>
- <bean id="referenceDomainDAO" parent="txProxyTemplate">
- <property name="target">
- <bean class="it.openutils.configuration.dao.ReferenceDomainDAOImpl">
- <property name="sessionFactory" ref="sessionFactory" />
- </bean>
- </property>
- </bean>
-
+ <bean id="configurationCodeDAO" parent="txProxyTemplate">
+ <property name="target">
+ <bean class="it.openutils.configuration.dao.ConfigurationCodeDAOImpl">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+ </property>
+ </bean>
+ <bean id="configurationDomainDAO" parent="txProxyTemplate">
+ <property name="target">
+ <bean class="it.openutils.configuration.dao.ConfigurationDomainDAOImpl">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+ </property>
+ </bean>
+ <bean id="referenceCodeDAO" parent="txProxyTemplate">
+ <property name="target">
+ <bean class="it.openutils.configuration.dao.ReferenceCodeDAOImpl">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+ </property>
+ </bean>
+ <bean id="referenceDomainDAO" parent="txProxyTemplate">
+ <property name="target">
+ <bean class="it.openutils.configuration.dao.ReferenceDomainDAOImpl">
+ <property name="sessionFactory" ref="sessionFactory" />
+ </bean>
+ </property>
+ </bean>
</beans>
\ No newline at end of file
Modified: trunk/openutils-configuration-services/src/test/resources/spring-database.xml
===================================================================
--- trunk/openutils-configuration-services/src/test/resources/spring-database.xml 2008-01-04 21:21:07 UTC (rev 514)
+++ trunk/openutils-configuration-services/src/test/resources/spring-database.xml 2008-01-04 21:22:28 UTC (rev 515)
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<!--
- # ATTENZIONE: queste proprietà sono utilizzate solo per gli unit tests
- # i file per la configurazione del db utilizzati dall'applicazione web sono in
- # src/main/web-app/WEB-INF
+ # ATTENZIONE: queste proprietà sono utilizzate solo per gli unit tests
+ # i file per la configurazione del db utilizzati dall'applicazione web sono in
+ # src/main/web-app/WEB-INF
-->
<beans>
- <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
- <property name="location">
- <value>classpath:database.properties</value>
- </property>
- </bean>
- <bean id="dataSource"...
[truncated message content] |