org.bibalex.daf.entities.job
Class RejectingState

java.lang.Object
  extended by org.bibalex.daf.entities.job.JobState
      extended by org.bibalex.daf.entities.job.RejectingState

public class RejectingState
extends JobState

This class contains the logic necessary to reject the job. Calling makeTransition method will cause the job to be rejected.

Author:
Shehab.Kamal

Field Summary
private  java.lang.String comment
           
private  java.lang.String destination
           
private  java.lang.String errorMessage
           
private  FileHandler ftpHandler
           
private  TransitionInfo info
           
private  Job job
           
private  Phase nextPhase
           
private  User nextUser
           
private  Phase phase
           
private  java.lang.String source
           
private  User user
           
private  WorkStation workstation
           
 
Constructor Summary
RejectingState(Job job, User user, WorkStation workstation, User nextUser, Phase nextPhase, java.lang.String comment)
          Creates a new instance of RejectingState.
 
Method Summary
 void canReject_FileLevelInfo(java.util.ArrayList<FileLevelInfo> todoInfo, java.util.ArrayList<FileLevelInfo> nextInfo, Phase currentPhase, int nextPhaseID)
          Determines whether the job can be rejected to the given phase because of FileLevelInfo or not.
 java.lang.String getErrorMessage()
          This method gets the mesage that is to be displaed to the user
 java.lang.String getName()
          Gets the name of the state.
 int getNoOfFiles()
          Gets the number of files required to be transferred in order to reject the job.
 boolean makeForcedTransition()
          Rejects the job by force.
 boolean makeTransition()
          Rejects the job.
private  boolean makeTransition(boolean forced)
          Rejects the job.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

job

private Job job

user

private User user

workstation

private WorkStation workstation

info

private TransitionInfo info

nextUser

private User nextUser

nextPhase

private Phase nextPhase

comment

private java.lang.String comment

phase

private Phase phase

ftpHandler

private FileHandler ftpHandler

source

private java.lang.String source

destination

private java.lang.String destination

errorMessage

private java.lang.String errorMessage
Constructor Detail

RejectingState

public RejectingState(Job job,
                      User user,
                      WorkStation workstation,
                      User nextUser,
                      Phase nextPhase,
                      java.lang.String comment)
               throws java.lang.Exception
Creates a new instance of RejectingState.

Parameters:
job - The job to reject.
user - The user who is rejecting the job.
workstation - The workstation from which the job will be rejected.
nextUser - The User entity representing the suggested user.
nextPhase - The Phase entity representing the suggested phase.
comment - The reason the job is to be redirected.
Throws:
java.lang.Exception - If the information necessary to reject the job cannot be obtained.
Method Detail

getName

public java.lang.String getName()
Gets the name of the state.

Specified by:
getName in class JobState
Returns:
The name of the state.

getNoOfFiles

public int getNoOfFiles()
Gets the number of files required to be transferred in order to reject the job.

Specified by:
getNoOfFiles in class JobState
Returns:
The number of files to reject the job.

makeTransition

public boolean makeTransition()
Rejects the job.

Specified by:
makeTransition in class JobState
Returns:
True if the job has been rejected.

makeForcedTransition

public boolean makeForcedTransition()
Rejects the job by force.

Returns:
True if the job status in the database has changed to rejected.

makeTransition

private boolean makeTransition(boolean forced)
Rejects the job.

Parameters:
forced - Determines which stored procudre is called. If true Job_RejectForced is called otherwise Job_Reject is called.
Returns:
True if the job has been rejected otherwise false

canReject_FileLevelInfo

public void canReject_FileLevelInfo(java.util.ArrayList<FileLevelInfo> todoInfo,
                                    java.util.ArrayList<FileLevelInfo> nextInfo,
                                    Phase currentPhase,
                                    int nextPhaseID)
                             throws java.lang.Exception
Determines whether the job can be rejected to the given phase because of FileLevelInfo or not.

Parameters:
todoInfo - An ArrayList holding the 'ToDo' FileLevelInfo.
nextInfo - An ArrayList holding the 'Next' FileLevelInfo.
currentPhase - The current phase of the job.
nextPhaseID - The suggested phase to redirect the job to.
Throws:
java.lang.Exception - If the job cannot be rejected from this phase to the given next phase.

getErrorMessage

public java.lang.String getErrorMessage()
Description copied from class: JobState
This method gets the mesage that is to be displaed to the user

Specified by:
getErrorMessage in class JobState
Returns:
The error message to be dispalayed to the user