Search in sources :

Example 6 with Precedence

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

the class PrecedenceService method getPrecedenceOrThrow.

/**
 * 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 Precedence back. If there is no valid
 * Precedence, an exception is thrown
 *
 * @param precedenceSystemId
 * @return
 */
protected Precedence getPrecedenceOrThrow(@NotNull String precedenceSystemId) {
    Precedence precedence = precedenceRepository.findBySystemId(precedenceSystemId);
    if (precedence == null) {
        String info = INFO_CANNOT_FIND_OBJECT + " Precedence, using systemId " + precedenceSystemId;
        logger.info(info);
        throw new NoarkEntityNotFoundException(info);
    }
    return precedence;
}
Also used : NoarkEntityNotFoundException(nikita.common.util.exceptions.NoarkEntityNotFoundException) Precedence(nikita.common.model.noark5.v4.casehandling.Precedence)

Example 7 with Precedence

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

the class PrecedenceService method updatePrecedence.

@Override
public Precedence updatePrecedence(String systemId, Long version, Precedence incomingPrecedence) {
    Precedence existingPrecedence = getPrecedenceOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    existingPrecedence.setDescription(incomingPrecedence.getDescription());
    existingPrecedence.setPrecedenceDate(incomingPrecedence.getPrecedenceDate());
    existingPrecedence.setPrecedenceApprovedBy(incomingPrecedence.getPrecedenceApprovedBy());
    existingPrecedence.setPrecedenceApprovedDate(incomingPrecedence.getPrecedenceApprovedDate());
    existingPrecedence.setPrecedenceAuthority(incomingPrecedence.getPrecedenceAuthority());
    precedenceRepository.save(existingPrecedence);
    return existingPrecedence;
}
Also used : Precedence(nikita.common.model.noark5.v4.casehandling.Precedence)

Example 8 with Precedence

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

the class PrecedenceHateoasSerializer method serializeNoarkEntity.

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

Aggregations

Precedence (nikita.common.model.noark5.v4.casehandling.Precedence)3 Precedence (nikita.model.noark5.v4.casehandling.Precedence)3 RegistryEntry (nikita.common.model.noark5.v4.casehandling.RegistryEntry)1 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)1 NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)1