Search in sources :

Example 6 with CasePartyRole

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

the class CasePartyRoleService method getCasePartyRoleOrThrow.

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

Example 7 with CasePartyRole

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

the class CasePartyRoleService method generateDefaultCasePartyRole.

/**
 * Generate a default CasePartyRole object
 *
 * @return the CasePartyRole object wrapped as a CasePartyRoleHateoas object
 */
@Override
public CasePartyRole generateDefaultCasePartyRole() {
    CasePartyRole casePartyRole = new CasePartyRole();
    casePartyRole.setCode(TEMPLATE_CASE_PARTY_ROLE_CODE);
    casePartyRole.setDescription(TEMPLATE_CASE_PARTY_ROLE_DESCRIPTION);
    return casePartyRole;
}
Also used : CasePartyRole(nikita.common.model.noark5.v4.metadata.CasePartyRole)

Example 8 with CasePartyRole

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

the class CasePartyRoleService method findAll.

// All READ operations
/**
 * Retrieve a list of all CasePartyRole objects
 *
 * @return list of CasePartyRole objects wrapped as a
 * MetadataHateoas object
 */
@Override
public MetadataHateoas findAll() {
    MetadataHateoas metadataHateoas = new MetadataHateoas((List<INikitaEntity>) (List) casePartyRoleRepository.findAll(), CASE_PARTY_ROLE);
    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 CasePartyRole (nikita.common.model.noark5.v4.metadata.CasePartyRole)3 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1