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 edu.nrao.sss.util.EnumerationUtility;
007    
008    /** <i>Placeholder for time when we integrate proposal work.</i>
009     * An enumeration of proposal statuses.
010     * 
011     * @version 1.1
012     * @since   2006-03-02
013     */
014    public enum ProposalStatus
015    {
016      // TODO get someone to see if these descriptions are accurate.
017      /** Signifies that the given {@link Proposal} is a draft.  */
018      DRAFT, 
019    
020      /** Signifies that the given {@link Proposal} has been submitted for approval. */
021      SUBMITTED, 
022    
023      /** Signifies that the given {@link Proposal} has been withdrawn from consideration. */
024      WITHDRAWN, 
025    
026      /** Signifies that the given {@link Proposal} is in the hands of a referee.  */
027      REFEREE, 
028    
029      /** Signifies that the given {@link Proposal} is currently being evaluated. */
030      EVALUATE, 
031    
032      /** Signifies that the given {@link Proposal} has been accepted. */
033      ACCEPTED, 
034    
035      /** Signifies that the given {@link Proposal} has been rejected. */
036      REJECTED, 
037    
038      /** Signifies that the given {@link Proposal} is scheduled for execution. */
039      SCHEDULE, 
040    
041      /** Signifies that the given {@link Proposal} has been completed. */
042      FINISHED, 
043    
044      /** Signifies that the given {@link Proposal} ??? */
045      RELEASE,
046      
047      /** An unknown proposal status.  This element is used to implement the
048       *  <i>Null Object Pattern</i>.  In situations where a method might
049       *  be tempted to return <i>null</i>, this element is returned instead.
050       */
051      UNKNOWN;
052    
053      /**
054       * Returns a default proposal status.
055       * @return a default proposal status.
056       */
057      public static ProposalStatus getDefault()
058      {
059        return DRAFT;
060      }
061      
062      /**
063       * Returns a text representation of this enumeration constant.
064       * @return a text representation of this enumeration constant.
065       */
066      public String toString()
067      {
068        return EnumerationUtility.getSharedInstance().enumToString(this);
069      }
070      
071      /**
072       * Returns the proposal status represented by {@code text}.
073       * <p>
074       * For details about the transformation, see
075       * {@link EnumerationUtility#enumFromString(Class, String)}.</p>
076       * 
077       * @param text a text representation of a proposal status.
078       * 
079       * @return the proposal status represented by {@code text}.
080       */
081      public static ProposalStatus fromString(String text)
082      {
083        return EnumerationUtility.getSharedInstance()
084                                 .enumFromString(ProposalStatus.class, text);
085      }
086    }