/** * Returns non-confidential TrackedEntityAttributes from ProgramTrackedEntityAttributes. Use * getAttributes() to access the persisted attribute list. */ public List<TrackedEntityAttribute> getNonConfidentialTrackedEntityAttributes() { return getTrackedEntityAttributes().stream() .filter( a -> !a.isConfidentialBool() ) .collect( Collectors.toList() ); }
/** * Returns TrackedEntityAttributes from ProgramTrackedEntityAttributes which * have a legend set and is of numeric value type. */ public List<TrackedEntityAttribute> getNonConfidentialTrackedEntityAttributesWithLegendSet() { return getTrackedEntityAttributes().stream() .filter( a -> !a.isConfidentialBool() && a.hasLegendSet() && a.isNumericType() ) .collect( Collectors.toList() ); }
/** * 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; }
attributes.addAll( program.getTrackedEntityAttributes() ); attributes.addAll( new HashSet<>( queryParams.getProgram().getTrackedEntityAttributes() ) );
/** * 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; }
for( TrackedEntityAttribute att : program.getTrackedEntityAttributes() )