use of org.openforis.collect.remoting.service.NodeUpdateRequest.AttributeUpdateRequest in project collect by openforis.
the class AttributeUpdateRequestProxy method toAttributeUpdateRequest.
@Override
@SuppressWarnings("unchecked")
public AttributeUpdateRequest<?> toAttributeUpdateRequest(CodeListManager codeListManager, RecordSessionManager sessionManager, CollectRecord record) {
AttributeUpdateRequest<Value> opts = new NodeUpdateRequest.AttributeUpdateRequest<Value>();
Attribute<?, ?> attribute = (Attribute<?, ?>) record.getNodeByInternalId(nodeId);
opts.setAttribute((Attribute<?, Value>) attribute);
Value parsedValue;
if (attribute instanceof FileAttribute) {
parsedValue = parseFileAttributeValue(sessionManager, record, nodeId, value);
} else if (value == null) {
parsedValue = null;
} else {
Entity parentEntity = attribute.getParent();
String attributeName = attribute.getName();
parsedValue = parseCompositeAttributeValue(codeListManager, parentEntity, attributeName, value);
}
opts.setValue(parsedValue);
opts.setSymbol(symbol);
return opts;
}
Aggregations