Search in sources :

Example 11 with HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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 HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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 HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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 HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject 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 HateoasNoarkObject

use of nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject in project nikita-noark5-core by HiOA-ABI.

the class HateoasHandler method addLinksOnNew.

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

Aggregations

Counted (com.codahale.metrics.annotation.Counted)12 ApiOperation (io.swagger.annotations.ApiOperation)12 ApiResponses (io.swagger.annotations.ApiResponses)12 Timed (com.codahale.metrics.annotation.Timed)6 NikitaException (nikita.common.util.exceptions.NikitaException)6 NikitaException (nikita.util.exceptions.NikitaException)6 AfterNoarkEntityDeletedEvent (nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)6 AfterNoarkEntityDeletedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)6 Class (nikita.common.model.noark5.v4.Class)5 HateoasNoarkObject (nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject)5 INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)5 Class (nikita.model.noark5.v4.Class)5 Authorisation (nikita.webapp.security.Authorisation)5 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)5 INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)4 NoarkEntity (nikita.common.model.noark5.v4.NoarkEntity)3 Record (nikita.common.model.noark5.v4.Record)3 NoarkEntity (nikita.model.noark5.v4.NoarkEntity)3 Record (nikita.model.noark5.v4.Record)3 HateoasNoarkObject (nikita.model.noark5.v4.hateoas.HateoasNoarkObject)3