java.lang.AssertionError:expected: 1, actual: 0 spring webflow junit - junit4

When I call method using EasyMock and set the expectation for the method call, in which method return result is Map.In my test case the return result is not taken by spring webflow. Method is expecting the RequestContext of spring webflow that is org.springframework.webflow.execution.RequestContext . I am trying to pass the MockRequestContext in junit test case but its not working
Below is the error
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#41e68d87 targetAction = [EvaluateAction#49ff7d8c expression = setErrorMessages.getErrorMessagesMap(flowRequestContext), resultExpression = flowScope.errorMessageMap], attributes = map[[empty]]] in state 'set_error_in_scope' of flow 'shclogin-flow' -- action execution attributes were 'map[[empty]]'
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Transition.execute(Transition.java:228)
at org.springframework.webflow.engine.DecisionState.doEnter(DecisionState.java:51)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Transition.execute(Transition.java:228)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:395)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
at org.springframework.webflow.engine.support.TransitionExecutingFlowExecutionExceptionHandler.handle(TransitionExecutingFlowExecutionExceptionHandler.java:111)
at org.springframework.webflow.engine.FlowExecutionExceptionHandlerSet.handleException(FlowExecutionExceptionHandlerSet.java:109)
at org.springframework.webflow.engine.Flow.handleException(Flow.java:600)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.tryFlowHandlers(FlowExecutionImpl.java:647)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleException(FlowExecutionImpl.java:603)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:263)
at org.springframework.webflow.test.execution.AbstractFlowExecutionTests.resumeFlow(AbstractFlowExecutionTests.java:136)
at com.shc.ecom.test.usr.TestloginlFlow.testAction(TestloginlFlow.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.expression.ExpressionInvocationTargetException: A problem occurred when trying to execute method 'getErrorMessagesMap' on object of type [com.shc.ecom.sso.cas.web.flow.SetErrorMessages$$EnhancerByCGLIB$$500571b9]
at org.springframework.expression.spel.ast.MethodReference.throwSimpleExceptionIfPossible(MethodReference.java:227)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:133)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
at org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
... 32 more
Caused by: java.lang.AssertionError:
Unexpected method call SetErrorMessages.getErrorMessagesMap([RequestControlContextImpl#c94fd30 externalContext = org.springframework.webflow.test.MockExternalContext#36328d33, currentEvent = [null], requestScope = map[[empty]], attributes = map[[empty]], messageContext = [DefaultMessageContext#2c4d1ac sourceMessages = map[[null] -> list[[empty]]]], flowExecution = [FlowExecutionImpl#7f0d96f2 flow = 'shclogin-flow', flowSessions = list[[FlowSessionImpl#545b995e flow = 'shclogin-flow', state = 'set_error_in_scope', scope = map[[empty]]]]]]):
SetErrorMessages.getErrorMessagesMap(flowRequestContext): expected: 1, actual: 0
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:85)
at org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:94)
at com.shc.ecom.sso.cas.web.flow.SetErrorMessages$$EnhancerByCGLIB$$500571b9.getErrorMessagesMap(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:112)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
... 42 more
Test Cases
public class TestloginlFlow extends AbstractXmlFlowExecutionTests {
UsrInitialFlowSetupAction usrInitialFlowSetupAction;
AuthenticationViaFormAction authenticationViaFormAction;
UsrIsSYWRUserCheckAction usrIsSYWRUserCheckAction;
SSOGatewayService ssoGatewayService;
CustomGenerateServiceTicketAction generateServiceTicketAction;
CentralAuthenticationService centralAuthenticateService;
CookieRetrievingCookieGenerator warnCookieGenerator;
USRAuthenticationViaFormAction usrAuthenticationViaFormAction;
List<ArgumentExtractor> argumentExtractor;
SetErrorMessages setErrorMessages;
MockRequestContext flowRequestContext;
#Override
protected void setUp() throws Exception {
usrInitialFlowSetupAction = EasyMock.createMock("usrInitialFlowSetupAction", UsrInitialFlowSetupAction.class); // usrAuthenticationViaFormAction
setErrorMessages = EasyMock.createMock("SetErrorMessages", SetErrorMessages.class);
usrAuthenticationViaFormAction = EasyMock.createMock("usrAuthenticationViaFormAction",
USRAuthenticationViaFormAction.class);
usrIsSYWRUserCheckAction = EasyMock.createMock("usrIsSYWRUserCheckAction", UsrIsSYWRUserCheckAction.class); // ssoGatewayService
ssoGatewayService = EasyMock.createMock("ssoGatewayService", SSOGatewayService.class);
generateServiceTicketAction = EasyMock.createMock("generateServiceTicketAction",
CustomGenerateServiceTicketAction.class);
centralAuthenticateService = EasyMock.createMock("centralAuthenticateService",
CentralAuthenticationService.class);
warnCookieGenerator = EasyMock.createMock("centralAuthenticateService", CookieRetrievingCookieGenerator.class);
argumentExtractor = EasyMock.createMock("argumentExtractors", List.class);
generateServiceTicketAction = EasyMock.createMock("generateServiceTicketAction",
CustomGenerateServiceTicketAction.class);
flowRequestContext = EasyMock.createMock("flowRequestContext", MockRequestContext.class);
}
#Override
protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
return resourceFactory.createFileResource("src/main/webapp/WEB-INF/usr/flows/shclogin-flow.xml");
}
#Override
protected void registerMockFlowBeans(ConfigurableBeanFactory builderContext) {
builderContext.registerSingleton("usrInitialFlowSetupAction", usrInitialFlowSetupAction);
builderContext.registerSingleton("argumentExtractors", argumentExtractor);
builderContext.registerSingleton("warnCookieGenerator", warnCookieGenerator);
builderContext.registerSingleton("centralAuthenticateService", centralAuthenticateService);
builderContext.registerSingleton("usrAuthenticationViaFormAction", usrAuthenticationViaFormAction);
builderContext.registerSingleton("usrIsSYWRUserCheckAction", usrIsSYWRUserCheckAction);
builderContext.registerSingleton("ssoGatewayService", ssoGatewayService);
builderContext.registerSingleton("generateServiceTicketAction", generateServiceTicketAction);
builderContext.registerSingleton("ticketGrantingTicketCookieGenerator", warnCookieGenerator);
builderContext.registerSingleton("setErrorMessages", setErrorMessages);
builderContext.registerSingleton("flowRequestContext", flowRequestContext);
}
public void testAction1() throws Exception {
// setCurrentState("initialFlowSetup");
MockExternalContext ctx = new MockExternalContext();
MutableAttributeMap input = new LocalAttributeMap();
input.put("loginId", "12");
input.put("logonPassword", "ankur");
input.put("sourceSiteId", "3");
input.put("fullpage", "");
input.put("partialuser", "true");
input.put("service", "");
input.put("redirectUrl", "");
input.put("sywLogin", "er4fju");
input.put("tncmodal", null);
input.put("modifyservice", "no");
// input.put("reglogin", false);
// input.put("enrollresponse", 200);
input.put("shcCaptchaKey", null);
input.put("ticketGrantingTicketId", "1234");
Map<String, Object> parameters = new HashMap<>();
parameters.put("renew", "yes");
ParameterMap requestParameterMap = new LocalParameterMap(parameters);
ctx.setRequestParameterMap(requestParameterMap);
MockRequestContext context = new MockRequestContext();
Event event = new Event(this, "success");
EasyMock.expect(usrInitialFlowSetupAction.doExecute(flowRequestContext)).andReturn(event);
EasyMock.replay(usrInitialFlowSetupAction);
/*
* FlowExecution flowExecution = getFlowExecution(); FlowSession session
* = flowExecution.getActiveSession();
* session.getScope().put("ticketGrantingTicketId", "ee");
*/
// updateFlowExecution(flowExecution);
startFlow(input, ctx);
}
public void testAction() throws Exception {
setCurrentState("initialFlowSetup");
FlowExecutionContext flowExecution = getFlowExecution();
MockRequestContext context = new MockRequestContext();
MockExternalContext ctx = new MockExternalContext();
//context.setExternalContext(ctx);
//context.setFlowExecutionContext(flowExecution);
//context.setActiveSession(flowExecution.getActiveSession());
Map<String, Object> model = new HashMap<String, Object>();
model.put("originalUrl", 123);
model.put("parameters", "xyz");
// context.getFlowScope().put("errorMessageMap", model);
ctx.setEventId("error");
EasyMock.expect(setErrorMessages.getErrorMessagesMap(flowRequestContext)).andReturn(model);
EasyMock.replay(setErrorMessages);
resumeFlow(ctx);
assertResponseWrittenEquals("/loginfailure", ctx);
assertFlowExecutionEnded();
}
}
xml flow
version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"
start-state="initialFlowSetup" >
<input name="loginId" value="requestScope.loginId" />
<input name="logonPassword" value="requestScope.logonPassword" />
<input name="sourceSiteId" value="requestScope.sourceSiteId" />
<input name="fullpage" value="requestScope.fullpage" />
<input name="partialuser" value="requestScope.partialuser" />
<input name="sourceSiteId" value="flowScope.sourceSite" />
<input name="service" value="requestScope.service" />
<input name="redirectUrl" value="requestScope.redirectUrl" />
<input name="sywLogin" value="requestScope.sywLogin" />
<input name="tncmodal" value="requestScope.tncmodal" />
<input name="modifyservice" value="requestScope.modifyservice" />
<input name="reglogin" value="flowScope.reglogin" />
<input name="enrollresponse" value="flowScope.enrollresponse" />
<input name="shcCaptchaKey" value="requestScope.shcKey" />
<input name="shcCaptchaResponse" value="requestScope.shcResponse" />
<input name="sywmax" value="flowScope.sywmax" />
<input name="auth" value="flowScope.auth" />
<input name="maxactivationflow" value="flowScope.maxactivationflow" />
<action-state id="initialFlowSetup">
<evaluate expression="usrInitialFlowSetupAction" />
<transition on="success" to="ticketGrantingTicketExistsCheck" />
<transition on="error" to="pickup_error_redirect" />
</action-state>
<decision-state id="ticketGrantingTicketExistsCheck">
<if test="flowScope.ticketGrantingTicketId != null" then="hasServiceCheck"
else="gatewayRequestCheck" />
</decision-state>
<decision-state id="gatewayRequestCheck">
<if
test="externalContext.requestParameterMap['gateway'] != '' && externalContext.requestParameterMap['gateway'] != null && flowScope.service != null"
then="redirect" else="submit" />
</decision-state>
<decision-state id="hasServiceCheck">
<if test="flowScope.service != null" then="renewRequestCheck"
else="viewGenericLoginSuccess" />
</decision-state>
<decision-state id="renewRequestCheck">
<if
test="externalContext.requestParameterMap['renew'] != '' && externalContext.requestParameterMap['renew'] != null"
then="submit" else="generateServiceTicket" />
</decision-state>
<!-- The "warn" action makes the determination of whether to redirect directly
to the requested service or display the "confirmation" page to go back to
the server. -->
<decision-state id="warn">
<if test="flowScope.warnCookieValue" then="showWarningView"
else="redirect" />
</decision-state>
<!-- <action-state id="startAuthenticate"> <action bean="x509Check" /> <transition
on="success" to="sendTicketGrantingTicket" /> <transition on="error" to="viewLoginForm"
/> </action-state> -->
<view-state id="viewLoginForm" view="casLoginView">
<on-render>
<evaluate expression="authenticationViaFormAction.setupForm()" />
<evaluate expression="authenticationViaFormAction.referenceData()"/>
</on-render>
<transition on="submit" to="bindAndValidate" />
</view-state>
<action-state id="bindAndValidate">
<evaluate expression="usrAuthenticationViaFormAction" />
<transition on="success" to="submit" />
<transition on="error" to="redirect" />
</action-state>
<action-state id="submit">
<evaluate expression = "usrAuthenticationViaFormAction.setCredentialsToFlowScope()" />
<evaluate expression="usrAuthenticationViaFormAction.submit(flowRequestContext, flowScope.credentials, messageContext)" />
<transition on="success" to="sendTicketGrantingTicket" />
<transition on="authenticationFailure" to="pickup_error_redirect" />
<transition on="error" to="pickup_error_redirect">
<set name="errorCode" value="flowScope.errorCode" /> <!-- scope="conversation" />-->
</transition>
</action-state>
<action-state id="sendTicketGrantingTicket">
<evaluate expression="sendTicketGrantingTicketAction" />
<transition on="success" to="serviceCheck" />
</action-state>
<decision-state id="serviceCheck">
<if test="flowScope.service != null" then="checkEnrollResponse"
else="viewGenericLoginSuccess" />
</decision-state>
<decision-state id="checkEnrollResponse">
<if test="flowScope.enrollresponse != null" then="generateServiceTicket"
else="checksywrrequired" />
</decision-state>
<!-- select the success modal based on the flow caller -->
<decision-state id="checksywrrequired">
<if test="requestScope.sywLogin == 'true'" then="sywrRequired"
else="generateServiceTicket" />
</decision-state>
<action-state id="sywrRequired">
<evaluate expression="usrIsSYWRUserCheckAction" />
<transition on="success" to="isAffinityCheckRequired" />
<transition on="error" to="generateServiceTicketNoSywr" />
</action-state>
<decision-state id="isAffinityCheckRequired">
<if test="requestScope.sourceSiteId==6" then="craftsmanAffinityCheck"
else="generateServiceTicket" />
</decision-state>
<action-state id="craftsmanAffinityCheck">
<evaluate expression="ssoGatewayService.searchUserByMemberNumberInTelluride(flowScope.sywrNumber,
requestParameters.sourceSiteId)" result="returnEmailResponse"/>
<transition on="success" to="checkForCcAffinityModal" />
</action-state>
<!--
<bean-action bean="ssoGatewayService" method="searchUserByMemberNumberInTelluride">
<method-arguments>
<argument expression="flowScope.sywrNumber" />
<argument expression="${requestParameters.sourceSiteId}" />
</method-arguments>
<method-result name="returnEmailResponse" scope="flow" />
</bean-action>
-->
<decision-state id="checkForCcAffinityModal">
<if test="flowScope.returnEmailResponse.ccAffinity==true" then="generateServiceTicket"
else="generateServiceTicketNoCcaffinity" />
</decision-state>
<action-state id="generateServiceTicketNoSywr">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="sendtickettomodalforloginnosywr" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="generateServiceTicketNoCcaffinity">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="sendtickettomodalforloginnoccaffinity" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="generateServiceTicket">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="pickupticketmodal" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="setErrorCode">
<evaluate expression="setErrorCodeBean.submit()" />
<transition on="success" to="pickup_error_redirect" />
</action-state>
<!-- the "viewGenericLogin" is the end state for when a user attempts to
login without coming directly from a service. They have only initialized
their single-sign on session. -->
<end-state id="viewGenericLoginSuccess" view="casLoginGenericSuccessView" />
<!-- The "showWarningView" end state is the end state for when the user
has requested privacy settings (to be "warned") to be turned on. It delegates
to a view defines in default_views.properties that display the "Please click
here to go to the service." message. -->
<end-state id="showWarningView" view="casLoginConfirmView" />
<!-- The "redirect" end state allows CAS to properly end the workflow while
still redirecting the user back to the service required. -->
<end-state id="redirect" view="externalRedirect:#{requestScope.response.url}" />
<end-state id="viewServiceErrorView" view="viewServiceErrorView" />
<end-state id="viewServiceSsoErrorView" view="viewServiceSsoErrorView" />
<!-- select the success modal based on the flow caller -->
<decision-state id="pickupticketmodal">
<if test="flowScope.enrollresponse != null" then="sendtickettomodal_reg"
else="sendTicket" />
</decision-state>
<!-- send the service ticket back to the modal, no view required in this
subflow -->
<end-state id="sendtickettomodal_reg">
<output name = "serviceTicketId" value = "requestScope.serviceTicketId"/>
</end-state>
<!-- <output-mapper>
<mapping source="${requestScope.serviceTicketId}" target="serviceTicketId" />
</output-mapper> -->
<decision-state id="sendTicket">
<if test="flowScope.auth != null && flowScope.auth != ''"
then="sendtickettomodalforloginnosywr" else="sendtickettomodalforlogin" />
</decision-state>
<end-state id="sendtickettomodalforlogin" view="/displayserviceticketandcookie">
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "sywmax" value = "requestScope.sywmax"/>
<output name = "irp" value = "requestScope.irp"/>
<output name = "auth" value = "requestScope.auth"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice"/>
<mapping source="${requestScope.sywmax}" target="sywmax"/>
<mapping source="${requestScope.irp}" target="irp"/>
<mapping source="${requestScope.auth}" target="auth"/>
</output-mapper>
-->
<!-- for login, directly sending the st to the modal -->
<end-state id="sendtickettomodalforloginnosywr" view="displayserviceticketandcookienosywr" >
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "irp" value = "requestScope.irp"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice" />
<mapping source="${requestScope.irp}" target="irp" />
</output-mapper>
-->
<end-state id="sendtickettomodalforloginnoccaffinity" view="displayserviceticketandcookienoccaffinity">
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "irp" value = "requestScope.irp"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice" />
<mapping source="${requestScope.irp}" target="irp" />
</output-mapper>
-->
<!-- for login, directly sending the st to the modal -->
<end-state id="showTnCModal" view="/showTnCModalToUsers">
</end-state>
<!-- select the error redirect based on the flow caller -->
<decision-state id="pickup_error_redirect">
<if test="flowScope.enrollresponse != null" then="pickup_error_redirect_reg"
else="set_error_in_scope" />
</decision-state>
<action-state id="set_error_in_scope">
<evaluate expression="setErrorMessages.getErrorMessagesMap(flowRequestContext)" result="flowScope.errorMessageMap"
result-type="java.util.HashMap"></evaluate>
<transition on="success" to="pickup_error_redirect_login"> </transition>
</action-state>
<!-- redirect when error to create sso session, no view required in this subflow -->
<end-state id="pickup_error_redirect_reg" />
<end-state id="pickup_error_redirect_login" view="/loginfailure" >
<on-entry>
<set name="flowScope.parameters" value="flowScope.errorMessageMap.parameters"></set>
</on-entry>
</end-state>
<!-- current not properly defined the global error condition -->
<global-transitions>
<transition to="pickup_error_redirect"
on-exception="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException" />
<transition to="pickup_error_redirect"
on-exception="org.jasig.cas.services.UnauthorizedSsoServiceException" />
<transition to="pickup_error_redirect"
on-exception="org.jasig.cas.services.UnauthorizedServiceException" />
<transition to="pickup_error_redirect"
on-exception="org.springframework.webflow.execution.FlowExecutionException" />
</global-transitions>
</flow>

You are still having the same issues, which are issues with mocking and expecting the exact same object as a parameter.
Why do you care so much about the flowRequestContext object?
EasyMock.expect(setErrorMessages.getErrorMessagesMap(flowRequestContext)).andReturn(model);
just use:
EasyMock.expect(setErrorMessages.getErrorMessagesMap((RequestContext)EasyMock.anyObject())).andReturn(model);
which will work with any instance of RequestContext that can be within your flow

Related

IBM Host On Demand Macro <condition> message warning action

I am trying to get 3 options condition, but I am going crazy:
In a specific field may appear a number, a text or be an empty field
Conditions:
if any text = warning message pops up: "This in an error "
if any number= [pagedown] action
if empty = warning message pops up: "pls change code "
May someone help me?
Thanks!
<HAScript name="new condition" description="" timeout="60000" pausetime="300" promptall="te" blockinput="false" author="gennaro" creationdate="Nov 19, 2022 8:07:14 PM" supressclearevents="false" usevars="true" ignorepauseforenhancedtn="true" delayifnotenhancedtn="0" ignorepausetimeforenhancedtn="true">
<vars>
<create name="$text$" type="string" value="" />
<create name="$num$" type="integer" value="0" />
<create name="$emptyfield$" type="field" />
</vars>
<screen name="Screen1" entryscreen="true" exitscreen="true" transient="false">
<description >
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
</description>
<actions>
<extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="6" scol="66" erow="6" ecol="70" unwrap="false" continuous="false" assigntovar="$text$" />
<extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="6" scol="66" erow="6" ecol="70" unwrap="false" continuous="false" assigntovar="$num$" />
<extract name="&apos;Extract&apos;" planetype="TEXT_PLANE" srow="6" scol="66" erow="6" ecol="70" unwrap="false" continuous="false" assigntovar="$emptyfield$" />
<if condition="$string$" >
<input value="" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
<message title="$string$" value="" />
</if>
<if condition="$num$" >
<input value="&apos;[pagedn]&apos;" row="0" col="0" movecursor="true" xlatehostkeys="true" encrypted="false" />
</if>
<if condition="$emptyfield$" >
<message title="$emptyfield$" value="" />
</if>
</actions>
<nextscreens timeout="0" >
</nextscreens>
</screen>
</HAScript>
I was expecting
Conditions:
if any text = warning message pops up: "This in an error "
if any mumber= [pagedoen] action
if empty = warning message pops up: "pls change code "

java.lang.AssertionError: on call of method in easy mock spring webflow junit

I have tried to resume the flow with directly from particular state i.e setCurrentState("initialFlowSetup"). In which the flow is transition to other state with the given eventid error but after certain transition there is one action involved setErrorMessages.getErrorMessagesMap(flowRequestContext)" result="flowScope.errorMessageMap" in state set_error_in_scope which is returning the Map.
When I call the method using EasyMock and set the expectation the return result as map in my test case the return result is not taken by webflow. Below is the error.
I am not able to understand the concept , when to set expectation and set the result to webflow so the return result will be identified by flow.
Error
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing [AnnotatedAction#7c974942 targetAction = [EvaluateAction#1eea9d2d expression = setErrorMessages.getErrorMessagesMap(flowRequestContext), resultExpression = flowScope.errorMessageMap], attributes = map[[empty]]] in state 'set_error_in_scope' of flow 'shclogin-flow' -- action execution attributes were 'map[[empty]]'
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:60)
at org.springframework.webflow.engine.ActionState.doEnter(ActionState.java:101)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Transition.execute(Transition.java:228)
at org.springframework.webflow.engine.DecisionState.doEnter(DecisionState.java:51)
at org.springframework.webflow.engine.State.enter(State.java:194)
at org.springframework.webflow.engine.Transition.execute(Transition.java:228)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.execute(FlowExecutionImpl.java:395)
at org.springframework.webflow.engine.impl.RequestControlContextImpl.execute(RequestControlContextImpl.java:214)
at org.springframework.webflow.engine.support.TransitionExecutingFlowExecutionExceptionHandler.handle(TransitionExecutingFlowExecutionExceptionHandler.java:111)
at org.springframework.webflow.engine.FlowExecutionExceptionHandlerSet.handleException(FlowExecutionExceptionHandlerSet.java:109)
at org.springframework.webflow.engine.Flow.handleException(Flow.java:600)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.tryFlowHandlers(FlowExecutionImpl.java:647)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.handleException(FlowExecutionImpl.java:603)
at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:263)
at org.springframework.webflow.test.execution.AbstractFlowExecutionTests.resumeFlow(AbstractFlowExecutionTests.java:136)
at com.shc.ecom.test.usr.TestloginlFlow.testAction(TestloginlFlow.java:149)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:131)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.springframework.expression.ExpressionInvocationTargetException: A problem occurred when trying to execute method 'getErrorMessagesMap' on object of type [com.shc.ecom.sso.cas.web.flow.SetErrorMessages$$EnhancerByCGLIB$$ae43a022]
at org.springframework.expression.spel.ast.MethodReference.throwSimpleExceptionIfPossible(MethodReference.java:227)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:133)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:342)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:299)
at org.springframework.binding.expression.spel.SpringELExpression.getValue(SpringELExpression.java:84)
at org.springframework.webflow.action.EvaluateAction.doExecute(EvaluateAction.java:75)
at org.springframework.webflow.action.AbstractAction.execute(AbstractAction.java:188)
at org.springframework.webflow.execution.AnnotatedAction.execute(AnnotatedAction.java:145)
at org.springframework.webflow.execution.ActionExecutor.execute(ActionExecutor.java:51)
... 34 more
Caused by: java.lang.AssertionError:
Unexpected method call SetErrorMessages.getErrorMessagesMap([RequestControlContextImpl#48bfb884 externalContext = org.springframework.webflow.test.MockExternalContext#11653e3b, currentEvent = [null], requestScope = map[[empty]], attributes = map[[empty]], messageContext = [DefaultMessageContext#715fb77 sourceMessages = map[[null] -> list[[empty]]]], flowExecution = [FlowExecutionImpl#1b9c1b51 flow = 'shclogin-flow', flowSessions = list[[FlowSessionImpl#2e52fb3e flow = 'shclogin-flow', state = 'set_error_in_scope', scope = map['errorMessageMap' -> map['originalUrl' -> 123]]]]]]):
SetErrorMessages.getErrorMessagesMap(requestContext): expected: 1, actual: 0
at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:44)
at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:85)
at org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:94)
at com.shc.ecom.sso.cas.web.flow.SetErrorMessages$$EnhancerByCGLIB$$ae43a022.getErrorMessagesMap(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:112)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
... 44 more
Xml
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd"
start-state="initialFlowSetup" >
<input name="loginId" value="requestScope.loginId" />
<input name="logonPassword" value="requestScope.logonPassword" />
<input name="sourceSiteId" value="requestScope.sourceSiteId" />
<input name="fullpage" value="requestScope.fullpage" />
<input name="partialuser" value="requestScope.partialuser" />
<input name="sourceSiteId" value="flowScope.sourceSite" />
<input name="service" value="requestScope.service" />
<input name="redirectUrl" value="requestScope.redirectUrl" />
<input name="sywLogin" value="requestScope.sywLogin" />
<input name="tncmodal" value="requestScope.tncmodal" />
<input name="modifyservice" value="requestScope.modifyservice" />
<input name="reglogin" value="flowScope.reglogin" />
<input name="enrollresponse" value="flowScope.enrollresponse" />
<input name="shcCaptchaKey" value="requestScope.shcKey" />
<input name="shcCaptchaResponse" value="requestScope.shcResponse" />
<input name="sywmax" value="flowScope.sywmax" />
<input name="auth" value="flowScope.auth" />
<input name="maxactivationflow" value="flowScope.maxactivationflow" />
<action-state id="initialFlowSetup">
<evaluate expression="usrInitialFlowSetupAction" />
<transition on="success" to="ticketGrantingTicketExistsCheck" />
<transition on="error" to="pickup_error_redirect" />
</action-state>
<decision-state id="ticketGrantingTicketExistsCheck">
<if test="flowScope.ticketGrantingTicketId != null" then="hasServiceCheck"
else="gatewayRequestCheck" />
</decision-state>
<decision-state id="gatewayRequestCheck">
<if
test="externalContext.requestParameterMap['gateway'] != '' && externalContext.requestParameterMap['gateway'] != null && flowScope.service != null"
then="redirect" else="submit" />
</decision-state>
<decision-state id="hasServiceCheck">
<if test="flowScope.service != null" then="renewRequestCheck"
else="viewGenericLoginSuccess" />
</decision-state>
<decision-state id="renewRequestCheck">
<if
test="externalContext.requestParameterMap['renew'] != '' && externalContext.requestParameterMap['renew'] != null"
then="submit" else="generateServiceTicket" />
</decision-state>
<!-- The "warn" action makes the determination of whether to redirect directly
to the requested service or display the "confirmation" page to go back to
the server. -->
<decision-state id="warn">
<if test="flowScope.warnCookieValue" then="showWarningView"
else="redirect" />
</decision-state>
<!-- <action-state id="startAuthenticate"> <action bean="x509Check" /> <transition
on="success" to="sendTicketGrantingTicket" /> <transition on="error" to="viewLoginForm"
/> </action-state> -->
<view-state id="viewLoginForm" view="casLoginView">
<on-render>
<evaluate expression="authenticationViaFormAction.setupForm()" />
<evaluate expression="authenticationViaFormAction.referenceData()"/>
</on-render>
<transition on="submit" to="bindAndValidate" />
</view-state>
<action-state id="bindAndValidate">
<evaluate expression="usrAuthenticationViaFormAction" />
<transition on="success" to="submit" />
<transition on="error" to="redirect" />
</action-state>
<action-state id="submit">
<evaluate expression = "usrAuthenticationViaFormAction.setCredentialsToFlowScope()" />
<evaluate expression="usrAuthenticationViaFormAction.submit(flowRequestContext, flowScope.credentials, messageContext)" />
<transition on="success" to="sendTicketGrantingTicket" />
<transition on="authenticationFailure" to="pickup_error_redirect" />
<transition on="error" to="pickup_error_redirect">
<set name="errorCode" value="flowScope.errorCode" /> <!-- scope="conversation" />-->
</transition>
</action-state>
<action-state id="sendTicketGrantingTicket">
<evaluate expression="sendTicketGrantingTicketAction" />
<transition on="success" to="serviceCheck" />
</action-state>
<decision-state id="serviceCheck">
<if test="flowScope.service != null" then="checkEnrollResponse"
else="viewGenericLoginSuccess" />
</decision-state>
<decision-state id="checkEnrollResponse">
<if test="flowScope.enrollresponse != null" then="generateServiceTicket"
else="checksywrrequired" />
</decision-state>
<!-- select the success modal based on the flow caller -->
<decision-state id="checksywrrequired">
<if test="requestScope.sywLogin == 'true'" then="sywrRequired"
else="generateServiceTicket" />
</decision-state>
<action-state id="sywrRequired">
<evaluate expression="usrIsSYWRUserCheckAction" />
<transition on="success" to="isAffinityCheckRequired" />
<transition on="error" to="generateServiceTicketNoSywr" />
</action-state>
<decision-state id="isAffinityCheckRequired">
<if test="requestScope.sourceSiteId==6" then="craftsmanAffinityCheck"
else="generateServiceTicket" />
</decision-state>
<action-state id="craftsmanAffinityCheck">
<evaluate expression="ssoGatewayService.searchUserByMemberNumberInTelluride(flowScope.sywrNumber,
requestParameters.sourceSiteId)" result="returnEmailResponse"/>
<transition on="success" to="checkForCcAffinityModal" />
</action-state>
<!--
<bean-action bean="ssoGatewayService" method="searchUserByMemberNumberInTelluride">
<method-arguments>
<argument expression="flowScope.sywrNumber" />
<argument expression="${requestParameters.sourceSiteId}" />
</method-arguments>
<method-result name="returnEmailResponse" scope="flow" />
</bean-action>
-->
<decision-state id="checkForCcAffinityModal">
<if test="flowScope.returnEmailResponse.ccAffinity==true" then="generateServiceTicket"
else="generateServiceTicketNoCcaffinity" />
</decision-state>
<action-state id="generateServiceTicketNoSywr">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="sendtickettomodalforloginnosywr" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="generateServiceTicketNoCcaffinity">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="sendtickettomodalforloginnoccaffinity" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="generateServiceTicket">
<evaluate expression="generateServiceTicketAction" />
<transition on="success" to="pickupticketmodal" />
<transition on="error" to="setErrorCode" />
<transition on="gateway" to="redirect" />
</action-state>
<action-state id="setErrorCode">
<evaluate expression="setErrorCodeBean.submit()" />
<transition on="success" to="pickup_error_redirect" />
</action-state>
<!-- the "viewGenericLogin" is the end state for when a user attempts to
login without coming directly from a service. They have only initialized
their single-sign on session. -->
<end-state id="viewGenericLoginSuccess" view="casLoginGenericSuccessView" />
<!-- The "showWarningView" end state is the end state for when the user
has requested privacy settings (to be "warned") to be turned on. It delegates
to a view defines in default_views.properties that display the "Please click
here to go to the service." message. -->
<end-state id="showWarningView" view="casLoginConfirmView" />
<!-- The "redirect" end state allows CAS to properly end the workflow while
still redirecting the user back to the service required. -->
<end-state id="redirect" view="externalRedirect:#{requestScope.response.url}" />
<end-state id="viewServiceErrorView" view="viewServiceErrorView" />
<end-state id="viewServiceSsoErrorView" view="viewServiceSsoErrorView" />
<!-- select the success modal based on the flow caller -->
<decision-state id="pickupticketmodal">
<if test="flowScope.enrollresponse != null" then="sendtickettomodal_reg"
else="sendTicket" />
</decision-state>
<!-- send the service ticket back to the modal, no view required in this
subflow -->
<end-state id="sendtickettomodal_reg">
<output name = "serviceTicketId" value = "requestScope.serviceTicketId"/>
</end-state>
<!-- <output-mapper>
<mapping source="${requestScope.serviceTicketId}" target="serviceTicketId" />
</output-mapper> -->
<decision-state id="sendTicket">
<if test="flowScope.auth != null && flowScope.auth != ''"
then="sendtickettomodalforloginnosywr" else="sendtickettomodalforlogin" />
</decision-state>
<end-state id="sendtickettomodalforlogin" view="/displayserviceticketandcookie">
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "sywmax" value = "requestScope.sywmax"/>
<output name = "irp" value = "requestScope.irp"/>
<output name = "auth" value = "requestScope.auth"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice"/>
<mapping source="${requestScope.sywmax}" target="sywmax"/>
<mapping source="${requestScope.irp}" target="irp"/>
<mapping source="${requestScope.auth}" target="auth"/>
</output-mapper>
-->
<!-- for login, directly sending the st to the modal -->
<end-state id="sendtickettomodalforloginnosywr" view="displayserviceticketandcookienosywr" >
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "irp" value = "requestScope.irp"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice" />
<mapping source="${requestScope.irp}" target="irp" />
</output-mapper>
-->
<end-state id="sendtickettomodalforloginnoccaffinity" view="displayserviceticketandcookienoccaffinity">
<output name = "modifyservice" value = "requestScope.modifyservice"/>
<output name = "irp" value = "requestScope.irp"/>
</end-state>
<!--
<output-mapper>
<mapping source="${requestScope.modifyservice}" target="modifyservice" />
<mapping source="${requestScope.irp}" target="irp" />
</output-mapper>
-->
<!-- for login, directly sending the st to the modal -->
<end-state id="showTnCModal" view="/showTnCModalToUsers">
</end-state>
<!-- select the error redirect based on the flow caller -->
<decision-state id="pickup_error_redirect">
<if test="flowScope.enrollresponse != null" then="pickup_error_redirect_reg"
else="set_error_in_scope" />
</decision-state>
<action-state id="set_error_in_scope">
<evaluate expression="setErrorMessages.getErrorMessagesMap(flowRequestContext)" result="flowScope.errorMessageMap"
result-type="java.util.HashMap"></evaluate>
<transition on="success" to="pickup_error_redirect_login"> </transition>
</action-state>
<!-- redirect when error to create sso session, no view required in this subflow -->
<end-state id="pickup_error_redirect_reg" />
<end-state id="pickup_error_redirect_login" view="/loginfailure" >
<on-entry>
<set name="flowScope.parameters" value="flowScope.errorMessageMap.parameters"></set>
</on-entry>
</end-state>
<!-- current not properly defined the global error condition -->
<global-transitions>
<transition to="pickup_error_redirect"
on-exception="org.springframework.webflow.execution.repository.NoSuchFlowExecutionException" />
<transition to="pickup_error_redirect"
on-exception="org.jasig.cas.services.UnauthorizedSsoServiceException" />
<transition to="pickup_error_redirect"
on-exception="org.jasig.cas.services.UnauthorizedServiceException" />
<transition to="pickup_error_redirect"
on-exception="org.springframework.webflow.execution.FlowExecutionException" />
</global-transitions>
</flow>
Test Case
public class TestloginlFlow extends AbstractXmlFlowExecutionTests {
UsrInitialFlowSetupAction usrInitialFlowSetupAction;
AuthenticationViaFormAction authenticationViaFormAction;
UsrIsSYWRUserCheckAction usrIsSYWRUserCheckAction;
SSOGatewayService ssoGatewayService;
CustomGenerateServiceTicketAction generateServiceTicketAction;
CentralAuthenticationService centralAuthenticateService;
CookieRetrievingCookieGenerator warnCookieGenerator;
USRAuthenticationViaFormAction usrAuthenticationViaFormAction;
List<ArgumentExtractor> argumentExtractor;
SetErrorMessages setErrorMessages;
RequestControlContext requestContext;
#Override
protected void setUp() throws Exception {
usrInitialFlowSetupAction = EasyMock.createMock("usrInitialFlowSetupAction", UsrInitialFlowSetupAction.class); // usrAuthenticationViaFormAction
setErrorMessages = EasyMock.createMock("SetErrorMessages", SetErrorMessages.class);
usrAuthenticationViaFormAction = EasyMock.createMock("usrAuthenticationViaFormAction",
USRAuthenticationViaFormAction.class);
usrIsSYWRUserCheckAction = EasyMock.createMock("usrIsSYWRUserCheckAction", UsrIsSYWRUserCheckAction.class); // ssoGatewayService
ssoGatewayService = EasyMock.createMock("ssoGatewayService", SSOGatewayService.class);
generateServiceTicketAction = EasyMock.createMock("generateServiceTicketAction",
CustomGenerateServiceTicketAction.class);
centralAuthenticateService = EasyMock.createMock("centralAuthenticateService",
CentralAuthenticationService.class);
warnCookieGenerator = EasyMock.createMock("centralAuthenticateService", CookieRetrievingCookieGenerator.class);
argumentExtractor = EasyMock.createMock("argumentExtractors", List.class);
generateServiceTicketAction = EasyMock.createMock("generateServiceTicketAction",
CustomGenerateServiceTicketAction.class);
requestContext=EasyMock.createMock("requestContext",RequestControlContext.class);
}
#Override
protected FlowDefinitionResource getResource(FlowDefinitionResourceFactory resourceFactory) {
return resourceFactory.createFileResource("src/main/webapp/WEB-INF/usr/flows/shclogin-flow.xml");
}
#Override
protected void registerMockFlowBeans(ConfigurableBeanFactory builderContext) {
builderContext.registerSingleton("argumentExtractors", argumentExtractor);
builderContext.registerSingleton("warnCookieGenerator", warnCookieGenerator);
builderContext.registerSingleton("centralAuthenticateService", centralAuthenticateService);
builderContext.registerSingleton("usrAuthenticationViaFormAction", usrAuthenticationViaFormAction);
builderContext.registerSingleton("usrIsSYWRUserCheckAction", usrIsSYWRUserCheckAction);
builderContext.registerSingleton("ssoGatewayService", ssoGatewayService);
builderContext.registerSingleton("generateServiceTicketAction", generateServiceTicketAction);
builderContext.registerSingleton("ticketGrantingTicketCookieGenerator", warnCookieGenerator);
builderContext.registerSingleton("setErrorMessages", setErrorMessages);
builderContext.registerSingleton("request", requestContext);
}
#Override
protected void configureFlowBuilderContext(MockFlowBuilderContext builderContext) {
usrAuthenticationViaFormAction.setCentralAuthenticationService(centralAuthenticateService);
usrAuthenticationViaFormAction.setWarnCookieGenerator(warnCookieGenerator);
builderContext.registerBean("warnCookieGenerator", warnCookieGenerator);
builderContext.registerBean("centralAuthenticateService", centralAuthenticateService);
builderContext.registerBean("usrAuthenticationViaFormAction", usrAuthenticationViaFormAction);
builderContext.registerBean("usrIsSYWRUserCheckAction", usrIsSYWRUserCheckAction);
builderContext.registerBean("ssoGatewayService", ssoGatewayService);
builderContext.registerBean("generateServiceTicketAction", generateServiceTicketAction);
builderContext.registerBean("setErrorMessages", setErrorMessages);
builderContext.registerBean("request", requestContext);
}
public void testAction() throws Exception {
setCurrentState("initialFlowSetup");
MockExternalContext ctx = new MockExternalContext();
MutableAttributeMap input = new LocalAttributeMap();
MockRequestControlContext context = new MockRequestControlContext();
FlowExecution flowExecution = getFlowExecution();
FlowSession session = flowExecution.getActiveSession();
Map<String, Object> model = new HashMap<String, Object>();
model.put("originalUrl", 123);
session.getScope().put("errorMessageMap", model);
updateFlowExecution(flowExecution);
ctx.setEventId("error");
EasyMock.expect(setErrorMessages.getErrorMessagesMap(requestContext)).andReturn(model);
EasyMock.replay(setErrorMessages);
resumeFlow(ctx);
assertResponseWrittenEquals("/loginfailure", ctx);
assertFlowExecutionEnded();
}
public void testAction1() throws Exception {
// setCurrentState("initialFlowSetup");
MockExternalContext ctx = new MockExternalContext();
MutableAttributeMap input = new LocalAttributeMap();
input.put("loginId", "12");
input.put("logonPassword", "ankur");
input.put("sourceSiteId", "3");
input.put("fullpage", "");
input.put("partialuser", "true");
input.put("service", "");
input.put("redirectUrl", "");
input.put("sywLogin", "er4fju");
input.put("tncmodal", null);
input.put("modifyservice", "no");
// input.put("reglogin", false);
// input.put("enrollresponse", 200);
input.put("shcCaptchaKey", null);
input.put("ticketGrantingTicketId", "1234");
Map<String, Object> parameters = new HashMap<>();
parameters.put("renew", "yes");
ParameterMap requestParameterMap = new LocalParameterMap(parameters);
ctx.setRequestParameterMap(requestParameterMap);
MockRequestContext context = new MockRequestContext();
Event event = new Event(this, "success");
EasyMock.expect(usrInitialFlowSetupAction.doExecute(flowRequestContext)).andReturn(event);
EasyMock.replay(usrInitialFlowSetupAction);
//Mockito.mock(usrInitialFlowSetupAction.doExecute(flowRequestContext), event)
/*
* FlowExecution flowExecution = getFlowExecution(); FlowSession session
* = flowExecution.getActiveSession();
* session.getScope().put("ticketGrantingTicketId", "ee");
*/
// updateFlowExecution(flowExecution);
startFlow(input, ctx);
}
}

iTextSharp SetField for fields with same name on different pages

I used acroFields.GetTranslatedFieldName() to get the next fieldnames from the pdf:
topmostSubform[0].Page1[0].CheckBox2A[0]
topmostSubform[0].Page1[0].CheckBox2A[1]
topmostSubform[0].Page2[0].CheckBox2A[0]
topmostSubform[0].Page2[0].CheckBox2A[1]
topmostSubform[0].Page3[0].CheckBox2A[0]
topmostSubform[0].Page3[0].CheckBox2A[1]
I use the next line of code to fill CheckBox2A[0] on the second page.
fields.SetField("topmostSubform[0].Page2[0].CheckBox2A[0]", "1")
Instead of CheckBox2A[0] on the second page, CheckBox2A[0] on the first page gets checked.
iTextSharp (and also iText for Java, tested here) does not correctly associate the reference derived from the XFA template structure
topmostSubform[0].Page2[0].CheckBox2A[0]
with the matching entry in the one XFA dataset:
<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" >
<xfa:data >
<topmostSubform >
<!-- vvv the incorrect match by iText -->
<CheckBox2A >0</CheckBox2A >
<!-- ^^^ the incorrect match by iText -->
<CheckBox2A >0</CheckBox2A >
<CheckBox2B >0</CheckBox2B >
<CheckBox2B >0</CheckBox2B >
<Voorletters />
<Achternaam />
<CheckBox2C >0</CheckBox2C >
<CheckBox2C >0</CheckBox2C >
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<HuisNrTekst5 />
<HuisNrNummer5 />
<Straat />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<HuisNrTekst5 />
<HuisNrNummer5 />
<TextField1 />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<TextField1 />
<CheckBox2D >0</CheckBox2D >
<CheckBox2D >0</CheckBox2D >
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<BurgerserviceNr />
<Voorletters />
<Achternaam />
<CheckBox2E >0</CheckBox2E >
<CheckBox2E >0</CheckBox2E >
<HuisNrTekst5 />
<HuisNrNummer5 />
<Straat />
<PostcodeNr1c />
<PostcodeAlpha1c />
<Plaats />
<DatumDag />
<DatumMaand />
<DatumJaar />
<IBANREKC_2 />
<IBANREKB_2 />
<IBANREKA_2 />
<IBAN_2 />
<Telefoon />
<!-- vvv the correct match -->
<CheckBox2A >0</CheckBox2A >
<!-- ^^^ the correct match -->
<CheckBox2A >0</CheckBox2A >
<CheckBox2B >0</CheckBox2B >
<CheckBox2B >0</CheckBox2B >
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<CheckBox2C >0</CheckBox2C >
<CheckBox2C >0</CheckBox2C >
<TextField1 />
<TextField1 />
<CheckBox2D >0</CheckBox2D >
<CheckBox2D >0</CheckBox2D >
<Telefoon />
<CheckBox2E >0</CheckBox2E >
<CheckBox2E >0</CheckBox2E >
<CheckBox2F >0</CheckBox2F >
<CheckBox2F >0</CheckBox2F >
<TextField1 />
<TextField1 />
<CheckBox2G >0</CheckBox2G >
<CheckBox2G >0</CheckBox2G >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<IBAN_1E_01 />
<IBAN_1D_01 />
<IBAN_1C_01 />
<IBAN_1A_01 />
<IBAN_1B_01 />
<IBANREKC_1 />
<IBANREKB_1 />
<IBANREKA_1 />
<IBAN_1 />
<IBAN_1E_02 />
<IBAN_1D_02 />
<IBAN_1C_02 />
<IBAN_1B_02 />
<IBAN_1A_02 />
<CheckBox3D >0</CheckBox3D >
<CheckBox3D >0</CheckBox3D >
<CheckBox3D >0</CheckBox3D >
<CheckBox3A >0</CheckBox3A >
<CheckBox3A >0</CheckBox3A >
<CheckBox3A >0</CheckBox3A >
<CheckBox2A >0</CheckBox2A >
<CheckBox2A >0</CheckBox2A >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<CheckBox3B >0</CheckBox3B >
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<DatumDag />
<DatumMaand />
<DatumJaar />
<TextField1 />
<Telefoon />
</topmostSubform >
</xfa:data >
</xfa:datasets >
Thus, the wrong dataset element is changed. I'm afraid this has to be looked into by iText development, I have no fix at hand.
You might be in luck, though: The form in your document actually is a hybrid with both an AcroForm and an XFA representation. During your fields.SetField call iText attempts to set the value in both representations, and indeed, in the AcroForm representation it sets the correct one.
Thus, if the result PDF is not required to carry that XFA structure anymore, you can simply drop the XFA structure:
using (var pdfReader = new PdfReader(file))
using (FileStream output = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write))
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, output))
{
AcroFields fields = pdfStamper.AcroFields;
fields.SetField("topmostSubform[0].Page2[0].CheckBox2A[0]", "1");
fields.RemoveXfa();
}
Doing that you get the tick on page 2:

Alfresco Workflow Share Form

I am trying to build a custom workflow in alfresco community edition. Basically I am trying to modify the existing workflow called lifecycleprocess. I have been able to deploy the process using workflow console without error. But I am not able to do any change at all on the workflow form. My workflow is called leaveprocess and I have the following code :
Path : alfresco/tomcat/shared/classes/alfresco/extension/
leave-process-bpmn20.xml
<?xml version="1.0" encoding="UTF-8" ?>
<definitions id="leave-definitions"
typeLanguage="http://www.w3.org/2001/XMLSchema"
expressionLanguage="http://www.w3.org/1999/XPath"
targetNamespace="http://activiti.org/bpmn20"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:activiti="http://activiti.org/bpmn">
<process id="activitileaveApproval" name="Leave Process">
<extensionElements>
<!-- When process is deleted/cancelled, status should be set to draft -->
<activiti:executionListener event="end" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
if(cancelled || deleted) {
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
}
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
<startEvent id="start"
activiti:formKey="wf:submitReviewTask" />
<sequenceFlow id='flow1'
sourceRef='start'
targetRef='reviewTask'>
<extensionElements>
<activiti:executionListener event="take" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
<activiti:field name="script">
<activiti:string>
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].addAspect("wfl:status");
}
}
</activiti:string>
</activiti:field>
</activiti:executionListener>
</extensionElements>
</sequenceFlow>
<userTask id="reviewTask" name="Review Task"
activiti:formKey="wf:activitiReviewTask">
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status")) {
bpm_package.children[i].properties["wfl:status"] = "In Review";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
<activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${bpm_assignee.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow2'
sourceRef='reviewTask'
targetRef='reviewDecision' />
<exclusiveGateway id="reviewDecision" name="Review Decision" />
<sequenceFlow id='flow3' sourceRef='reviewDecision' targetRef='approved' >
<conditionExpression xsi:type="tFormalExpression">${wf_reviewOutcome == 'Approve'}</conditionExpression>
</sequenceFlow>
<sequenceFlow id='flow4'
sourceRef='reviewDecision'
targetRef='rejected' />
<userTask id="approved" name="Document Approved"
activiti:formKey="wf:approvedTask" >
<documentation>
The document was reviewed and approved.
</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status")) {
bpm_package.children[i].properties["wfl:status"] = "Approved";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${initiator.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<userTask id="rejected" name="Document Rejected"
activiti:formKey="wf:rejectedTask" >
<documentation>
The document was reviewed and rejected.
</documentation>
<extensionElements>
<activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
<activiti:field name="script">
<activiti:string>
if (typeof bpm_workflowDueDate != 'undefined') task.setVariableLocal('bpm_dueDate', bpm_workflowDueDate);
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
</activiti:string>
</activiti:field>
</activiti:taskListener>
</extensionElements>
<humanPerformer>
<resourceAssignmentExpression>
<formalExpression>${initiator.properties.userName}</formalExpression>
</resourceAssignmentExpression>
</humanPerformer>
</userTask>
<sequenceFlow id='flow5' sourceRef='approved'
targetRef='end' />
<sequenceFlow id='flow6' sourceRef='rejected'
targetRef='end' />
<endEvent id="end" />
</process>
</definitions>
leave-messages.properties
# For JBPM leave Workflow Example
wfl_leaveapproval.workflow.title=Leave Application
wfl_leaveapproval.workflow.description=Leave Application (Auto updates document status)
wfl_leaveapproval.node.review.transition.reject.title=Reject
wfl_leaveapproval.node.review.transition.reject.description=Reject
wfl_leaveapproval.node.review.transition.approve.title=Approve
wfl_leaveapproval.node.review.transition.approve.description=Approve
# For Activiti leave Workflow Example
activitileaveApproval=Leave Application
activitileaveApproval=Leave Application workflow Activiti (Auto updates document status)
leave-workflow-context.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="leave.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<!-- JBPM version of leave process -->
<props>
<prop key="engineId">jbpm</prop>
<prop key="location">alfresco/extension/leave_processdefinition.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">false</prop>
</props>
<!-- Activiti version of leave process -->
<props>
<prop key="engineId">activiti</prop>
<prop key="location">alfresco/extension/leave-process.bpmn20.xml</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">false</prop>
</props>
</list>
</property>
<property name="models">
<list>
<value>alfresco/extension/leaveModel.xml</value>
</list>
</property>
<property name="labels">
<list>
<value>alfresco/extension/leave-messages</value>
</list>
</property>
</bean>
</beans>
leave_processdefinition.xml
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wfl:leaveapproval">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitReviewTask" swimlane="initiator" />
<event type="node-leave">
<!-- Call script once the workflow package exists i.e. on node-leave -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<!-- Apply the Workflow leave Aspect (wfl:status) if not set already. Note: The default wfl:status property is draft -->
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
if (!bpm_package.children[i].hasAspect("wfl:status"))
{
bpm_package.children[i].addAspect("wfl:status");
}
}
</script>
</action>
</event>
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</swimlane>
<task-node name="review">
<event type="node-enter">
<!-- Update the status to In Review when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "In Review";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
</task>
<transition name="approve" to="approved" />
<transition name="reject" to="rejected" />
</task-node>
<task-node name="rejected">
<event type="node-enter">
<!-- Update the status to Draft when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:rejectedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<task-node name="approved">
<event type="node-enter">
<!-- Update the status to Approved when we enter this task -->
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
for (var i = 0; i < bpm_package.children.length; i++)
{
bpm_package.children[i].properties["wfl:status"] = "Approved";
bpm_package.children[i].save();
}
</script>
</action>
</event>
<task name="wf:approvedTask" swimlane="initiator" />
<transition name="" to="end" />
</task-node>
<end-state name="end" />
<event type="process-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
if (cancelled)
{
for (var i = 0; i < bpm_package.children.length; i++)
{
if (bpm_package.children[0].hasAspect("wfl:status"))
{
bpm_package.children[i].properties["wfl:status"] = "Draft";
bpm_package.children[i].save();
}
}
if (logger.isLoggingEnabled()) logger.log("Workflow cancelled, status reset to Draft");
}
else
{
if (logger.isLoggingEnabled()) logger.log("Workflow completed");
}
</script>
</action>
</event>
</process-definition>
leaveModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<model name="wfl:workflowleavemodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Workflow leave Model</description>
<author></author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<imports>
<!-- Import Alfresco Dictionary Definitions -->
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d" />
<!-- Import Alfresco Content Domain Model Definitions -->
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm" />
</imports>
<namespaces>
<namespace uri="wfl.model" prefix="wfl" />
</namespaces>
<constraints>
<constraint name="wfl:status" type="LIST">
<parameter name="allowedValues">
<list>
<value>Draft</value>
<value>In Review</value>
<value>Approved</value>
</list>
</parameter>
</constraint>
</constraints>
<aspects>
<!-- Status property is used to manage workflow approval -->
<aspect name="wfl:status">
<title>Status</title>
<properties>
<property name="wfl:status">
<title>Status</title>
<type>d:text</type>
<default>Draft</default>
<constraints>
<constraint ref="wfl:status" />
</constraints>
</property>
</properties>
</aspect>
</aspects>
</model>
Path : alfresco/tomcat/webapps/share/WEB-INF/classes/alfresco/
share-workflow-form-config.xml
<!-- Leave Workflow Definition -->
<config evaluator="string-compare" condition="jbpm$wfl:leaveApproval">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="bpm:workflowDueDate" />
<show id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="packageItems" />
<show id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info" />
<field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
<field id="packageItems" set="items" />
<field id="bpm:sendEMailNotifications" set="other">
<control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
<config evaluator="string-compare" condition="activiti$activitileaveApproval">
<forms>
<form>
<field-visibility>
<show id="bpm:workflowDescription" />
<show id="bpm:workflowDueDate" />
<show id="bpm:workflowPriority" />
<show id="bpm:assignee" />
<show id="packageItems" />
<show id="bpm:sendEMailNotifications" />
</field-visibility>
<appearance>
<set id="" appearance="title" label-id="workflow.set.general" />
<set id="info" appearance="" template="/org/alfresco/components/form/2-column-set.ftl" />
<set id="assignee" appearance="title" label-id="workflow.set.assignee" />
<set id="items" appearance="title" label-id="workflow.set.items" />
<set id="other" appearance="title" label-id="workflow.set.other" />
<field id="bpm:workflowDescription" label-id="workflow.field.message">
<control template="/org/alfresco/components/form/controls/textarea.ftl">
<control-param name="style">width: 95%</control-param>
</control>
</field>
<field id="bpm:workflowDueDate" label-id="workflow.field.due" set="info">
<control template="/org/alfresco/components/form/controls/date.ftl">
<control-param name="showTime">false</control-param>
<control-param name="submitTime">false</control-param>
</control>
</field>
<field id="bpm:workflowPriority" label-id="workflow.field.priority" set="info">
<control template="/org/alfresco/components/form/controls/workflow/priority.ftl" />
</field>
<field id="bpm:assignee" label-id="workflow.field.reviewer" set="assignee" />
<field id="packageItems" set="items" />
<field id="bpm:sendEMailNotifications" set="other">
<control template="/org/alfresco/components/form/controls/workflow/email-notification.ftl" />
</field>
</appearance>
</form>
</forms>
</config>
I am unable to understand, no matter what changes I do in this code for share-workflow-form-config.xml, It does not reflect when go to Share->Workflows I've started->select Leave Process. It always show the default form there. Somebody please guide me what I am doing wrong here.
You need to replace this
<form>
with following line
<form id="workflow-details">
means add attribute "id" in your form tag
After making changes in share-config you have to restart alfresco :)
Deploy of workflow (via workflow console) makes just re-deploy of the workflow definitions (also like deploy of models,.. )
But
<config evaluator="string-compare" condition="jbpm$wfl:leaveApproval">
Should works :D, no other idea why not working..

Spring webflow second popup problem

I have 1st popup, and this 1st popup opens 2nd popup
Code:
<view-state id="paneMaintenance" parent="#pe-cards" model="model">
<transition on="task-view" then="developers-task-view" bind="false">
</transition>
</view-state>
<view-state id="developers-task-view" view="/WEB-INF/jsp/taskView/taskAssignDevelopersPopUp.jsp" model="taskAssignModel" parent="#paneMaintenance" popup="true" >
<transition on="create" to="create-task-after" bind="false" >
<evaluate expression="taskAssignHandler.create(taskAssignModel, model.paneModel, true)" />
</transition>
</view-state>
<view-state id="create-task-after" view="/WEB-INF/jsp/taskView/taskCreateAfter.jsp" model="taskAssignModel" parent="#developers-task-view" popup="true">
<transition on="confirm" bind="true">
<evaluate expression="taskAssignHandler.saveTaskAssign(taskAssignModel, model.paneModel)" />
</transition>
<transition on="cancel" bind="false" to="paneMaintenance"/>
</view-state>
I need to execute some code, then close 2nd popup, and then return to 1st popup.
How can i do it?
If 1st popup opens 2nd popup, and there is transition from 2nd popup to 1st popup, then 2nd popup opens second 1st popup, instead of close himself and return to 1st popup
Please help.
You can use tiles and create some tiles definitions, like this:
<definition name="myBasicView" extends="myView">
<put-attribute name="body" value="/WEB-INF/jsp/taskView/yourPageBody.jsp" />
</definition>
<definition name="myFirstView" extends="myView">
<put-attribute name="body" value="/WEB-INF/jsp/taskView/yourPageBody.jsp" />
<put-attribute name="popup" value="/WEB-INF/jsp/taskView/taskAssignDevelopersPopUp.jsp" />
</definition>
<definition name="mySecondView" extends="myView">
<put-attribute name="body" value="/WEB-INF/jsp/taskView/yourPageBody.jsp" />
<put-attribute name="popup" value="/WEB-INF/jsp/taskView/taskCreateAfter.jsp" />
</definition>
and then use these definitions:
<view-state id="paneMaintenance" parent="#pe-cards" model="model" view="myBasicView" >
<transition on="task-view" then="developers-task-view" bind="false">
</transition>
</view-state>
<view-state id="developers-task-view" view="myFirstView" model="taskAssignModel" parent="#paneMaintenance" popup="true" >
<transition on="create" to="create-task-after" bind="false" >
<evaluate expression="taskAssignHandler.create(taskAssignModel, model.paneModel, true)" />
</transition>
</view-state>
<view-state id="create-task-after" view="mySecondView" model="taskAssignModel" parent="#developers-task-view" popup="true">
<transition on="confirm" bind="true">
<evaluate expression="taskAssignHandler.saveTaskAssign(taskAssignModel, model.paneModel)" />
</transition>
<transition on="cancel" bind="false" to="paneMaintenance"/>
</view-state>
So 1 popup for each view!