Search in sources :

Example 21 with AdministrativeUnit

use of nikita.common.model.noark5.v4.admin.AdministrativeUnit in project nikita-noark5-core by HiOA-ABI.

the class AdministrativeUnitController method getAdministrativeUnitTemplate.

// Create a suggested administrativeUnit(like a template) with default values (nothing persisted)
// GET [contextPath][api]/admin/ny-administrativtenhet
@ApiOperation(value = "Creates a suggested AdministrativeUnit", response = AdministrativeUnit.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "AdministrativeUnit codes found", response = AdministrativeUnit.class), @ApiResponse(code = 404, message = "No AdministrativeUnit found"), @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(method = RequestMethod.GET, value = NEW_ADMINISTRATIVE_UNIT)
public ResponseEntity<AdministrativeUnitHateoas> getAdministrativeUnitTemplate(HttpServletRequest request) {
    AdministrativeUnit administrativeUnit = new AdministrativeUnit();
    administrativeUnit.setShortName("kortnavn på administrativtenhet");
    administrativeUnit.setAdministrativeUnitName("Formell navn på administrativtenhet");
    AdministrativeUnitHateoas adminHateoas = new AdministrativeUnitHateoas(administrativeUnit);
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(adminHateoas);
}
Also used : AdministrativeUnit(nikita.common.model.noark5.v4.admin.AdministrativeUnit) AdministrativeUnitHateoas(nikita.common.model.noark5.v4.hateoas.admin.AdministrativeUnitHateoas) Counted(com.codahale.metrics.annotation.Counted) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 22 with AdministrativeUnit

use of nikita.common.model.noark5.v4.admin.AdministrativeUnit 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
@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, new Authorisation());
    return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body("");
}
Also used : NikitaException(nikita.common.util.exceptions.NikitaException) Authorisation(nikita.webapp.security.Authorisation) CorrespondencePartType(nikita.common.model.noark5.v4.metadata.CorrespondencePartType) Counted(com.codahale.metrics.annotation.Counted) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)12 ApiOperation (io.swagger.annotations.ApiOperation)12 ApiResponses (io.swagger.annotations.ApiResponses)12 AdministrativeUnit (nikita.model.noark5.v4.admin.AdministrativeUnit)7 Timed (com.codahale.metrics.annotation.Timed)6 AdministrativeUnit (nikita.common.model.noark5.v4.admin.AdministrativeUnit)6 AdministrativeUnitHateoas (nikita.common.model.noark5.v4.hateoas.admin.AdministrativeUnitHateoas)5 AdministrativeUnitHateoas (nikita.model.noark5.v4.hateoas.admin.AdministrativeUnitHateoas)5 Authorisation (nikita.webapp.security.Authorisation)5 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)5 JsonNode (com.fasterxml.jackson.databind.JsonNode)4 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 NikitaMalformedInputDataException (nikita.common.util.exceptions.NikitaMalformedInputDataException)2 NikitaMalformedInputDataException (nikita.util.exceptions.NikitaMalformedInputDataException)2 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 List (java.util.List)1 Series (nikita.common.model.noark5.v4.Series)1 CaseFile (nikita.common.model.noark5.v4.casehandling.CaseFile)1