GNDMS 0.6.0
RESTful verison of GNDMS
Static Public Member Functions

de.zib.gndms.logic.model.gorfx.taskflow.TaskFlowAux Class Reference

List of all members.

Static Public Member Functions

static TaskFlowStatus statusFromTaskFlow (Session session, TaskFlow tf)
 Constructs a taskflow status object from a task flow.
static TaskFlowStatus statusFromTaskFlow (Dao dao, TaskFlow tf)

Member Function Documentation

static TaskFlowStatus de.zib.gndms.logic.model.gorfx.taskflow.TaskFlowAux.statusFromTaskFlow ( Session  session,
TaskFlow  tf 
) [static]

Constructs a taskflow status object from a task flow.

Parameters:
tfThe taskflow.
Returns:
The newly created status object.
Note:
this one never sets the TaskSpecifier.
                                                                                    {

        TaskFlowStatus state = new TaskFlowStatus();

        if ( tf.getOrder() == null )
            state.setState( TaskFlowStatus.State.NO_ORDER );
        else if ( tf.isUnfulfillableOrder() )
            state.setState( TaskFlowStatus.State.ORDER_UNFULFILLABLE );
        else if ( tf.getQuotes() == null )
            state.setState( TaskFlowStatus.State.NO_QUOTES );
        else if ( tf.getTaskling() == null )
            state.setState( TaskFlowStatus.State.TASK_PREPARED ); // all precautions to start the task have been performed
                                                                  // thus the task is prepared.
        else {
            Taskling taskling = tf.getTaskling();
            Task task = session.findTask( taskling.getId() );
            TaskStatus remoteStatus = TaskTypeConverter.statusFromTask( task );
            switch ( remoteStatus.getStatus() ) {
                case FINISHED:
                case FAILED:
                    state.setState( TaskFlowStatus.State.TASK_DONE );
                    break;
                case RUNNING:
                    state.setState( TaskFlowStatus.State.TASK_RUNNING );
                    break;
                case WAITING:
                    state.setState( TaskFlowStatus.State.TASK_PREPARED );
                    break;
                case PAUSED:
                    state.setState( TaskFlowStatus.State.TASK_PAUSED );
                    break;
            }
            state.setTaskStatus( remoteStatus );
        }

        return state;
    }

The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables