public String getTrackedEntityInstanceRecipient( TrackedEntityInstance tei, ValueType type ) { Set<TrackedEntityAttributeValue> attributeValues = tei.getTrackedEntityAttributeValues(); for ( TrackedEntityAttributeValue value : attributeValues ) { if ( value != null && value.getAttribute().getValueType().equals( type ) && value.getPlainValue() != null && !value.getPlainValue().trim().isEmpty() ) { return value.getPlainValue(); } } throw new IllegalQueryException( "Tracked entity does not have any attribute of value type: " + type.toString() ); }
/** * Returns the encrypted or the plain-text value based on the confidential * state of the attribute. * * @return String with value, either plain-text or decrypted. */ @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getValue() { return (getAttribute().getConfidential() ? this.getEncryptedValue() : this.getPlainValue()); }
private static String filterValue( TrackedEntityAttributeValue av ) { String value = av.getPlainValue(); if ( value == null ) { return CONFIDENTIAL_VALUE_REPLACEMENT; } // If the AV has an OptionSet -> substitute value with the name of the Option if ( av.getAttribute().hasOptionSet() ) { value = av.getAttribute().getOptionSet().getOptionByCode( value ).getName(); } return value != null ? value : MISSING_VALUE_REPLACEMENT; }
private static String filterValue( TrackedEntityAttributeValue av ) { String value = av.getPlainValue(); if ( value == null ) { return CONFIDENTIAL_VALUE_REPLACEMENT; } // If the AV has an OptionSet -> substitute value with the name of the Option if ( av.getAttribute().hasOptionSet() ) { value = av.getAttribute().getOptionSet().getOptionByCode( value ).getName(); } return value != null ? value : MISSING_VALUE_REPLACEMENT; } }