private Map<String, OrganisationUnit> getMatchingPersistedOrgUnits( Collection<String> identifiers, final IdentifiableProperty property ) { List<OrganisationUnit> orgUnits = idObjectManager.getObjects( OrganisationUnit.class, property, identifiers ); return IdentifiableObjectUtils.getIdMap( orgUnits, IdScheme.from( property ) ); }
params.getDataSets().addAll( idObjManager.getObjects( DataSet.class, IdentifiableProperty.UID, dataSets ) ); .addAll( idObjManager.getObjects( OrganisationUnit.class, IdentifiableProperty.UID, orgUnits ) ); idObjManager.getObjects( OrganisationUnitGroup.class, IdentifiableProperty.UID, orgUnitGroups ) );
params.getDataSets().addAll( identifiableObjectManager.getObjects( DataSet.class, IdentifiableProperty.UID, dataSets ) ); params.getDataElementGroups().addAll( identifiableObjectManager.getObjects( DataElementGroup.class, IdentifiableProperty.UID, dataElementGroups ) ); params.getOrganisationUnits().addAll( identifiableObjectManager.getObjects( OrganisationUnit.class, IdentifiableProperty.UID, organisationUnits ) ); params.getOrganisationUnitGroups().addAll( identifiableObjectManager.getObjects( OrganisationUnitGroup.class, IdentifiableProperty.UID, organisationUnitGroups ) ); params.getAttributeOptionCombos().addAll( identifiableObjectManager.getObjects( CategoryOptionCombo.class, IdentifiableProperty.UID, attributeOptionCombos ) );
manager.getObjects( TrackedEntityInstance.class, IdentifiableProperty.UID, events.stream() .filter( event -> event.getTrackedEntityInstance() != null ) .forEach( tei -> trackedEntityInstanceCache.put( tei.getUid(), (TrackedEntityInstance) tei ) ); manager.getObjects( ProgramInstance.class, IdentifiableProperty.UID, events.stream() .filter( event -> event.getEnrollment() != null )
@Override @Transactional public List<DataSetCompletenessResult> getDataSetCompleteness( int periodId, Collection<Integer> organisationUnitIds, int dataSetId, Set<Integer> groupIds ) { final DataSet dataSet = dataSetService.getDataSet( dataSetId ); final Period period = periodService.getPeriod( periodId ); final List<Integer> periodsBetweenDates = getIdentifiers( periodService.getPeriodsBetweenDates( dataSet.getPeriodType(), period.getStartDate(), period.getEndDate() ) ); final Map<Integer, OrganisationUnit> orgUnits = Maps.uniqueIndex( organisationUnitService.getOrganisationUnits( organisationUnitIds ), OrganisationUnit::getId ); final Set<OrganisationUnitGroup> groups = groupIds != null ? Sets.newHashSet( idObjectManager.getObjects( OrganisationUnitGroup.class, groupIds ) ) : null; final List<DataSetCompletenessResult> results = new ArrayList<>(); for ( final Integer unitId : organisationUnitIds ) { final OrganisationUnit unit = orgUnits.get( unitId ); final Set<Integer> children = organisationUnitService.getOrganisationUnitHierarchy().getChildren( unit.getId() ); final Set<Integer> relevantSources = getRelevantSources( dataSet, children, groups ); final DataSetCompletenessResult result = getDataSetCompleteness( period, periodsBetweenDates, unit, relevantSources, dataSet ); if ( result.getSources() > 0 ) { results.add( result ); } } return results; }
final Set<OrganisationUnitGroup> groups = groupIds != null ? Sets.newHashSet( idObjectManager.getObjects( OrganisationUnitGroup.class, groupIds ) ) : null;