dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27015
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13394: add new controller for DataElementOperands
------------------------------------------------------------
revno: 13394
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-23 10:13:02 +0100
message:
add new controller for DataElementOperands
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementOperandStore.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementOperandService.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.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/dataelement/DataElementOperandService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandService.java 2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandService.java 2013-12-23 09:13:02 +0000
@@ -33,27 +33,30 @@
/**
* @author Abyot Asalefew
- * @version $Id$
*/
public interface DataElementOperandService
{
String ID = DataElementOperandService.class.getName();
- int addDataElementOperand( DataElementOperand dataElementOperand );
+ int addDataElementOperand( DataElementOperand dataElementOperand );
void deleteDataElementOperand( DataElementOperand dataElementOperand );
DataElementOperand getDataElementOperand( int id );
-
+
DataElementOperand getDataElementOperandByUid( String uid );
-
+
List<DataElementOperand> getDataElementOperandsByUid( Collection<String> uids );
DataElementOperand getDataElementOperand( DataElementOperand dataElementOperand );
Collection<DataElementOperand> getAllDataElementOperands();
+ Collection<DataElementOperand> getAllDataElementOperands(int first, int max);
+
Collection<DataElementOperand> getDataElementOperandByDataElements( Collection<DataElement> dataElements );
Collection<DataElementOperand> getDataElementOperandByOptionCombos( Collection<DataElementCategoryOptionCombo> optionCombos );
+
+ Collection<DataElementOperand> getDataElementOperandByDataElementGroup( DataElementGroup dataElementGroup );
}
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementOperandStore.java 2013-12-23 09:13:02 +0000
@@ -0,0 +1,44 @@
+package org.hisp.dhis.dataelement;
+
+/*
+ * Copyright (c) 2004-2013, 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.
+ */
+
+import org.hisp.dhis.common.GenericIdentifiableObjectStore;
+
+import java.util.Collection;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public interface DataElementOperandStore
+ extends GenericIdentifiableObjectStore<DataElementOperand>
+{
+ String ID = DataElementOperand.class.getName();
+
+ Collection<DataElementOperand> getByDataElementGroup( DataElementGroup dataElementGroup );
+}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2013-11-21 09:09:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementStore.java 2013-12-23 09:13:02 +0000
@@ -74,7 +74,7 @@
Collection<DataElement> getAllActiveDataElements();
/**
- * Returns all DataElements with a given aggregantion operator.
+ * Returns all DataElements with a given aggregation operator.
*
* @param aggregationOperator the aggregation operator of the DataElements
* to return.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2013-09-17 18:07:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateIdentifiableObjectStore.java 2013-12-23 09:13:02 +0000
@@ -336,7 +336,7 @@
@Override
@SuppressWarnings("unchecked")
- public final List<T> getAllOrderedName()
+ public List<T> getAllOrderedName()
{
Query query = sharingEnabled() ? getQueryAllOrderedNameAcl() : getQueryAllOrderedName();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementOperandService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementOperandService.java 2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementOperandService.java 2013-12-23 09:13:02 +0000
@@ -28,16 +28,16 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.expression.ExpressionService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.StringUtils;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
-import org.hisp.dhis.common.GenericStore;
-import org.hisp.dhis.expression.ExpressionService;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.StringUtils;
-
/**
* @author Abyot Asalefew
*/
@@ -49,13 +49,13 @@
// Dependencies
// -------------------------------------------------------------------------
- private GenericStore<DataElementOperand> dataElementOperandStore;
+ private DataElementOperandStore dataElementOperandStore;
- public void setDataElementOperandStore( GenericStore<DataElementOperand> dataElementOperandStore )
+ public void setDataElementOperandStore( DataElementOperandStore dataElementOperandStore )
{
this.dataElementOperandStore = dataElementOperandStore;
}
-
+
private DataElementService dataElementService;
public void setDataElementService( DataElementService dataElementService )
@@ -88,50 +88,50 @@
{
return dataElementOperandStore.get( id );
}
-
+
public DataElementOperand getDataElementOperandByUid( String uid )
{
if ( StringUtils.isEmpty( uid ) )
{
return null;
}
-
+
Matcher matcher = ExpressionService.OPERAND_UID_PATTERN.matcher( uid );
-
+
matcher.find();
-
+
String deUid = matcher.group( 1 );
String cocUid = matcher.group( 2 );
-
+
DataElement dataElement = dataElementService.getDataElement( deUid );
-
+
if ( dataElement == null )
{
return null;
}
-
+
DataElementCategoryOptionCombo categoryOptionCombo = null;
-
+
if ( cocUid != null )
{
categoryOptionCombo = categoryService.getDataElementCategoryOptionCombo( cocUid );
}
-
+
return new DataElementOperand( dataElement, categoryOptionCombo );
}
public List<DataElementOperand> getDataElementOperandsByUid( Collection<String> uids )
{
List<DataElementOperand> list = new ArrayList<DataElementOperand>();
-
+
for ( String uid : uids )
{
list.add( getDataElementOperandByUid( uid ) );
}
-
+
return list;
}
-
+
public DataElementOperand getDataElementOperand( DataElementOperand dataElementOperand )
{
for ( DataElementOperand operand : getAllDataElementOperands() )
@@ -148,7 +148,13 @@
public Collection<DataElementOperand> getAllDataElementOperands()
{
- return dataElementOperandStore.getAll();
+ return dataElementOperandStore.getAllOrderedName();
+ }
+
+ @Override
+ public Collection<DataElementOperand> getAllDataElementOperands( int first, int max )
+ {
+ return dataElementOperandStore.getAllOrderedName( first, max );
}
public Collection<DataElementOperand> getDataElementOperandByDataElements( Collection<DataElement> dataElements )
@@ -181,4 +187,10 @@
return operands;
}
+
+ @Override
+ public Collection<DataElementOperand> getDataElementOperandByDataElementGroup( DataElementGroup dataElementGroup )
+ {
+ return dataElementOperandStore.getByDataElementGroup( dataElementGroup );
+ }
}
=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementOperandStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementOperandStore.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementOperandStore.java 2013-12-23 09:13:02 +0000
@@ -0,0 +1,79 @@
+package org.hisp.dhis.dataelement.hibernate;
+
+/*
+ * Copyright (c) 2004-2013, 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.
+ */
+
+import org.hibernate.Query;
+import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.dataelement.DataElementOperandStore;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class HibernateDataElementOperandStore
+ extends HibernateIdentifiableObjectStore<DataElementOperand>
+ implements DataElementOperandStore
+{
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public List<DataElementOperand> getAllOrderedName()
+ {
+ String hql = "from DataElementOperand d";
+ Query query = getQuery( hql );
+
+ return query.list();
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public List<DataElementOperand> getAllOrderedName( int first, int max )
+ {
+ String hql = "from DataElementOperand d";
+ Query query = getQuery( hql );
+ query.setFirstResult( first );
+ query.setMaxResults( max );
+
+ return query.list();
+ }
+
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<DataElementOperand> getByDataElementGroup( DataElementGroup dataElementGroup )
+ {
+ String hql = "select d from DataElementOperand d, DataElementGroup deg where deg=:dataElementGroup and d.dataElement in elements(deg.members)";
+ Query query = getQuery( hql );
+ query.setEntity( "dataElementGroup", dataElementGroup );
+
+ return query.list();
+ }
+}
=== 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 2013-12-20 12:55:20 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2013-12-23 09:13:02 +0000
@@ -14,12 +14,6 @@
<property name="sessionFactory" ref="sessionFactory" />
</bean>
- <bean id="org.hisp.dhis.dataelement.DataElementOperandStore" class="org.hisp.dhis.hibernate.HibernateGenericStore">
- <property name="clazz" value="org.hisp.dhis.dataelement.DataElementOperand" />
- <property name="sessionFactory" ref="sessionFactory" />
- <property name="cacheable" value="true" />
- </bean>
-
<bean id="org.hisp.dhis.dataentryform.DataEntryFormStore" class="org.hisp.dhis.dataentryform.hibernate.HibernateDataEntryFormStore">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
@@ -31,6 +25,13 @@
<property name="cacheable" value="true" />
</bean>
+ <bean id="org.hisp.dhis.dataelement.DataElementOperandStore" class="org.hisp.dhis.dataelement.hibernate.HibernateDataElementOperandStore">
+ <property name="clazz" value="org.hisp.dhis.dataelement.DataElementOperand" />
+ <property name="sessionFactory" ref="sessionFactory" />
+ <property name="jdbcTemplate" ref="jdbcTemplate" />
+ <property name="cacheable" value="true" />
+ </bean>
+
<bean id="org.hisp.dhis.dataelement.DataElementGroupStore" class="org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.hisp.dhis.dataelement.DataElementGroup" />
<property name="sessionFactory" ref="sessionFactory" />
=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2013-10-31 10:29:22 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/MetaData.java 2013-12-23 09:13:02 +0000
@@ -47,6 +47,7 @@
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
+import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.Section;
import org.hisp.dhis.document.Document;
@@ -89,7 +90,7 @@
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-@JacksonXmlRootElement( localName = "metaData", namespace = DxfNamespaces.DXF_2_0 )
+@JacksonXmlRootElement(localName = "metaData", namespace = DxfNamespaces.DXF_2_0)
public class MetaData
{
private Date created;
@@ -122,6 +123,8 @@
private List<DataElementCategoryOptionCombo> categoryOptionCombos = new ArrayList<DataElementCategoryOptionCombo>();
+ private List<DataElementOperand> dataElementOperands = new ArrayList<DataElementOperand>();
+
private List<Dashboard> dashboards = new ArrayList<Dashboard>();
private List<DataElement> dataElements = new ArrayList<DataElement>();
@@ -182,7 +185,6 @@
private List<RelationshipType> relationshipTypes = new ArrayList<RelationshipType>();
- //@author Ovidiu Rosu <rosu.ovi@xxxxxxxxx>
private List<MetaDataFilter> metaDataFilters = new ArrayList<MetaDataFilter>();
private List<PatientIdentifierType> personIdentifierTypes = new ArrayList<PatientIdentifierType>();
@@ -196,7 +198,7 @@
}
@JsonProperty
- @JacksonXmlProperty( isAttribute = true )
+ @JacksonXmlProperty(isAttribute = true)
public Date getCreated()
{
return created;
@@ -208,8 +210,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "attributeTypes", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "attributeType", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "attributeTypes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "attributeType", namespace = DxfNamespaces.DXF_2_0)
public List<Attribute> getAttributeTypes()
{
return attributeTypes;
@@ -221,8 +223,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "users", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "user", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "users", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "user", namespace = DxfNamespaces.DXF_2_0)
public List<User> getUsers()
{
return users;
@@ -234,8 +236,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "userRoles", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "userRole", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "userRoles", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "userRole", namespace = DxfNamespaces.DXF_2_0)
public List<UserAuthorityGroup> getUserRoles()
{
return userRoles;
@@ -247,8 +249,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "userGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "userGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "userGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "userGroup", namespace = DxfNamespaces.DXF_2_0)
public List<UserGroup> getUserGroups()
{
return userGroups;
@@ -260,8 +262,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "messageConversations", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "messageConversation", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "messageConversations", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "messageConversation", namespace = DxfNamespaces.DXF_2_0)
public List<MessageConversation> getMessageConversations()
{
return messageConversations;
@@ -273,8 +275,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "interpretations", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "interpretation", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "interpretations", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "interpretation", namespace = DxfNamespaces.DXF_2_0)
public List<Interpretation> getInterpretations()
{
return interpretations;
@@ -286,8 +288,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElements", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dataElement", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataElements", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataElement", namespace = DxfNamespaces.DXF_2_0)
public List<DataElement> getDataElements()
{
return dataElements;
@@ -299,8 +301,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "optionSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "optionSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "optionSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "optionSet", namespace = DxfNamespaces.DXF_2_0)
public List<OptionSet> getOptionSets()
{
return optionSets;
@@ -312,8 +314,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElementGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dataElementGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataElementGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataElementGroup", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementGroup> getDataElementGroups()
{
return dataElementGroups;
@@ -325,8 +327,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataElementGroupSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dataElementGroupSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataElementGroupSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataElementGroupSet", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementGroupSet> getDataElementGroupSets()
{
return dataElementGroupSets;
@@ -338,8 +340,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "concepts", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "concept", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "concepts", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "concept", namespace = DxfNamespaces.DXF_2_0)
public List<Concept> getConcepts()
{
return concepts;
@@ -351,8 +353,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categories", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "category", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "categories", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "category", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementCategory> getCategories()
{
return categories;
@@ -364,8 +366,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryOptions", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "categoryOption", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "categoryOptions", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "categoryOption", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementCategoryOption> getCategoryOptions()
{
return categoryOptions;
@@ -377,8 +379,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryCombos", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "categoryCombos", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "categoryCombo", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementCategoryCombo> getCategoryCombos()
{
return categoryCombos;
@@ -390,8 +392,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "categoryOptionCombos", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "categoryOptionCombo", namespace = DxfNamespaces.DXF_2_0)
public List<DataElementCategoryOptionCombo> getCategoryOptionCombos()
{
return categoryOptionCombos;
@@ -403,8 +405,21 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicators", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "indicator", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataElementOperands", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataElementOperand", namespace = DxfNamespaces.DXF_2_0)
+ public List<DataElementOperand> getDataElementOperands()
+ {
+ return dataElementOperands;
+ }
+
+ public void setDataElementOperands( List<DataElementOperand> dataElementOperands )
+ {
+ this.dataElementOperands = dataElementOperands;
+ }
+
+ @JsonProperty
+ @JacksonXmlElementWrapper(localName = "indicators", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "indicator", namespace = DxfNamespaces.DXF_2_0)
public List<Indicator> getIndicators()
{
return indicators;
@@ -416,8 +431,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "indicatorGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "indicatorGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "indicatorGroup", namespace = DxfNamespaces.DXF_2_0)
public List<IndicatorGroup> getIndicatorGroups()
{
return indicatorGroups;
@@ -429,8 +444,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorGroupSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "indicatorGroupSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "indicatorGroupSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "indicatorGroupSet", namespace = DxfNamespaces.DXF_2_0)
public List<IndicatorGroupSet> getIndicatorGroupSets()
{
return indicatorGroupSets;
@@ -442,8 +457,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "indicatorTypes", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "indicatorType", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "indicatorTypes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "indicatorType", namespace = DxfNamespaces.DXF_2_0)
public List<IndicatorType> getIndicatorTypes()
{
return indicatorTypes;
@@ -455,8 +470,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "organisationUnits", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "organisationUnit", namespace = DxfNamespaces.DXF_2_0)
public List<OrganisationUnit> getOrganisationUnits()
{
return organisationUnits;
@@ -468,8 +483,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "organisationUnitGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "organisationUnitGroup", namespace = DxfNamespaces.DXF_2_0)
public List<OrganisationUnitGroup> getOrganisationUnitGroups()
{
return organisationUnitGroups;
@@ -481,8 +496,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitGroupSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "organisationUnitGroupSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "organisationUnitGroupSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "organisationUnitGroupSet", namespace = DxfNamespaces.DXF_2_0)
public List<OrganisationUnitGroupSet> getOrganisationUnitGroupSets()
{
return organisationUnitGroupSets;
@@ -494,8 +509,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "organisationUnitLevels", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "organisationUnitLevel", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "organisationUnitLevels", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "organisationUnitLevel", namespace = DxfNamespaces.DXF_2_0)
public List<OrganisationUnitLevel> getOrganisationUnitLevels()
{
return organisationUnitLevels;
@@ -507,8 +522,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "sections", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "section", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "sections", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "section", namespace = DxfNamespaces.DXF_2_0)
public List<Section> getSections()
{
return sections;
@@ -520,8 +535,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dataSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataSet", namespace = DxfNamespaces.DXF_2_0)
public List<DataSet> getDataSets()
{
return dataSets;
@@ -533,8 +548,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "validationRules", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "validationRule", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "validationRules", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "validationRule", namespace = DxfNamespaces.DXF_2_0)
public List<ValidationRule> getValidationRules()
{
return validationRules;
@@ -546,8 +561,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "validationRuleGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "validationRuleGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "validationRuleGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "validationRuleGroup", namespace = DxfNamespaces.DXF_2_0)
public List<ValidationRuleGroup> getValidationRuleGroups()
{
return validationRuleGroups;
@@ -559,8 +574,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "sqlViews", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "sqlView", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "sqlViews", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "sqlView", namespace = DxfNamespaces.DXF_2_0)
public List<SqlView> getSqlViews()
{
return sqlViews;
@@ -572,8 +587,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "charts", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "chart", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "charts", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "chart", namespace = DxfNamespaces.DXF_2_0)
public List<Chart> getCharts()
{
return charts;
@@ -585,8 +600,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "reports", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "report", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "reports", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "report", namespace = DxfNamespaces.DXF_2_0)
public List<Report> getReports()
{
return reports;
@@ -598,8 +613,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "reportTables", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "reportTable", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "reportTables", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "reportTable", namespace = DxfNamespaces.DXF_2_0)
public List<ReportTable> getReportTables()
{
return reportTables;
@@ -611,8 +626,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "documents", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "document", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "documents", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "document", namespace = DxfNamespaces.DXF_2_0)
public List<Document> getDocuments()
{
return documents;
@@ -624,8 +639,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "constants", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "constant", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "constants", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "constant", namespace = DxfNamespaces.DXF_2_0)
public List<Constant> getConstants()
{
return constants;
@@ -637,8 +652,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dashboards", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dashboard", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dashboards", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dashboard", namespace = DxfNamespaces.DXF_2_0)
public List<Dashboard> getDashboards()
{
return dashboards;
@@ -650,8 +665,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "maps", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "map", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "maps", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "map", namespace = DxfNamespaces.DXF_2_0)
public List<Map> getMaps()
{
return maps;
@@ -663,8 +678,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapViews", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "mapView", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "mapViews", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "mapView", namespace = DxfNamespaces.DXF_2_0)
public List<MapView> getMapViews()
{
return mapViews;
@@ -676,8 +691,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLegends", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "mapLegend", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "mapLegends", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "mapLegend", namespace = DxfNamespaces.DXF_2_0)
public List<MapLegend> getMapLegends()
{
return mapLegends;
@@ -689,8 +704,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLegendSets", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "mapLegendSet", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "mapLegendSets", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "mapLegendSet", namespace = DxfNamespaces.DXF_2_0)
public List<MapLegendSet> getMapLegendSets()
{
return mapLegendSets;
@@ -702,8 +717,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "mapLayers", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "mapLayer", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "mapLayers", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "mapLayer", namespace = DxfNamespaces.DXF_2_0)
public List<MapLayer> getMapLayers()
{
return mapLayers;
@@ -715,8 +730,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dataDictionaries", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dataDictionary", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dataDictionaries", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dataDictionary", namespace = DxfNamespaces.DXF_2_0)
public List<DataDictionary> getDataDictionaries()
{
return dataDictionaries;
@@ -728,8 +743,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "programs", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "program", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "programs", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "program", namespace = DxfNamespaces.DXF_2_0)
public List<Program> getPrograms()
{
return programs;
@@ -741,8 +756,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "programStages", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "programStage", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "programStages", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "programStage", namespace = DxfNamespaces.DXF_2_0)
public List<ProgramStage> getProgramStages()
{
return programStages;
@@ -754,8 +769,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "relationshipTypes", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "relationshipType", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "relationshipTypes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "relationshipType", namespace = DxfNamespaces.DXF_2_0)
public List<RelationshipType> getRelationshipTypes()
{
return relationshipTypes;
@@ -767,8 +782,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "personIdentifierTypes", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "personIdentifierType", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "personIdentifierTypes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "personIdentifierType", namespace = DxfNamespaces.DXF_2_0)
public List<PatientIdentifierType> getPersonIdentifierTypes()
{
return personIdentifierTypes;
@@ -780,8 +795,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "personAttributeTypes", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "personAttributeType", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "personAttributeTypes", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "personAttributeType", namespace = DxfNamespaces.DXF_2_0)
public List<PatientAttribute> getPersonAttributeTypes()
{
return personAttributeTypes;
@@ -793,8 +808,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "personAttributeGroups", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "personAttributeGroup", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "personAttributeGroups", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "personAttributeGroup", namespace = DxfNamespaces.DXF_2_0)
public List<PatientAttributeGroup> getPersonAttributeGroups()
{
return personAttributeGroups;
@@ -806,8 +821,8 @@
}
@JsonProperty
- @JacksonXmlElementWrapper( localName = "dimensions", namespace = DxfNamespaces.DXF_2_0 )
- @JacksonXmlProperty( localName = "dimension", namespace = DxfNamespaces.DXF_2_0 )
+ @JacksonXmlElementWrapper(localName = "dimensions", namespace = DxfNamespaces.DXF_2_0)
+ @JacksonXmlProperty(localName = "dimension", namespace = DxfNamespaces.DXF_2_0)
public List<DimensionalObject> getDimensions()
{
return dimensions;
=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/dataelement/DataElementOperandController.java 2013-12-23 09:13:02 +0000
@@ -0,0 +1,96 @@
+package org.hisp.dhis.api.controller.dataelement;
+
+/*
+ * Copyright (c) 2004-2013, 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.
+ */
+
+import org.hisp.dhis.api.controller.AbstractCrudController;
+import org.hisp.dhis.api.controller.WebMetaData;
+import org.hisp.dhis.api.controller.WebOptions;
+import org.hisp.dhis.common.Pager;
+import org.hisp.dhis.dataelement.DataElementGroup;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.dataelement.DataElementOperandService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = DataElementOperandController.RESOURCE_PATH )
+public class DataElementOperandController extends AbstractCrudController<DataElementOperand>
+{
+ public static final String RESOURCE_PATH = "/dataElementOperands";
+
+ private DataElementOperandService dataElementOperandService;
+
+ @Autowired
+ public void setDataElementOperandService( DataElementOperandService dataElementOperandService )
+ {
+ this.dataElementOperandService = dataElementOperandService;
+ }
+
+ protected List<DataElementOperand> getEntityList( WebMetaData metaData, WebOptions options )
+ {
+ List<DataElementOperand> entityList;
+
+ if ( options.getOptions().containsKey( "dataElementGroup" ) )
+ {
+ DataElementGroup dataElementGroup = manager.get( DataElementGroup.class, options.getOptions().get( "dataElementGroup" ) );
+
+ if ( dataElementGroup == null )
+ {
+ entityList = new ArrayList<DataElementOperand>();
+ }
+ else
+ {
+ entityList = new ArrayList<DataElementOperand>( dataElementOperandService.getDataElementOperandByDataElementGroup( dataElementGroup ) );
+ }
+ }
+ else if ( options.hasPaging() )
+ {
+ int count = manager.getCount( getEntityClass() );
+
+ Pager pager = new Pager( options.getPage(), count, options.getPageSize() );
+ metaData.setPager( pager );
+
+ entityList = new ArrayList<DataElementOperand>( dataElementOperandService.getAllDataElementOperands(
+ pager.getOffset(), pager.getPageSize() ) );
+ }
+ else
+ {
+ entityList = new ArrayList<DataElementOperand>( dataElementOperandService.getAllDataElementOperands() );
+ }
+
+ return entityList;
+ }
+}