Search in sources :

Example 1 with PolicyDocumentIsInconsistentException

use of io.imunity.furms.api.validation.exceptions.PolicyDocumentIsInconsistentException in project furms by unity-idm.

the class PolicyDocumentFormView method savePolicyDocument.

private void savePolicyDocument(boolean withRevision) {
    PolicyDocumentFormModel policyDocumentFormModel = binder.getBean();
    PolicyDocument policyDocument = PolicyDocumentFormModelMapper.map(policyDocumentFormModel);
    try {
        if (policyDocument.id == null)
            policyDocumentService.create(policyDocument);
        else if (withRevision)
            policyDocumentService.updateWithRevision(policyDocument);
        else
            policyDocumentService.update(policyDocument);
        UI.getCurrent().navigate(PolicyDocumentsView.class);
    } catch (DuplicatedNameValidationError e) {
        showErrorNotification(getTranslation("name.duplicated.error.message"));
    } catch (PolicyDocumentIsInconsistentException e) {
        showErrorNotification(getTranslation("policy.document.terminal-state.message"));
    } catch (Exception e) {
        showErrorNotification(getTranslation("base.error.message"));
        throw e;
    }
}
Also used : DuplicatedNameValidationError(io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError) PolicyDocumentIsInconsistentException(io.imunity.furms.api.validation.exceptions.PolicyDocumentIsInconsistentException) PolicyDocument(io.imunity.furms.domain.policy_documents.PolicyDocument) PolicyDocumentIsInconsistentException(io.imunity.furms.api.validation.exceptions.PolicyDocumentIsInconsistentException)

Aggregations

DuplicatedNameValidationError (io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError)1 PolicyDocumentIsInconsistentException (io.imunity.furms.api.validation.exceptions.PolicyDocumentIsInconsistentException)1 PolicyDocument (io.imunity.furms.domain.policy_documents.PolicyDocument)1