|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.nrao.sss.util.LookupTable<Date,Source> edu.nrao.sss.model.source.SourceLookupTable
public class SourceLookupTable
A lookup table where the index is of type Date
and the value is of type Source
.
Version Info:
$Revision: 1709 $ |
$Date: 2008-11-14 11:22:37 -0700 (Fri, 14 Nov 2008) $ |
$Author: dharland $ (last person to modify) |
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 | |
---|---|
SourceLookupTable()
Creates a new table with a default name. |
|
SourceLookupTable(String nameOfTable)
Creates a new table with the given name. |
Method Summary | |
---|---|
void |
clear()
|
void |
clearId()
Resets this entry's ID, and the IDs of all its components, to a value that represents the unidentified state. |
SourceLookupTable |
clone()
Returns a deep copy of this source lookup table. |
SourceLookupTable |
cloneAllButSources()
Returns a copy of this source lookup table that holds references to the same sources as this table. |
boolean |
equals(Object o)
Returns true if o is equal to this table. |
static SourceLookupTable |
fromXml(Reader reader)
Creates a new table based on the XML data read from reader . |
static SourceLookupTable |
fromXml(String xmlFile)
Creates a new table from the XML data in the given file. |
Long |
getCreatedBy()
Returns the ID of the user who created this object. |
Date |
getCreatedOn()
Returns the date on which this object was created. |
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. |
SourceTableListener |
getListener()
Returns the object that is listening to this table. |
String |
getName()
Returns the name of this table. |
List<String> |
getNotes()
Returns a list of notes about this table. |
int |
hashCode()
Returns a hash code value for this table. |
Source |
put(Date key,
Source value)
|
void |
putAll(Map<Date,Source> map)
|
Source |
remove(Date key)
|
void |
removeListener(SourceTableListener listener)
Removes listener as a listener of this table. |
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 |
setId(Long id)
Do not use. |
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 |
setListener(SourceTableListener listener)
Sets the object that will listen to this table. |
void |
setName(String newName)
Sets the name of this table. |
String |
toString()
Returns a text representation of this table. |
String |
toXml()
Returns an XML representation of this table. |
void |
writeAsXmlTo(Writer writer)
Writes an XML representation of this table to writer . |
Methods inherited from class edu.nrao.sss.util.LookupTable |
---|
containsKey, containsValue, get, getKeySet, getKeySetFor, removeValue, size, toMap |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface edu.nrao.sss.model.source.SourceCatalogEntry |
---|
get |
Constructor Detail |
---|
public SourceLookupTable()
public SourceLookupTable(String nameOfTable)
nameOfTable
- the name of this table. If this value is
null, this table will be given a
default name.Method Detail |
---|
public void setId(Long id)
SourceCatalogEntry
setId
in interface SourceCatalogEntry
public Long getId()
getId
in interface Identifiable
public void clearId()
SourceCatalogEntry
This method is useful for preparing an entry for storage in a database. The ID property (as of now, though this may change in the future) is used by our persistence mechanism to identify objects. If you are persisting this entry for the first time, you may need to call this method before performing a save. This is especially true if you have created this source from XML, as the XML unmarshalling brings along the ID property.
clearId
in interface SourceCatalogEntry
public void setName(String newName)
If newName
is null or the empty string
(""), the request to change the name will be
denied and the current name will remain in place.
setName
in interface SourceCatalogEntry
setName
in interface Nameable
newName
- the new name for this table.public String getName()
getName
in interface SourceCatalogEntry
getName
in interface Nameable
public List<String> getNotes()
This method returns the list actually held by this
SourceLookuptable
, so
any list manipulations may be performed by first fetching the list and
then operating on it.
getNotes
in interface SourceCatalogEntry
public void setListener(SourceTableListener listener)
listener
- the object that will listen to this table. If this value
is null, a null-like listener will be used instead.public void removeListener(SourceTableListener listener)
listener
as a listener of this table.
listener
- a listener of this table.public SourceTableListener getListener()
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 clear()
clear
in class LookupTable<Date,Source>
public Source put(Date key, Source value)
put
in class LookupTable<Date,Source>
public void putAll(Map<Date,Source> map)
putAll
in class LookupTable<Date,Source>
public Source remove(Date key)
remove
in class LookupTable<Date,Source>
public String toString()
toString
in class LookupTable<Date,Source>
public String toXml() throws JAXBException
JAXBException
- if anything goes wrong during the conversion to XML.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 SourceLookupTable 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 SourceLookupTable 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 SourceLookupTable clone()
If anything goes wrong during the cloning procedure,
a RuntimeException
will be thrown.
clone
in interface CatalogItem<SourceCatalogEntry>
clone
in class LookupTable<Date,Source>
cloneAllButSources()
public SourceLookupTable cloneAllButSources()
clone()
public boolean equals(Object o)
o
is equal to this table.
equals
in class LookupTable<Date,Source>
public int hashCode()
hashCode
in class LookupTable<Date,Source>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |