private void execute ( Executable action , ContentResult contentResult ) { try { ChooseWhenRule chooseWhenRule = null ; if ( action . getCaseNo ( ) > 0 ) { ChooseRuleMap chooseRuleMap = getTransletRule ( ) . getChooseRuleMap ( ) ; if ( chooseRuleMap == null || chooseRuleMap . isEmpty ( ) ) { throw new IllegalRuleException ( "No defined choose rules" ) ; } ChooseRule chooseRule = chooseRuleMap . getChooseRule ( action . getCaseNo ( ) ) ; if ( chooseRule == null ) { throw new IllegalRuleException ( "No choose rule with case number: " + ChooseRule . toCaseGroupNo ( action . getCaseNo ( ) ) ) ; } chooseWhenRule = chooseRule . getChooseWhenRule ( action . getCaseNo ( ) ) ; if ( chooseWhenRule == null ) { throw new IllegalRuleException ( "No choose rule with case number: " + action . getCaseNo ( ) ) ; } if ( processedChooses != null && processedChooses . contains ( chooseRule . getCaseNo ( ) ) ) { return ; } if ( processedChooses == null || ! processedChooses . contains ( chooseWhenRule . getCaseNo ( ) ) ) { BooleanExpression expression = new BooleanExpression ( this ) ; if ( expression . evaluate ( chooseWhenRule ) ) { if ( processedChooses == null ) { processedChooses = new HashSet <> ( ) ; } processedChooses . add ( chooseRule . getCaseNo ( ) ) ; processedChooses . add ( chooseWhenRule . getCaseNo ( ) ) ; } else { return ; } } } if ( log . isDebugEnabled ( ) ) { log . debug ( "Action " + action ) ; } Object resultValue = action . execute ( this ) ; if ( ! action . isHidden ( ) && contentResult != null && resultValue != ActionResult . NO_RESULT ) { if ( resultValue instanceof ProcessResult ) { contentResult . addActionResult ( action , ( ProcessResult ) resultValue ) ; } else { contentResult . addActionResult ( action , resultValue ) ; } } if ( action . isLastInChooseWhen ( ) && chooseWhenRule != null && chooseWhenRule . getResponse ( ) != null ) { reserveResponse ( chooseWhenRule . getResponse ( ) ) ; } } catch ( ActionExecutionException e ) { throw e ; } catch ( Exception e ) { setRaisedException ( e ) ; throw new ActionExecutionException ( "Failed to execute action " + action , e ) ; } }
Execute action .