use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class CaseFileHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject caseFileHateoas, JsonGenerator jgen) throws IOException {
CaseFile caseFile = (CaseFile) noarkSystemIdEntity;
jgen.writeStartObject();
if (caseFile.getSystemId() != null) {
jgen.writeStringField(SYSTEM_ID, caseFile.getSystemId());
}
if (caseFile.getFileId() != null) {
jgen.writeStringField(FILE_ID, caseFile.getFileId());
}
if (caseFile.getTitle() != null) {
jgen.writeStringField(TITLE, caseFile.getTitle());
}
if (caseFile.getOfficialTitle() != null) {
jgen.writeStringField(FILE_PUBLIC_TITLE, caseFile.getOfficialTitle());
}
if (caseFile.getDescription() != null) {
jgen.writeStringField(DESCRIPTION, caseFile.getDescription());
}
CommonUtils.Hateoas.Serialize.printKeyword(jgen, caseFile);
if (caseFile.getDocumentMedium() != null) {
jgen.writeStringField(DOCUMENT_MEDIUM, caseFile.getDocumentMedium());
}
CommonUtils.Hateoas.Serialize.printStorageLocation(jgen, caseFile);
if (caseFile.getCreatedDate() != null) {
jgen.writeStringField(CREATED_DATE, Serialize.formatDateTime(caseFile.getCreatedDate()));
}
if (caseFile.getCreatedBy() != null) {
jgen.writeStringField(CREATED_BY, caseFile.getCreatedBy());
}
if (caseFile.getFinalisedDate() != null) {
jgen.writeStringField(FINALISED_DATE, Serialize.formatDateTime(caseFile.getFinalisedDate()));
}
if (caseFile.getFinalisedBy() != null) {
jgen.writeStringField(FINALISED_BY, caseFile.getFinalisedBy());
}
if (caseFile.getReferenceSeries() != null && caseFile.getReferenceSeries().getSystemId() != null) {
jgen.writeStringField(REFERENCE_SERIES, caseFile.getReferenceSeries().getSystemId());
}
if (caseFile.getCaseYear() != null) {
jgen.writeNumberField(CASE_YEAR, caseFile.getCaseYear().intValue());
}
if (caseFile.getCaseSequenceNumber() != null) {
jgen.writeNumberField(CASE_SEQUENCE_NUMBER, caseFile.getCaseSequenceNumber().intValue());
}
if (caseFile.getCaseDate() != null) {
jgen.writeStringField(CASE_DATE, Serialize.formatDate(caseFile.getCaseDate()));
}
if (caseFile.getAdministrativeUnit() != null) {
jgen.writeStringField(ADMINISTRATIVE_UNIT, caseFile.getAdministrativeUnit());
}
if (caseFile.getCaseResponsible() != null) {
jgen.writeStringField(CASE_RESPONSIBLE, caseFile.getCaseResponsible());
}
if (caseFile.getRecordsManagementUnit() != null) {
jgen.writeStringField(CASE_RECORDS_MANAGEMENT_UNIT, caseFile.getRecordsManagementUnit());
}
if (caseFile.getCaseStatus() != null) {
jgen.writeStringField(CASE_STATUS, caseFile.getCaseStatus());
}
if (caseFile.getLoanedDate() != null) {
jgen.writeStringField(CASE_LOANED_DATE, Serialize.formatDate(caseFile.getLoanedDate()));
}
if (caseFile.getLoanedTo() != null) {
jgen.writeStringField(CASE_LOANED_TO, caseFile.getLoanedTo());
}
// TODO: Implement M209 referanseSekundaerKlassifikasjon
// CommonCommonUtils.Hateoas.Serialize.printSecondaryClassification(jgen, caseFile);
CommonUtils.Hateoas.Serialize.printCaseParty(jgen, caseFile);
// CommonUtils.Hateoas.Serialize.printPrecedence(jgen, caseFile);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, caseFileHateoas.getLinks(caseFile));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity 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.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartUnitHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
CorrespondencePartUnit correspondencePart = (CorrespondencePartUnit) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printCorrespondencePartUnit(jgen, correspondencePart);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject registryEntryHateoas, JsonGenerator jgen) throws IOException {
RegistryEntry registryEntry = (RegistryEntry) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, registryEntry);
if (registryEntry.getArchivedDate() != null) {
jgen.writeStringField(RECORD_ARCHIVED_DATE, Serialize.formatDateTime(registryEntry.getArchivedDate()));
}
if (registryEntry.getArchivedBy() != null) {
jgen.writeStringField(RECORD_ARCHIVED_BY, registryEntry.getArchivedBy());
}
CommonUtils.Hateoas.Serialize.printDisposal(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printScreening(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printClassified(jgen, registryEntry);
// handle general registryEntry properties
if (registryEntry.getTitle() != null) {
jgen.writeStringField(TITLE, registryEntry.getTitle());
}
if (registryEntry.getOfficialTitle() != null) {
jgen.writeStringField(FILE_PUBLIC_TITLE, registryEntry.getOfficialTitle());
}
if (registryEntry.getDescription() != null) {
jgen.writeStringField(DESCRIPTION, registryEntry.getDescription());
}
CommonUtils.Hateoas.Serialize.printKeyword(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printDocumentMedium(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printStorageLocation(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printComment(jgen, registryEntry);
// TODO: FIX THIS CommonCommonUtils.Hateoas.Serialize.printCrossReference(jgen, registryEntry);
if (registryEntry.getRecordYear() != null) {
jgen.writeNumberField(REGISTRY_ENTRY_YEAR, registryEntry.getRecordYear().intValue());
}
if (registryEntry.getRecordSequenceNumber() != null) {
jgen.writeNumberField(REGISTRY_ENTRY_SEQUENCE_NUMBER, registryEntry.getRecordSequenceNumber().intValue());
}
if (registryEntry.getRegistryEntryNumber() != null) {
jgen.writeNumberField(REGISTRY_ENTRY_NUMBER, registryEntry.getRegistryEntryNumber().intValue());
}
if (registryEntry.getRegistryEntryType() != null) {
jgen.writeStringField(REGISTRY_ENTRY_TYPE, registryEntry.getRegistryEntryType());
}
if (registryEntry.getRecordStatus() != null) {
jgen.writeStringField(REGISTRY_ENTRY_STATUS, registryEntry.getRecordStatus());
}
if (registryEntry.getRecordDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_DATE, Serialize.formatDate(registryEntry.getRecordDate()));
}
if (registryEntry.getDocumentDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_DOCUMENT_DATE, Serialize.formatDate(registryEntry.getDocumentDate()));
}
if (registryEntry.getReceivedDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_RECEIVED_DATE, Serialize.formatDate(registryEntry.getReceivedDate()));
}
if (registryEntry.getSentDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_SENT_DATE, Serialize.formatDate(registryEntry.getSentDate()));
}
if (registryEntry.getDueDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_DUE_DATE, Serialize.formatDate(registryEntry.getDueDate()));
}
if (registryEntry.getFreedomAssessmentDate() != null) {
jgen.writeStringField(REGISTRY_ENTRY_RECORD_FREEDOM_ASSESSMENT_DATE, Serialize.formatDate(registryEntry.getFreedomAssessmentDate()));
}
if (registryEntry.getNumberOfAttachments() != null) {
jgen.writeNumberField(REGISTRY_ENTRY_NUMBER_OF_ATTACHMENTS, registryEntry.getNumberOfAttachments().intValue());
}
if (registryEntry.getLoanedDate() != null) {
jgen.writeStringField(CASE_LOANED_DATE, Serialize.formatDate(registryEntry.getLoanedDate()));
}
if (registryEntry.getLoanedTo() != null) {
jgen.writeStringField(CASE_LOANED_TO, registryEntry.getLoanedTo());
}
/*
TODO: Temp disabled!
CommonUtils.Hateoas.Serialize.printCorrespondencePartPersons(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printCorrespondencePartUnits(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printCorrespondencePartInternals(jgen, registryEntry);
*/
CommonUtils.Hateoas.Serialize.printSignOff(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printDocumentFlow(jgen, registryEntry);
// CommonUtils.Hateoas.Serialize.printPrecedence(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printElectronicSignature(jgen, registryEntry);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, registryEntryHateoas.getLinks(registryEntry));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class MetadataHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject metadataHateoas, JsonGenerator jgen) throws IOException {
if (!(noarkSystemIdEntity instanceof IMetadataEntity)) {
throw new NikitaException("Internal error when serialising " + noarkSystemIdEntity + " Not castable to nikita.common.model.noark5.v4.interfaces.entities.IMetadataEntity");
}
IMetadataEntity metadataEntity = (IMetadataEntity) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, metadataEntity);
if (metadataEntity.getCode() != null) {
jgen.writeStringField(CODE, metadataEntity.getCode());
}
if (metadataEntity.getDescription() != null) {
jgen.writeStringField(DESCRIPTION, metadataEntity.getDescription());
}
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, metadataHateoas.getLinks(metadataEntity));
jgen.writeEndObject();
}
Aggregations