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();
}
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));
}
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);
}
}
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);
}
}
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);
}
Aggregations