Search in sources :

Example 1 with RegistryEntry

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

the class RegistryEntryService method deleteEntity.

// All DELETE operations
@Override
public void deleteEntity(@NotNull String registryEntrySystemId) {
    RegistryEntry registryEntry = getRegistryEntryOrThrow(registryEntrySystemId);
    registryEntryRepository.delete(registryEntry);
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Example 2 with RegistryEntry

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

the class RegistryEntryService method createCorrespondencePartPersonAssociatedWithRegistryEntry.

@Override
public CorrespondencePartPerson createCorrespondencePartPersonAssociatedWithRegistryEntry(String systemID, CorrespondencePartPerson correspondencePart) {
    RegistryEntry registryEntry = getRegistryEntryOrThrow(systemID);
    associateCorrespondencePartTypeWithCorrespondencePart(correspondencePart);
    ContactInformation contactInformation = correspondencePart.getContactInformation();
    if (null != contactInformation) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(contactInformation);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(contactInformation);
    }
    SimpleAddress postalAddress = correspondencePart.getPostalAddress();
    if (null != postalAddress) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(postalAddress);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(postalAddress);
    }
    SimpleAddress residingAddress = correspondencePart.getResidingAddress();
    if (null != residingAddress) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(residingAddress);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(residingAddress);
    }
    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.createNewCorrespondencePartPerson(correspondencePart);
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Example 3 with RegistryEntry

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

the class RegistryEntryService method handleUpdate.

// All UPDATE operations
@Override
public RegistryEntry handleUpdate(@NotNull String systemId, @NotNull Long version, @NotNull RegistryEntry incomingRegistryEntry) {
    RegistryEntry existingRegistryEntry = getRegistryEntryOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != incomingRegistryEntry.getDescription()) {
        existingRegistryEntry.setDescription(incomingRegistryEntry.getDescription());
    }
    if (null != incomingRegistryEntry.getTitle()) {
        existingRegistryEntry.setTitle(incomingRegistryEntry.getTitle());
    }
    if (null != incomingRegistryEntry.getDocumentMedium()) {
        existingRegistryEntry.setDocumentMedium(incomingRegistryEntry.getDocumentMedium());
    }
    if (null != incomingRegistryEntry.getDocumentDate()) {
        existingRegistryEntry.setDocumentDate(incomingRegistryEntry.getDocumentDate());
    }
    if (null != incomingRegistryEntry.getDueDate()) {
        existingRegistryEntry.setDueDate(incomingRegistryEntry.getDueDate());
    }
    if (null != incomingRegistryEntry.getFreedomAssessmentDate()) {
        existingRegistryEntry.setFreedomAssessmentDate(incomingRegistryEntry.getFreedomAssessmentDate());
    }
    if (null != incomingRegistryEntry.getLoanedDate()) {
        existingRegistryEntry.setLoanedDate(incomingRegistryEntry.getLoanedDate());
    }
    if (null != incomingRegistryEntry.getLoanedTo()) {
        existingRegistryEntry.setLoanedTo(incomingRegistryEntry.getLoanedTo());
    }
    existingRegistryEntry.setVersion(version);
    registryEntryRepository.save(existingRegistryEntry);
    return existingRegistryEntry;
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Example 4 with RegistryEntry

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

the class RegistryEntryService method createCorrespondencePartUnitAssociatedWithRegistryEntry.

@Override
public CorrespondencePartUnit createCorrespondencePartUnitAssociatedWithRegistryEntry(String systemID, CorrespondencePartUnit correspondencePart) {
    RegistryEntry registryEntry = getRegistryEntryOrThrow(systemID);
    associateCorrespondencePartTypeWithCorrespondencePart(correspondencePart);
    ContactInformation contactInformation = correspondencePart.getContactInformation();
    if (null != contactInformation) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(contactInformation);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(contactInformation);
    }
    SimpleAddress postalAddress = correspondencePart.getPostalAddress();
    if (null != postalAddress) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(postalAddress);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(postalAddress);
    }
    SimpleAddress businessAddress = correspondencePart.getBusinessAddress();
    if (null != businessAddress) {
        NoarkUtils.NoarkEntity.Create.setNikitaEntityValues(businessAddress);
        NoarkUtils.NoarkEntity.Create.setSystemIdEntityValues(businessAddress);
    }
    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.createNewCorrespondencePartUnit(correspondencePart);
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Example 5 with RegistryEntry

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

the class CaseFileImportService method createRegistryEntryAssociatedWithCaseFile.

@Override
public RegistryEntry createRegistryEntryAssociatedWithCaseFile(String fileSystemId, RegistryEntry registryEntry) {
    RegistryEntry persistedRecord = null;
    CaseFile file = caseFileRepository.findBySystemIdOrderBySystemId(fileSystemId);
    if (file == null) {
        String info = INFO_CANNOT_FIND_OBJECT + " CaseFile, using fileSystemId " + fileSystemId;
        logger.info(info);
        throw new NoarkEntityNotFoundException(info);
    } else {
        registryEntry.setReferenceFile(file);
        persistedRecord = registryEntryImportService.save(registryEntry);
    }
    return persistedRecord;
}
Also used : CaseFile(nikita.model.noark5.v4.casehandling.CaseFile) NoarkEntityNotFoundException(nikita.util.exceptions.NoarkEntityNotFoundException) RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry)

Aggregations

RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)18 Counted (com.codahale.metrics.annotation.Counted)14 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 RegistryEntry (nikita.common.model.noark5.v4.casehandling.RegistryEntry)13 Timed (com.codahale.metrics.annotation.Timed)7 Authorisation (nikita.webapp.security.Authorisation)6 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)6 NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)4 Date (java.util.Date)3 RegistryEntryHateoas (nikita.common.model.noark5.v4.hateoas.casehandling.RegistryEntryHateoas)3 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)3 RegistryEntryHateoas (nikita.model.noark5.v4.hateoas.casehandling.RegistryEntryHateoas)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 TreeSet (java.util.TreeSet)2 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)2 CaseFile (nikita.common.model.noark5.v4.casehandling.CaseFile)2