@Override public String allowDeleteCategory( Category category ) { for ( CategoryOptionCombo categoryOptionCombo : categoryService.getAllCategoryOptionCombos() ) { if ( categoryOptionCombo.getCategoryCombo().getCategories().contains( category ) ) { return categoryOptionCombo.getCategoryCombo().getName(); } } return null; } }
private static void validateAocMatchesDataSetCc( MetaDataProperties mdProps ) throws ImportConflictException { // TODO MdCache? CategoryCombo aocCC = mdProps.attrOptCombo.getCategoryCombo(); CategoryCombo dsCc = mdProps.dataSet.getCategoryCombo(); if ( !aocCC.equals( dsCc ) ) { throw new ImportConflictException( new ImportConflict( aocCC.getUid(), String .format( "Attribute option combo: %s must have category combo: %s", aocCC.getUid(), dsCc.getUid() ) ) ); } }
private void addExplodedCategoryAttributes( CategoryOptionCombo coc ) throws AdxException { Map<String, String> categoryAttributes = new HashMap<>(); if ( !coc.isDefault() ) { for ( Category category : coc.getCategoryCombo().getCategories() ) { String categoryCode = category.getCode(); if ( categoryCode == null || !XMLChar.isValidName( categoryCode ) ) { throw new AdxException( "Category code for " + category.getName() + " is missing or invalid: " + categoryCode ); } String catOptCode = category.getCategoryOption( coc ).getCode(); if ( catOptCode == null || catOptCode.isEmpty() ) { throw new AdxException( "CategoryOption code for " + category.getCategoryOption( coc ).getName() + " is missing" ); } categoryAttributes.put( categoryCode, catOptCode ); } } categoryOptionMap.put( coc.getId(), categoryAttributes ); }