Search in sources :

Example 6 with PrecedenceStatus

use of nikita.common.model.noark5.v4.metadata.PrecedenceStatus in project nikita-noark5-core by HiOA-ABI.

the class PrecedenceStatusService method findAll.

// All READ operations
/**
 * Retrieve a list of all PrecedenceStatus objects
 *
 * @return list of PrecedenceStatus objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findAll() {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) precedenceStatusRepository.findAll(), PRECEDENCE_STATUS);
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)

Example 7 with PrecedenceStatus

use of nikita.common.model.noark5.v4.metadata.PrecedenceStatus in project nikita-noark5-core by HiOA-ABI.

the class PrecedenceStatusService method findByCode.

/**
 * retrieve all PrecedenceStatus 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 PrecedenceStatus objects wrapped as a MetadataHateoas
 * object
 */
@Override
public MetadataHateoas findByCode(String code) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) precedenceStatusRepository.findByCode(code), PRECEDENCE_STATUS);
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)

Example 8 with PrecedenceStatus

use of nikita.common.model.noark5.v4.metadata.PrecedenceStatus in project nikita-noark5-core by HiOA-ABI.

the class PrecedenceStatusService method generateDefaultPrecedenceStatus.

/**
 * Generate a default PrecedenceStatus object
 *
 * @return the PrecedenceStatus object
 */
@Override
public PrecedenceStatus generateDefaultPrecedenceStatus() {
    PrecedenceStatus precedenceStatus = new PrecedenceStatus();
    precedenceStatus.setCode(TEMPLATE_PRECEDENCE_STATUS_CODE);
    precedenceStatus.setDescription(TEMPLATE_PRECEDENCE_STATUS_DESCRIPTION);
    return precedenceStatus;
}
Also used : PrecedenceStatus(nikita.common.model.noark5.v4.metadata.PrecedenceStatus)

Aggregations

MetadataHateoas (nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)6 Authorisation (nikita.webapp.security.Authorisation)6 List (java.util.List)3 INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)3 PrecedenceStatus (nikita.common.model.noark5.v4.metadata.PrecedenceStatus)3 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1