Search in sources :

Example 1 with AttributeUpdateRequest

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;
}
Also used : Entity(org.openforis.idm.model.Entity) AttributeUpdateRequest(org.openforis.collect.remoting.service.NodeUpdateRequest.AttributeUpdateRequest) Attribute(org.openforis.idm.model.Attribute) FileAttribute(org.openforis.idm.model.FileAttribute) Value(org.openforis.idm.model.Value) FileAttribute(org.openforis.idm.model.FileAttribute)

Aggregations

AttributeUpdateRequest (org.openforis.collect.remoting.service.NodeUpdateRequest.AttributeUpdateRequest)1 Attribute (org.openforis.idm.model.Attribute)1 Entity (org.openforis.idm.model.Entity)1 FileAttribute (org.openforis.idm.model.FileAttribute)1 Value (org.openforis.idm.model.Value)1