Search in sources :

Example 26 with INikitaEntity

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

Example 27 with INikitaEntity

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

the class CorrespondencePartUnitHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject correspondencePartHateoas, JsonGenerator jgen) throws IOException {
    CorrespondencePartUnit correspondencePart = (CorrespondencePartUnit) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printCorrespondencePartUnit(jgen, correspondencePart);
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, correspondencePartHateoas.getLinks(correspondencePart));
    jgen.writeEndObject();
}
Also used : CorrespondencePartUnit(nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartUnit)

Example 28 with INikitaEntity

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

the class MetadataHateoasSerializer method serializeNoarkEntity.

@Override
public void serializeNoarkEntity(INikitaEntity noarkSystemIdEntity, HateoasNoarkObject metadataHateoas, JsonGenerator jgen) throws IOException {
    if (!(noarkSystemIdEntity instanceof nikita.model.noark5.v4.interfaces.entities.IMetadataEntity)) {
        throw new NikitaException("Internal error when serialising " + noarkSystemIdEntity + " Not castable to nikita.model.noark5.v4.interfaces.entities.IMetadataEntity");
    }
    IMetadataEntity metadataEntity = (IMetadataEntity) noarkSystemIdEntity;
    jgen.writeStartObject();
    CommonUtils.Hateoas.Serialize.printSystemIdEntity(jgen, metadataEntity);
    if (metadataEntity.getCode() != null) {
        jgen.writeStringField(CODE, metadataEntity.getCode());
    }
    if (metadataEntity.getDescription() != null) {
        jgen.writeStringField(DESCRIPTION, metadataEntity.getDescription());
    }
    CommonUtils.Hateoas.Serialize.printHateoasLinks(jgen, metadataHateoas.getLinks(metadataEntity));
    jgen.writeEndObject();
}
Also used : NikitaException(nikita.util.exceptions.NikitaException) IMetadataEntity(nikita.model.noark5.v4.interfaces.entities.IMetadataEntity)

Example 29 with INikitaEntity

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

the class HateoasHandler method addLinksOnNew.

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

Example 30 with INikitaEntity

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

the class ClassHateoasController method findAllClass.

@ApiOperation(value = "Retrieves multiple Class entities limited by ownership rights", notes = "The field skip" + "tells how many Class 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 = ClassHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Class list found", response = ClassHateoas.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<ClassHateoas> findAllClass(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip) {
    ClassHateoas classHateoas = new ClassHateoas((ArrayList<INikitaEntity>) (ArrayList) classService.findClassByOwnerPaginated(top, skip));
    classHateoasHandler.addLinks(classHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(classHateoas);
}
Also used : ClassHateoas(nikita.model.noark5.v4.hateoas.ClassHateoas) 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