DimensionalObjectUtils { public static String getKey( List<DimensionalItemObject> column, List<DimensionalItemObject> row ) { List<String> ids = new ArrayList<>(); List<DimensionalItemObject> dimensions = new ArrayList<>(); dimensions.addAll( column ); dimensions.addAll( row ); for ( DimensionalItemObject item : dimensions ) { ids.add( item.getDimensionItem() ); } Collections.sort( ids ); return StringUtils.join( ids, DIMENSION_SEP ); }  static List<DimensionalObject> getCopies( List<DimensionalObject> dimensions ); static List<String> getDimensions( Collection<DimensionalObject> dimensions ); static NameableObject[][] getItemArray( List<DimensionalObject> dimensions ); @SafeVarargs static Map<T, T> asMap( final T... elements ); static String getDimensionFromParam( String param ); static List<String> getDimensionItemsFromParam( String param ); static List<String> getItemsFromParam( String param ); static boolean anyDimensionHasItems( Collection<DimensionalObject> dimensions ); static String getValueFromKeywordParam( String param ); static String getUidFromGroupParam( String param ); static void setDimensionItemsForFilters( DimensionalObject dimension, Grid grid, boolean naForNull ); static String getPrettyFilter( String filter ); static boolean isCompositeDimensionalObject( String expression ); static String getFirstIdentifer( String compositeItem ); static String getSecondIdentifer( String compositeItem ); static boolean isWildCard( String identifier ); static List<DimensionalItemObject> getList( DimensionalItemObject... objects ); static List<DimensionalItemObject> asList( Collection<? extends DimensionalItemObject> collection ); static List<DimensionalObject> asDimensionalObjectList( Collection<? extends DimensionalObject> collection ); @SuppressWarnings("unchecked") static List<T> asTypedList( Collection<DimensionalItemObject> collection ); static List<DimensionalItemObject> getDimensionalItemObjects( Collection<?> values, boolean naForNull ); static List<String> getDimensionalItemIds( Collection<DimensionalItemObject> objects ); static Set<DimensionalItemObject> getDataElements( Collection<DataElementOperand> operands ); static Set<DimensionalItemObject> getCategoryOptionCombos( Collection<DataElementOperand> operands ); static Set<DimensionalItemObject> getAttributeOptionCombos( Collection<DataElementOperand> operands ); static Map<String, String> getDimensionItemIdSchemeMap( Collection<? extends DimensionalItemObject> objects, IdScheme idScheme ); static Map<String, String> getDataElementOperandIdSchemeMap( Collection<DataElementOperand> dataElementOperands, IdScheme idScheme ); static String getDimensionItem( String uid, ReportingRateMetric metric ); static List<DimensionalItemObject> replaceOperandTotalsWithDataElements( List<DimensionalItemObject> items ); static String getKey( List<DimensionalItemObject> column, List<DimensionalItemObject> row ); static Map<String, Object> getSortedKeysMap( Map<String, Object> valueMap ); static String sortKey( String key ); static String getKey( List<DimensionalItemObject> objects ); static String getName( List<DimensionalItemObject> objects ); static Map<DimensionalItemObject, Double> convertToDimItemValueMap(
        List<DimensionItemObjectValue> dimensionItemObjectValues ); static final String COMPOSITE_DIM_OBJECT_ESCAPED_SEP; static final String COMPOSITE_DIM_OBJECT_PLAIN_SEP; static final String TITLE_ITEM_SEP; static final String NULL_REPLACEMENT; static final String NAME_SEP; static final String COL_SEP; }
@Test public void testGetIdentifier() { DataElementGroup oA = new DataElementGroup(); DataElementGroup oB = new DataElementGroup(); DataElementGroup oC = new DataElementGroup(); oA.setUid( "a1" ); oB.setUid( "b1" ); oC.setUid( "c1" ); List<DimensionalItemObject> column = new ArrayList<>(); column.add( oC ); column.add( oA ); List<DimensionalItemObject> row = new ArrayList<>(); row.add( oB ); assertEquals( "a1-b1-c1", DimensionalObjectUtils.getKey( column, row ) ); assertEquals( "b1", DimensionalObjectUtils.getKey( new ArrayList<>(), row ) ); }
@Test public void testGetKey() { DataElement deA = new DataElement( "DE NameA" ); deA.setShortName( "DE ShortNameA" ); DataElement deB = new DataElement( "DE NameB" ); deB.setShortName( "DE ShortNameB" ); DataElement deC = new DataElement( "DE NameC" ); deC.setShortName( "DE ShortNameC" ); List<DimensionalItemObject> objects = Lists.newArrayList( deA, deB, deC ); String name = DimensionalObjectUtils.getKey( objects ); assertEquals( "de_shortnamea_de_shortnameb_de_shortnamec", name ); }