Search in sources :

Example 1 with ExecuteScriptArgument

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;
}
Also used : ExecuteScriptArgument(com.evolveum.midpoint.provisioning.ucf.api.ExecuteScriptArgument) ScriptContext(org.identityconnectors.framework.common.objects.ScriptContext) ConnectorObject(org.identityconnectors.framework.common.objects.ConnectorObject) GuardedString(org.identityconnectors.common.security.GuardedString)

Example 2 with ExecuteScriptArgument

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;
}
Also used : ExecuteScriptArgument(com.evolveum.midpoint.provisioning.ucf.api.ExecuteScriptArgument) ExecuteProvisioningScriptOperation(com.evolveum.midpoint.provisioning.ucf.api.ExecuteProvisioningScriptOperation)

Aggregations

ExecuteScriptArgument (com.evolveum.midpoint.provisioning.ucf.api.ExecuteScriptArgument)2 ExecuteProvisioningScriptOperation (com.evolveum.midpoint.provisioning.ucf.api.ExecuteProvisioningScriptOperation)1 GuardedString (org.identityconnectors.common.security.GuardedString)1 ConnectorObject (org.identityconnectors.framework.common.objects.ConnectorObject)1 ScriptContext (org.identityconnectors.framework.common.objects.ScriptContext)1