Class InventoryBasic
java.lang.Object
cbsw.InventoryBasic
An API for an inventory stored as an XML document.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInventoryBasic(String fileName, String elementName) Loads the inventory (.xml) document and locates the named table. -
Method Summary
Modifier and TypeMethodDescriptionvoidIndexes the table.getFieldValue(String name) Get the value for the named field for the current row.getFieldValue(Element el, String name) Get the value for the named field in the Element.Prompts for an identify and updates the current element.booleanvoidvoidupdateField(String name, String value) Update the value for the named field.voidWrites the modfied inventory.voidwriteBackup(String fileNamePrefix) Writes the current inventory document.
-
Field Details
-
inventoryDocument
-
inventoryElement
-
currentElement
-
elementName
-
-
Constructor Details
-
InventoryBasic
-
-
Method Details
-
getDocument
-
doIndex
Indexes the table.
An indexing attribute is added to each table row to allow simple searching using the getElementById method.
- Parameters:
indexAttributeName- The name of the indexing attribute.
-
identify
Prompts for an identify and updates the current element.
- Parameters:
id- The candidate identifier.match- The identifier must match this regular expression.reference- Identifier of existing element to clone.idAttributeName- The name of the id attribute.- Returns:
- The element.
-
write
Writes the modfied inventory.
- Parameters:
fileName- Path of database XML file.
-
writeBackup
Writes the current inventory document.
A timestamp is appended to the created file name after the provided prefix.
- Parameters:
fileNamePrefix- The file name prefix.
-
updateField
-
getFieldValue
-
getFieldValue
-
isCurrentElementNull
public boolean isCurrentElementNull() -
setText
-