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, IAuthorisation authorisation) {
this.authorisation = authorisation;
Iterable<INikitaEntity> entities = hateoasNoarkObject.getList();
for (INikitaEntity entity : entities) {
addEntityLinksOnNew(entity, hateoasNoarkObject);
}
}
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, IAuthorisation authorisation) {
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 FondsService method findFondsCreatorAssociatedWithFonds.
// All READ operations
/**
* Retrieve a list of FondsCreator objects associated with a given Fonds
* from the database. First we try to locate the Fonds object. If the
* Fonds object does not exist a NoarkEntityNotFoundException exception
* is thrown that the caller has to deal with.
* <p>
* If any FondsCreator objects exist, they are wrapped in a
* FondsCreatorHateoas object and returned to the caller.
*
* @param fondsSystemId The systemId of the Fonds object that you want to
* retrieve associated FondsCreator objects
* @return the fondsCreator objects wrapped as a FondsCreatorHateoas object
*/
@Override
public FondsCreatorHateoas findFondsCreatorAssociatedWithFonds(@NotNull String fondsSystemId) {
Fonds fonds = getFondsOrThrow(fondsSystemId);
FondsCreatorHateoas fondsCreatorHateoas = new FondsCreatorHateoas((List<INikitaEntity>) (List) fonds.getReferenceFondsCreator());
fondsCreatorHateoasHandler.addLinks(fondsCreatorHateoas, new Authorisation());
return fondsCreatorHateoas;
}
use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class FondsService method findSingleFonds.
/**
* Retrieve a list of StorageLocation objects associated with a given Fonds
* from the database. First we try to locate the Fonds object. If the
* Fonds object does not exist a NoarkEntityNotFoundException exception
* is thrown that the caller has to deal with.
*
* If any StorageLocation objects exist, they are wrapped in a
* StorageLocationHateoas object and returned to the caller.
*
* @param fondsSystemId The systemId of the Fonds object that you want to
* retrieve associated StorageLocation objects
*
* @return the newly persisted fondsCreator object wrapped as a
* StorageLocationHateoas object
*/
/*@Override
TODO: Finish implementing this.
public StorageLocationHateoas findStorageLocationAssociatedWithFonds(
@NotNull String fondsSystemId) {
Fonds fonds = getFondsOrThrow(fondsSystemId);
StorageLocationHateoas stroageLocationHateoas = new
StorageLocationHateoas((List<INikitaEntity>)
(List) fonds.getReferenceStorageLocation());
fondsCreatorHateoasHandler.addLinks(stroageLocationHateoas,
new Authorisation());
return stroageLocationHateoas;
} */
/**
* Retrieve a single Fonds objects from the database.
*
* @param fondsSystemId The systemId of the Fonds object you wish to
* retrieve
* @return the Fonds object wrapped as a FondsHateoas object
*/
@Override
public FondsHateoas findSingleFonds(String fondsSystemId) {
Fonds existingFonds = getFondsOrThrow(fondsSystemId);
FondsHateoas fondsHateoas = new FondsHateoas(fondsRepository.save(existingFonds));
fondsHateoasHandler.addLinks(fondsHateoas, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingFonds));
return fondsHateoas;
}
use of nikita.model.noark5.v4.interfaces.entities.INikitaEntity in project nikita-noark5-core by HiOA-ABI.
the class CasePartyRoleService method findByCode.
/**
* retrieve all CasePartyRole that have a particular code.
* <br>
* Note, this will be replaced by OData search.
*
* @param code The code of the object you wish to retrieve
* @return A list of CasePartyRole objects wrapped as a MetadataHateoas
* object
*/
@Override
public MetadataHateoas findByCode(String code) {
MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) casePartyRoleRepository.findByCode(code), CASE_PARTY_ROLE);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return metadataHateoas;
}
Aggregations