Search in sources :

Example 1 with Precedence

use of nikita.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.model.noark5.v4.casehandling.Precedence)

Example 2 with Precedence

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

the class RegistryEntryService method createPrecedenceAssociatedWithRecord.

@Override
public Precedence createPrecedenceAssociatedWithRecord(String registryEntrySystemID, Precedence precedence) {
    RegistryEntry registryEntry = getRegistryEntryOrThrow(registryEntrySystemID);
    NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(precedence);
    NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(precedence);
    // bidirectional relationship @ManyToMany, set both sides of relationship
    registryEntry.getReferencePrecedence().add(precedence);
    precedence.getReferenceRegistryEntry().add(registryEntry);
    return precedenceService.createNewPrecedence(precedence);
}
Also used : RegistryEntry(nikita.common.model.noark5.v4.casehandling.RegistryEntry)

Example 3 with Precedence

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

the class RegistryEntryService method createPrecedenceAssociatedWithRecord.

@Override
public Precedence createPrecedenceAssociatedWithRecord(String registryEntrySystemID, Precedence precedence) {
    RegistryEntry registryEntry = getRegistryEntryOrThrow(registryEntrySystemID);
    NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(precedence);
    NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(precedence);
    // bidirectional relationship @ManyToMany, set both sides of relationship
    registryEntry.getReferencePrecedence().add(precedence);
    precedence.getReferenceRegistryEntry().add(registryEntry);
    return precedenceService.createNewPrecedence(precedence);
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Example 4 with Precedence

use of nikita.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.model.noark5.v4.casehandling.Precedence)

Example 5 with Precedence

use of nikita.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.findBySystemIdOrderBySystemId(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.util.exceptions.NoarkEntityNotFoundException) Precedence(nikita.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