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();
}
use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.
the class SeriesHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject seriesHateoas, JsonGenerator jgen) throws IOException {
Series series = (Series) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, series);
CommonUtils.Hateoas.Serialize.printTitleAndDescription(jgen, series);
if (series.getSeriesStatus() != null) {
jgen.writeStringField(SERIES_STATUS, series.getSeriesStatus());
}
CommonUtils.Hateoas.Serialize.printDocumentMedium(jgen, series);
CommonUtils.Hateoas.Serialize.printStorageLocation(jgen, series);
CommonUtils.Hateoas.Serialize.printCreateEntity(jgen, series);
CommonUtils.Hateoas.Serialize.printFinaliseEntity(jgen, series);
if (series.getSeriesStartDate() != null) {
jgen.writeStringField(SERIES_START_DATE, Serialize.formatDate(series.getSeriesStartDate()));
}
if (series.getSeriesEndDate() != null) {
jgen.writeStringField(SERIES_END_DATE, Serialize.formatDate(series.getSeriesEndDate()));
}
if (series.getReferencePrecursor() != null && series.getReferencePrecursor().getSystemId() != null) {
jgen.writeStringField(SERIES_PRECURSOR, series.getReferencePrecursor().getSystemId());
}
if (series.getReferenceSuccessor() != null && series.getReferenceSuccessor().getSystemId() != null) {
jgen.writeStringField(SERIES_SUCCESSOR, series.getReferenceSuccessor().getSystemId());
}
CommonUtils.Hateoas.Serialize.printDisposal(jgen, series);
CommonUtils.Hateoas.Serialize.printDisposalUndertaken(jgen, series);
CommonUtils.Hateoas.Serialize.printDeletion(jgen, series);
CommonUtils.Hateoas.Serialize.printScreening(jgen, series);
CommonUtils.Hateoas.Serialize.printClassified(jgen, series);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, seriesHateoas.getLinks(series));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartPersonHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
CorrespondencePartPerson correspondencePart = (CorrespondencePartPerson) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printCorrespondencePartPerson(jgen, correspondencePart);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.
the class PrecedenceHateoasSerializer method serializeNoarkEntity.
@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject precedenceHateoas, JsonGenerator jgen) throws IOException {
Precedence precedence = (Precedence) noarkSystemIdEntity;
jgen.writeStartObject();
CommonUtils.Hateoas.Serialize.printPrecedence(jgen, precedence);
CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, precedenceHateoas.getLinks(precedence));
jgen.writeEndObject();
}
use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.
the class RecordHateoasController method deleteRecordBySystemId.
// Delete a Record identified by systemID
// DELETE [contextPath][api]/arkivstruktur/registrering/{systemId}/
@ApiOperation(value = "Deletes a single Record entity identified by systemID", response = HateoasNoarkObject.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Parent entity (DocumentDescription or Record) returned", response = HateoasNoarkObject.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.DELETE)
public ResponseEntity<String> deleteRecordBySystemId(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemID of the record to delete", required = true) @PathVariable("systemID") final String systemID) {
Record record = recordService.findBySystemId(systemID);
/* NoarkEntity parentEntity = record.chooseParent();
HateoasNoarkObject hateoasNoarkObject;
if (parentEntity instanceof Series) {
hateoasNoarkObject = new SeriesHateoas(parentEntity);
seriesHateoasHandler.addLinks(hateoasNoarkObject, new Authorisation());
}
else if (parentEntity instanceof File) {
hateoasNoarkObject = new FileHateoas(parentEntity);
fileHateoasHandler.addLinks(hateoasNoarkObject, new Authorisation());
}
else if (parentEntity instanceof Class) {
hateoasNoarkObject = new ClassHateoas(parentEntity);
classHateoasHandler.addLinks(hateoasNoarkObject, new Authorisation());
}
else {
throw new nikita.webapp.util.exceptions.NikitaException("Internal error. Could not process"
+ request.getRequestURI());
} */
recordService.deleteEntity(systemID);
applicationEventPublisher.publishEvent(new AfterNoarkEntityDeletedEvent(this, record));
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body("{\"status\": \"deleted\"}");
}
Aggregations