Search in sources :

Example 1 with NoarkGeneralEntity

use of nikita.common.model.noark5.v4.NoarkGeneralEntity in project nikita-noark5-core by HiOA-ABI.

the class HateoasDeserializer method deserialize.

@Override
public HateoasNoarkObject deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
    StringBuilder errors = new StringBuilder();
    NoarkGeneralEntity entity = new NoarkGeneralEntity();
    ObjectNode objectNode = mapper.readTree(jsonParser);
    // Deserialise general properties
    CommonUtils.Hateoas.Deserialize.deserialiseNoarkEntity(entity, objectNode, errors);
    // If there are additional throw a malformed input exception
    if (objectNode.size() != 0) {
        errors.append("The arkiv you tried to create is malformed. The " + "following fields are not recognised as arkiv fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]. ");
    }
    // if (0 < errors.length())
    // throw new NikitaMalformedInputDataException(errors.toString());
    HateoasNoarkObject hateoasNoarkObject = new HateoasNoarkObject(entity);
    return hateoasNoarkObject;
}
Also used : NoarkGeneralEntity(nikita.common.model.noark5.v4.NoarkGeneralEntity) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) HateoasNoarkObject(nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 NoarkGeneralEntity (nikita.common.model.noark5.v4.NoarkGeneralEntity)1 HateoasNoarkObject (nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject)1