Search in sources :

Example 1 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.

the class BasicRecordHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject basicRecordHateoas, JsonGenerator jgen) throws IOException {
    BasicRecord basicRecord = (BasicRecord) noarkSystemIdEntity;
    jgen.writeStartObject();
    // handle the record properties first
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, basicRecord);
    if (basicRecord.getArchivedDate() != null) {
        jgen.writeStringField(RECORD_ARCHIVED_DATE, Serialize.formatDateTime(basicRecord.getArchivedDate()));
    }
    if (basicRecord.getArchivedBy() != null) {
        jgen.writeStringField(RECORD_ARCHIVED_BY, basicRecord.getArchivedBy());
    }
    CommonUtils.Hateoas.Serialize.printDisposal(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printScreening(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printClassified(jgen, basicRecord);
    // handle general basicRecord properties
    if (basicRecord.getTitle() != null) {
        jgen.writeStringField(TITLE, basicRecord.getTitle());
    }
    if (basicRecord.getOfficialTitle() != null) {
        jgen.writeStringField(FILE_PUBLIC_TITLE, basicRecord.getOfficialTitle());
    }
    if (basicRecord.getDescription() != null) {
        jgen.writeStringField(DESCRIPTION, basicRecord.getDescription());
    }
    CommonUtils.Hateoas.Serialize.printKeyword(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printDocumentMedium(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printStorageLocation(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printComment(jgen, basicRecord);
    // TODO: FIX THIS CommonCommonUtils.Hateoas.Serialize.printCrossReference(jgen, basicRecord);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, basicRecordHateoas.getLinks(basicRecord));
    jgen.writeEndObject();
}
Also used : BasicRecord(nikita.model.noark5.v4.BasicRecord)

Example 2 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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.model.noark5.v4.Class)

Example 3 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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.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.model.noark5.v4.DocumentDescription)

Example 4 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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.model.noark5.v4.File)

Example 5 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.

the class RecordHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject recordHateoas, JsonGenerator jgen) throws IOException {
    Record record = (Record) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, record);
    CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, record);
    if (record.getArchivedDate() != null) {
        jgen.writeStringField(RECORD_ARCHIVED_DATE, Serialize.formatDateTime(record.getArchivedDate()));
    }
    if (record.getArchivedBy() != null) {
        jgen.writeStringField(RECORD_ARCHIVED_BY, record.getArchivedBy());
    }
    CommonUtils.Hateoas.Serialize.printDisposal(jgen, record);
    CommonUtils.Hateoas.Serialize.printScreening(jgen, record);
    CommonUtils.Hateoas.Serialize.printClassified(jgen, record);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, recordHateoas.getLinks(record));
    jgen.writeEndObject();
}
Also used : Record(nikita.model.noark5.v4.Record)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)12 ApiOperation (io.swagger.annotations.ApiOperation)12 ApiResponses (io.swagger.annotations.ApiResponses)12 Timed (com.codahale.metrics.annotation.Timed)6 NikitaException (nikita.common.util.exceptions.NikitaException)6 NikitaException (nikita.util.exceptions.NikitaException)6 AfterNoarkEntityDeletedEvent (nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)6 AfterNoarkEntityDeletedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)6 Class (nikita.common.model.noark5.v4.Class)5 HateoasNoarkObject (nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject)5 INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)5 Class (nikita.model.noark5.v4.Class)5 Authorisation (nikita.webapp.security.Authorisation)5 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)5 INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)4 NoarkEntity (nikita.common.model.noark5.v4.NoarkEntity)3 Record (nikita.common.model.noark5.v4.Record)3 NoarkEntity (nikita.model.noark5.v4.NoarkEntity)3 Record (nikita.model.noark5.v4.Record)3 HateoasNoarkObject (nikita.model.noark5.v4.hateoas.HateoasNoarkObject)3