Search in sources :

Example 1 with ElectronicSignatureSecurityLevel

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

the class ElectronicSignatureSecurityLevelService method findByCode.

/**
 * retrieve all ElectronicSignatureSecurityLevel 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 ElectronicSignatureSecurityLevel objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findByCode(String code) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) electronicSignatureSecurityLevelRepository.findByCode(code), ELECTRONIC_SIGNATURE_SECURITY_LEVEL);
    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 2 with ElectronicSignatureSecurityLevel

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

the class ElectronicSignatureSecurityLevelService method generateDefaultElectronicSignatureSecurityLevel.

/**
 * Generate a default ElectronicSignatureSecurityLevel object
 *
 * @return the ElectronicSignatureSecurityLevel object wrapped as a
 * ElectronicSignatureSecurityLevelHateoas object
 */
@Override
public ElectronicSignatureSecurityLevel generateDefaultElectronicSignatureSecurityLevel() {
    ElectronicSignatureSecurityLevel electronicSignatureSecurityLevel = new ElectronicSignatureSecurityLevel();
    electronicSignatureSecurityLevel.setCode(TEMPLATE_ELECTRONIC_SIGNATURE_SECURITY_LEVEL_CODE);
    electronicSignatureSecurityLevel.setDescription(TEMPLATE_ELECTRONIC_SIGNATURE_SECURITY_LEVEL_DESCRIPTION);
    return electronicSignatureSecurityLevel;
}
Also used : ElectronicSignatureSecurityLevel(nikita.common.model.noark5.v4.metadata.ElectronicSignatureSecurityLevel)

Example 3 with ElectronicSignatureSecurityLevel

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

the class ElectronicSignatureSecurityLevelService method findByDescription.

/**
 * Retrieve all ElectronicSignatureSecurityLevel that have a given
 * description.
 * <br>
 * Note, this will be replaced by OData search.
 *
 * @param description Description of object you wish to retrieve. The
 *                    whole text, this is an exact search.
 * @return A list of ElectronicSignatureSecurityLevel objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findByDescription(String description) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) electronicSignatureSecurityLevelRepository.findByDescription(description), ELECTRONIC_SIGNATURE_SECURITY_LEVEL);
    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 4 with ElectronicSignatureSecurityLevel

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

the class ElectronicSignatureSecurityLevelService method findAll.

// All READ operations
/**
 * Retrieve a list of all ElectronicSignatureSecurityLevel objects
 *
 * @return list of ElectronicSignatureSecurityLevel objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findAll() {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) electronicSignatureSecurityLevelRepository.findAll(), ELECTRONIC_SIGNATURE_SECURITY_LEVEL);
    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 5 with ElectronicSignatureSecurityLevel

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

the class ElectronicSignatureSecurityLevelService method getElectronicSignatureSecurityLevelOrThrow.

/**
 * Internal helper method. Rather than having a find and try catch in
 * multiple methods, we have it here once. If you call this, be aware
 * that you will only ever get a valid ElectronicSignatureSecurityLevel
 * object back. If there is no ElectronicSignatureSecurityLevel object,
 * a NoarkEntityNotFoundException exception is thrown
 *
 * @param systemId The systemId of the ElectronicSignatureSecurityLevel
 *                 object to retrieve
 * @return the ElectronicSignatureSecurityLevel object
 */
private ElectronicSignatureSecurityLevel getElectronicSignatureSecurityLevelOrThrow(@NotNull String systemId) {
    ElectronicSignatureSecurityLevel electronicSignatureSecurityLevel = electronicSignatureSecurityLevelRepository.findBySystemId(systemId);
    if (electronicSignatureSecurityLevel == null) {
        String info = INFO_CANNOT_FIND_OBJECT + " ElectronicSignatureSecurityLevel, using systemId " + systemId;
        logger.error(info);
        throw new NoarkEntityNotFoundException(info);
    }
    return electronicSignatureSecurityLevel;
}
Also used : ElectronicSignatureSecurityLevel(nikita.common.model.noark5.v4.metadata.ElectronicSignatureSecurityLevel) NoarkEntityNotFoundException(nikita.common.util.exceptions.NoarkEntityNotFoundException)

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