use of nikita.common.model.noark5.v4.casehandling.RegistryEntry in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryService method createCorrespondencePartInternalAssociatedWithRegistryEntry.
@Override
public CorrespondencePartInternal createCorrespondencePartInternalAssociatedWithRegistryEntry(String systemID, CorrespondencePartInternal correspondencePart) {
RegistryEntry registryEntry = getRegistryEntryOrThrow(systemID);
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.createNewCorrespondencePartInternal(correspondencePart);
}
use of nikita.common.model.noark5.v4.casehandling.RegistryEntry in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryImportService method createDocumentDescriptionAssociatedWithRegistryEntry.
@Override
public DocumentDescription createDocumentDescriptionAssociatedWithRegistryEntry(String systemID, DocumentDescription documentDescription) {
DocumentDescription persistedDocumentDescription = null;
RegistryEntry registryEntry = registryEntryRepository.findBySystemIdOrderBySystemId(systemID);
if (registryEntry == null) {
String info = INFO_CANNOT_FIND_OBJECT + " RegistryEntry, using registryEntrySystemId " + systemID;
logger.info(info);
throw new NoarkEntityNotFoundException(info);
} else {
TreeSet<Record> records = (TreeSet<Record>) documentDescription.getReferenceRecord();
if (records == null) {
records = new TreeSet<>();
documentDescription.setReferenceRecord(records);
}
records.add(registryEntry);
persistedDocumentDescription = documentDescriptionImportService.save(documentDescription);
}
return persistedDocumentDescription;
}
use of nikita.common.model.noark5.v4.casehandling.RegistryEntry in project nikita-noark5-core by HiOA-ABI.
the class CaseFileHateoasController method findRegistryEntryAssociatedWithCaseFileBySystemId.
// Retrieve all RegistryEntry associated with a casefile identified by systemId
// GET [contextPath][api]/casehandling/saksmappe/{systemID}/journalpost
@ApiOperation(value = "Retrieves all RegistryEntry associated with a CaseFile identified by systemId", response = RegistryEntry.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "RegistryEntry list returned", response = RegistryEntryHateoas.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
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + REGISTRY_ENTRY, method = RequestMethod.GET)
public ResponseEntity<RegistryEntryHateoas> findRegistryEntryAssociatedWithCaseFileBySystemId(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the caseFile to retrieve", required = true) @PathVariable("systemID") final String caseFileSystemId) {
CaseFile caseFile = caseFileService.findBySystemIdOrderBySystemId(caseFileSystemId);
if (caseFile == null) {
throw new NoarkEntityNotFoundException(caseFileSystemId);
}
RegistryEntryHateoas registryEntryHateoas = new RegistryEntryHateoas(new ArrayList<>(caseFile.getReferenceRecord()));
registryEntryHateoasHandler.addLinks(registryEntryHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(registryEntryHateoas);
}
use of nikita.common.model.noark5.v4.casehandling.RegistryEntry in project nikita-noark5-core by HiOA-ABI.
the class CaseFileHateoasController method createDefaultRegistryEntry.
// API - All GET Requests (CRUD - READ)
// Create a RegistryEntry object with default values
// GET [contextPath][api]/casehandling/mappe/SYSTEM_ID/ny-journalpost
@ApiOperation(value = "Create a RegistryEntry with default values", response = RegistryEntry.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "RegistryEntry returned", response = RegistryEntry.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
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_REGISTRY_ENTRY, method = RequestMethod.GET)
public ResponseEntity<RegistryEntryHateoas> createDefaultRegistryEntry(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response) {
RegistryEntry defaultRegistryEntry = new RegistryEntry();
defaultRegistryEntry.setDescription(TEST_DESCRIPTION);
defaultRegistryEntry.setTitle(TEST_TITLE);
defaultRegistryEntry.setDocumentDate(new Date());
RegistryEntryHateoas registryEntryHateoas = new RegistryEntryHateoas(defaultRegistryEntry);
registryEntryHateoasHandler.addLinksOnNew(registryEntryHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(registryEntryHateoas);
}
use of nikita.common.model.noark5.v4.casehandling.RegistryEntry in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryHateoasController method deleteRecordBySystemId.
// Delete a Record identified by systemID
// DELETE [contextPath][api]/casehandling/journalpost/{systemId}/
@ApiOperation(value = "Deletes a single RegistryEntry entity identified by systemID", response = String.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Parent entity (DocumentDescription or Record) returned", response = String.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
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.DELETE)
public ResponseEntity<String> deleteRecordBySystemId(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the record to delete", required = true) @PathVariable("systemID") final String systemID) {
RegistryEntry registryEntry = registryEntryService.findBySystemIdOrderBySystemId(systemID);
registryEntryService.deleteEntity(systemID);
applicationEventPublisher.publishEvent(new AfterNoarkEntityDeletedEvent(this, registryEntry));
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(CommonUtils.WebUtils.getSuccessStatusStringForDelete());
}
Aggregations