use of nikita.common.model.noark5.v4.admin.User in project nikita-noark5-core by HiOA-ABI.
the class FondsCreatorHateoasController method getFondsCreatorTemplate.
// Create a suggested FondsCreator (like a template) object with default values (nothing persisted)
// GET [contextPath][api]/arkivstruktur/arkiv/{systemID}/ny-arkivskaper
// GET [contextPath][api]/arkivstruktur/ny-arkivskaper
@ApiOperation(value = "Suggests the contents of a new FondsCreator", notes = "Returns a pre-filled FondsCreator" + " with values relevant for the logged-in user", response = FondsCreatorHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsCreator " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsCreatorHateoas.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(method = RequestMethod.GET, value = { NEW_FONDS_CREATOR, FONDS + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_FONDS_CREATOR })
public ResponseEntity<FondsCreatorHateoas> getFondsCreatorTemplate(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response) throws NikitaException {
FondsCreator suggestedFondsCreator = new FondsCreator();
// TODO: This should be replaced with configurable data based on whoever is logged in
// Currently just returns the test values
suggestedFondsCreator.setFondsCreatorId("123456789");
suggestedFondsCreator.setFondsCreatorName("Eksempel kommune");
suggestedFondsCreator.setDescription("Eksempel kommune ligger i eksempel fylke nord for nord");
FondsCreatorHateoas fondsCreatorHateoas = new FondsCreatorHateoas(suggestedFondsCreator);
fondsHateoasHandler.addLinksOnNew(fondsCreatorHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(fondsCreatorHateoas);
}
use of nikita.common.model.noark5.v4.admin.User in project nikita-noark5-core by HiOA-ABI.
the class FondsHateoasController method getFondsTemplate.
// Create a suggested Fonds (like a template) object with default values (nothing persisted)
// GET [contextPath][api]/arkivstruktur/ny-arkiv
@ApiOperation(value = "Suggests the contents of a new Fonds object", notes = "Returns a pre-filled Fonds object" + " with values relevant for the logged-in user", response = FondsHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fonds " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsHateoas.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(method = RequestMethod.GET, value = { NEW_FONDS, FONDS_CREATOR + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_FONDS })
public ResponseEntity<FondsHateoas> getFondsTemplate(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response) throws NikitaException {
Fonds suggestedFonds = new Fonds();
// TODO: This should be replaced with configurable data based on whoever is logged in
// Currently just returns the test values
suggestedFonds.setTitle(TEST_TITLE);
suggestedFonds.setDescription(TEST_DESCRIPTION);
suggestedFonds.setDocumentMedium(DOCUMENT_MEDIUM_ELECTRONIC);
FondsHateoas fondsHateoas = new FondsHateoas(suggestedFonds);
fondsHateoasHandler.addLinksOnNew(fondsHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(fondsHateoas);
}
use of nikita.common.model.noark5.v4.admin.User in project nikita-noark5-core by HiOA-ABI.
the class RegistryEntryHateoasController method getCorrespondencePartInternalTemplate.
// Create a suggested CorrespondencePartInternal (like a template) object with default values (nothing persisted)
// GET [contextPath][api]/casehandling/journalpost/{systemId}/ny-korrespondansepartintern
@ApiOperation(value = "Suggests the contents of a new CorrespondencePartInternal object", notes = "Returns a pre-filled CorrespondencePartInternal object" + " with values relevant for the logged-in user", response = CorrespondencePartInternalHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePart " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CorrespondencePartInternalHateoas.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(method = RequestMethod.GET, value = { SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CORRESPONDENCE_PART_INTERNAL })
public ResponseEntity<String> getCorrespondencePartInternalTemplate(HttpServletRequest request) throws NikitaException {
CorrespondencePartInternal suggestedCorrespondencePart = new CorrespondencePartInternal();
CorrespondencePartType correspondencePartType = correspondencePartTypeService.findByCode(CORRESPONDENCE_PART_CODE_EA);
if (correspondencePartType == null) {
throw new NikitaException("Internal error, metadata missing. [" + CORRESPONDENCE_PART_CODE_EA + "] returns no value");
}
suggestedCorrespondencePart.setCorrespondencePartType(correspondencePartType);
// The reason this is not implemented is that we are missing AdministrativeUnit and multiple users
CorrespondencePartInternalHateoas correspondencePartHateoas = new CorrespondencePartInternalHateoas(suggestedCorrespondencePart);
correspondencePartHateoasHandler.addLinksOnTemplate(correspondencePartHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body("");
}
use of nikita.common.model.noark5.v4.admin.User in project nikita-noark5-core by HiOA-ABI.
the class FondsService method generateDefaultSeries.
/**
* Generate a Default Fonds object that can be associated with the
* identified Fonds.
* <br>
* Note. Ideally this method would be configurable based on the logged in
* user and the business area they are working with. A generic Noark core
* like this does not have scope for that kind of functionality.
*
* @param fondsSystemId The systemId of the Fonds object you wish to
* generate a default Series for
* @return the Series object wrapped as a SeriesHateoas object
*/
@Override
public SeriesHateoas generateDefaultSeries(@NotNull String fondsSystemId) {
Series defaultSeries = new Series();
defaultSeries.setSeriesStatus(STATUS_OPEN);
defaultSeries.setDocumentMedium(DOCUMENT_MEDIUM_ELECTRONIC);
defaultSeries.setTitle("Default Series object generated by nikita " + "that can be associated with Fonds with systemID " + fondsSystemId);
SeriesHateoas seriesHateoas = new SeriesHateoas(defaultSeries);
seriesHateoasHandler.addLinksOnNew(seriesHateoas, new Authorisation());
return seriesHateoas;
}
use of nikita.common.model.noark5.v4.admin.User in project nikita-noark5-core by HiOA-ABI.
the class FondsService method generateDefaultFonds.
/**
* Generate a Default Fonds object that can be associated with the
* identified Fonds. If fondsSystemId has a value, it is assumed you wish
* to generate a sub-fonds.
* <br>
* Note. Ideally this method would be configurable based on the logged in
* user and the business area they are working with. A generic Noark core
* like this does not have scope for that kind of functionality.
*
* @param fondsSystemId The systemId of the Fonds object you wish to
* generate a default sub-fonds. Null if the Fonds
* is not a sub-fonds.
* @return the Fonds object wrapped as a FondsHateoas object
*/
@Override
public FondsHateoas generateDefaultFonds(String fondsSystemId) {
Fonds defaultFonds = new Fonds();
defaultFonds.setTitle(TEST_TITLE);
defaultFonds.setDescription(TEST_DESCRIPTION);
defaultFonds.setDocumentMedium(DOCUMENT_MEDIUM_ELECTRONIC);
FondsHateoas fondsHateoas = new FondsHateoas(defaultFonds);
fondsHateoasHandler.addLinksOnNew(fondsHateoas, new Authorisation());
return fondsHateoas;
}
Aggregations