private static String commaDelimitedIds( Collection<? extends IdentifiableObject> idObjects ) { return TextUtils.getCommaDelimitedString( IdentifiableObjectUtils.getIdentifiers( idObjects ) ); }
/** * Returns a string representing the graph of ancestors. The string is delimited * by "/". The ancestors are ordered by root first and represented by UIDs. * * @param roots the root organisation units, if null using real roots. */ public String getParentGraph( Collection<OrganisationUnit> roots ) { Set<String> rootUids = roots != null ? Sets.newHashSet( IdentifiableObjectUtils.getUids( roots ) ) : null; List<String> ancestors = getAncestorUids( rootUids ); return StringUtils.join( ancestors, PATH_SEP ); }
@Override @SuppressWarnings( "unchecked" ) public <T extends IdentifiableObject> Map<String, T> getIdMap( Class<T> clazz, IdScheme idScheme ) { IdentifiableObjectStore<T> store = (IdentifiableObjectStore<T>) getIdentifiableObjectStore( clazz ); Map<String, T> map = new HashMap<>(); if ( store == null ) { return map; } List<T> objects = store.getAll(); return IdentifiableObjectUtils.getIdMap( objects, idScheme ); }
financialYearStart ); String periodString = getCommaDelimitedString( getIdentifiers( periodService.reloadPeriods( relativePeriods ) ) ); String isoPeriodString = getCommaDelimitedString( IdentifiableObjectUtils.getUids( relativePeriods ) );
getUids( params.getDimensionOrFilterItems( PERIOD_DIM_ID ) ) : getLocalPeriodIdentifiers( params.getDimensionOrFilterItems( PERIOD_DIM_ID ), calendar );
/** * Returns a concatenated String of the display names of all user authority * groups for this user credentials. */ public String getUserAuthorityGroupsName() { return IdentifiableObjectUtils.join( userAuthorityGroups ); }
values.add( pe != null ? IdentifiableObjectUtils.getLocalPeriodIdentifier( pe, calendar ) : null );
periods = IdentifiableObjectUtils.getLocalPeriodIdentifiers( report.getRelatives().getRelativePeriods( date, format, true, financialYearStart ), calendar );
getUids( params.getDimensionOrFilterItems( PERIOD_DIM_ID ) ) : getLocalPeriodIdentifiers( params.getDimensionOrFilterItems( PERIOD_DIM_ID ), calendar );
public String getOrganisationUnitsName() { return IdentifiableObjectUtils.join( organisationUnits ); }
period.setUid( getLocalPeriodIdentifier( period, calendar ) );
private Set<Integer> getRelevantSources( DataSet dataSet, Set<Integer> sources, Set<OrganisationUnitGroup> groups ) { Set<Integer> dataSetSources = new HashSet<>( getIdentifiers( dataSet.getSources() ) ); if ( groups != null ) { for ( OrganisationUnitGroup group : groups ) { List<Integer> ids = getIdentifiers( group.getMembers() ); dataSetSources.retainAll( ids ); } } return Sets.intersection( dataSetSources, sources ); } }
Collection<String> dataElements = IdentifiableObjectUtils.getUids( dataElementService.getDataElementsByAggregationLevel( level ) );
public String generateTitle() { List<String> titleItems = new ArrayList<>(); for ( String filter : filterDimensions ) { DimensionalObject object = getDimensionalObject( filter, relativePeriodDate, relativeUser, true, organisationUnitsAtLevel, organisationUnitsInGroups, format ); if ( object != null ) { String item = IdentifiableObjectUtils.join( object.getItems() ); String filt = DimensionalObjectUtils.getPrettyFilter( object.getFilter() ); if ( item != null ) { titleItems.add( item ); } if ( filt != null ) { titleItems.add( filt ); } } } return join( titleItems, DimensionalObjectUtils.TITLE_ITEM_SEP ); }
@Override @SuppressWarnings( "unchecked" ) public <T extends IdentifiableObject> Map<String, T> getIdMapNoAcl( Class<T> clazz, IdScheme idScheme ) { IdentifiableObjectStore<T> store = (IdentifiableObjectStore<T>) getIdentifiableObjectStore( clazz ); Map<String, T> map = new HashMap<>(); if ( store == null ) { return map; } List<T> objects = store.getAllNoAcl(); return IdentifiableObjectUtils.getIdMap( objects, idScheme ); }
String dataElementIds = getCommaDelimitedString( getIdentifiers( dataElements ) ); String periodIds = getCommaDelimitedString( getIdentifiers( periods ) ); String categoryOptionComboIds = getCommaDelimitedString( getIdentifiers( categoryOptionCombos ) );
/** * Returns filter items for all filters associated with this * query item. If no filter items are specified, return all * items part of the option set. If not option set is specified, * returns null. */ public List<String> getOptionSetFilterItemsOrAll() { if ( !hasOptionSet() ) { return null; } return hasFilter() ? getOptionSetQueryFilterItems() : IdentifiableObjectUtils.getUids( optionSet.getOptions() ); }
public void populateGridColumnsAndRows( Date date, User user, List<OrganisationUnit> organisationUnitsAtLevel, List<OrganisationUnit> organisationUnitsInGroups, I18nFormat format ) { List<DimensionalItemObject[]> tableColumns = new ArrayList<>(); List<DimensionalItemObject[]> tableRows = new ArrayList<>(); List<DimensionalItemObject> filterItems = new ArrayList<>(); for ( String dimension : columnDimensions ) { tableColumns.add( getDimensionalObject( dimension, date, user, false, organisationUnitsAtLevel, organisationUnitsInGroups, format ).getItems().toArray( IRT ) ); } for ( String dimension : rowDimensions ) { tableRows.add( getDimensionalObject( dimension, date, user, true, organisationUnitsAtLevel, organisationUnitsInGroups, format ).getItems().toArray( IRT ) ); } for ( String filter : filterDimensions ) { filterItems.addAll( getDimensionalObject( filter, date, user, true, organisationUnitsAtLevel, organisationUnitsInGroups, format ).getItems() ); } gridColumns = new CombinationGenerator<>( tableColumns.toArray( IRT2D ) ).getCombinations(); gridRows = new CombinationGenerator<>( tableRows.toArray( IRT2D ) ).getCombinations(); addListIfEmpty( gridColumns ); addListIfEmpty( gridRows ); gridTitle = IdentifiableObjectUtils.join( filterItems ); }
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 ) ); }
@Override public PeriodHierarchy getPeriodHierarchy( Collection<Period> periods ) { PeriodHierarchy hierarchy = new PeriodHierarchy(); for ( Period period : periods ) { hierarchy.getIntersectingPeriods().put( period.getId(), new HashSet<>( getIdentifiers( getIntersectingPeriods( period.getStartDate(), period.getEndDate() ) ) ) ); hierarchy.getPeriodsBetween().put( period.getId(), new HashSet<>( getIdentifiers( getPeriodsBetweenDates( period.getStartDate(), period.getEndDate() ) ) ) ); } return hierarchy; }