dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #36398
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18627: update attribute service/store to support PS, TE, TEA metadata attributes
------------------------------------------------------------
revno: 18627
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-03-19 12:41:07 +0700
message:
update attribute service/store to support PS,TE,TEA metadata attributes
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.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/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeService.java 2015-03-19 05:41:07 +0000
@@ -43,28 +43,28 @@
/**
* Adds an attribute.
- *
+ *
* @param attribute the attribute.
*/
void addAttribute( Attribute attribute );
/**
* Updates an attribute.
- *
+ *
* @param attribute the attribute.
*/
void updateAttribute( Attribute attribute );
/**
* Deletes an attribute.
- *
+ *
* @param attribute the attribute.
*/
void deleteAttribute( Attribute attribute );
/**
* Gets the attribute with the given id.
- *
+ *
* @param id the attribute id.
* @return the attribute with the given id.
*/
@@ -72,7 +72,7 @@
/**
* Gets the attribute with the given uid.
- *
+ *
* @param id the attribute uid.
* @return the attribute with the given uid.
*/
@@ -80,7 +80,7 @@
/**
* Gets the attribute with the given name.
- *
+ *
* @param name the name.
* @return the attribute with the given name.
*/
@@ -96,35 +96,35 @@
/**
* Gets all attributes.
- *
+ *
* @return a set of all attributes.
*/
Set<Attribute> getAllAttributes();
/**
* Gets attributes which are associated with data elements.
- *
+ *
* @return a set of attributes associated with data elements.
*/
Set<Attribute> getDataElementAttributes();
/**
* Gets attributes which are associated with data element groups.
- *
+ *
* @return a set of attributes associated with data element groups.
*/
Set<Attribute> getDataElementGroupAttributes();
/**
* Gets attributes which are associated with indicators.
- *
+ *
* @return a set of attributes associated with indicators.
*/
Set<Attribute> getIndicatorAttributes();
/**
* Gets attributes which are associated with data elements.
- *
+ *
* @return a set of attributes associated with data elements.
*/
Set<Attribute> getIndicatorGroupAttributes();
@@ -138,14 +138,14 @@
/**
* Gets attributes which are associated with organisation units.
- *
+ *
* @return a set of attributes associated with organisation units.
*/
Set<Attribute> getOrganisationUnitAttributes();
/**
* Gets attributes which are associated with organisation unit groups.
- *
+ *
* @return a set of attributes associated with organisation unit groups.
*/
Set<Attribute> getOrganisationUnitGroupAttributes();
@@ -159,14 +159,14 @@
/**
* Gets attributes which are associated with users.
- *
+ *
* @return a set of attributes which are associated with users.
*/
Set<Attribute> getUserAttributes();
/**
* Gets attributes which are associated with user groups.
- *
+ *
* @return a set of attributes which are associated with user groups.
*/
Set<Attribute> getUserGroupAttributes();
@@ -179,15 +179,36 @@
Set<Attribute> getProgramAttributes();
/**
+ * Gets attributes which are associated with program stages.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getProgramStageAttributes();
+
+ /**
+ * Gets attributes which are associated with tracked entities.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getTrackedEntityAttributes();
+
+ /**
+ * Gets attributes which are associated with programs.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getTrackedEntityAttributeAttributes();
+
+ /**
* Gets the number of attributes.
- *
+ *
* @return the number of attributes.
*/
int getAttributeCount();
/**
* Gets the number of attributes with the given name.
- *
+ *
* @return the number of attributes with the given name.
*/
int getAttributeCountByName( String name );
@@ -202,28 +223,28 @@
/**
* Adds an attribute value.
- *
+ *
* @param attributeValue the attribute value.
*/
void addAttributeValue( AttributeValue attributeValue );
/**
* Updates an attribute value.
- *
+ *
* @param attributeValue the attribute value.
*/
void updateAttributeValue( AttributeValue attributeValue );
/**
* Deletes an attribute value.
- *
+ *
* @param attributeValue the attribute value.
*/
void deleteAttributeValue( AttributeValue attributeValue );
/**
* Gets the attribute value with the given id.
- *
+ *
* @param id the id.
* @return the attribute value with the given id.
*/
@@ -231,14 +252,14 @@
/**
* Gets all attribute values.
- *
+ *
* @return a set with all attribute values.
*/
Set<AttributeValue> getAllAttributeValues();
/**
* Gets the number of attribute values.
- *
+ *
* @return the number of attribute values.
*/
int getAttributeValueCount();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-03-08 14:00:13 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/attribute/AttributeStore.java 2015-03-19 05:41:07 +0000
@@ -28,10 +28,10 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+
import java.util.Set;
-import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-
/**
* @author mortenoh
*/
@@ -116,4 +116,25 @@
* @return All attributes with attribute.program = true
*/
Set<Attribute> getProgramAttributes();
+
+ /**
+ * Gets attributes which are associated with program stages.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getProgramStageAttributes();
+
+ /**
+ * Gets attributes which are associated with tracked entities.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getTrackedEntityAttributes();
+
+ /**
+ * Gets attributes which are associated with programs.
+ *
+ * @return a set of attributes which are associated with programs.
+ */
+ Set<Attribute> getTrackedEntityAttributeAttributes();
}
=== 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 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/DefaultAttributeService.java 2015-03-19 05:41:07 +0000
@@ -187,6 +187,24 @@
}
@Override
+ public Set<Attribute> getProgramStageAttributes()
+ {
+ return new HashSet<>( i18n( i18nService, attributeStore.getProgramStageAttributes() ) );
+ }
+
+ @Override
+ public Set<Attribute> getTrackedEntityAttributes()
+ {
+ return new HashSet<>( i18n( i18nService, attributeStore.getTrackedEntityAttributes() ) );
+ }
+
+ @Override
+ public Set<Attribute> getTrackedEntityAttributeAttributes()
+ {
+ return new HashSet<>( i18n( i18nService, attributeStore.getTrackedEntityAttributeAttributes() ) );
+ }
+
+ @Override
public int getAttributeCount()
{
return attributeStore.getCount();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/attribute/hibernate/HibernateAttributeStore.java 2015-03-19 05:41:07 +0000
@@ -119,4 +119,25 @@
{
return new HashSet<Attribute>( getCriteria( Restrictions.eq( "programAttribute", true ) ).list() );
}
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getProgramStageAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "programStageAttribute", true ) ).list() );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getTrackedEntityAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "trackedEntityAttribute", true ) ).list() );
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Set<Attribute> getTrackedEntityAttributeAttributes()
+ {
+ return new HashSet<Attribute>( getCriteria( Restrictions.eq( "trackedEntityAttributeAttribute", true ) ).list() );
+ }
}