Search in sources :

Example 11 with INikitaEntity

use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity 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();
}
Also used : Precedence(nikita.model.noark5.v4.casehandling.Precedence)

Example 12 with INikitaEntity

use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class HateoasHandler method addSelfLink.

@Override
public void addSelfLink(INikitaEntity entity, IHateoasNoarkObject hateoasNoarkObject) {
    String systemId = entity.getSystemId();
    hateoasNoarkObject.addLink(entity, new Link(contextPath + HATEOAS_API_PATH + SLASH + entity.getFunctionalTypeName() + SLASH + entity.getBaseTypeName() + SLASH + systemId + SLASH, getRelSelfLink(), false));
}
Also used : Link(nikita.model.noark5.v4.hateoas.Link)

Example 13 with INikitaEntity

use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class HateoasHandler method addLinksOnTemplate.

@Override
public void addLinksOnTemplate(IHateoasNoarkObject hateoasNoarkObject, HttpServletRequest request, IAuthorisation authorisation) {
    setParameters(request);
    this.authorisation = authorisation;
    Iterable<INikitaEntity> entities = hateoasNoarkObject.getList();
    for (INikitaEntity entity : entities) {
        addEntityLinksOnTemplate(entity, hateoasNoarkObject);
    }
}
Also used : INikitaEntity(nikita.model.noark5.v4.interfaces.entities.INikitaEntity)

Example 14 with INikitaEntity

use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class HateoasHandler method addLinks.

@Override
public void addLinks(IHateoasNoarkObject hateoasNoarkObject, HttpServletRequest request, IAuthorisation authorisation) {
    setParameters(request);
    this.authorisation = authorisation;
    Iterable<INikitaEntity> entities = hateoasNoarkObject.getList();
    for (INikitaEntity entity : entities) {
        addSelfLink(entity, hateoasNoarkObject);
        addEntityLinks(entity, hateoasNoarkObject);
    }
    // { "entity": [], "_links": [] }
    if (!hateoasNoarkObject.isSingleEntity()) {
        StringBuffer url = request.getRequestURL();
        Link selfLink = new Link(url.toString(), getRelSelfLink(), false);
        hateoasNoarkObject.addSelfLink(selfLink);
    }
}
Also used : INikitaEntity(nikita.model.noark5.v4.interfaces.entities.INikitaEntity) Link(nikita.model.noark5.v4.hateoas.Link)

Example 15 with INikitaEntity

use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.

the class BasicRecordHateoasController method findAllBasicRecord.

@ApiOperation(value = "Retrieves multiple BasicRecord entities limited by ownership rights", notes = "The field skip" + "tells how many BasicRecord rows of the result set to ignore (starting at 0), while  top tells how many rows" + " after skip to return. Note if the value of top is greater than system value " + " nikita-noark5-core.pagination.maxPageSize, then nikita-noark5-core.pagination.maxPageSize is used. ", response = BasicRecordHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "BasicRecord list found", response = BasicRecordHateoas.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)
public ResponseEntity<BasicRecordHateoas> findAllBasicRecord(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip) {
    BasicRecordHateoas basicRecordHateoas = new BasicRecordHateoas((ArrayList<INikitaEntity>) (ArrayList) basicRecordService.findBasicRecordByOwnerPaginated(top, skip));
    basicRecordHateoasHandler.addLinks(basicRecordHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(basicRecordHateoas);
}
Also used : INikitaEntity(nikita.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) ArrayList(java.util.ArrayList) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)19 Counted (com.codahale.metrics.annotation.Counted)16 Timed (com.codahale.metrics.annotation.Timed)16 ArrayList (java.util.ArrayList)16 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)16 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 Fonds (nikita.model.noark5.v4.Fonds)3 CaseFileHateoas (nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)3 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)2 FondsCreator (nikita.model.noark5.v4.FondsCreator)2 Record (nikita.model.noark5.v4.Record)2 FondsHateoas (nikita.model.noark5.v4.hateoas.FondsHateoas)2 Link (nikita.model.noark5.v4.hateoas.Link)2 AfterNoarkEntityDeletedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)2 List (java.util.List)1 BasicRecord (nikita.model.noark5.v4.BasicRecord)1 Class (nikita.model.noark5.v4.Class)1 DocumentObject (nikita.model.noark5.v4.DocumentObject)1 File (nikita.model.noark5.v4.File)1