use of com.evolveum.midpoint.provisioning.ucf.api.ExecuteScriptArgument in project midpoint by Evolveum.
the class ConnectorInstanceConnIdImpl method convertToScriptContext.
private ScriptContext convertToScriptContext(ExecuteProvisioningScriptOperation executeOp) {
// creating script arguments map form the execute script operation
// arguments
Map<String, Object> scriptArguments = new HashMap<String, Object>();
for (ExecuteScriptArgument argument : executeOp.getArgument()) {
scriptArguments.put(argument.getArgumentName(), argument.getArgumentValue());
}
ScriptContext scriptContext = new ScriptContext(executeOp.getLanguage(), executeOp.getTextCode(), scriptArguments);
return scriptContext;
}
use of com.evolveum.midpoint.provisioning.ucf.api.ExecuteScriptArgument in project midpoint by Evolveum.
the class ProvisioningUtil method convertToScriptOperation.
public static ExecuteProvisioningScriptOperation convertToScriptOperation(ProvisioningScriptType scriptType, String desc, PrismContext prismContext) throws SchemaException {
ExecuteProvisioningScriptOperation scriptOperation = new ExecuteProvisioningScriptOperation();
MutablePrismPropertyDefinition scriptArgumentDefinition = prismContext.definitionFactory().createPropertyDefinition(FAKE_SCRIPT_ARGUMENT_NAME, DOMUtil.XSD_STRING);
scriptArgumentDefinition.setMinOccurs(0);
scriptArgumentDefinition.setMaxOccurs(-1);
for (ProvisioningScriptArgumentType argument : scriptType.getArgument()) {
ExecuteScriptArgument arg = new ExecuteScriptArgument(argument.getName(), StaticExpressionUtil.getStaticOutput(argument, scriptArgumentDefinition, desc, ExpressionReturnMultiplicityType.SINGLE, prismContext));
scriptOperation.getArgument().add(arg);
}
scriptOperation.setLanguage(scriptType.getLanguage());
scriptOperation.setTextCode(scriptType.getCode());
if (scriptType.getHost() != null && scriptType.getHost().equals(ProvisioningScriptHostType.CONNECTOR)) {
scriptOperation.setConnectorHost(true);
scriptOperation.setResourceHost(false);
}
if (scriptType.getHost() == null || scriptType.getHost().equals(ProvisioningScriptHostType.RESOURCE)) {
scriptOperation.setConnectorHost(false);
scriptOperation.setResourceHost(true);
}
scriptOperation.setCriticality(scriptType.getCriticality());
return scriptOperation;
}
Aggregations