@Override public Map<String, String> getSecurityQuestions(final String username) { return ScriptingUtils.executeGroovyScript(this.groovyResource, "getSecurityQuestions", new Object[]{username, LOGGER}, Map.class, true); } }
/** * Gets object instance from groovy resource. * * @param <T> the type parameter * @param resource the resource * @param expectedType the expected type * @return the object instance from groovy resource */ public static <T> T getObjectInstanceFromGroovyResource(final Resource resource, final Class<T> expectedType) { return getObjectInstanceFromGroovyResource(resource, ArrayUtils.EMPTY_CLASS_ARRAY, ArrayUtils.EMPTY_OBJECT_ARRAY, expectedType); }
private void compileScriptResource(final Resource script) { this.groovyScript = ScriptingUtils.parseGroovyScript(script, true); }
/** * Is inline groovy script ?. * * @param script the script * @return the boolean */ public static boolean isInlineGroovyScript(final String script) { return getMatcherForInlineGroovyScript(script).find(); }
private void writeAccountToGroovyResource(final ConsentDecision decision) { watchableScript.execute("write", Boolean.class, decision, LOGGER); }
public GroovyScriptInterruptInquirer(final Resource resource) { this.watchableScript = new WatchableGroovyScriptResource(resource); }
@Override public boolean send(final String from, final String to, final String message) { return ScriptingUtils.executeGroovyScript(this.groovyResource, new Object[]{from, to, message, LOGGER}, Boolean.class, true); } }
@Override public String transform(final String formUserId) { return ScriptingUtils.executeGroovyScript(this.script, new Object[]{formUserId, LOGGER}, String.class, true); } }
@Override public boolean supports(final Credential credential) { return ScriptingUtils.executeGroovyScript(this.groovyResource, "supports", new Object[]{credential, LOGGER}, Boolean.class, true); } }
@Override public Principal createPrincipal(final String id, final Map<String, Object> attributes) { return ScriptingUtils.executeGroovyScript(this.groovyResource, new Object[]{id, attributes, LOGGER}, Principal.class, true); } }
@Override public void decorate(final RequestContext requestContext, final ApplicationContext applicationContext) { ScriptingUtils.executeGroovyScript(groovyScript, new Object[]{requestContext, applicationContext, LOGGER}, Void.class, true); } }
/** * Execute. * * @param <T> the type parameter * @param args the args * @param clazz the clazz * @return the result */ public <T> T execute(final Object[] args, final Class<T> clazz) { if (this.groovyScript != null) { return ScriptingUtils.executeGroovyScript(this.groovyScript, args, clazz, true); } return null; }
@Override public boolean process(final AuthenticationTransaction transaction) throws AuthenticationException { return ScriptingUtils.executeGroovyScript(this.groovyResource, new Object[]{transaction, LOGGER}, Boolean.class, true); }
@Override public String findUsername(final String email) { return ScriptingUtils.executeGroovyScript(this.groovyResource, "findUsername", new Object[]{email, LOGGER}, String.class, true); }
@Override public String findEmail(final String username) { return ScriptingUtils.executeGroovyScript(this.groovyResource, "findEmail", new Object[]{username, LOGGER}, String.class, true); }
/** * Execute groovy script. * * @param <T> the type parameter * @param groovyScript the groovy script * @param methodName the method name * @param clazz the clazz * @return the t */ public static <T> T executeGroovyScript(final Resource groovyScript, final String methodName, final Class<T> clazz) { return executeGroovyScript(groovyScript, methodName, ArrayUtils.EMPTY_OBJECT_ARRAY, clazz, false); }
/** * Execute groovy script via run object. * * @param <T> the type parameter * @param groovyScript the groovy script * @param args the args * @param clazz the clazz * @param failOnError the fail on error * @return the object */ public static <T> T executeGroovyScript(final Resource groovyScript, final Object[] args, final Class<T> clazz, final boolean failOnError) { return executeGroovyScript(groovyScript, "run", args, clazz, failOnError); }
/** * Execute groovy script. * * @param <T> the type parameter * @param groovyObject the groovy object * @param args the args * @param clazz the clazz * @param failOnError the fail on error * @return the result */ public static <T> T executeGroovyScript(final GroovyObject groovyObject, final Object[] args, final Class<T> clazz, final boolean failOnError) { return executeGroovyScript(groovyObject, "run", args, clazz, failOnError); }
/** * Execute t. * * @param <T> the type parameter * @param methodName the method name * @param clazz the clazz * @param args the args * @return the t */ public <T> T execute(final String methodName, final Class<T> clazz, final Object... args) { if (this.groovyScript != null) { return ScriptingUtils.executeGroovyScript(this.groovyScript, methodName, args, clazz, true); } return null; } }
/** * Execute groovy script t. * * @param <T> the type parameter * @param groovyScript the groovy script * @param methodName the method name * @param clazz the clazz * @param args the args * @return the type to return */ public static <T> T executeGroovyScript(final Resource groovyScript, final String methodName, final Class<T> clazz, final Object... args) { return executeGroovyScript(groovyScript, methodName, args, clazz, false); }