use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TestMappingDynamicSysVar method testPasswordString.
@Test
public void testPasswordString() throws Exception {
// WHEN
PrismValueDeltaSetTriple<PrismPropertyValue<String>> outputTriple = evaluator.evaluateMappingDynamicReplace("mapping-script-system-variables-password.xml", "testPasswordString", // target
"employeeType", // changed property
new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_VALUE), // changed values
evaluator.createProtectedString("weighAnch0r"));
// THEN
PrismAsserts.assertTripleNoZero(outputTriple);
PrismAsserts.assertTriplePlus(outputTriple, "weighAnch0r");
PrismAsserts.assertTripleMinus(outputTriple, "d3adM3nT3llN0Tal3s");
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class ResourceValidatorImpl method checkSchemaHandlingDefaults.
private void checkSchemaHandlingDefaults(ResourceValidationContext ctx, SchemaHandlingType schemaHandling) {
int defAccount = 0, defEntitlement = 0, defGeneric = 0;
int totalAccount = 0;
for (ResourceObjectTypeDefinitionType def : schemaHandling.getObjectType()) {
if (Boolean.TRUE.equals(def.isDefault())) {
switch(fillDefault(def.getKind())) {
case ACCOUNT:
defAccount++;
break;
case ENTITLEMENT:
defEntitlement++;
break;
case GENERIC:
defGeneric++;
break;
default:
throw new IllegalStateException();
}
}
if (fillDefault(def.getKind()) == ShadowKindType.ACCOUNT) {
totalAccount++;
}
}
checkMultipleDefaultDefinitions(ctx, ShadowKindType.ACCOUNT, defAccount);
checkMultipleDefaultDefinitions(ctx, ShadowKindType.ENTITLEMENT, defEntitlement);
checkMultipleDefaultDefinitions(ctx, ShadowKindType.GENERIC, defGeneric);
if (totalAccount > 0 && defAccount == 0) {
ctx.validationResult.add(Issue.Severity.INFO, CAT_SCHEMA_HANDLING, C_NO_DEFAULT_ACCOUNT_SCHEMA_HANDLING_DEFAULT_DEFINITION, getString(ctx.bundle, CLASS_DOT + C_NO_DEFAULT_ACCOUNT_SCHEMA_HANDLING_DEFAULT_DEFINITION), ctx.resourceRef, new ItemPath(ResourceType.F_SCHEMA_HANDLING, SchemaHandlingType.F_OBJECT_TYPE));
}
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class Visualizer method createSceneItemCommon.
private SceneItemImpl createSceneItemCommon(Item<?, ?> item) {
SceneItemImpl si = new SceneItemImpl(createSceneItemName(item));
ItemDefinition<?> def = item.getDefinition();
if (def != null) {
si.setOperational(def.isOperational());
}
si.setSourceItem(item);
si.setSourceRelPath(new ItemPath(item.getElementName()));
return si;
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class TriggerScannerTaskHandler method removeTrigger.
private void removeTrigger(PrismObject<ObjectType> object, PrismContainerValue<TriggerType> triggerCVal, Task task, PrismContainerDefinition<TriggerType> triggerContainerDef) {
ContainerDelta<TriggerType> triggerDelta = triggerContainerDef.createEmptyDelta(new ItemPath(F_TRIGGER));
triggerDelta.addValuesToDelete(triggerCVal.clone());
Collection<? extends ItemDelta> modifications = MiscSchemaUtil.createCollection(triggerDelta);
// This is detached result. It will not take part of the task result. We do not really care.
OperationResult result = new OperationResult(TriggerScannerTaskHandler.class.getName() + ".removeTrigger");
try {
repositoryService.modifyObject(object.getCompileTimeClass(), object.getOid(), modifications, result);
result.computeStatus();
task.recordObjectActionExecuted(object, ChangeType.MODIFY, null);
} catch (ObjectNotFoundException e) {
// Object is gone. Ergo there are no triggers left. Ergo the trigger was removed.
// Ergo this is not really an error.
task.recordObjectActionExecuted(object, ChangeType.MODIFY, e);
LOGGER.trace("Unable to remove trigger from {}: {} (but this is probably OK)", object, e.getMessage(), e);
} catch (SchemaException | ObjectAlreadyExistsException e) {
task.recordObjectActionExecuted(object, ChangeType.MODIFY, e);
LOGGER.error("Unable to remove trigger from {}: {}", object, e.getMessage(), e);
} catch (Throwable t) {
task.recordObjectActionExecuted(object, ChangeType.MODIFY, t);
throw t;
} finally {
// maybe OK (absolute correctness is not quite important here)
task.markObjectActionExecutedBoundary();
}
}
use of com.evolveum.midpoint.prism.path.ItemPath in project midpoint by Evolveum.
the class FocusProjectionsTabPanel method updateShadowActivation.
private void updateShadowActivation(AjaxRequestTarget target, List<FocusSubwrapperDto<ShadowType>> accounts, boolean enabled) {
if (!isAnyProjectionSelected(target, projectionModel)) {
return;
}
for (FocusSubwrapperDto<ShadowType> account : accounts) {
if (!account.isLoadedOK()) {
continue;
}
ObjectWrapper<ShadowType> wrapper = account.getObject();
ContainerWrapper<ActivationType> activation = wrapper.findContainerWrapper(new ItemPath(ShadowType.F_ACTIVATION));
if (activation == null) {
warn(getString("pageAdminFocus.message.noActivationFound", wrapper.getDisplayName()));
continue;
}
PropertyWrapper enabledProperty = (PropertyWrapper) activation.findPropertyWrapper(ActivationType.F_ADMINISTRATIVE_STATUS);
if (enabledProperty == null || enabledProperty.getValues().size() != 1) {
warn(getString("pageAdminFocus.message.noEnabledPropertyFound", wrapper.getDisplayName()));
continue;
}
ValueWrapper value = (ValueWrapper) enabledProperty.getValues().get(0);
ActivationStatusType status = enabled ? ActivationStatusType.ENABLED : ActivationStatusType.DISABLED;
((PrismPropertyValue) value.getValue()).setValue(status);
wrapper.setSelected(false);
}
target.add(getFeedbackPanel(), get(createComponentPath(ID_SHADOWS)));
}
Aggregations