Search in sources :

Example 1 with PostalCode

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

the class PostalCodeService method findByDescription.

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

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

the class PostalCodeService method findAll.

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

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

the class PostalCodeService method generateDefaultPostalCode.

/**
 * Generate a default PostalCode object
 *
 * @return the PostalCode object wrapped as a PostalCodeHateoas object
 */
@Override
public PostalCode generateDefaultPostalCode() {
    PostalCode postalCode = new PostalCode();
    postalCode.setCode(TEMPLATE_POST_CODE_CODE);
    postalCode.setDescription(TEMPLATE_POST_CODE_DESCRIPTION);
    return postalCode;
}
Also used : PostalCode(nikita.common.model.noark5.v4.metadata.PostalCode)

Example 4 with PostalCode

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

the class PostalCodeService method findByCode.

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

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

the class PostalCodeService method find.

// find by systemId
/**
 * Retrieve a single PostalCode object identified by systemId
 *
 * @param systemId systemId of the PostalCode you wish to retrieve
 * @return single PostalCode object wrapped as a MetadataHateoas object
 */
@Override
public MetadataHateoas find(String systemId) {
    MetadataHateoas metadataHateoas = new MetadataHateoas(postalCodeRepository.findBySystemId(systemId));
    metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
    return metadataHateoas;
}
Also used : Authorisation(nikita.webapp.security.Authorisation) 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 PostalCode (nikita.common.model.noark5.v4.metadata.PostalCode)3 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1