@Override public T call() throws ExecutionException { return manager.getObject( clazz, idScheme, id ); }
private List<DimensionalItemObject> buildCategoryOptionComboList( List<String> items, IdScheme inputIdScheme ) { return items.stream().map( item -> idObjectManager.getObject( CategoryOptionCombo.class, inputIdScheme, item ) ) .filter( Objects::nonNull ) .collect( Collectors.toList() ); }
/** * Returns a {@link ProgramDataElementDimensionItem}. * * @param idScheme the identifier scheme. * @param programId the program identifier. * @param dataElementId the data element identifier. */ private ProgramDataElementDimensionItem getProgramDataElementDimensionItem( IdScheme idScheme, String programId, String dataElementId ) { Program program = idObjectManager.getObject( Program.class, idScheme, programId ); DataElement dataElement = idObjectManager.getObject( DataElement.class, idScheme, dataElementId ); if ( program == null || dataElement == null ) { return null; } return new ProgramDataElementDimensionItem( program, dataElement ); }
/** * Returns a {@link ProgramTrackedEntityAttributeDimensionItem}. * * @param idScheme the identifier scheme. * @param programId the program identifier. * @param attributeId the attribute identifier. */ private ProgramTrackedEntityAttributeDimensionItem getProgramAttributeDimensionItem( IdScheme idScheme, String programId, String attributeId ) { Program program = idObjectManager.getObject( Program.class, idScheme, programId ); TrackedEntityAttribute attribute = idObjectManager.getObject( TrackedEntityAttribute.class, idScheme, attributeId ); if ( program == null || attribute == null ) { return null; } return new ProgramTrackedEntityAttributeDimensionItem( program, attribute ); }
/** * Returns a {@link DataElementOperand}. For identifier wild cards * {@link ExpressionService#SYMBOL_WILDCARD}, the relevant property * will be null. * * @param idScheme the identifier scheme. * @param dataElementId the data element identifier. * @param categoryOptionComboId the category option combo identifier. */ private DataElementOperand getDataElementOperand( IdScheme idScheme, String dataElementId, String categoryOptionComboId, String attributeOptionComboId ) { DataElement dataElement = idObjectManager.getObject( DataElement.class, idScheme, dataElementId ); CategoryOptionCombo categoryOptionCombo = idObjectManager.getObject( CategoryOptionCombo.class, idScheme, categoryOptionComboId ); CategoryOptionCombo attributeOptionCombo = idObjectManager.getObject( CategoryOptionCombo.class, idScheme, attributeOptionComboId ); if ( dataElement == null || (categoryOptionCombo == null && !SYMBOL_WILDCARD.equals( categoryOptionComboId )) ) { return null; } return new DataElementOperand( dataElement, categoryOptionCombo, attributeOptionCombo ); }
private CategoryOption getCategoryOption( IdScheme idScheme, String id ) { return categoryOptionCache.get( id, () -> manager.getObject( CategoryOption.class, idScheme, id ) ); }
private CategoryOptionCombo getCategoryOptionCombo( IdScheme idScheme, String id ) { return categoryOptionComboCache.get( id, () -> manager.getObject( CategoryOptionCombo.class, idScheme, id ) ); }
private DataElement getDataElement( IdScheme idScheme, String id ) { return dataElementCache.get( id, () -> manager.getObject( DataElement.class, idScheme, id ) ); }
private OrganisationUnit getOrganisationUnit( IdSchemes idSchemes, String id ) { return organisationUnitCache.get( id, () -> manager.getObject( OrganisationUnit.class, idSchemes.getOrgUnitIdScheme(), id ) ); }
private OrganisationUnit getOrganisationUnit( IdSchemes idSchemes, String id ) { return organisationUnitCache .get( id, () -> manager.getObject( OrganisationUnit.class, idSchemes.getOrgUnitIdScheme(), id ) ); }
private Program getProgram( IdSchemes idSchemes, String id ) { if ( id == null ) { return null; } return programCache .get( id, () -> manager.getObject( Program.class, idSchemes.getProgramIdScheme(), id ) ); }
private TrackedEntityType getTrackedEntityType( IdSchemes idSchemes, String id ) { return trackedEntityCache .get( id, () -> manager.getObject( TrackedEntityType.class, idSchemes.getTrackedEntityIdScheme(), id ) ); }
private TrackedEntityAttribute getTrackedEntityAttribute( IdSchemes idSchemes, String id ) { return trackedEntityAttributeCache.get( id, () -> manager .getObject( TrackedEntityAttribute.class, idSchemes.getTrackedEntityAttributeIdScheme(), id ) ); }
private ProgramStage getProgramStage( IdScheme idScheme, String id ) { if ( id == null ) { return null; } ProgramStage programStage = programStageCache.get( id ); if ( programStage == null ) { programStage = manager.getObject( ProgramStage.class, idScheme, id ); if ( programStage != null ) { programStageCache.put( id, programStage ); dataElementCache.putAll( programStage.getAllDataElements().stream().collect( Collectors.toMap( DataElement::getUid, de -> de ) ) ); } } return programStage; }
private Program getProgram( IdScheme idScheme, String id ) { if ( id == null ) { return null; } Program program = programCache.get( id ); if ( program == null ) { program = manager.getObject( Program.class, idScheme, id ); if( program != null ) { programCache.put( id, program ); programStageCache.putAll( program.getProgramStages().stream().collect( Collectors.toMap( ProgramStage::getUid, ps -> ps ) ) ); for ( ProgramStage programStage : program.getProgramStages() ) { dataElementCache.putAll( programStage.getAllDataElements().stream().collect( Collectors.toMap( DataElement::getUid, de -> de ) ) ); } } } return program; }
/** * Returns a {@link ReportingRate}. * * @param idScheme the identifier scheme. * @param dataSetId the data set identifier. * @param metric the reporting rate metric. */ private ReportingRate getReportingRate( IdScheme idScheme, String dataSetId, String metric ) { DataSet dataSet = idObjectManager.getObject( DataSet.class, idScheme, dataSetId ); boolean metricValid = isValidEnum( ReportingRateMetric.class, metric ); if ( dataSet == null || !metricValid ) { return null; } return new ReportingRate( dataSet, ReportingRateMetric.valueOf( metric ) ); }
@Override public CategoryOptionCombo getCategoryOptionComboAcl( IdentifiableProperty property, String id ) { CategoryOptionCombo coc = idObjectManager.getObject( CategoryOptionCombo.class, property, id ); if ( coc != null ) { User user = currentUserService.getCurrentUser(); for ( CategoryOption categoryOption : coc.getCategoryOptions() ) { if ( !aclService.canDataWrite( user, categoryOption ) ) { return null; } } } return coc; }
CategoryOptionCombo categoryOptionCombo = optionComboMap.get( optionComboId, () -> idObjectManager.getObject( CategoryOptionCombo.class, IdScheme.UID, optionComboId ) );
CategoryOptionCombo categoryOptionCombo = optionComboMap.get( optionComboId, () -> idObjectManager.getObject( CategoryOptionCombo.class, IdScheme.UID, optionComboId ) );
CategoryOption categoryOption = idObjectManager.getObject( CategoryOption.class, idScheme, uid );