|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.model.project.Project
public class Project
A scientifically independent subset of the observations set forth in
a Proposal
.
An approved Proposal
may lead to one or more Project
s.
These projects are created by the Observing Program Committee.
Different projects from the same proposal may have different scientific
ratings.
A proposal is typically split into projects when time is requested on
different telescopes. There is usually a one-to-one corespondence between
project and telescope within a given proposal.
Version Info:
$Revision: 2277 $ |
$Date: 2009-04-29 11:19:38 -0600 (Wed, 29 Apr 2009) $ |
$Author: dharland $ |
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 | |
---|---|
Project()
Creates a new instance. |
Method Summary | |
---|---|
void |
addProgramBlock(int idx,
ProgramBlock progBlock)
Adds the given program block to this project at index idx . |
void |
addProgramBlock(ProgramBlock progBlock)
Adds the given program block to this project. |
void |
appendComments(String additionalComments)
Adds additional comments to those already associated with this project. |
void |
clearId()
Resets this project's id to UNIDENTIFIED and calls all of it's ProgramBlock's clearId() methods. |
Project |
clone()
Returns a project that is a copy of this one. |
ProgramBlock |
createProgramBlock()
Creates and returns a new program block that is suitable for use with this project. |
static Project |
createProject(TelescopeType telescope)
Creates an instance of a project that is appropriate for the given telescope. |
boolean |
equals(Object o)
Returns true if o is equal to this project. |
static Project |
fromXml(Reader reader)
Creates a new project based on the XML data read from reader . |
static Project |
fromXml(String xmlFile)
Creates a new project from the XML data in the given file. |
double |
getAllocatedTime()
Returns the amount of time allocated to this project by the Time Allocation Committee. |
String |
getComments()
Returns comments about this project. |
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()
Returns the ID of the user who is authorized to edit this project. |
EventSetStatus |
getExecutionStatus()
Returns this project's execution status. |
Long |
getId()
|
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. |
List<ProgramBlock> |
getProgramBlocks()
Returns the program blocks that belong to this project. |
List<ProgramBlock> |
getProgramBlocksSortedByPrereqs()
Returns a list of this project's program blocks sorted such that any prerequisites of the block at index i are at in indices greater than i. |
String |
getProjectCode()
Returns this project's NRAO code. |
ProjectType |
getProjectType()
Returns the type of this project. |
Proposal |
getProposal()
Returns the proposal that spawned this project. |
String |
getProposalCode()
Returns the NRAO code of the proposal that spawned this project. |
Collection<ScheduleEntry> |
getReadyToScheduleEntries(Collection<ScheduleEntry> destination)
Returns the schedule entries of this project that are ready for scheduling. |
Collection<ScheduleEntry> |
getScheduleEntries(EventStatus execStatus,
Collection<ScheduleEntry> destination)
Returns the schedule entries of this project that have an execution status of execStatus . |
ScientificPriority |
getScientificPriority()
Returns the scientific priority of this project. |
TelescopeType |
getTelescope()
Returns the telescope used by this project. |
double |
getTimeUsedSoFar()
Returns the telescope time used so far for this project. |
String |
getTitle()
Returns the title of this project. |
int |
hashCode()
|
boolean |
hasProposal()
Returns true if this project has a non-null proposal. |
boolean |
isTest()
Returns true if this project is a test, as opposed to official, project. |
void |
removeAllProgramBlocks()
Removes all program blocks from this project. |
void |
removeProgramBlock(ProgramBlock progBlock)
Removes the given program block from this project. |
void |
reset()
Resets this project to its initial state. |
void |
setAllocatedTime(double allocatedTime)
Sets the amount of time allocated to this project by the Time Allocation Committee. |
void |
setComments(String replacementComments)
Sets comments about this project. |
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 userId)
Sets the ID of the user who is authorized to edit this project. |
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 |
setProjectCode(String newCode)
Sets this project's NRAO code. |
void |
setProjectType(ProjectType type)
Sets the type of this project. |
void |
setProposal(Proposal proposal)
Sets the proposal that spawned this project. |
void |
setProposalCode(String newCode)
|
void |
setProposalProvider(ProposalProvider newProvider)
Tells this project where to look for proposals if it does not already have one. |
void |
setScientificPriority(ScientificPriority newPriority)
Sets the scientific priority for this project. |
void |
setTelescope(TelescopeType telescope)
Sets the telescope on which this project will be performed. |
void |
setTest(boolean projectIsTest)
Declares this project as either a test or official project. |
void |
setTitle(String newTitle)
Sets the title of this project. |
String |
toString()
Returns a text representation of this project. |
String |
toSummaryString()
Returns a short textual description of this project. |
String |
toXml()
Returns an XML representation of this project. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this project to writer . |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Project()
Method Detail |
---|
public static Project createProject(TelescopeType telescope)
setTelescope
method before it is returned.
telescope
- the telescope for which a new project is desired.
If telescope
is null, it will be
treated as if it had been
TelescopeType.getDefault()
.
telescope
.public void reset()
public Long getId()
getId
in interface Identifiable
public void clearId()
public void setProjectCode(String newCode)
Note that this is not necessarily the identifier that the
persistence layer will use to uniquely identify projects in the
data store. (See getId()
for that concept.) Instead,
this is NRAO's identifier for this project.
newCode
- this project's NRAO identifier.public String getProjectCode()
setProjectCode(String)
public void setTitle(String newTitle)
Proposal
that led to this project.
newTitle
- the title of this project.public String getTitle()
public void setProposal(Proposal proposal)
If proposal
is the same as this.getProposal()
,
this method will do nothing. Otherwise a reference to proposal
is saved in this project.
Consequences of Changing a Project's Proposal:
proposal
- the proposal that spawned this project.public Proposal getProposal()
Note to Developers: This method may be expensive. If
all you need is the proposal's ID code, the
getProposalCode()
method is more efficient. Of course,
if you need extensive information from the proposal,
you should use this method.
Note that it is possible for this project to not yet have a proposal. In this situation, the return value will be null. Also, if there are any problems encountered while using the proposal repository, null will be returned.
getProposalCode()
,
hasProposal()
public boolean hasProposal()
The only times this method should return false are:
public void setProposalProvider(ProposalProvider newProvider)
newProvider
- a provider of proposals.public String getProposalCode()
Calling this method instead of getProposal().getPropId()
may be more efficient.
getProposal()
public void setProposalCode(String newCode)
public ProgramBlock createProgramBlock()
public void addProgramBlock(ProgramBlock progBlock)
If progBlock
is already part of this project,
or if it is null, no action is taken.
Otherwise it is added to this project, removed from
the project to which it had been attached (if any),
and updated so that it knows it belongs to this project.
progBlock
- the program block to be added to this project.public void addProgramBlock(int idx, ProgramBlock progBlock)
idx
.
If progBlock
is already part of this project,
or if it is null, no action is taken.
Otherwise it is added to this project, removed from
the project to which it had been attached (if any),
and updated so that it knows it belongs to this project.
idx
- the index in our list of program blocks at which to add progBlock
.progBlock
- the program block to be added to this project.public void removeProgramBlock(ProgramBlock progBlock)
If progBlock
is null, or if it does
not belong to this project, nothing happens.
If it is a prerequisite of one or more of the program
blocks held by this project, an exception is thrown
and it is not removed from this project.
Otherwise, progBlock
is removed from this
project and has its project attribute set to
null.
progBlock
- the program block to be removed.public void removeAllProgramBlocks()
public List<ProgramBlock> getProgramBlocks()
The returned List
is a copy of the one held internally
by this project, so changes made to it will not be reflected herein.
public List<ProgramBlock> getProgramBlocksSortedByPrereqs()
Note that the sort determines only how prerequisites and things dependent on them are place relative to one another. For example, imagine four blocks A, B, C, and D. C has A and B as prerequisites and no other block has prerequisites. The returned list will place C in a lower index than A and B. However, we know nothing about how A and B will be placed relative to each other, nor do we know ahead of time where D will be placed.
public Collection<ScheduleEntry> getScheduleEntries(EventStatus execStatus, Collection<ScheduleEntry> destination)
execStatus
. Only the status of the
entries is considered. This method does not look, for example, at the
isTest()
property.
execStatus
- the execution status of the schedule entries to be added
to destination
.destination
- the collection to which the schedule entries should be
added. If this collection is null, a new one
will be created. This collection is returned.
destination
or a new collection, if destination
is
null.getReadyToScheduleEntries(Collection)
public Collection<ScheduleEntry> getReadyToScheduleEntries(Collection<ScheduleEntry> destination)
destination
- the collection to which the ready-to-be-scheduled
entries should be added. If this collection is
null, a new one will be created. This
collection is returned.
destination
or a new collection, if destination
is
null.getScheduleEntries(EventStatus, Collection)
public EventSetStatus getExecutionStatus()
public void setTelescope(TelescopeType telescope)
telescope
- the telescope used by this project.public TelescopeType getTelescope()
public void setScientificPriority(ScientificPriority newPriority)
newPriority
- the scientific priority for this project.public ScientificPriority getScientificPriority()
public void setAllocatedTime(double allocatedTime)
allocatedTime
- the amount of time allocated to this project
in whole and fractional hours.public double getAllocatedTime()
public void setTest(boolean projectIsTest)
projectIsTest
- true if this project is a test project.public boolean isTest()
public void setProjectType(ProjectType type)
type
- the type of this project.public ProjectType getProjectType()
public double getTimeUsedSoFar()
public void setCreatedBy(Long userId)
UserAccountable
If userId
is null, this object will be updated
not with null but with UserAccountable.NULL_USER_ID
instead.
setCreatedBy
in interface UserAccountable
userId
- the ID of the user who most recently updated this object.public void setCreatedOn(Date d)
UserAccountable
If d
is null it will be ignored and this method
will do nothing.
setCreatedOn
in interface UserAccountable
d
- the date on which this object was created.public void setLastUpdatedBy(Long userId)
UserAccountable
If userId
is null, this object will be updated
not with null but with UserAccountable.NULL_USER_ID
instead.
setLastUpdatedBy
in interface UserAccountable
userId
- the ID of the user who most recently updated this object.public void setLastUpdatedOn(Date d)
UserAccountable
If d
is null it will be ignored and this method
will do nothing.
setLastUpdatedOn
in interface UserAccountable
d
- the date on which this object was most recently updated.public Long getCreatedBy()
UserAccountable
If this object does not know the identity of the user who created
it, the returned ID will be UserAccountable.NULL_USER_ID
.
getCreatedBy
in interface UserAccountable
public Date getCreatedOn()
UserAccountable
getCreatedOn
in interface UserAccountable
public Long getLastUpdatedBy()
UserAccountable
If this object does not know the identity of the user who lasted
updated it, the returned ID will be UserAccountable.NULL_USER_ID
.
getLastUpdatedBy
in interface UserAccountable
public Date getLastUpdatedOn()
UserAccountable
getLastUpdatedOn
in interface UserAccountable
public void setEditor(Long userId)
userId
- the ID of the user who is authorized to edit this project.public Long getEditor()
public void setComments(String replacementComments)
replacementComments
- free-form comments about this project.
These comments replace all previously set comments.
A null value will be replaced by the empty string ("").appendComments(String)
public void appendComments(String additionalComments)
additionalComments
- new, additional, comments about this project.setComments(String)
public String getComments()
appendComments(String)
,
setComments(String)
public String toString()
toString
in class Object
public String toSummaryString()
public String toXml() throws JAXBException
JAXBException
- if anything goes wrong during the conversion to XML.writeAsXmlTo(Writer)
public void writeAsXmlTo(Writer writer) throws JAXBException
writer
.
writer
- the device to which XML is written.
JAXBException
- if anything goes wrong during the conversion to XML.public static Project fromXml(String xmlFile) throws JAXBException, XMLStreamException, FileNotFoundException
xmlFile
- the name of an XML file. This method will attempt to locate
the file by using Class.getResource(String)
.
FileNotFoundException
- if the XML file cannot be found.
JAXBException
- if the schema file used (if any) is malformed, if
the XML file cannot be read, or if the XML file is not
schema-valid.
XMLStreamException
- if there is a problem opening the XML file,
if the XML is not well-formed, or for some other
"unexpected processing conditions".public static Project fromXml(Reader reader) throws JAXBException, XMLStreamException
reader
.
reader
- the source of the XML data.
If this value is null, null is returned.
reader
.
XMLStreamException
- if the XML is not well-formed,
or for some other "unexpected processing conditions".
JAXBException
- if anything else goes wrong during the
transformation.public Project clone()
For the most part this project is deeply cloned. For example, the clone and this project will have their own lists of program blocks, and the program blocks in the clone will be clones of those in this project. There are, however, a few exceptions to the deep copy philosophy:
Identifiable.UNIDENTIFIED
.
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in class Object
public boolean equals(Object o)
o
is equal to this project.
In order to be equal to this project, o
must be non-null
and of the same class as this project. Equality is determined by examining
the equality of corresponding attributes, with the following exceptions,
which are ignored when assessing equality:
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |