Search in sources :

Example 6 with CorrespondencePart

use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartInternalHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
    CorrespondencePartInternal correspondencePart = (CorrespondencePartInternal) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printCorrespondencePartInternal(jgen, correspondencePart);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
    jgen.writeEndObject();
}
Also used : CorrespondencePartInternal(nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal)

Example 7 with CorrespondencePart

use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartService method getCorrespondencePartOrThrow.

/**
 * Internal helper method. Rather than having a find and try catch in multiple methods, we have it here once.
 * If you call this, be aware that you will only ever get a valid CorrespondencePart back. If there is no valid
 * CorrespondencePart, an exception is thrown
 *
 * @param correspondencePartSystemId
 * @return
 */
protected CorrespondencePart getCorrespondencePartOrThrow(@NotNull String correspondencePartSystemId) {
    CorrespondencePart correspondencePart = correspondencePartRepository.findBySystemId(correspondencePartSystemId);
    if (correspondencePart == null) {
        String info = INFO_CANNOT_FIND_OBJECT + " CorrespondencePart, using systemId " + correspondencePartSystemId;
        logger.info(info);
        throw new NoarkEntityNotFoundException(info);
    }
    return correspondencePart;
}
Also used : NoarkEntityNotFoundException(nikita.common.util.exceptions.NoarkEntityNotFoundException) CorrespondencePart(nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart)

Example 8 with CorrespondencePart

use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartPersonDeserializer method deserialize.

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

Example 9 with CorrespondencePart

use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartInternalHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
    CorrespondencePartInternal correspondencePart = (CorrespondencePartInternal) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printCorrespondencePartInternal(jgen, correspondencePart);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
    jgen.writeEndObject();
}
Also used : CorrespondencePartInternal(nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal)

Example 10 with CorrespondencePart

use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartUnitHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
    CorrespondencePartUnit correspondencePart = (CorrespondencePartUnit) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printCorrespondencePartUnit(jgen, correspondencePart);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
    jgen.writeEndObject();
}
Also used : CorrespondencePartUnit(nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartUnit)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)6 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 Timed (com.codahale.metrics.annotation.Timed)3 CorrespondencePartType (nikita.common.model.noark5.v4.metadata.CorrespondencePartType)3 NikitaException (nikita.common.util.exceptions.NikitaException)3 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)3 CorrespondencePartType (nikita.model.noark5.v4.metadata.CorrespondencePartType)3 NikitaException (nikita.util.exceptions.NikitaException)3 Authorisation (nikita.webapp.security.Authorisation)3 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 CorrespondencePartPerson (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartPerson)2 CorrespondencePartPerson (nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartPerson)2 ArrayList (java.util.ArrayList)1 Record (nikita.common.model.noark5.v4.Record)1 RegistryEntry (nikita.common.model.noark5.v4.casehandling.RegistryEntry)1 CorrespondencePart (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePart)1 CorrespondencePartInternal (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal)1 CorrespondencePartUnit (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartUnit)1