Search in sources :

Example 6 with RegistryEntryStatus

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

the class RegistryEntryStatusService method generateDefaultRegistryEntryStatus.

/**
 * Generate a default RegistryEntryStatus object
 *
 * @return the RegistryEntryStatus object wrapped as a RegistryEntryStatusHateoas object
 */
@Override
public RegistryEntryStatus generateDefaultRegistryEntryStatus() {
    RegistryEntryStatus RegistryEntryStatus = new RegistryEntryStatus();
    RegistryEntryStatus.setCode(TEMPLATE_REGISTRY_ENTRY_STATUS_CODE);
    RegistryEntryStatus.setDescription(TEMPLATE_REGISTRY_ENTRY_STATUS_DESCRIPTION);
    return RegistryEntryStatus;
}
Also used : RegistryEntryStatus(nikita.common.model.noark5.v4.metadata.RegistryEntryStatus)

Example 7 with RegistryEntryStatus

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

the class RegistryEntryStatusService method createNewRegistryEntryStatus.

// All CREATE operations
/**
 * Persists a new RegistryEntryStatus object to the database.
 *
 * @param RegistryEntryStatus RegistryEntryStatus object with values set
 * @return the newly persisted RegistryEntryStatus object wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas createNewRegistryEntryStatus(RegistryEntryStatus RegistryEntryStatus) {
    RegistryEntryStatus.setDeleted(false);
    RegistryEntryStatus.setOwnedBy(SecurityContextHolder.getContext().getAuthentication().getName());
    MetadataHateoas metadataHateoas = new MetadataHateoas(RegistryEntryStatusRepository.save(RegistryEntryStatus));
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : Authorisation(nikita.webapp.security.Authorisation) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)

Example 8 with RegistryEntryStatus

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

the class RegistryEntryStatusService method findByCode.

/**
 * retrieve all RegistryEntryStatus that have a particular code.
 * <br>
 * Note, this will be replaced by OData search.
 *
 * @param code
 * @return A list of RegistryEntryStatus objects wrapped as a MetadataHateoas
 * object
 */
@Override
public MetadataHateoas findByCode(String code) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) RegistryEntryStatusRepository.findByCode(code), REGISTRY_ENTRY_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)

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 RegistryEntryStatus (nikita.common.model.noark5.v4.metadata.RegistryEntryStatus)3 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1