public List < TaskAction > filterStandardActions ( List < TaskAction > standardTaskActions ) throws ServiceException , DataAccessException { CodeTimer timer = new CodeTimer ( "TaskManager.filterStandardTaskActions()" , true ) ; List < TaskAction > filteredTaskActions = standardTaskActions ; try { ActivityInstance activityInstance = getActivityInstance ( true ) ; if ( activityInstance != null ) { Long processInstanceId = activityInstance . getProcessInstanceId ( ) ; ProcessInstance processInstance = ServiceLocator . getWorkflowServices ( ) . getProcess ( processInstanceId ) ; if ( processInstance . isEmbedded ( ) ) { // remove RETRY since no default behavior is defined for inline tasks TaskAction retryAction = null ; for ( TaskAction taskAction : standardTaskActions ) { if ( taskAction . getTaskActionName ( ) . equalsIgnoreCase ( "Retry" ) ) retryAction = taskAction ; } if ( retryAction != null ) standardTaskActions . remove ( retryAction ) ; } Process processVO = null ; if ( processInstance . getProcessInstDefId ( ) > 0L ) processVO = ProcessCache . getProcessInstanceDefiniton ( processInstance . getProcessId ( ) , processInstance . getProcessInstDefId ( ) ) ; if ( processVO == null ) processVO = ProcessCache . getProcess ( processInstance . getProcessId ( ) ) ; if ( processInstance . isEmbedded ( ) ) processVO = processVO . getSubProcessVO ( new Long ( processInstance . getComment ( ) ) ) ; List < Transition > outgoingWorkTransVOs = processVO . getAllTransitions ( activityInstance . getActivityId ( ) ) ; boolean foundNullResultCode = false ; for ( Transition workTransVO : outgoingWorkTransVOs ) { Integer eventType = workTransVO . getEventType ( ) ; if ( ( eventType . equals ( EventType . FINISH ) || eventType . equals ( EventType . RESUME ) ) && workTransVO . getCompletionCode ( ) == null ) { foundNullResultCode = true ; break ; } } if ( ! foundNullResultCode ) { TaskAction cancelAction = null ; TaskAction completeAction = null ; for ( TaskAction taskAction : standardTaskActions ) { if ( taskAction . getTaskActionName ( ) . equalsIgnoreCase ( "Cancel" ) ) cancelAction = taskAction ; if ( taskAction . getTaskActionName ( ) . equalsIgnoreCase ( "Complete" ) ) completeAction = taskAction ; } if ( cancelAction != null ) standardTaskActions . remove ( cancelAction ) ; if ( completeAction != null ) standardTaskActions . remove ( completeAction ) ; } } } catch ( Exception ex ) { logger . severeException ( ex . getMessage ( ) , ex ) ; } timer . stopAndLogTiming ( "" ) ; return filteredTaskActions ; }
Filters according to what s applicable depending on the context of the task activity instance .