/** * Returns data elements which are part of the stages of this program which * have a legend set and is of numeric value type. */ public Set<DataElement> getDataElementsWithLegendSet() { return getDataElements().stream() .filter( de -> de.hasLegendSet() && de.isNumericType() ) .collect( Collectors.toSet() ); }
for ( DataElement dataElement : program.getDataElements() )
@Override public List<ProgramDataElementDimensionItem> getGeneratedProgramDataElements( String programUid ) { Program program = getProgram( programUid ); List<ProgramDataElementDimensionItem> programDataElements = Lists.newArrayList(); if ( program == null ) { return programDataElements; } for ( DataElement element : program.getDataElements() ) { programDataElements.add( new ProgramDataElementDimensionItem( program, element ) ); } Collections.sort( programDataElements ); return programDataElements; } }
/** * Indicates whether the given organisation unit field is valid, i.e. * whether it matches the identifier of an attribute or data element of * organisation unit value type part of the query program. */ public boolean orgUnitFieldIsValid() { if ( orgUnitField == null ) { return true; } if ( program.getTrackedEntityAttributes().stream() .anyMatch( at -> at.getValueType().isOrganisationUnit() && orgUnitField.equals( at.getUid() ) ) ) { return true; } if ( program.getDataElements().stream() .anyMatch( at -> at.getValueType().isOrganisationUnit() && orgUnitField.equals( at.getUid() ) ) ) { return true; } return false; }
/** * Indicates whether the given time field is valid, i.e. whether * it is either a fixed time field or matches the identifier of an * attribute or data element of date value type part of the query program. */ public boolean timeFieldIsValid() { if ( timeField == null ) { return true; } if ( TimeField.fieldIsValid( timeField ) ) { return true; } if ( program.getTrackedEntityAttributes().stream() .anyMatch( at -> at.getValueType().isDate() && timeField.equals( at.getUid() ) ) ) { return true; } if ( program.getDataElements().stream() .anyMatch( de -> de.getValueType().isDate() && timeField.equals( de.getUid() ) ) ) { return true; } return false; }