Search in sources :

Example 46 with INikitaEntity

use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class CasePartyRoleService method findByDescription.

/**
 * Retrieve all CasePartyRole that have a given
 * description.
 * <br>
 * Note, this will be replaced by OData search.
 *
 * @param description Description of object you wish to retrieve. The
 *                    whole text, this is an exact search.
 * @return A list of CasePartyRole objects wrapped as a MetadataHateoas
 * object
 */
@Override
public MetadataHateoas findByDescription(String description) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) casePartyRoleRepository.findByDescription(description), CASE_PARTY_ROLE);
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)

Example 47 with INikitaEntity

use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class ClassificationTypeService method findByDescription.

/**
 * Retrieve all ClassificationType that have a given description.
 * <br>
 * Note, this will be replaced by OData search.
 *
 * @param description Description of object you wish to retrieve. The
 *                    whole text, this is an exact search.
 * @return A list of ClassificationType objects wrapped as a MetadataHateoas
 * object
 */
@Override
public MetadataHateoas findByDescription(String description) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) classificationTypeRepository.findByDescription(description), CLASSIFICATION_TYPE);
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)

Example 48 with INikitaEntity

use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class ClassHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject classHateoas, JsonGenerator jgen) throws IOException {
    Class klass = (Class) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, klass);
    CommonUtils.Hateoas.Serialize.printTitleAndDescription(jgen, klass);
    CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, klass);
    CommonUtils.Hateoas.Serialize.printFinaliseEntity(jgen, klass);
    // TODO: Fix this ! CommonCommonUtils.Hateoas.Serialize.printCrossReference(jgen, klass);
    CommonUtils.Hateoas.Serialize.printDisposal(jgen, klass);
    CommonUtils.Hateoas.Serialize.printScreening(jgen, klass);
    CommonUtils.Hateoas.Serialize.printClassified(jgen, klass);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, classHateoas.getLinks(klass));
    jgen.writeEndObject();
}
Also used : Class(nikita.common.model.noark5.v4.Class)

Example 49 with INikitaEntity

use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class DocumentDescriptionHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkEntity, HateoasNoarkObject documentDescriptionHateoas, JsonGenerator jgen) throws IOException {
    DocumentDescription documentDescription = (DocumentDescription) noarkEntity;
    jgen.writeStartObject();
    // handle DocumentDescription properties
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, documentDescription);
    if (documentDescription.getDocumentType() != null) {
        jgen.writeStringField(DOCUMENT_DESCRIPTION_DOCUMENT_TYPE, documentDescription.getDocumentType());
    }
    if (documentDescription.getDocumentStatus() != null) {
        jgen.writeStringField(DOCUMENT_DESCRIPTION_STATUS, documentDescription.getDocumentStatus());
    }
    CommonUtils.Hateoas.Serialize.printTitleAndDescription(jgen, documentDescription);
    if (documentDescription.getDocumentNumber() != null) {
        jgen.writeNumberField(DOCUMENT_DESCRIPTION_DOCUMENT_NUMBER, documentDescription.getDocumentNumber().intValue());
    }
    CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, documentDescription);
    if (documentDescription.getAssociationDate() != null) {
        jgen.writeStringField(DOCUMENT_DESCRIPTION_ASSOCIATION_DATE, Serialize.formatDate(documentDescription.getAssociationDate()));
    }
    if (documentDescription.getAssociationDate() != null) {
        jgen.writeStringField(DOCUMENT_DESCRIPTION_ASSOCIATION_BY, documentDescription.getAssociatedBy());
    }
    if (documentDescription.getAssociatedWithRecordAs() != null) {
        jgen.writeStringField(DOCUMENT_DESCRIPTION_ASSOCIATED_WITH_RECORD_AS, documentDescription.getAssociatedWithRecordAs());
    }
    CommonUtils.Hateoas.Serialize.printComment(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printDisposal(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printDisposalUndertaken(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printDeletion(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printScreening(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printClassified(jgen, documentDescription);
    if (documentDescription.getStorageLocation() != null) {
        jgen.writeStringField(STORAGE_LOCATION, documentDescription.getStorageLocation());
    }
    CommonUtils.Hateoas.Serialize.printElectronicSignature(jgen, documentDescription);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, documentDescriptionHateoas.getLinks(documentDescription));
    jgen.writeEndObject();
}
Also used : DocumentDescription(nikita.common.model.noark5.v4.DocumentDescription)

Example 50 with INikitaEntity

use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class FileHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject fileHateoas, JsonGenerator jgen) throws IOException {
    File file = (File) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, file);
    CommonUtils.Hateoas.Serialize.printStorageLocation(jgen, file);
    if (file.getFileId() != null) {
        jgen.writeStringField(FILE_ID, file.getFileId());
        if (file.getTitle() != null) {
            jgen.writeStringField(TITLE, file.getTitle());
        }
        if (file.getOfficialTitle() != null) {
            jgen.writeStringField(FILE_PUBLIC_TITLE, file.getOfficialTitle());
        }
        if (file.getDescription() != null) {
            jgen.writeStringField(DESCRIPTION, file.getDescription());
        }
    }
    CommonUtils.Hateoas.Serialize.printDocumentMedium(jgen, file);
    CommonUtils.Hateoas.Serialize.printKeyword(jgen, file);
    CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, file);
    CommonUtils.Hateoas.Serialize.printFinaliseEntity(jgen, file);
    if (file.getReferenceSeries() != null && file.getReferenceSeries().getSystemId() != null) {
        jgen.writeStringField(REFERENCE_SERIES, file.getReferenceSeries().getSystemId());
    }
    // TODO: CommonCommonUtils.Hateoas.Serialize.printCrossReference(jgen, file.getReferenceCrossReference());
    CommonUtils.Hateoas.Serialize.printComment(jgen, file);
    CommonUtils.Hateoas.Serialize.printDisposal(jgen, file);
    CommonUtils.Hateoas.Serialize.printScreening(jgen, file);
    CommonUtils.Hateoas.Serialize.printClassified(jgen, file);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, fileHateoas.getLinks(file));
    jgen.writeEndObject();
}
Also used : File(nikita.common.model.noark5.v4.File)

Aggregations

INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)80 Authorisation (nikita.webapp.security.Authorisation)78 List (java.util.List)77 MetadataHateoas (nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)54 Counted (com.codahale.metrics.annotation.Counted)40 ApiOperation (io.swagger.annotations.ApiOperation)34 ApiResponses (io.swagger.annotations.ApiResponses)34 ArrayList (java.util.ArrayList)20 INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)19 Timed (com.codahale.metrics.annotation.Timed)16 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)16 Fonds (nikita.common.model.noark5.v4.Fonds)6 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)5 CaseFileHateoas (nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)4 DocumentDescription (nikita.common.model.noark5.v4.DocumentDescription)3 Record (nikita.common.model.noark5.v4.Record)3 Fonds (nikita.model.noark5.v4.Fonds)3 FondsCreator (nikita.common.model.noark5.v4.FondsCreator)2 CaseFile (nikita.common.model.noark5.v4.casehandling.CaseFile)2 DocumentObjectHateoas (nikita.common.model.noark5.v4.hateoas.DocumentObjectHateoas)2