use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartInternalDeserializer method deserialize.
@Override
public CorrespondencePartInternal deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
StringBuilder errors = new StringBuilder();
CorrespondencePartInternal correspondencePartInternal = new CorrespondencePartInternal();
ObjectNode objectNode = mapper.readTree(jsonParser);
CommonUtils.Hateoas.Deserialize.deserialiseNoarkSystemIdEntity(correspondencePartInternal, objectNode, errors);
CommonUtils.Hateoas.Deserialize.deserialiseCorrespondencePartInternalEntity(correspondencePartInternal, objectNode, errors);
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
errors.append("The korrespondansepartintern you tried to create is malformed. The " + "following fields are not recognised as korrespondansepartintern fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]. ");
}
if (0 < errors.length())
throw new NikitaMalformedInputDataException(errors.toString());
return correspondencePartInternal;
}
use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal 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();
}
use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartInternalDeserializer method deserialize.
@Override
public CorrespondencePartInternal deserialize(JsonParser jsonParser, DeserializationContext dc) throws IOException {
CorrespondencePartInternal correspondencePartInternal = new CorrespondencePartInternal();
ObjectNode objectNode = mapper.readTree(jsonParser);
CommonUtils.Hateoas.Deserialize.deserialiseNoarkSystemIdEntity(correspondencePartInternal, objectNode);
CommonUtils.Hateoas.Deserialize.deserialiseCorrespondencePartInternalEntity(correspondencePartInternal, objectNode);
// If there are additional throw a malformed input exception
if (objectNode.size() != 0) {
throw new NikitaMalformedInputDataException("The korrespondansepartintern you tried to create is malformed. The " + "following fields are not recognised as korrespondansepartintern fields [" + CommonUtils.Hateoas.Deserialize.checkNodeObjectEmpty(objectNode) + "]");
}
return correspondencePartInternal;
}
use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryService method createCorrespondencePartInternalAssociatedWithRegistryEntry.
@Override
public CorrespondencePartInternal createCorrespondencePartInternalAssociatedWithRegistryEntry(String systemID, CorrespondencePartInternal correspondencePart) {
RegistryEntry registryEntry = getRegistryEntryOrThrow(systemID);
NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(correspondencePart);
NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(correspondencePart);
// bidirectional relationship @ManyToMany, set both sides of relationship
registryEntry.getReferenceCorrespondencePart().add(correspondencePart);
correspondencePart.getReferenceRegistryEntry().add(registryEntry);
return correspondencePartService.createNewCorrespondencePartInternal(correspondencePart);
}
use of nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartService method deleteCorrespondencePartInternal.
@Override
public void deleteCorrespondencePartInternal(@NotNull String code) {
CorrespondencePartInternal correspondencePartInternal = (CorrespondencePartInternal) getCorrespondencePartOrThrow(code);
/*
// Disassociate the link between Fonds and FondsCreator
// https://github.com/HiOA-ABI/nikita-noark5-core/issues/82
Query q = entityManager.createNativeQuery("DELETE FROM fonds_fonds_creator WHERE f_pk_fonds_id = :id ;");
q.setParameter("id", fonds.getId());
q.executeUpdate();
entityManager.remove(fonds);
entityManager.flush();
entityManager.clear();*/
correspondencePartRepository.delete(correspondencePartInternal);
}
Aggregations