dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15131
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5343: Replaced AttributeValueStore with HibernateGenericStore
------------------------------------------------------------
revno: 5343
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-09 19:58:11 +0100
message:
Replaced AttributeValueStore with HibernateGenericStore
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeValueStore.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java 2011-09-07 13:42:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeValueStore.java 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute;
-
-import org.hisp.dhis.common.GenericStore;
-
-/**
- * @author mortenoh
- */
-public interface AttributeValueStore
- extends GenericStore<AttributeValue>
-{
- String ID = AttributeValueStore.class.getName();
-
- int getCount();
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2011-11-22 15:48:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2011-12-09 18:58:11 +0000
@@ -81,13 +81,6 @@
Collection<T> getBetweenByName( String name, int first, int max );
/**
- * Gets the count of objects.
- *
- * @return the count of objects.
- */
- int getCount();
-
- /**
* Gets the count of objects which name is like the given name.
*
* @param name the name which result object names must be like.
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java 2011-09-07 13:42:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java 2011-12-09 18:58:11 +0000
@@ -97,4 +97,11 @@
* @param object the object instance to delete.
*/
void delete( T object );
+
+ /**
+ * Gets the count of objects.
+ *
+ * @return the count of objects.
+ */
+ int getCount();
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2011-11-23 18:37:43 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2011-12-09 18:58:11 +0000
@@ -26,6 +26,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.hisp.dhis.common.GenericStore;
import org.springframework.transaction.annotation.Transactional;
/**
@@ -41,24 +42,14 @@
private AttributeStore attributeStore;
- public AttributeStore getAttributeStore()
- {
- return attributeStore;
- }
-
public void setAttributeStore( AttributeStore attributeStore )
{
this.attributeStore = attributeStore;
}
- private AttributeValueStore attributeValueStore;
-
- public AttributeValueStore getAttributeValueStore()
- {
- return attributeValueStore;
- }
-
- public void setAttributeValueStore( AttributeValueStore attributeValueStore )
+ private GenericStore<AttributeValue> attributeValueStore;
+
+ public void setAttributeValueStore( GenericStore<AttributeValue> attributeValueStore )
{
this.attributeValueStore = attributeValueStore;
}
=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeValueStore.java 2011-09-06 11:52:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeValueStore.java 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2004-2010, University of Oslo All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met: *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer. * Redistributions in binary
- * form must reproduce the above copyright notice, this list of conditions and
- * the following disclaimer in the documentation and/or other materials provided
- * with the distribution. * Neither the name of the HISP project nor the names
- * of its contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission. THIS SOFTWARE IS
- * PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.attribute.hibernate;
-
-import org.hisp.dhis.attribute.AttributeValue;
-import org.hisp.dhis.attribute.AttributeValueStore;
-import org.hisp.dhis.hibernate.HibernateGenericStore;
-
-/**
- * @author mortenoh
- */
-public class HibernateAttributeValueStore
- extends HibernateGenericStore<AttributeValue>
- implements AttributeValueStore
-{
-
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-12-07 14:19:06 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2011-12-09 18:58:11 +0000
@@ -243,11 +243,13 @@
<bean id="org.hisp.dhis.attribute.AttributeStore" class="org.hisp.dhis.attribute.hibernate.HibernateAttributeStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.hisp.dhis.attribute.Attribute" />
+ <property name="cacheable" value="true" />
</bean>
- <bean id="org.hisp.dhis.attribute.AttributeValueStore" class="org.hisp.dhis.attribute.hibernate.HibernateAttributeValueStore">
+ <bean id="org.hisp.dhis.attribute.AttributeValueStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.hisp.dhis.attribute.AttributeValue" />
+ <property name="cacheable" value="true" />
</bean>
<bean id="org.hisp.dhis.options.SystemSettingStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2011-09-21 15:53:54 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/attribute/AttributeValueStoreTest.java 2011-12-09 18:58:11 +0000
@@ -27,21 +27,23 @@
import static org.junit.Assert.*;
import org.hisp.dhis.DhisSpringTest;
+import org.hisp.dhis.common.GenericStore;
public class AttributeValueStoreTest
extends DhisSpringTest
{
- private AttributeValueStore attributeValueStore;
+ private GenericStore<AttributeValue> attributeValueStore;
private AttributeValue attributeValue1;
private AttributeValue attributeValue2;
@Override
+ @SuppressWarnings("unchecked")
protected void setUpTest()
{
AttributeStore attributeStore = (AttributeStore) getBean( "org.hisp.dhis.attribute.AttributeStore" );
- attributeValueStore = (AttributeValueStore) getBean( "org.hisp.dhis.attribute.AttributeValueStore" );
+ attributeValueStore = (GenericStore<AttributeValue>) getBean( "org.hisp.dhis.attribute.AttributeValueStore" );
Attribute attribute1 = new Attribute();
attribute1.setName( "attribute_simple" );