use of com.evolveum.midpoint.util.LocalizableMessageBuilder in project midpoint by Evolveum.
the class PageCertDefinitions method createCampaignPerformed.
private void createCampaignPerformed(AjaxRequestTarget target, AccessCertificationDefinitionType definition) {
LOGGER.debug("Create certification campaign performed for {}", definition.asPrismObject());
OperationResult result = new OperationResult(OPERATION_CREATE_CAMPAIGN);
try {
Task task = createSimpleTask(OPERATION_CREATE_CAMPAIGN);
if (!Boolean.TRUE.equals(definition.isAdHoc())) {
AccessCertificationCampaignType campaign = getCertificationService().createCampaign(definition.getOid(), task, result);
result.setUserFriendlyMessage(new LocalizableMessageBuilder().key("PageCertDefinitions.campaignWasCreated").arg(getOrig(campaign.getName())).build());
} else {
result.recordWarning(createStringResource("PageCertDefinitions.message.createCampaignPerformed.warning", definition.getName()).getString());
}
} catch (Exception ex) {
result.recordFatalError(ex);
} finally {
result.computeStatusIfUnknown();
}
showResult(result);
target.add(getFeedbackPanel());
}
use of com.evolveum.midpoint.util.LocalizableMessageBuilder in project midpoint by Evolveum.
the class ObjectPolicyAspectPart method createDefaultProcessName.
private <T extends ObjectType> LocalizableMessage createDefaultProcessName(ModelInvocationContext<T> ctx, ObjectDelta<T> deltaToApprove) {
ObjectType focus = ctx.getFocusObjectNewOrOld();
String opKey;
if (deltaToApprove.isAdd()) {
opKey = "Added";
} else if (deltaToApprove.isDelete()) {
opKey = "Deleted";
} else {
opKey = "Modified";
}
return new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_SHORT_MESSAGE_KEY_PREFIX + "objectModification.toBe" + opKey).args(ObjectTypeUtil.createDisplayInformation(asPrismObject(focus), false)).build();
}
use of com.evolveum.midpoint.util.LocalizableMessageBuilder in project midpoint by Evolveum.
the class ObjectModificationConstraintEvaluator method createMessage.
private <AH extends AssignmentHolderType> LocalizableMessage createMessage(JAXBElement<ModificationPolicyConstraintType> constraint, PolicyRuleEvaluationContext<AH> rctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
String keyPostfix = createStateKey(rctx) + createOperationKey(rctx);
LocalizableMessage builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_KEY_PREFIX + CONSTRAINT_KEY_PREFIX + keyPostfix).args(ObjectTypeUtil.createDisplayInformation(rctx.focusContext.getObjectAny(), true)).build();
return evaluatorHelper.createLocalizableMessage(constraint, rctx, builtInMessage, result);
}
use of com.evolveum.midpoint.util.LocalizableMessageBuilder in project midpoint by Evolveum.
the class ObjectModificationConstraintEvaluator method createShortMessage.
private <AH extends AssignmentHolderType> LocalizableMessage createShortMessage(JAXBElement<ModificationPolicyConstraintType> constraint, PolicyRuleEvaluationContext<AH> rctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
String keyPostfix = createStateKey(rctx) + createOperationKey(rctx);
LocalizableMessage builtInMessage = new LocalizableMessageBuilder().key(SchemaConstants.DEFAULT_POLICY_CONSTRAINT_SHORT_MESSAGE_KEY_PREFIX + CONSTRAINT_KEY_PREFIX + keyPostfix).args(ObjectTypeUtil.createDisplayInformation(rctx.focusContext.getObjectAny(), false)).build();
return evaluatorHelper.createLocalizableShortMessage(constraint, rctx, builtInMessage, result);
}
use of com.evolveum.midpoint.util.LocalizableMessageBuilder in project midpoint by Evolveum.
the class AlwaysTrueConstraintEvaluator method createBuiltInMessage.
@NotNull
private <AH extends AssignmentHolderType> LocalizableMessage createBuiltInMessage(String keyPrefix, JAXBElement<AlwaysTruePolicyConstraintType> constraintElement, PolicyRuleEvaluationContext<AH> ctx, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException {
AlwaysTruePolicyConstraintType constraint = constraintElement.getValue();
List<Object> args = new ArrayList<>();
args.add(evaluatorHelper.createBeforeAfterMessage(ctx));
String keySuffix;
if (constraint.getName() != null) {
args.add(constraint.getName());
keySuffix = KEY_NAMED;
} else {
keySuffix = KEY_UNNAMED;
}
LocalizableMessage builtInMessage = new LocalizableMessageBuilder().key(keyPrefix + keySuffix).args(args).build();
return evaluatorHelper.createLocalizableMessage(constraintElement, ctx, builtInMessage, result);
}
Aggregations