← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21205: controller for dataValueAudit

 

------------------------------------------------------------
revno: 21205
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-27 12:26:25 +0700
message:
  controller for dataValueAudit
added:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AuditController.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.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/datavalue/DataValueAudit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAudit.java	2015-11-27 05:26:25 +0000
@@ -28,7 +28,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import org.hisp.dhis.common.AuditType;
+import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -58,7 +61,7 @@
     private OrganisationUnit organisationUnit;
 
     private DataElementCategoryOptionCombo categoryOptionCombo;
-    
+
     private DataElementCategoryOptionCombo attributeOptionCombo;
 
     private AuditType auditType;
@@ -99,6 +102,8 @@
         this.id = id;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getValue()
     {
         return value;
@@ -109,6 +114,8 @@
         this.value = value;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getModifiedBy()
     {
         return modifiedBy;
@@ -119,6 +126,8 @@
         this.modifiedBy = modifiedBy;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Date getTimestamp()
     {
         return timestamp;
@@ -129,6 +138,8 @@
         this.timestamp = timestamp;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public DataElement getDataElement()
     {
         return dataElement;
@@ -139,6 +150,8 @@
         this.dataElement = dataElement;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public Period getPeriod()
     {
         return period;
@@ -149,6 +162,8 @@
         this.period = period;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public OrganisationUnit getOrganisationUnit()
     {
         return organisationUnit;
@@ -159,6 +174,8 @@
         this.organisationUnit = organisationUnit;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public DataElementCategoryOptionCombo getCategoryOptionCombo()
     {
         return categoryOptionCombo;
@@ -169,6 +186,8 @@
         this.categoryOptionCombo = categoryOptionCombo;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public DataElementCategoryOptionCombo getAttributeOptionCombo()
     {
         return attributeOptionCombo;
@@ -179,6 +198,8 @@
         this.attributeOptionCombo = attributeOptionCombo;
     }
 
+    @JsonProperty
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public AuditType getAuditType()
     {
         return auditType;

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditService.java	2015-11-27 05:26:25 +0000
@@ -28,13 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.List;
-
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
+import java.util.List;
+
 /**
  * @author Quang Nguyen
  * @author Halvdan Hoem Grelland
@@ -56,7 +56,7 @@
      *
      * @param dataValue the DataValue to get DataValueAudits for.
      * @return a list of DataValueAudits which match the given DataValue,
-     *         or an empty collection if there are no matches.
+     * or an empty collection if there are no matches.
      */
     List<DataValueAudit> getDataValueAudits( DataValue dataValue );
 
@@ -64,16 +64,19 @@
      * Returns all DataValueAudits for the given DataElement, Period,
      * OrganisationUnit and DataElementCategoryOptionCombo.
      *
-     * @param dataElement the DataElement of the DataValueAudits.
-     * @param period the Period of the DataValueAudits.
-     * @param organisationUnit the OrganisationUnit of the DataValueAudits.
-     * @param categoryOptionCombo the DataElementCategoryOptionCombo of the DataValueAudits.
+     * @param dataElement          the DataElement of the DataValueAudits.
+     * @param period               the Period of the DataValueAudits.
+     * @param organisationUnit     the OrganisationUnit of the DataValueAudits.
+     * @param categoryOptionCombo  the DataElementCategoryOptionCombo of the DataValueAudits.
      * @param attributeOptionCombo the attribute option combo.
      * @return a list of DataValueAudits which matches the given DataElement, Period,
-     *         OrganisationUnit and DataElementCategoryOptionCombo, or an empty collection if
-     *         there are not matches.
+     * OrganisationUnit and DataElementCategoryOptionCombo, or an empty collection if
+     * there are not matches.
      */
-    List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period, OrganisationUnit organisationUnit, 
+    List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period, OrganisationUnit organisationUnit,
+        DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo );
+
+    List<DataValueAudit> getDataValueAudits( DataElement dataElement, List<Period> periods, List<OrganisationUnit> organisationUnits,
         DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo );
 
     /**

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValueAuditStore.java	2015-11-27 05:26:25 +0000
@@ -28,13 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.List;
-
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
+import java.util.List;
+
 /**
  * @author Quang Nguyen
  * @author Halvdan Hoem Grelland
@@ -56,8 +56,8 @@
      *
      * @param dataValue the DataValue to get DataValueAudits for.
      * @return a list of DataValueAudits which match the DataElement Period,
-     *         OrganisationUnit and DataElementCategoryOptionCombo of the given DataValue,
-     *         or an empty list if no DataValueAudits match.
+     * OrganisationUnit and DataElementCategoryOptionCombo of the given DataValue,
+     * or an empty list if no DataValueAudits match.
      */
     List<DataValueAudit> getDataValueAudits( DataValue dataValue );
 
@@ -65,16 +65,19 @@
      * Returns all DataValueAudits which match the given DataElement, Period,
      * OrganisationUnit and DataElementCategoryOptionCombo.
      *
-     * @param dataElement the DataElement of the DataValueAudits.
-     * @param period the Period of the DataValueAudits.
-     * @param organisationUnit the OrganisationUnit of the DataValueAudits.
-     * @param categoryOptionCombo the DataElementCategoryOptionCombo of the DataValueAudits.
+     * @param dataElement          the DataElement of the DataValueAudits.
+     * @param period               the Period of the DataValueAudits.
+     * @param organisationUnit     the OrganisationUnit of the DataValueAudits.
+     * @param categoryOptionCombo  the DataElementCategoryOptionCombo of the DataValueAudits.
      * @param attributeOptionCombo the attribute option combo.
      * @return a list of DataValueAudits which match the given DataElement, Period,
-     *         OrganisationUnit and DataElementCategoryOptionCombo, or an empty list
-     *         if no DataValueAudits match.
+     * OrganisationUnit and DataElementCategoryOptionCombo, or an empty list
+     * if no DataValueAudits match.
      */
-    List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period, OrganisationUnit organisationUnit, 
+    List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period, OrganisationUnit organisationUnit,
+        DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo );
+
+    List<DataValueAudit> getDataValueAudits( DataElement dataElement, List<Period> period, List<OrganisationUnit> organisationUnits,
         DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo );
 
     /**

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/DefaultDataValueAuditService.java	2015-11-27 05:26:25 +0000
@@ -28,14 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.List;
-
+import com.google.common.collect.Lists;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.List;
+
 /**
  * @author Quang Nguyen
  * @author Halvdan Hoem Grelland
@@ -81,7 +82,14 @@
     public List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period,
         OrganisationUnit organisationUnit, DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo )
     {
-        return dataValueAuditStore.getDataValueAudits( dataElement, period, organisationUnit, categoryOptionCombo, attributeOptionCombo );
+        return getDataValueAudits( dataElement, Lists.newArrayList( period ), Lists.newArrayList( organisationUnit ), categoryOptionCombo, attributeOptionCombo );
+    }
+
+    @Override
+    public List<DataValueAudit> getDataValueAudits( DataElement dataElement, List<Period> periods,
+        List<OrganisationUnit> organisationUnits, DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo )
+    {
+        return dataValueAuditStore.getDataValueAudits( dataElement, periods, organisationUnits, categoryOptionCombo, attributeOptionCombo );
     }
 
     @Override

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	2015-06-16 05:11:29 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/datavalue/hibernate/HibernateDataValueAuditStore.java	2015-11-27 05:26:25 +0000
@@ -28,9 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
+import com.google.common.collect.Lists;
 import org.hibernate.Criteria;
 import org.hibernate.Query;
 import org.hibernate.Session;
@@ -46,6 +44,9 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodStore;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author Quang Nguyen
  * @author Halvdan Hoem Grelland
@@ -92,26 +93,62 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
+    @SuppressWarnings( "unchecked" )
     public List<DataValueAudit> getDataValueAudits( DataElement dataElement, Period period,
         OrganisationUnit organisationUnit, DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo )
     {
+        return getDataValueAudits( dataElement, Lists.newArrayList( period ), Lists.newArrayList( organisationUnit ), categoryOptionCombo, attributeOptionCombo );
+    }
+
+    @Override
+    @SuppressWarnings( "unchecked" )
+    public List<DataValueAudit> getDataValueAudits( DataElement dataElement, List<Period> periods, List<OrganisationUnit> organisationUnits,
+        DataElementCategoryOptionCombo categoryOptionCombo, DataElementCategoryOptionCombo attributeOptionCombo )
+    {
         Session session = sessionFactory.getCurrentSession();
-
-        Period storedPeriod = periodStore.reloadPeriod( period );
-
-        if( storedPeriod == null )
-        {
-            return new ArrayList<>();
-        }
-
-        Criteria criteria = session.createCriteria( DataValueAudit.class )
-            .add( Restrictions.eq( "dataElement", dataElement ) )
-            .add( Restrictions.eq( "period", storedPeriod ) )
-            .add( Restrictions.eq( "organisationUnit", organisationUnit ) )
-            .add( Restrictions.eq( "categoryOptionCombo", categoryOptionCombo ) )
-            .add( Restrictions.eq( "attributeOptionCombo", attributeOptionCombo ) )
-            .addOrder( Order.desc( "timestamp" ) );
+        List<Period> storedPeriods = new ArrayList<>();
+
+        if ( !periods.isEmpty() )
+        {
+            for ( Period period : periods )
+            {
+                Period storedPeriod = periodStore.reloadPeriod( period );
+
+                if ( storedPeriod != null )
+                {
+                    storedPeriods.add( storedPeriod );
+                }
+            }
+        }
+
+        Criteria criteria = session.createCriteria( DataValueAudit.class );
+
+        if ( dataElement != null )
+        {
+            criteria.add( Restrictions.eq( "dataElement", dataElement ) );
+        }
+
+        if ( !storedPeriods.isEmpty() )
+        {
+            criteria.add( Restrictions.in( "period", storedPeriods ) );
+        }
+
+        if ( !organisationUnits.isEmpty() )
+        {
+            criteria.add( Restrictions.in( "organisationUnit", organisationUnits ) );
+        }
+
+        if ( categoryOptionCombo != null )
+        {
+            criteria.add( Restrictions.eq( "categoryOptionCombo", categoryOptionCombo ) );
+        }
+
+        if ( attributeOptionCombo != null )
+        {
+            criteria.add( Restrictions.eq( "attributeOptionCombo", attributeOptionCombo ) );
+        }
+
+        criteria.addOrder( Order.desc( "timestamp" ) );
 
         return criteria.list();
     }

=== added file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AuditController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AuditController.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AuditController.java	2015-11-27 05:26:25 +0000
@@ -0,0 +1,175 @@
+package org.hisp.dhis.webapi.controller;
+
+/*
+ * Copyright (c) 2004-2015, 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.IdentifiableObjectManager;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.datavalue.DataValueAudit;
+import org.hisp.dhis.datavalue.DataValueAuditService;
+import org.hisp.dhis.dxf2.webmessage.WebMessageException;
+import org.hisp.dhis.fieldfilter.FieldFilterService;
+import org.hisp.dhis.node.NodeUtils;
+import org.hisp.dhis.node.types.RootNode;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.webapi.utils.WebMessageUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+@Controller
+@RequestMapping( value = "/audits", method = RequestMethod.GET )
+public class AuditController
+{
+    @Autowired
+    private IdentifiableObjectManager manager;
+
+    @Autowired
+    private DataValueAuditService dataValueAuditService;
+
+    @Autowired
+    private FieldFilterService fieldFilterService;
+
+    @RequestMapping( value = "dataValue", method = RequestMethod.GET )
+    public @ResponseBody RootNode getAggregateDataValueAudit(
+        @RequestParam( required = false ) String de,
+        @RequestParam( required = false, defaultValue = "" ) List<String> pe,
+        @RequestParam( required = false, defaultValue = "" ) List<String> ou,
+        @RequestParam( required = false ) String co,
+        @RequestParam( required = false ) String cc
+    ) throws WebMessageException
+    {
+        DataElement dataElement = getDataElement( de );
+        List<Period> periods = getPeriods( pe );
+        List<OrganisationUnit> organisationUnits = getOrganisationUnit( ou );
+        DataElementCategoryOptionCombo categoryOptionCombo = getCategoryOptionCombo( co );
+        DataElementCategoryOptionCombo attributeOptionCombo = getAttributeOptionCombo( cc );
+
+        List<DataValueAudit> dataValueAudits = dataValueAuditService.getDataValueAudits( dataElement, periods,
+            organisationUnits, categoryOptionCombo, attributeOptionCombo );
+
+        RootNode rootNode = NodeUtils.createRootNode( "dataValueAudits" );
+        rootNode.addChild( fieldFilterService.filter( DataValueAudit.class, dataValueAudits, new ArrayList<>() ) );
+
+        return rootNode;
+    }
+
+    //-----------------------------------------------------------------------------------------------------------------
+    // Helpers
+    //-----------------------------------------------------------------------------------------------------------------
+
+    private DataElement getDataElement( String de ) throws WebMessageException
+    {
+        if ( de == null )
+        {
+            return null;
+        }
+
+        DataElement dataElement = manager.search( DataElement.class, de );
+
+        if ( dataElement == null )
+        {
+            throw new WebMessageException( WebMessageUtils.conflict( "Illegal dataElement identifier: " + de ) );
+        }
+
+        return dataElement;
+    }
+
+    private List<Period> getPeriods( List<String> peIdentifiers ) throws WebMessageException
+    {
+        List<Period> periods = new ArrayList<>();
+
+        for ( String pe : peIdentifiers )
+        {
+            Period period = PeriodType.getPeriodFromIsoString( pe );
+
+            if ( period == null )
+            {
+                throw new WebMessageException( WebMessageUtils.conflict( "Illegal period identifier: " + pe ) );
+            }
+        }
+
+        return periods;
+    }
+
+    private List<OrganisationUnit> getOrganisationUnit( List<String> ou ) throws WebMessageException
+    {
+        if ( ou == null )
+        {
+            return new ArrayList<>();
+        }
+
+        return manager.getByUid( OrganisationUnit.class, ou );
+    }
+
+    private DataElementCategoryOptionCombo getCategoryOptionCombo( @RequestParam String co ) throws WebMessageException
+    {
+        if ( co == null )
+        {
+            return null;
+        }
+
+        DataElementCategoryOptionCombo categoryOptionCombo = manager.search( DataElementCategoryOptionCombo.class, co );
+
+        if ( categoryOptionCombo == null )
+        {
+            throw new WebMessageException( WebMessageUtils.conflict( "Illegal categoryOptionCombo identifier: " + co ) );
+        }
+
+        return categoryOptionCombo;
+    }
+
+    private DataElementCategoryOptionCombo getAttributeOptionCombo( @RequestParam String cc ) throws WebMessageException
+    {
+        if ( cc == null )
+        {
+            return null;
+        }
+
+        DataElementCategoryOptionCombo attributeOptionCombo = manager.search( DataElementCategoryOptionCombo.class, cc );
+
+        if ( attributeOptionCombo == null )
+        {
+            throw new WebMessageException( WebMessageUtils.conflict( "Illegal attributeOptionCombo identifier: " + cc ) );
+        }
+
+        return attributeOptionCombo;
+    }
+}