001    /**
002     * Do we want to use this space for anything?  Eg, revision history?
003     */
004    package edu.nrao.sss.model.proposal;
005    
006    import java.sql.Blob;
007    
008    import edu.nrao.sss.util.Identifiable;
009    
010    /** <i>Placeholder for time when we integrate proposal work.</i>
011     * A scientific and technical justification for a proposal.
012     * <p>
013     * <b>CVS Info:</b>
014     * <table style="margin-left:2em">
015     *   <tr><td>$Revision: 161 $</td>
016     *   <tr><td>$Date: 2006-12-15 11:48:34 -0700 (Fri, 15 Dec 2006) $</td>
017     *   <tr><td>$Author: btruitt $</td>
018     * </table></p>
019     *  
020     * @since 2006-03-23
021     */
022    public class JustificationFile
023    {
024      private Long                        proposalId;
025      private JustificationFileDescriptor descriptor;
026      private Blob                        data;
027      
028      /** Creates a new instance. */
029      public JustificationFile()
030      {
031        descriptor = new JustificationFileDescriptor();
032        initialize();
033      }
034      
035      private void initialize()
036      {
037        proposalId = Identifiable.UNIDENTIFIED;
038        data       = null;
039      }
040      
041      /** Resets this file to its initial state. */
042      public void reset()
043      {
044        initialize();
045        descriptor.reset();
046      }
047      
048      /**
049       * Sets the identifier of the proposal to which this justification belongs.
050       * 
051       * @param proposalId the ID for this justification file's proposal.
052       */
053      public void setProposalId(Long proposalId)
054      {
055        this.proposalId = (proposalId == null) ? Identifiable.UNIDENTIFIED
056                                               : proposalId;
057      }
058    
059      /**
060       * Returns the identifier of the proposal to which this justification belongs.
061       * 
062       * @return the ID of the proposal to which this justification belongs.
063       */
064      public Long getProposalId()
065      {
066        return proposalId;
067      }
068    
069      /**
070       * Returns a descriptor for this justification file.
071       * @return a descriptor for this justification file.
072       */
073      public JustificationFileDescriptor getDescriptor()
074      {
075        return descriptor;
076      }
077    
078      /**
079       * Sets the contents of this justification file.
080       * @param data a Blob containing the justification file contents.
081       */
082     public void setData(Blob data)
083      {
084        this.data = data;
085      }
086    
087     /**
088      * Returns the contents of this justification file.
089      * <p>
090      * If this file has no content, <i>null</i> will be returned.</p>
091      * 
092      * @return the contents of this justification file, or <i>null</i>
093      *         if this file has no content.
094      */
095      public Blob getData()
096      {
097        return data;
098      }
099    }