Search in sources :

Example 1 with RegistryEntryType

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

the class RegistryEntryTypeService method generateDefaultRegistryEntryType.

/**
 * Generate a default RegistryEntryType object
 *
 * @return the RegistryEntryType object
 */
@Override
public RegistryEntryType generateDefaultRegistryEntryType() {
    RegistryEntryType format = new RegistryEntryType();
    format.setCode(TEMPLATE_REGISTRY_ENTRY_TYPE_CODE);
    format.setDescription(TEMPLATE_REGISTRY_ENTRY_TYPE_DESCRIPTION);
    return format;
}
Also used : RegistryEntryType(nikita.common.model.noark5.v4.metadata.RegistryEntryType)

Example 2 with RegistryEntryType

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

the class RegistryEntryTypeService method findByDescription.

/**
 * Retrieve all RegistryEntryType 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 RegistryEntryType objects wrapped as a MetadataHateoas object
 */
@Override
public MetadataHateoas findByDescription(String description) {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) formatRepository.findByDescription(description), REGISTRY_ENTRY_TYPE);
    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 3 with RegistryEntryType

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

the class RegistryEntryTypeService method findByCode.

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

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

the class RegistryEntryTypeService method getRegistryEntryTypeOrThrow.

/**
 * 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 RegistryEntryType object back. If
 * there is no RegistryEntryType object, a NoarkEntityNotFoundException
 * exception is thrown
 *
 * @param systemId The systemId of the RegistryEntryType object to retrieve
 * @return the RegistryEntryType object
 */
private RegistryEntryType getRegistryEntryTypeOrThrow(@NotNull String systemId) {
    RegistryEntryType format = formatRepository.findBySystemId(systemId);
    if (format == null) {
        String info = INFO_CANNOT_FIND_OBJECT + " RegistryEntryType,  " + "using systemId " + systemId;
        logger.error(info);
        throw new NoarkEntityNotFoundException(info);
    }
    return format;
}
Also used : RegistryEntryType(nikita.common.model.noark5.v4.metadata.RegistryEntryType) NoarkEntityNotFoundException(nikita.common.util.exceptions.NoarkEntityNotFoundException)

Example 5 with RegistryEntryType

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

the class RegistryEntryTypeService method findAll.

// All READ operations
/**
 * Retrieve a list of all RegistryEntryType objects
 *
 * @return list of RegistryEntryType objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findAll() {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) formatRepository.findAll(), REGISTRY_ENTRY_TYPE);
    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 RegistryEntryType (nikita.common.model.noark5.v4.metadata.RegistryEntryType)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 ParseException (java.text.ParseException)1 Date (java.util.Date)1 RegistryEntry (nikita.common.model.noark5.v4.casehandling.RegistryEntry)1 NikitaMalformedInputDataException (nikita.common.util.exceptions.NikitaMalformedInputDataException)1 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)1 NikitaMalformedInputDataException (nikita.util.exceptions.NikitaMalformedInputDataException)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1