package org.apereo.cas.web.flow.configurer;

import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.util.ScriptingUtils;
import org.apereo.cas.web.flow.CasWebflowConstants;
import org.apereo.cas.web.support.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.webflow.definition.registry.FlowDefinitionRegistry;
import org.springframework.webflow.engine.ActionState;
import org.springframework.webflow.engine.builder.support.FlowBuilderServices;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;

/**
 * This is {@link GroovyWebflowConfigurer}.
 *
 * @author Misagh Moayyed
 * @since 5.2.0
 */
public class GroovyWebflowConfigurer extends AbstractCasWebflowConfigurer {
    private static final Logger LOGGER = LoggerFactory.getLogger(GroovyWebflowConfigurer.class);

    public GroovyWebflowConfigurer(final FlowBuilderServices flowBuilderServices, final FlowDefinitionRegistry loginFlowDefinitionRegistry,
                                   final ApplicationContext applicationContext, final CasConfigurationProperties casProperties) {
        super(flowBuilderServices, loginFlowDefinitionRegistry, applicationContext, casProperties);
    }

    @Override
    public void doInitialize() throws Exception {
        final Resource script = casProperties.getWebflow().getGroovy().getLocation();
        if (script != null) {
            final Object[] args = new Object[]{this, applicationContext, LOGGER};
            LOGGER.debug("Executing Groovy script [{}] to auto-configure the webflow context", script);
            ScriptingUtils.executeGroovyScript(script, args, Object.class);
        }
    }
}

@@ -149,104 +149,8 @@
 ls;%0A
-import org.apereo.cas.web.flow.CasWebflowConstants;%0Aimport org.apereo.cas.web.support.WebUtils;%0A
 impo
@@ -170,16 +170,16 @@
 Logger;%0A
+
 import o
@@ -385,63 +385,8 @@
 ry;%0A
-import org.springframework.webflow.engine.ActionState;%0A
 impo
@@ -463,174 +463,8 @@
 ces;
-%0Aimport org.springframework.webflow.execution.Action;%0Aimport org.springframework.webflow.execution.Event;%0Aimport org.springframework.webflow.execution.RequestContext;
 %0A%0A/*

fix checkstyle