public static TaskEntity createAndInsert ( VariableScope execution ) { TaskEntity task = create ( ) ; if ( execution instanceof ExecutionEntity ) { ExecutionEntity executionEntity = ( ExecutionEntity ) execution ; task . setExecution ( executionEntity ) ; task . skipCustomListeners = executionEntity . isSkipCustomListeners ( ) ; task . insert ( executionEntity ) ; return task ; } else if ( execution instanceof CaseExecutionEntity ) { task . setCaseExecution ( ( DelegateCaseExecution ) execution ) ; } task . insert ( null ) ; return task ; }
creates and initializes a new persistent task .