Search in sources :

Example 1 with AfterNoarkEntityUpdatedEvent

use of nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class ElectronicSignatureVerifiedService method handleUpdate.

/**
 * Update a ElectronicSignatureVerified identified by its systemId
 * <p>
 * Copy the values you are allowed to change, code and description
 *
 * @param systemId                    The systemId of the
 *                                    electronicSignatureVerified
 *                                    object you wish to update
 * @param electronicSignatureVerified The updated
 *                                    electronicSignatureVerified
 *                                    object. Note the values you
 *                                    are allowed to change are
 *                                    copied from this object. This
 *                                    object is not persisted.
 * @return the updated electronicSignatureVerified
 */
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, ElectronicSignatureVerified electronicSignatureVerified) {
    ElectronicSignatureVerified existingElectronicSignatureVerified = getElectronicSignatureVerifiedOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != existingElectronicSignatureVerified.getCode()) {
        existingElectronicSignatureVerified.setCode(existingElectronicSignatureVerified.getCode());
    }
    if (null != existingElectronicSignatureVerified.getDescription()) {
        existingElectronicSignatureVerified.setDescription(existingElectronicSignatureVerified.getDescription());
    }
    // Note this can potentially result in a NoarkConcurrencyException
    // exception
    existingElectronicSignatureVerified.setVersion(version);
    MetadataHateoas electronicSignatureVerifiedHateoas = new MetadataHateoas(electronicSignatureVerifiedRepository.save(existingElectronicSignatureVerified));
    metadataHateoasHandler.addLinks(electronicSignatureVerifiedHateoas, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingElectronicSignatureVerified));
    return electronicSignatureVerifiedHateoas;
}
Also used : ElectronicSignatureVerified(nikita.common.model.noark5.v4.metadata.ElectronicSignatureVerified) Authorisation(nikita.webapp.security.Authorisation) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas) AfterNoarkEntityUpdatedEvent(nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)

Example 2 with AfterNoarkEntityUpdatedEvent

use of nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class FlowStatusService method handleUpdate.

/**
 * Update a FlowStatus identified by its systemId
 * <p>
 * Copy the values you are allowed to change, code and description
 *
 * @param systemId The systemId of the flowStatus object you wish to update
 * @param flowStatus    The updated flowStatus object. Note the values you
 *                      are allowed to change are copied from this object.
 *                      This object is not persisted.
 * @return the updated flowStatus
 */
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, FlowStatus flowStatus) {
    FlowStatus existingFlowStatus = getFlowStatusOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != existingFlowStatus.getCode()) {
        existingFlowStatus.setCode(existingFlowStatus.getCode());
    }
    if (null != existingFlowStatus.getDescription()) {
        existingFlowStatus.setDescription(existingFlowStatus.getDescription());
    }
    // Note this can potentially result in a NoarkConcurrencyException
    // exception
    existingFlowStatus.setVersion(version);
    MetadataHateoas flowStatusHateoas = new MetadataHateoas(flowStatusRepository.save(existingFlowStatus));
    metadataHateoasHandler.addLinks(flowStatusHateoas, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingFlowStatus));
    return flowStatusHateoas;
}
Also used : Authorisation(nikita.webapp.security.Authorisation) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas) FlowStatus(nikita.common.model.noark5.v4.metadata.FlowStatus) AfterNoarkEntityUpdatedEvent(nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)

Example 3 with AfterNoarkEntityUpdatedEvent

use of nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class FormatService method handleUpdate.

/**
 * Update a Format identified by its systemId
 * <p>
 * Copy the values you are allowed to change, code and description
 *
 * @param systemId The systemId of the format object you wish to update
 * @param format   The updated format object. Note the values you are
 *                 allowed to change are copied from this object. This
 *                 object is not persisted.
 * @return the updated format
 */
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, Format format) {
    Format existingFormat = getFormatOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != existingFormat.getCode()) {
        existingFormat.setCode(existingFormat.getCode());
    }
    if (null != existingFormat.getDescription()) {
        existingFormat.setDescription(existingFormat.getDescription());
    }
    // Note this can potentially result in a NoarkConcurrencyException
    // exception
    existingFormat.setVersion(version);
    MetadataHateoas formatHateoas = new MetadataHateoas(formatRepository.save(existingFormat));
    metadataHateoasHandler.addLinks(formatHateoas, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingFormat));
    return formatHateoas;
}
Also used : Format(nikita.common.model.noark5.v4.metadata.Format) Authorisation(nikita.webapp.security.Authorisation) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas) AfterNoarkEntityUpdatedEvent(nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)

Example 4 with AfterNoarkEntityUpdatedEvent

use of nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class PrecedenceStatusService method handleUpdate.

/**
 * Update a PrecedenceStatus identified by its systemId
 * <p>
 * Copy the values you are allowed to change, code and description
 *
 * @param systemId         The systemId of the precedenceStatus object you wish to
 *                         update
 * @param precedenceStatus The updated precedenceStatus object. Note the
 *                         values you are allowed to change are copied
 *                         from this object. This object is not persisted.
 * @return the updated precedenceStatus
 */
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, PrecedenceStatus precedenceStatus) {
    PrecedenceStatus existingPrecedenceStatus = getPrecedenceStatusOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != existingPrecedenceStatus.getCode()) {
        existingPrecedenceStatus.setCode(existingPrecedenceStatus.getCode());
    }
    if (null != existingPrecedenceStatus.getDescription()) {
        existingPrecedenceStatus.setDescription(existingPrecedenceStatus.getDescription());
    }
    // Note this can potentially result in a NoarkConcurrencyException
    // exception
    existingPrecedenceStatus.setVersion(version);
    MetadataHateoas precedenceStatusHateoas = new MetadataHateoas(precedenceStatusRepository.save(existingPrecedenceStatus));
    metadataHateoasHandler.addLinks(precedenceStatusHateoas, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingPrecedenceStatus));
    return precedenceStatusHateoas;
}
Also used : Authorisation(nikita.webapp.security.Authorisation) PrecedenceStatus(nikita.common.model.noark5.v4.metadata.PrecedenceStatus) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas) AfterNoarkEntityUpdatedEvent(nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)

Example 5 with AfterNoarkEntityUpdatedEvent

use of nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class SignOffMethodService method handleUpdate.

/**
 * Update a SignOffMethod identified by its systemId
 * <p>
 * Copy the values you are allowed to change, code and description
 *
 * @param SignOffMethod
 * @return the updated SignOffMethod
 */
@Override
public MetadataHateoas handleUpdate(String systemId, Long version, SignOffMethod SignOffMethod) {
    SignOffMethod existingSignOffMethod = getSignOffMethodOrThrow(systemId);
    // Copy all the values you are allowed to copy ....
    if (null != existingSignOffMethod.getCode()) {
        existingSignOffMethod.setCode(existingSignOffMethod.getCode());
    }
    if (null != existingSignOffMethod.getDescription()) {
        existingSignOffMethod.setDescription(existingSignOffMethod.getDescription());
    }
    // Note this can potentially result in a NoarkConcurrencyException
    // exception
    existingSignOffMethod.setVersion(version);
    MetadataHateoas SignOffMethodHateoas = new MetadataHateoas(SignOffMethodRepository.save(existingSignOffMethod));
    metadataHateoasHandler.addLinks(SignOffMethodHateoas, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, existingSignOffMethod));
    return SignOffMethodHateoas;
}
Also used : SignOffMethod(nikita.common.model.noark5.v4.metadata.SignOffMethod) Authorisation(nikita.webapp.security.Authorisation) MetadataHateoas(nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas) AfterNoarkEntityUpdatedEvent(nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)

Aggregations

Authorisation (nikita.webapp.security.Authorisation)34 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)34 MetadataHateoas (nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas)17 Counted (com.codahale.metrics.annotation.Counted)15 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 FondsHateoas (nikita.common.model.noark5.v4.hateoas.FondsHateoas)3 Fonds (nikita.common.model.noark5.v4.Fonds)2 CaseFileHateoas (nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)2 Class (nikita.common.model.noark5.v4.Class)1 ClassificationSystem (nikita.common.model.noark5.v4.ClassificationSystem)1 DocumentDescription (nikita.common.model.noark5.v4.DocumentDescription)1 DocumentObject (nikita.common.model.noark5.v4.DocumentObject)1 FondsCreator (nikita.common.model.noark5.v4.FondsCreator)1 Record (nikita.common.model.noark5.v4.Record)1 CaseFile (nikita.common.model.noark5.v4.casehandling.CaseFile)1 RegistryEntry (nikita.common.model.noark5.v4.casehandling.RegistryEntry)1 CorrespondencePartInternal (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal)1 CorrespondencePartPerson (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartPerson)1 CorrespondencePartUnit (nikita.common.model.noark5.v4.casehandling.secondary.CorrespondencePartUnit)1