use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class CorrelationConfirmationEvaluator method matchUserCorrelationRule.
public <F extends FocusType> boolean matchUserCorrelationRule(Class<F> focusType, PrismObject<ShadowType> currentShadow, PrismObject<F> userType, ObjectSynchronizationType synchronization, ResourceType resourceType, SystemConfigurationType configurationType, Task task, OperationResult result) {
if (synchronization == null) {
LOGGER.warn("Resource does not support synchronization. Skipping evaluation correlation/confirmation for {} and {}", userType, currentShadow);
return false;
}
List<ConditionalSearchFilterType> conditionalFilters = synchronization.getCorrelation();
try {
for (ConditionalSearchFilterType conditionalFilter : conditionalFilters) {
if (matchUserCorrelationRule(focusType, currentShadow, userType, resourceType, configurationType, conditionalFilter, task, result)) {
LOGGER.debug("SYNCHRONIZATION: CORRELATION: expression for {} match user: {}", currentShadow, userType);
return true;
}
}
} catch (SchemaException ex) {
throw new SystemException("Failed to match user using correlation rule. " + ex.getMessage(), ex);
}
LOGGER.debug("SYNCHRONIZATION: CORRELATION: expression for {} does not match user: {}", new Object[] { currentShadow, userType });
return false;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class DiscoverConnectorsExecutor method rebindResources.
private void rebindResources(Map<String, String> rebindMap, ExecutionContext context, OperationResult result) throws ScriptExecutionException {
List<PrismObject<ResourceType>> resources;
try {
resources = modelService.searchObjects(ResourceType.class, null, null, null, result);
} catch (SchemaException | ConfigurationException | ObjectNotFoundException | CommunicationException | SecurityViolationException | ExpressionEvaluationException e) {
throw new ScriptExecutionException("Couldn't list resources: " + e.getMessage(), e);
}
for (PrismObject<ResourceType> resource : resources) {
if (resource.asObjectable().getConnectorRef() != null) {
String connectorOid = resource.asObjectable().getConnectorRef().getOid();
String newOid = rebindMap.get(connectorOid);
if (newOid != null) {
String msg = "resource " + resource + " from connector " + connectorOid + " to new one: " + newOid;
LOGGER.info("Rebinding " + msg);
ReferenceDelta refDelta = ReferenceDelta.createModificationReplace(ResourceType.F_CONNECTOR_REF, resource.getDefinition(), newOid);
ObjectDelta<ResourceType> objDelta = ObjectDelta.createModifyDelta(resource.getOid(), refDelta, ResourceType.class, prismContext);
operationsHelper.applyDelta(objDelta, context, result);
context.println("Rebound " + msg);
}
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class PurgeSchemaExecutor method execute.
@Override
public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException {
PipelineData output = PipelineData.createEmpty();
for (PipelineItem item : input.getData()) {
PrismValue value = item.getValue();
OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult);
context.checkTaskStop();
if (value instanceof PrismObjectValue && ((PrismObjectValue<Objectable>) value).asObjectable() instanceof ResourceType) {
PrismObject<ResourceType> resourceTypePrismObject = ((PrismObjectValue) value).asPrismObject();
ResourceType resourceType = resourceTypePrismObject.asObjectable();
long started = operationsHelper.recordStart(context, resourceType);
ObjectDelta delta = createDelta(resourceTypePrismObject.asObjectable());
try {
if (delta != null) {
operationsHelper.applyDelta(delta, ModelExecuteOptions.createRaw(), context, result);
context.println("Purged schema information from " + resourceTypePrismObject);
output.addValue(operationsHelper.getObject(ResourceType.class, resourceTypePrismObject.getOid(), true, context, result).getValue(), item.getResult());
} else {
context.println("There's no schema information to be purged in " + value);
output.addValue(resourceTypePrismObject.getValue(), item.getResult());
}
operationsHelper.recordEnd(context, resourceType, started, null);
} catch (Throwable ex) {
operationsHelper.recordEnd(context, resourceType, started, ex);
Throwable exception = processActionException(ex, NAME, value, context);
context.println("Couldn't purge schema information from " + resourceTypePrismObject + exceptionSuffix(exception));
}
} else {
//noinspection ThrowableNotThrown
processActionException(new ScriptExecutionException("Item is not a PrismObject<ResourceType>"), NAME, value, context);
}
operationsHelper.trimAndCloneResult(result, globalResult, context);
}
return output;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class ResourceListPanel method initColumns.
private List<IColumn> initColumns() {
List<IColumn> columns = new ArrayList<IColumn>();
IColumn column = new LinkColumn<SelectableBean<ResourceType>>(createStringResource("ObjectType.name"), "name", "value.name") {
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ResourceType>> rowModel) {
ResourceType resource = rowModel.getObject().getValue();
resourceSelectedPerformed(target, resource);
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.
the class SynchronizationUtils method isPolicyApplicable.
public static boolean isPolicyApplicable(PrismObject<? extends ShadowType> currentShadow, ObjectSynchronizationType synchronizationPolicy, PrismObject<ResourceType> resource) throws SchemaException {
ShadowType currentShadowType = currentShadow.asObjectable();
// objectClass
QName shadowObjectClass = currentShadowType.getObjectClass();
Validate.notNull(shadowObjectClass, "No objectClass in currentShadow");
return isPolicyApplicable(shadowObjectClass, currentShadowType.getKind(), currentShadowType.getIntent(), synchronizationPolicy, resource);
}
Aggregations