edu.nrao.sss.model.proposal
Class Proposal

java.lang.Object
  extended by edu.nrao.sss.model.proposal.Proposal
All Implemented Interfaces:
UserAccountable, Identifiable, XmlSerializable

public class Proposal
extends Object
implements Identifiable, XmlSerializable, UserAccountable

Placeholder for time when we integrate proposal work. A request for time to perform one or more projects on one or more telescopes.

Since:
2006-02-24
Version:
1.1

Field Summary
 
Fields inherited from interface edu.nrao.sss.util.Identifiable
UNIDENTIFIED
 
Fields inherited from interface edu.nrao.sss.model.UserAccountable
NULL_USER_ID
 
Constructor Summary
Proposal()
          Creates a new instance.
 
Method Summary
 void addAuthor(Author newAuthor)
           
 void addResource(Resource s)
           
 void addSession(Session s)
           
 void addSource(Source s)
           
 void addTelescope(TelescopeType newTelescope)
           
 Set<Project> createProjects()
          Creates and returns a set of projects based on the information in this proposal.
 void deleteResource(Resource s)
           
 void deleteSession(Session s)
           
 void deleteSource(Source s)
           
 void fromXml(String xml)
           
 String getAbstract()
           
 List<Author> getAuthors()
           
 Long getContactPerson()
           
 Long getCreatedBy()
          Returns the ID of the user who created this object.
 Date getCreatedOn()
          Returns the date on which this object was created.
 Long getEditor()
           
 Long getId()
          Resets this proposal to its initial state.
 JustificationFileDescriptor getJustificationFile()
           
 Long getLastUpdatedBy()
          Returns the ID of the user who most recently updated this object.
 Date getLastUpdatedOn()
          Returns the most recent date on which this object was updated.
 String getLegacyId()
           
 String getObservingTypeOther()
           
 Set<ObservingType> getObservingTypes()
           
 Set<String> getPreviousCodes()
           
 Set<String> getPreviousProposals()
           
 Long getPrincipalInvestigator()
           
 String getProposalCode()
           
 ProposalType getProposalType()
           
 Set<String> getRelatedProposals()
           
 Set<Resource> getResources()
           
 ScientificType getScientificCategory()
           
 String getScientificCategoryOther()
           
 Set<Session> getSessions()
           
 Set<Source> getSourceClones()
          Returns a set that contains one copy of each of the sources in this proposal.
 Set<Source> getSources()
           
 SupportType getStaffSupport()
           
 ProposalStatus getStatus()
           
 StudentSupport getStudentSupport()
           
 Date getSubmittedOn()
           
 Set<TelescopeType> getTelescopes()
           
 String getTitle()
           
 boolean isObserverToBePresent()
           
 void removeAuthor(Author oldAuthor)
           
 void removeTelescope(TelescopeType oldTelescope)
           
 void setAbstract(String newAbstract)
           
 void setContactPerson(Long contactPersonId)
           
 void setCreatedBy(Long userId)
          Sets the ID of the user who created this object.
 void setCreatedOn(Date d)
          Sets the date on which this object was created.
 void setEditor(Long editorId)
           
 void setJustificationFile(JustificationFileDescriptor newDescriptor)
           
 void setLastUpdatedBy(Long userId)
          Sets the ID of the user who most recently updated this object.
 void setLastUpdatedOn(Date d)
          Sets the date on which this object was most recently updated.
 void setLegacyId(String id)
           
 void setObserverToBePresent(boolean toBePresent)
           
 void setObservingTypeOther(String other)
           
 void setObservingTypes(Set<ObservingType> observingTypes)
           
 void setPreviousCodes(Set<String> newSetOfCodes)
           
 void setPreviousProposals(Set<String> prevProposals)
           
 void setPrincipalInvestigator(Long principalInvestigatorId)
           
 void setProposalCode(String newCode)
           
 void setProposalType(ProposalType proposalType)
           
 void setRelatedProposals(Set<String> rProposals)
           
 void setScientificCategory(ScientificType scienceCategory)
           
 void setScientificCategoryOther(String s)
           
 void setStaffSupport(SupportType sSupport)
           
 void setStatus(ProposalStatus newStatus)
           
 void setStudentSupport(StudentSupport ss)
           
 void setSubmittedOn(Date submit)
           
 void setTitle(String title)
           
 String toString()
           
 String toXml()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Proposal

public Proposal()
Creates a new instance.

Method Detail

getId

public Long getId()
Resets this proposal to its initial state. A reset proposal has the same state as a new proposal.

Specified by:
getId in interface Identifiable

getLegacyId

public String getLegacyId()
Returns:
XXX What is a legacy id?

setLegacyId

public void setLegacyId(String id)
See Also:
getLegacyId()

getProposalCode

public String getProposalCode()
Returns:
The comittee assigned id for this proposal.

setProposalCode

public void setProposalCode(String newCode)

getTitle

public String getTitle()

setTitle

public void setTitle(String title)

getProposalType

public ProposalType getProposalType()

setProposalType

public void setProposalType(ProposalType proposalType)

getStatus

public ProposalStatus getStatus()

setStatus

public void setStatus(ProposalStatus newStatus)

getPreviousCodes

public Set<String> getPreviousCodes()

setPreviousCodes

public void setPreviousCodes(Set<String> newSetOfCodes)

getPreviousProposals

public Set<String> getPreviousProposals()

setPreviousProposals

public void setPreviousProposals(Set<String> prevProposals)

getRelatedProposals

public Set<String> getRelatedProposals()

setRelatedProposals

public void setRelatedProposals(Set<String> rProposals)

setCreatedBy

public void setCreatedBy(Long userId)
Description copied from interface: UserAccountable
Sets the ID of the user who created this object.

If userId is null, this object will be updated not with null but with UserAccountable.NULL_USER_ID instead.

Specified by:
setCreatedBy in interface UserAccountable
Parameters:
userId - the ID of the user who most recently updated this object.

setCreatedOn

public void setCreatedOn(Date d)
Description copied from interface: UserAccountable
Sets the date on which this object was created.

If d is null it will be ignored and this method will do nothing.

Specified by:
setCreatedOn in interface UserAccountable
Parameters:
d - the date on which this object was created.

setLastUpdatedBy

public void setLastUpdatedBy(Long userId)
Description copied from interface: UserAccountable
Sets the ID of the user who most recently updated this object.

If userId is null, this object will be updated not with null but with UserAccountable.NULL_USER_ID instead.

Specified by:
setLastUpdatedBy in interface UserAccountable
Parameters:
userId - the ID of the user who most recently updated this object.

setLastUpdatedOn

public void setLastUpdatedOn(Date d)
Description copied from interface: UserAccountable
Sets the date on which this object was most recently updated.

If d is null it will be ignored and this method will do nothing.

Specified by:
setLastUpdatedOn in interface UserAccountable
Parameters:
d - the date on which this object was most recently updated.

getCreatedBy

public Long getCreatedBy()
Description copied from interface: UserAccountable
Returns the ID of the user who created this object.

If this object does not know the identity of the user who created it, the returned ID will be UserAccountable.NULL_USER_ID.

Specified by:
getCreatedBy in interface UserAccountable
Returns:
the ID of the user who created this object.

getCreatedOn

public Date getCreatedOn()
Description copied from interface: UserAccountable
Returns the date on which this object was created.

Specified by:
getCreatedOn in interface UserAccountable
Returns:
the date on which this object was created.

getLastUpdatedBy

public Long getLastUpdatedBy()
Description copied from interface: UserAccountable
Returns the ID of the user who most recently updated this object.

If this object does not know the identity of the user who lasted updated it, the returned ID will be UserAccountable.NULL_USER_ID.

Specified by:
getLastUpdatedBy in interface UserAccountable
Returns:
the ID of the user who most recently updated this object.

getLastUpdatedOn

public Date getLastUpdatedOn()
Description copied from interface: UserAccountable
Returns the most recent date on which this object was updated.

Specified by:
getLastUpdatedOn in interface UserAccountable
Returns:
the most recent date on which this object was updated.

getSubmittedOn

public Date getSubmittedOn()

setSubmittedOn

public void setSubmittedOn(Date submit)

getEditor

public Long getEditor()

setEditor

public void setEditor(Long editorId)

getContactPerson

public Long getContactPerson()

setContactPerson

public void setContactPerson(Long contactPersonId)

getPrincipalInvestigator

public Long getPrincipalInvestigator()

setPrincipalInvestigator

public void setPrincipalInvestigator(Long principalInvestigatorId)

getAuthors

public List<Author> getAuthors()

addAuthor

public void addAuthor(Author newAuthor)

removeAuthor

public void removeAuthor(Author oldAuthor)

addTelescope

public void addTelescope(TelescopeType newTelescope)

removeTelescope

public void removeTelescope(TelescopeType oldTelescope)

getTelescopes

public Set<TelescopeType> getTelescopes()

getObservingTypes

public Set<ObservingType> getObservingTypes()

setObservingTypes

public void setObservingTypes(Set<ObservingType> observingTypes)

getObservingTypeOther

public String getObservingTypeOther()

setObservingTypeOther

public void setObservingTypeOther(String other)

getScientificCategory

public ScientificType getScientificCategory()

setScientificCategory

public void setScientificCategory(ScientificType scienceCategory)

getScientificCategoryOther

public String getScientificCategoryOther()

setScientificCategoryOther

public void setScientificCategoryOther(String s)

getAbstract

public String getAbstract()
Returns:
the abstract

setAbstract

public void setAbstract(String newAbstract)

getJustificationFile

public JustificationFileDescriptor getJustificationFile()

setJustificationFile

public void setJustificationFile(JustificationFileDescriptor newDescriptor)

getSessions

public Set<Session> getSessions()

addSession

public void addSession(Session s)

deleteSession

public void deleteSession(Session s)

getSources

public Set<Source> getSources()

getSourceClones

public Set<Source> getSourceClones()
Returns a set that contains one copy of each of the sources in this proposal.

Returns:
a set of sources cloned from this proposal's set of sources.

addSource

public void addSource(Source s)

deleteSource

public void deleteSource(Source s)

getResources

public Set<Resource> getResources()

addResource

public void addResource(Resource s)

deleteResource

public void deleteResource(Resource s)

isObserverToBePresent

public boolean isObserverToBePresent()

setObserverToBePresent

public void setObserverToBePresent(boolean toBePresent)

getStaffSupport

public SupportType getStaffSupport()

setStaffSupport

public void setStaffSupport(SupportType sSupport)

getStudentSupport

public StudentSupport getStudentSupport()

setStudentSupport

public void setStudentSupport(StudentSupport ss)

createProjects

public Set<Project> createProjects()
Creates and returns a set of projects based on the information in this proposal.

One project is returned for each telescope specified in this proposal. (If no telescopes have been specified, the returned set will be empty.) Each project in the returned set will have had this proposal sent to its setProposal method.

Returns:
a set of projects based on the information in this proposal.

toString

public String toString()
Overrides:
toString in class Object

toXml

public String toXml()
Specified by:
toXml in interface XmlSerializable
Returns:
a string containing the xml representation of a proposal.
See Also:
public String toXML( int indent ) { StringBuilder sb = new StringBuilder(); sb.append( "\n\n" ); sb.append( " "+getTitle() + "\n" ); if ( previousProposals != null ){ sb.append( " " + previousProposals + "\n" ); } else { sb.append( " \n" ); } sb.append( " " + getRelatedProposals() + "\n" ); sb.append( " " + scientificCategory + "\n" ); if ( scientificCategory != null && ScientificType.OTHER.equals( scientificCategory ) ){ sb.append( " " +scientificCategoryOther + "\n" ); } if ( abstractStr != null ){ sb.append( " " + abstractStr + "\n" ); } sb.append( " \n" ); sb.append( " "+proposalType+"/>\n" ); sb.append( " \n" ); for ( ObservingType type: observingTypes ){ sb.append( " "+type+"\n"); } sb.append( " \n"); if ( observingTypeOther != null ){ sb.append( " "+observingTypeOther + "\n"); } else { sb.append( " \n" ); } if ( justificationFileName != null ){ sb.append( " \n" ); } else { sb.append( " \n"); } return sb.toString(); }

fromXml

public void fromXml(String xml)
Specified by:
fromXml in interface XmlSerializable


Copyright © 2009. All Rights Reserved.