private CategoryOptionCombo getAttributeOptionCombo( String key, CategoryCombo categoryCombo, Set<CategoryOption> categoryOptions ) { return attributeOptionComboCache.get( key, () -> categoryService.getCategoryOptionCombo( categoryCombo, categoryOptions ) ); }
@Override public Set<CategoryOptionCombo> getOptionCombosInExpression( String expression ) { return getIdObjectsInExpression( CATEGORY_OPTION_COMBO_OPERAND_PATTERN, expression, ( m ) -> categoryService.getCategoryOptionCombo( m.group( GROUP_CATEGORORY_OPTION_COMBO ) ) ); }
private CategoryOptionCombo getAttributeOptionCombo( int id ) { CategoryOptionCombo aoc = context.getAocIdMap().get( id ); if ( aoc == null ) { log.trace("DataValidationTask calling getCategoryOptionCombo( id " + id + " )" ); aoc = categoryService.getCategoryOptionCombo( id ); log.trace("DataValidationTask called getCategoryOptionCombo( id " + id + ")" ); addToAocCache( aoc ); } return aoc; }
private CategoryOptionCombo getAttributeOptionCombo( String uid ) { CategoryOptionCombo aoc = context.getAocUidMap().get( uid ); if ( aoc == null ) { log.trace("DataValidationTask calling getCategoryOptionCombo( uid " + uid + " )" ); aoc = categoryService.getCategoryOptionCombo( uid ); log.trace("DataValidationTask called getCategoryOptionCombo( uid " + uid + ")" ); addToAocCache( aoc ); } return aoc; }
@Override @Transactional public Set<DataElementOperand> getOperandsInExpression( String expression ) { Set<DataElementOperand> operandsInExpression = new HashSet<>(); if ( expression != null ) { final Matcher matcher = OPERAND_PATTERN.matcher( expression ); while ( matcher.find() ) { String dataElementUid = StringUtils.trimToNull( matcher.group( GROUP_DATA_ELEMENT ) ); String optionComboUid = StringUtils.trimToNull( matcher.group( GROUP_CATEGORORY_OPTION_COMBO ) ); DataElement dataElement = dataElementService.getDataElement( dataElementUid ); CategoryOptionCombo optionCombo = optionComboUid == null ? null : categoryService.getCategoryOptionCombo( optionComboUid ); operandsInExpression.add ( new DataElementOperand( dataElement, optionCombo ) ); } } return operandsInExpression; }
CategoryOptionCombo coc = categoryService.getCategoryOptionCombo( Integer.parseInt( matcher.group( 2 ) ) ); replacement += "." + coc.getUid();
/** * Reload attribute category option combos into this Hibernate context. * * @param results * @param dataElementCategoryService */ private static void reloadAttributeOptionCombos( Collection<ValidationResult> results, CategoryService dataElementCategoryService ) { for ( ValidationResult result : results ) { result.setAttributeOptionCombo( dataElementCategoryService .getCategoryOptionCombo( result.getAttributeOptionCombo().getId() ) ); } } }
attrOptCombo = categoryService.getCategoryOptionCombo( categoryCombo, categoryOptions ); attrOptCombo = categoryService.getCategoryOptionCombo( attributeOptionCombo );
private void saveValue( OrganisationUnit unit, Period period, org.hisp.dhis.dataelement.DataElement dataElement, DataValue dv ) { String value = dv.getValue().trim(); CategoryOptionCombo catOptCombo = categoryService.getCategoryOptionCombo( dv .getCategoryOptComboID() ); org.hisp.dhis.datavalue.DataValue dataValue = dataValueService.getDataValue( dataElement, period, unit, catOptCombo ); if ( dataValue == null ) { dataValue = new org.hisp.dhis.datavalue.DataValue( dataElement, period, unit, catOptCombo, categoryService.getDefaultCategoryOptionCombo(), value, "", new Date(), "" ); dataValueService.addDataValue( dataValue ); } else { dataValue.setValue( value ); dataValue.setLastUpdated( new Date() ); dataValueService.updateDataValue( dataValue ); } }
CategoryOptionCombo coc = categoryService.getCategoryOptionCombo( Integer.parseInt( matcher.group( 2 ) ) ); String replacement = "id=\"" + de.getUid() + "-" + coc.getUid() + "-val\""; matcher.appendReplacement( sb, replacement );
attributeOptionCombo = categoryService.getCategoryOptionCombo( dv.getAttributeOptionComboId() );
/** * Validates and retrieves the attribute option combo. 409 conflict as * status code along with a textual message will be set on the response in * case of invalid input. The response is cached. * * @param cc the category combo identifier. * @param cp the category and option query string. * @param skipFallback whether to skip fallback to default option combo if * attribute option combo is not found. * @return the attribute option combo identified from the given input, or * null. if the input was invalid. */ public CategoryOptionCombo getAttributeOptionCombo( String cc, String cp, boolean skipFallback ) { String cacheKey = TextUtils.joinHyphen( cc, cp, String.valueOf( skipFallback ) ); Integer id = ATTR_OPTION_COMBO_ID_CACHE.getIfPresent( cacheKey ); if ( id != null ) { return categoryService.getCategoryOptionCombo( id ); } else { CategoryOptionCombo aoc = getAttributeOptionComboInternal( cc, cp, skipFallback ); if ( aoc != null ) { ATTR_OPTION_COMBO_ID_CACHE.put( cacheKey, aoc.getId() ); } return aoc; } }
.getCategoryOptionCombo( code.getOptionId() );
.getCategoryOptionCombo( code.getOptionId() );
.getCategoryOptionCombo( code.getOptionId() );
categoryService.getCategoryOptionCombo( oldValue.getAttributeOptionComboId() ), oldValue.getValue(), storedBy, null, null );
.getCategoryOptionCombo( code.getOptionId() );
.getCategoryOptionCombo( code.getOptionId() );
outputOptionCombo, categoryService.getCategoryOptionCombo( aoc ), valueString, storedBy, now, null ) );