com.partnersoft.v3x.apps.Staker.server
Class JobArchive

java.lang.Object
  extended by com.partnersoft.v3x.apps.Staker.server.JobArchive

public class JobArchive
extends java.lang.Object

Collects and encapsulates all info related to a Job - header, checkout information, etc. A provided JobLibraryFileManager reference allows loading and saving to be encapsulated as well. It is intentionally not a bean - all state is not accessible through accessor methods. You must supply the required state (jobNumber and fileManager) to the constructor.


Constructor Summary
JobArchive(Job newJob, JobLibraryFileManager fileManager)
          Create a totally new JobArchive.
JobArchive(java.lang.String jobNumber, JobLibraryFileManager fileManager)
          Create a new JobArchive.
 
Method Summary
 void addNote(Note comment)
          Adds a note.
 void archiveJob()
          Backs up the job to Hub/data/backups/`jobNumber`-`timestamp`.tof.
 boolean changeHeader(ChangeJobHeader changer)
          Applies individual field changes to the JobHeader.
 boolean checkinHeader(CheckedOutJobHeader checkedOutHeader)
          Check in a modified version of the header.
 void checkinJob(CheckedOutJob jobbie)
          Check in job.
 CheckedOutJobHeader checkoutHeader(java.lang.String customer)
          Check out the current version of the header.
 CheckedOutJob checkoutJob(java.lang.String customer)
          Check out job.
 void forceReleaseJob()
          Forcibly release job; damn the consequences.
 JobCheckouts getCheckouts()
           
 JobHeader getHeader()
           
 Job getJob()
          Job in archive.
 java.lang.String getJobNumber()
           
 boolean isChanged()
          True if any part of the archive needs saving.
 void markChanged()
          Flag it as changed regardless of what it thinks.
 void markHeaderChanged()
          Mark that header changed.
 void releaseHeader(LibraryVersionReceipt receipt)
          Release header without modifying.
 void releaseJob(CheckedOutJob job)
          Release job.
 void removeJob()
           
 void resetJob(Job newJob)
          Use this to set up a new JobArchive, or to totally reset an old one.
 void runTriggers()
          Runs any trigger actions - e.g., setting the staked date the first time the job comes in as "Staked".
 void save()
          Save any changes.
static void spit(Job jobber)
           
 JobHeader viewHeader()
          Use this whenever distributing JobHeaders, since it gives you a cloned version, thus protecting the original.
 Job viewJob()
          Use this whenever distributing Jobs, since it gives you a cloned version, thus protecting the original.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobArchive

public JobArchive(java.lang.String jobNumber,
                  JobLibraryFileManager fileManager)
Create a new JobArchive.


JobArchive

public JobArchive(Job newJob,
                  JobLibraryFileManager fileManager)
           throws java.io.IOException
Create a totally new JobArchive.

Throws:
java.io.IOException
Method Detail

spit

public static void spit(Job jobber)

checkoutHeader

public CheckedOutJobHeader checkoutHeader(java.lang.String customer)
                                   throws java.io.IOException
Check out the current version of the header.

Throws:
java.io.IOException

checkinHeader

public boolean checkinHeader(CheckedOutJobHeader checkedOutHeader)
                      throws java.io.IOException
Check in a modified version of the header. Returns true if the header actually changed as a result.

Throws:
java.io.IOException

changeHeader

public boolean changeHeader(ChangeJobHeader changer)
                     throws java.io.IOException
Applies individual field changes to the JobHeader.

Throws:
java.io.IOException

addNote

public void addNote(Note comment)
             throws java.io.IOException
Adds a note.

Throws:
java.io.IOException

releaseHeader

public void releaseHeader(LibraryVersionReceipt receipt)
                   throws java.io.IOException
Release header without modifying.

Throws:
java.io.IOException

checkoutJob

public CheckedOutJob checkoutJob(java.lang.String customer)
                          throws java.io.IOException
Check out job.

Throws:
java.io.IOException

archiveJob

public void archiveJob()
                throws java.io.IOException,
                       JobLibraryException
Backs up the job to Hub/data/backups/`jobNumber`-`timestamp`.tof.

Throws:
java.io.IOException
JobLibraryException

checkinJob

public void checkinJob(CheckedOutJob jobbie)
                throws java.io.IOException,
                       JobLibraryException
Check in job.

Throws:
java.io.IOException
JobLibraryException

releaseJob

public void releaseJob(CheckedOutJob job)
                throws java.io.IOException
Release job.

Throws:
java.io.IOException

forceReleaseJob

public void forceReleaseJob()
                     throws java.io.IOException
Forcibly release job; damn the consequences.

Throws:
java.io.IOException

resetJob

public void resetJob(Job newJob)
              throws java.io.IOException
Use this to set up a new JobArchive, or to totally reset an old one.

Throws:
java.io.IOException

removeJob

public void removeJob()
               throws java.io.IOException
Throws:
java.io.IOException

save

public void save()
          throws java.io.IOException
Save any changes.

Throws:
java.io.IOException

markChanged

public void markChanged()
Flag it as changed regardless of what it thinks.


viewJob

public Job viewJob()
            throws java.io.IOException
Use this whenever distributing Jobs, since it gives you a cloned version, thus protecting the original.

Throws:
java.io.IOException

viewHeader

public JobHeader viewHeader()
                     throws java.io.IOException
Use this whenever distributing JobHeaders, since it gives you a cloned version, thus protecting the original.

Throws:
java.io.IOException

runTriggers

public void runTriggers()
                 throws java.io.IOException
Runs any trigger actions - e.g., setting the staked date the first time the job comes in as "Staked".

Throws:
java.io.IOException

getJobNumber

public java.lang.String getJobNumber()

getJob

public Job getJob()
           throws java.io.IOException
Job in archive.

Throws:
java.io.IOException

getHeader

public JobHeader getHeader()
                    throws java.io.IOException
Throws:
java.io.IOException

isChanged

public boolean isChanged()
True if any part of the archive needs saving.


markHeaderChanged

public void markHeaderChanged()
Mark that header changed.


getCheckouts

public JobCheckouts getCheckouts()
                          throws java.io.IOException
Throws:
java.io.IOException