private String getTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue ) { ValueType valueType = attributeValue.getAttribute().getValueType(); if ( valueType.isBoolean() ) { return attributeValue.getValue() != null ? attributeValue.getValue() : "false"; } if ( valueType.isNumeric() ) { return attributeValue.getValue() != null ? attributeValue.getValue() : "0"; } return attributeValue.getValue() != null ? attributeValue.getValue() : ""; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((entityInstance == null) ? 0 : entityInstance.hashCode()); result = prime * result + ((attribute == null) ? 0 : attribute.hashCode()); result = prime * result + ((getValue() == null) ? 0 : getValue().hashCode()); return result; }
private boolean addFileValue( TrackedEntityAttributeValue value ) { FileResource fileResource = fileResourceService.getFileResource( value.getValue() ); if ( fileResource == null ) { return false; } fileResource.setAssigned( true ); fileResourceService.updateFileResource( fileResource ); return true; } }
private void deleteFileValue( TrackedEntityAttributeValue value ) { if ( !value.getAttribute().getValueType().isFile() || fileResourceService.getFileResource( value.getValue() ) == null ) { return; } FileResource fileResource = fileResourceService.getFileResource( value.getValue() ); fileResource.setAssigned( false ); fileResourceService.updateFileResource( fileResource ); }
forEach( value -> attributeValueMap.put( value.getAttribute().getUid(), value.getValue() ) );
String result = dataValueIsValid( attributeValue.getValue(), attributeValue.getAttribute().getValueType() ); String.format( "FileResource with id '%s' not found", attributeValue.getValue() ) ); if ( attributeValue.getValue() != null ) .useReservedValue( attributeValue.getAttribute().getTextPattern(), attributeValue.getValue() );
.forEach( attrVal -> fileValues.add( attrVal.getValue() ) );
@Override public void updateTrackedEntityAttributeValue( TrackedEntityAttributeValue attributeValue ) if ( attributeValue != null && StringUtils.isEmpty( attributeValue.getValue() ) ) String result = dataValueIsValid( attributeValue.getValue(), attributeValue.getAttribute().getValueType() ); .useReservedValue( attributeValue.getAttribute().getTextPattern(), attributeValue.getValue() );
if ( !existingAttributeValue.getValue().equals( dtoAttribute.getValue() ) ) // value is changed, do update
attribute.setValueType( attributeValue.getAttribute().getValueType() ); attribute.setCode( attributeValue.getAttribute().getCode() ); attribute.setValue( attributeValue.getValue() ); attribute.setStoredBy( attributeValue.getStoredBy() ); attribute.setSkipSynchronization( attributeValue.getAttribute().getSkipSynchronization() );