org.bibalex.daf.managers.checkin
Class RetrievalManager

java.lang.Object
  extended by java.util.Observable
      extended by org.bibalex.daf.managers.checkin.RetrievalManager

public class RetrievalManager
extends java.util.Observable

This class holds the functionality implementation provided by the Retrieval Module.

Author:
Fadi.Edward

Constructor Summary
RetrievalManager()
           
 
Method Summary
private  boolean adjustRemainigFiles(java.lang.String rootFolder, StatusDef statusDef)
          Removes the extra files if exists.
static boolean assignJobTo(Job job, int jobTypeID, int phaseID, int userID)
          Assigns and uploads the given Job to the listed phase and user.
static boolean checkInJob(Job job, int phaseID, int userID)
          Moves the records of this job from the OldTransactionLog to the TransactionLog
private  boolean deCompressJob(Job job, StatusDef statusDef, boolean removeExtraFiles)
           
private  void deleteFile(java.lang.String filePath)
          Deletes a specific file.
private  void removeExtraFiles(java.lang.String rootFolder, StatusDef statusDef)
          Removes the extra files if exists.
static void removeJobFromWorkingDirectory(Job job)
          Deletes the Imported Job files from the working directory if they exists.
private  void removeThumbFile(java.lang.String rootFolder)
          Removes the thumbs.db file if it exists.
private  void renameAllFileNames(java.lang.String rootFolder, java.lang.String oldFileName, java.lang.String newFileName, boolean recursive)
          Renames all the files Upon the new naming Convention of the new System.
 boolean retrieve(Job job, StatusDef statusDef, boolean removeExtraFiles)
          This method completes the retrieval operation
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RetrievalManager

public RetrievalManager()
Method Detail

retrieve

public boolean retrieve(Job job,
                        StatusDef statusDef,
                        boolean removeExtraFiles)
This method completes the retrieval operation

Parameters:
job - The job to be retrieved
statusDef - The status definition of the job to be retrieved
removeExtraFiles - Indicates wether to remove any Extra Files or Not.
Returns:
True, if the retrieval is successful, and returns false otherwise

deCompressJob

private boolean deCompressJob(Job job,
                              StatusDef statusDef,
                              boolean removeExtraFiles)
Parameters:
job - The Job object to retrieve.
statusDef - the status definition of the job
Returns:
true if decompression is successfull, false otherwise.

checkInJob

public static boolean checkInJob(Job job,
                                 int phaseID,
                                 int userID)
Moves the records of this job from the OldTransactionLog to the TransactionLog

Parameters:
job - the job to move the records for.
phaseID - The phase ID to move to.
userID - The user ID to assign to.
Returns:
true if check in is successfull, false otherwise.

assignJobTo

public static boolean assignJobTo(Job job,
                                  int jobTypeID,
                                  int phaseID,
                                  int userID)
Assigns and uploads the given Job to the listed phase and user. If the job is already in the system then it is considered a simple assign or Job Type change, otherwise the job has also to be moved from the OldTransactionLog table to the Active one (TransactionLog table).

Parameters:
job - The Job to be assigned.
jobTypeID - The JobType ID to be modified to if necessary.
phaseID - The Phase ID to assign to within this JobType.
userID - The User ID to assign to.
Returns:
true if assign is successfull, false otherwise.

removeJobFromWorkingDirectory

public static void removeJobFromWorkingDirectory(Job job)
Deletes the Imported Job files from the working directory if they exists.

Parameters:
job - The Job object to remove the files for.

renameAllFileNames

private void renameAllFileNames(java.lang.String rootFolder,
                                java.lang.String oldFileName,
                                java.lang.String newFileName,
                                boolean recursive)
Renames all the files Upon the new naming Convention of the new System. Mostly used when retrieving Migrated Jobs

Parameters:
rootFolder - the Root folder of the Job.
oldFileName - The old file name to be renamed.
newFileName - The new file name to use.
recursive - Defines wether the renaming is recrusive on the SubFolders also or not.

deleteFile

private void deleteFile(java.lang.String filePath)
Deletes a specific file.

Parameters:
filePath - The Path of the file to delete.

removeThumbFile

private void removeThumbFile(java.lang.String rootFolder)
Removes the thumbs.db file if it exists. (used only with Windows Operating System).

Parameters:
rootFolder - The root folder to start removing from.

removeExtraFiles

private void removeExtraFiles(java.lang.String rootFolder,
                              StatusDef statusDef)
Removes the extra files if exists. (used only with Windows Operating System).

Parameters:
rootFolder - The root folder to start removing from.

adjustRemainigFiles

private boolean adjustRemainigFiles(java.lang.String rootFolder,
                                    StatusDef statusDef)
Removes the extra files if exists. (used only with Windows Operating System).

Parameters:
rootFolder - The root folder to start removing from.