PrismObjectValue objectValue = (PrismObjectValue) value; ObjectReferenceType ref = new ObjectReferenceType(); ref.setType(objectValue.asPrismObject().getDefinition().getTypeName()); // todo check the definition is present
OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult); context.checkTaskStop(); if (value instanceof PrismObjectValue && FocusType.class.isAssignableFrom(((PrismObjectValue) value).asPrismObject().getCompileTimeClass())) { PrismObject<FocusType> focalPrismObject = ((PrismObjectValue) value).asPrismObject(); FocusType focusType = focalPrismObject.asObjectable(); long started = operationsHelper.recordStart(context, focusType);
if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectBean = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectBean);
if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType object = prismObject.asObjectable(); if (object instanceof TaskType) {
@Test public void test500ScriptingUsers() throws Exception { final String TEST_NAME = "test500ScriptingUsers"; TestUtil.displayTestTitle(this, TEST_NAME); // GIVEN Task task = createTask(DOT_CLASS + TEST_NAME); OperationResult result = task.getResult(); PrismProperty<ScriptingExpressionType> expression = parseAnyData(SCRIPTING_USERS_FILE); // WHEN ExecutionContext output = scriptingExpressionEvaluator.evaluateExpression(expression.getAnyValue().getValue(), task, result); // THEN dumpOutput(output, result); result.computeStatus(); TestUtil.assertSuccess(result); PipelineData data = output.getFinalOutput(); assertEquals("Unexpected # of items in output", 5, data.getData().size()); Set<String> realOids = new HashSet<>(); for (PipelineItem item : data.getData()) { PrismValue value = item.getValue(); PrismObject<UserType> user = ((PrismObjectValue<UserType>) value).asPrismObject(); assertEquals("Description not set", "Test", user.asObjectable().getDescription()); realOids.add(user.getOid()); assertSuccess(item.getResult()); } assertEquals("Unexpected OIDs in output", Sets.newHashSet(Arrays.asList(USER_ADMINISTRATOR_OID, USER_JACK_OID, USER_BARBOSSA_OID, USER_GUYBRUSH_OID, USER_ELAINE_OID)), realOids); }
if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType);
@Override public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException { for (PipelineItem item: input.getData()) { PrismValue value = item.getValue(); OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult); context.checkTaskStop(); if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectBean = prismObject.asObjectable(); if (objectBean instanceof ShadowType || objectBean instanceof ResourceType) { try { provisioningService.applyDefinition(prismObject, context.getTask(), result); result.computeStatus(); } catch (Throwable ex) { result.recordFatalError("Couldn't reencrypt object", ex); Throwable exception = processActionException(ex, NAME, value, context); context.println("Couldn't apply definition to " + prismObject.toString() + exceptionSuffix(exception)); } } } else { //noinspection ThrowableNotThrown processActionException(new ScriptExecutionException("Item is not a PrismObject"), NAME, value, context); } operationsHelper.trimAndCloneResult(result, globalResult, context); } return input; } }
context.checkTaskStop(); if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof ResourceType) { PrismObject<ResourceType> resourceTypePrismObject = ((PrismObjectValue) value).asPrismObject(); ResourceType resourceType = resourceTypePrismObject.asObjectable(); long started = operationsHelper.recordStart(context, resourceType);
context.checkTaskStop(); if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof ConnectorHostType) { PrismObject<ConnectorHostType> connectorHostTypePrismObject = ((PrismObjectValue) value).asPrismObject(); Set<ConnectorType> newConnectors; long started = operationsHelper.recordStart(context, connectorHostTypePrismObject.asObjectable());
@Override public PipelineData execute(ActionExpressionType expression, PipelineData input, ExecutionContext context, OperationResult globalResult) throws ScriptExecutionException { ModelExecuteOptions executionOptions = getOptions(expression, input, context, globalResult); boolean dryRun = getParamDryRun(expression, input, context, globalResult); for (PipelineItem item : input.getData()) { PrismValue value = item.getValue(); OperationResult result = operationsHelper.createActionResult(item, this, context, globalResult); context.checkTaskStop(); if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType); Throwable exception = null; try { operationsHelper.applyDelta(createDeleteDelta(objectType), executionOptions, dryRun, context, result); operationsHelper.recordEnd(context, objectType, started, null); } catch (Throwable ex) { operationsHelper.recordEnd(context, objectType, started, ex); exception = processActionException(ex, NAME, value, context); } context.println((exception != null ? "Attempted to delete " : "Deleted ") + prismObject.toString() + optionsSuffix(executionOptions, dryRun) + exceptionSuffix(exception)); } else { //noinspection ThrowableNotThrown processActionException(new ScriptExecutionException("Item is not a PrismObject"), NAME, value, context); } operationsHelper.trimAndCloneResult(result, globalResult, context); } return input; }
if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof FocusType) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType);
context.checkTaskStop(); if (value instanceof PrismObjectValue && ((PrismObjectValue) value).asObjectable() instanceof ResourceType) { PrismObject<ResourceType> resourceTypePrismObject = ((PrismObjectValue) value).asPrismObject(); ResourceType resourceType = resourceTypePrismObject.asObjectable(); long started = operationsHelper.recordStart(context, resourceType);
if (value instanceof PrismObjectValue) { @SuppressWarnings({ "unchecked", "raw" }) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType);
if (value instanceof PrismObjectValue) { @SuppressWarnings({"unchecked", "raw"}) PrismObject<? extends ObjectType> prismObject = ((PrismObjectValue) value).asPrismObject(); ObjectType objectType = prismObject.asObjectable(); long started = operationsHelper.recordStart(context, objectType);
context.checkTaskStop(); if (value instanceof PrismObjectValue) { PrismObject<? extends ObjectType> object = ((PrismObjectValue) value).asPrismObject(); ObjectType objectBean = object.asObjectable(); long started = operationsHelper.recordStart(context, objectBean);
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);