use of nikita.model.noark5.v4.hateoas.Link 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.hateoas.Link 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.hateoas.Link in project nikita-noark5-core by HiOA-ABI.
the class FondsService method deleteEntity.
// All DELETE operations
@Override
public void deleteEntity(@NotNull String fondsSystemId) {
Fonds fonds = getFondsOrThrow(fondsSystemId);
// Disassociate the link between Fonds and FondsCreator
// https://github.com/HiOA-ABI/nikita-noark5-core/issues/82
Query q = entityManager.createNativeQuery("DELETE FROM fonds_fonds_creator WHERE f_pk_fonds_id = :id ;");
q.setParameter("id", fonds.getId());
q.executeUpdate();
entityManager.remove(fonds);
entityManager.flush();
entityManager.clear();
//fondsRepository.delete(fonds);
}
use of nikita.model.noark5.v4.hateoas.Link in project nikita-noark5-core by HiOA-ABI.
the class CorrespondencePartService method deleteCorrespondencePartInternal.
@Override
public void deleteCorrespondencePartInternal(@NotNull String code) {
CorrespondencePartInternal correspondencePartInternal = (CorrespondencePartInternal) getCorrespondencePartOrThrow(code);
/*
// Disassociate the link between Fonds and FondsCreator
// https://github.com/HiOA-ABI/nikita-noark5-core/issues/82
Query q = entityManager.createNativeQuery("DELETE FROM fonds_fonds_creator WHERE f_pk_fonds_id = :id ;");
q.setParameter("id", fonds.getId());
q.executeUpdate();
entityManager.remove(fonds);
entityManager.flush();
entityManager.clear();*/
correspondencePartRepository.delete(correspondencePartInternal);
}
Aggregations