=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/InputUtils.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/InputUtils.java 2015-03-16 13:49:22 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/utils/InputUtils.java 2015-03-16 13:56:13 +0000 @@ -34,7 +34,6 @@ import javax.servlet.http.HttpServletResponse; import org.hisp.dhis.common.IdentifiableObjectManager; -import org.hisp.dhis.dataelement.CategoryOptionGroup; import org.hisp.dhis.dataelement.DataElementCategoryCombo; import org.hisp.dhis.dataelement.DataElementCategoryOption; import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; @@ -130,98 +129,4 @@ return attributeOptionCombo; } - - /** - * Validates and retrieves a single category option group. 409 conflict as - * status code along with a textual message will be set on the response in - * case of invalid input. - * - * @param response the servlet response. - * @param cog the category option group query string. - * @return the set of category option groups, null if the input was - * missing or an empty set if the input was invalid. - */ - public Set getAttributeOptionGroup( HttpServletResponse response, String cog ) - { - Set groups = new HashSet<>(); - - groups.add(cog); - - return getAttributeOptionGroups( response, groups ); - } - - /** - * Validates and retrieves a set of category option groups. 409 conflict as - * status code along with a textual message will be set on the response in - * case of invalid input. - * - * @param response the servlet response. - * @param cog the category option group query string set. - * @return the set of category option groups, null if the input was - * missing or an empty set if the input was invalid. - */ - public Set getAttributeOptionGroups( HttpServletResponse response, Set cog ) - { - Set groups = null; - - if ( cog != null ) - { - groups = new HashSet<>(); - - for ( String id : cog ) - { - if ( "undefined".compareTo( id ) != 0 ) - { - CategoryOptionGroup categoryOptionGroup = categoryService.getCategoryOptionGroup( id ); - - if ( categoryOptionGroup == null ) - { - ContextUtils.conflictResponse( response, "Illegal category option group identifier: " + cog ); - return null; - } - - groups.add( categoryOptionGroup ); - } - } - } - - return groups; - } - - /** - * Validates and retrieves a set of category options. 409 conflict as - * status code along with a textual message will be set on the response in - * case of invalid input. - * - * @param response the servlet response. - * @param cp the category option query string. - * @return the set of category option groups, null if the input was - * missing or an empty set if the input was invalid. - */ - public Set getAttributeOptions( HttpServletResponse response, String cp ) - { - Set options = null; - - if ( cp != null ) - { - Set opts = ContextUtils.getQueryParamValues( cp ); - - options = new HashSet<>(); - - for ( String id : opts ) - { - DataElementCategoryOption categoryOption = categoryService.getDataElementCategoryOption( id ); - - if ( categoryOption == null ) - { - ContextUtils.conflictResponse( response, "Illegal category option identifier: " + id ); - return null; - } - - options.add( categoryOption ); - } - } - - return options; - } }