public class XMLDBModel
extends java.lang.Object
implements java.lang.Comparable
It is used as a data transfer object and hold 4 information about the model:
- Model name.
- Model content in xml format.
- Does the model exist in the database or it is a new model.
- List of parents for the current model.
Each of the 4 information has its own getter and setter methods.
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DB_MODEL_ID_ATTR
String for DBModelId.
|
static java.lang.String |
DB_MODEL_NAME
String for model name.
|
static java.lang.String |
DB_REFERENCE_ATTR
String for DBReference.
|
| Constructor and Description |
|---|
XMLDBModel(java.lang.String modelName)
Construct a XMLDBModel instance
with the given model name.
|
XMLDBModel(java.lang.String modelName,
java.lang.String modelId)
Construct a XMLDBModel instance
with the given model name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addParentList(java.util.List<XMLDBModel> list)
Add the given parent list to the model's
parent list.
|
void |
addReferencedChild(java.lang.String modelId)
Add the given child entity to the model's
referenced children list.
|
int |
compareTo(java.lang.Object otherModel)
Compare this model with another given model, and the model is compared
according to their name.
|
boolean |
equals(java.lang.Object xmldbModel)
Return true if this XMLDBModel has the same
name as the argument.
|
boolean |
getIsNew()
Return True or false based on if the model is new or it exists in the database.
|
java.lang.String |
getModel()
Return the model content.
|
java.lang.String |
getModelId()
Return the model id.
|
java.lang.String |
getModelName()
Return the model name.
|
java.util.List<java.util.List<XMLDBModel>> |
getParents()
Return the parents for the current model.
|
int |
getReferenceCount(java.util.List<XMLDBModel> list)
Return the number of times the model is referenced in the
given hierarchy.
|
java.util.List<java.lang.String> |
getReferencedChildren()
Return the first level referenced children entities
for the current model.
|
int |
hashCode()
Return the hash code for the XMLDBModel object.
|
void |
setIsNew(boolean isNew)
Set the isNew variable which indicates if the model is in the database or
it is new model.
|
void |
setModel(java.lang.String modelContent)
Set the model content.
|
void |
setModelId(java.lang.String modelId)
Set the model identifier.
|
void |
setModelName(java.lang.String modelName)
Set the model name.
|
void |
setParents(java.util.List<java.util.List<XMLDBModel>> listParents)
Set the parents for the current model.
|
void |
setReferencedChildren(java.util.List<java.lang.String> listChildren)
Set the first level referenced children entities for the current model.
|
java.lang.String |
toString()
Get the String representation of this model.
|
public static final java.lang.String DB_MODEL_ID_ATTR
public static final java.lang.String DB_REFERENCE_ATTR
public static final java.lang.String DB_MODEL_NAME
public XMLDBModel(java.lang.String modelName)
modelName - the name for the given model.public XMLDBModel(java.lang.String modelName,
java.lang.String modelId)
modelName - Name for the given model.modelId - Id for the given model.public void addParentList(java.util.List<XMLDBModel> list)
list - a List of parents to be added.public void addReferencedChild(java.lang.String modelId)
modelId - Child entity to be added to the referenced children list.public int compareTo(java.lang.Object otherModel)
compareTo in interface java.lang.ComparableotherModel - The other model to be compared with this model.public boolean equals(java.lang.Object xmldbModel)
equals in class java.lang.ObjectxmldbModel - The XMLDBModel object to be compared.public int hashCode()
hashCode in class java.lang.Objectpublic boolean getIsNew()
setIsNew(boolean)public java.lang.String getModel()
setModel(java.lang.String)public java.lang.String getModelId()
setModelId(java.lang.String)public java.lang.String getModelName()
setModelName(java.lang.String)public int getReferenceCount(java.util.List<XMLDBModel> list)
list - List of models in the parent hierarchy.public java.util.List<java.util.List<XMLDBModel>> getParents()
setParents(java.util.List<java.util.List<ptdb.common.dto.XMLDBModel>>)public java.util.List<java.lang.String> getReferencedChildren()
setReferencedChildren(java.util.List<java.lang.String>)public void setIsNew(boolean isNew)
isNew - a boolean True or false value to set the isNew member variable.getIsNew()public void setModel(java.lang.String modelContent)
modelContent - The model content in xml format.getModel()public void setModelId(java.lang.String modelId)
modelId - The model identifier.getModelId()public void setModelName(java.lang.String modelName)
modelName - The model name.getModelName()public void setParents(java.util.List<java.util.List<XMLDBModel>> listParents)
listParents - List of parents for this model.getParents()public void setReferencedChildren(java.util.List<java.lang.String> listChildren)
listChildren - List of first level referenced children entities
for this model.getReferencedChildren()public java.lang.String toString()
toString in class java.lang.Object