|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdiscovery.data.NarrativeDataManager
public class NarrativeDataManager
This class is responsible for all program interaction with the narrative database. All narrative information is saved in an XML file called 'narratives.xml', which is found in the current project's folder in the workspace directory. The class uses the JDOM package to deal with all XML operations. Methods are included to save and load the XML file. Narratives can be added, updated and deleted using the relevant methods. Accessor methods are also included, allowing Narrative objects to be built from the data and returned.
Constructor Summary | |
---|---|
NarrativeDataManager()
|
Method Summary | |
---|---|
void |
addNarrative(NarrativeModel n)
This is a mutator method which adds the data held within a Narrative object to the 'narratives.xml' file. |
void |
deleteNarrative(int toFind)
This is a mutator method which deletes a narrative from the 'narratives.xml' file. |
NarrativeModel |
getNarrative(int toFind)
This is an accessor method which returns a Narrative object of a narrative in the database. |
org.jdom.Document |
loadDatabase()
This method uses the SAXBuilder class to construct a Document object of the XML data held within the 'narratives.xml' file. |
void |
saveDatabase(org.jdom.Document doc)
This method saves the data in a Document object to the XML file 'narratives.xml'. |
void |
updateNarrative(NarrativeModel n)
This is a mutator method which updates a narrative in the XML file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NarrativeDataManager()
Method Detail |
---|
public org.jdom.Document loadDatabase()
public void saveDatabase(org.jdom.Document doc)
doc
- the JDOM document object representing the data to be savedpublic void addNarrative(NarrativeModel n)
cm
- the Narrative object representing the narrative to be added to the filepublic void deleteNarrative(int toFind)
toFind
- the ID number of the narrative to be deletedpublic void updateNarrative(NarrativeModel n)
cm
- the Narrative object representing the updated version of the narrativepublic NarrativeModel getNarrative(int toFind)
toFind
- an integer representing the ID number of the desired narrative
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |