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();
}
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);
}
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);
}
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;
}
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;
}
Aggregations