com.bigllc.retsiq.metadata
Class MetadataTableMap

java.lang.Object
  extended by com.bigllc.retsiq.metadata.MetadataTableMap
Direct Known Subclasses:
MetadataClass, MetadataColumnGroup, MetadataColumnGroupControl, MetadataColumnGroupNormalization, MetadataColumnGroupSet, MetadataColumnGroupTable, MetadataEditMask, MetadataForeignKey, MetadataLookup, MetadataLookupFilter, MetadataLookupFilterType, MetadataLookupType, MetadataObject, MetadataResource, MetadataSearchHelp, MetadataSystem, MetadataTable, MetadataUpdateHelp, MetadataUpdateType, MetadataUpdateTypeField, MetadataValidationExpression, MetadataValidationExternal, MetadataValidationExternalType, MetadataValidationLookup, MetadataValidationLookupType

public abstract class MetadataTableMap
extends java.lang.Object


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> map
           
protected  java.lang.String nameKey
           
protected  MetadataTableMap parent
           
 
Constructor Summary
MetadataTableMap(java.lang.String nameKey, java.util.Map<java.lang.String,java.lang.String> map)
           
 
Method Summary
 void addChild(MetadataTableMap child)
           
<T extends MetadataTableMap>
T
find(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.lang.String path)
          Convenience method to search for node based on path.
 java.lang.String get(java.lang.String column)
           
abstract  java.lang.String getAttributeName()
           
 MetadataTableMap getChild(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.lang.String name)
           
abstract  java.lang.String getChildDate(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
           
abstract  java.util.List<? extends MetadataTableMap> getChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
           
abstract  java.util.Map<java.lang.String,? extends MetadataTableMap> getChildrenLookup(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
           
 com.bigllc.retsiq.api.RETSConstants.MetadataType[] getChildTypes()
           
abstract  java.lang.String getChildVersion(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
           
 int getDepth()
          Get the depth of this node in the metadata tree.
 java.util.List<java.lang.String> getDisplayKeys()
           
 java.lang.String getFullPath()
           
 java.lang.String getFullPathName()
           
 java.util.List<java.lang.String> getKeys()
           
 java.util.Map<java.lang.String,java.lang.String> getMap()
           
abstract  com.bigllc.retsiq.api.RETSConstants.MetadataType getMetadataType()
           
 java.lang.String getName()
           
 java.lang.String getNameKey()
           
 MetadataTableMap getParent()
           
 java.util.Stack<MetadataTableMap> getPathStack()
          Get a stack of this node and all the parent node up to the system node.
 java.util.Stack<MetadataTableMap> getReversePathStack()
          As with getPathStack but with the node order reversed.
 MetadataTableMap getRoot()
           
 MetadataSystem getSystem()
           
 boolean hasDuplicateChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
          Check if there are child nodes with the same key.
 boolean hasEmptyAttribute(java.lang.String column)
          Returns true if the given column is not set, or is an empty or whitespace only string in the fields attribute map.
 boolean isChildOf(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
          Is the current node a child of the supplied type.
 void removeChild(MetadataTableMap child)
          Remove the child node specified and also remove it from the map if it is the same instance.
 void removeChild(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.lang.String name)
          Remove the child by type and name.
abstract  void setChildDate(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.lang.String date)
           
 void setChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.util.List<? extends MetadataTableMap> children)
          Set the children nodes of a specific metadata type for this node.
protected abstract  void setChildrenList(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.util.List<? extends MetadataTableMap> children)
          This method should be implemented to set the underlying list to the one passed.
abstract  void setChildVersion(com.bigllc.retsiq.api.RETSConstants.MetadataType type, java.lang.String version)
           
 void setParent(MetadataTableMap parent)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

protected MetadataTableMap parent

nameKey

protected java.lang.String nameKey

map

protected java.util.Map<java.lang.String,java.lang.String> map
Constructor Detail

MetadataTableMap

public MetadataTableMap(java.lang.String nameKey,
                        java.util.Map<java.lang.String,java.lang.String> map)
Method Detail

getMap

public java.util.Map<java.lang.String,java.lang.String> getMap()

get

public java.lang.String get(java.lang.String column)

hasEmptyAttribute

public boolean hasEmptyAttribute(java.lang.String column)
Returns true if the given column is not set, or is an empty or whitespace only string in the fields attribute map.


getKeys

public java.util.List<java.lang.String> getKeys()

getDisplayKeys

public java.util.List<java.lang.String> getDisplayKeys()

getMetadataType

public abstract com.bigllc.retsiq.api.RETSConstants.MetadataType getMetadataType()

getAttributeName

public abstract java.lang.String getAttributeName()

getName

public java.lang.String getName()

getNameKey

public java.lang.String getNameKey()

getParent

public MetadataTableMap getParent()

setParent

public void setParent(MetadataTableMap parent)

getChildDate

public abstract java.lang.String getChildDate(com.bigllc.retsiq.api.RETSConstants.MetadataType type)

setChildDate

public abstract void setChildDate(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                                  java.lang.String date)

getChildVersion

public abstract java.lang.String getChildVersion(com.bigllc.retsiq.api.RETSConstants.MetadataType type)

setChildVersion

public abstract void setChildVersion(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                                     java.lang.String version)

getRoot

public MetadataTableMap getRoot()

getSystem

public MetadataSystem getSystem()

find

public <T extends MetadataTableMap> T find(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                                           java.lang.String path)
Convenience method to search for node based on path. Path can either be relative to current node or from the System node if the path is prefixed with a "/". Relative search might look like "RES/MLSNUM"; Absolute path like "/PROPERTY/RES/MLSNUM".

Parameters:
type - the type of node to be retrieved
path - the absolute or relative path to return
Returns:
the matching node or null if not found

getChildren

public abstract java.util.List<? extends MetadataTableMap> getChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type)

setChildrenList

protected abstract void setChildrenList(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                                        java.util.List<? extends MetadataTableMap> children)
This method should be implemented to set the underlying list to the one passed. It is called from setChildren. Lookups are and setParent are handled by setChildren.

Parameters:
type - the metadata type of the list
children - the list containing the children nodes.

setChildren

public final void setChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                              java.util.List<? extends MetadataTableMap> children)
Set the children nodes of a specific metadata type for this node. Lookups and setParent are handled by this method. A call is made to setChildrenList so that the inheriting class can set the member variable if it chooses.

Parameters:
type - the metadata type of the list
children - the list containing the children nodes.

getChildrenLookup

public abstract java.util.Map<java.lang.String,? extends MetadataTableMap> getChildrenLookup(com.bigllc.retsiq.api.RETSConstants.MetadataType type)

getChild

public MetadataTableMap getChild(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                                 java.lang.String name)

addChild

public void addChild(MetadataTableMap child)

removeChild

public void removeChild(MetadataTableMap child)
Remove the child node specified and also remove it from the map if it is the same instance. If there are duplicates by name and the child in the map is not the same instance then it won't be deleted from the map.

Parameters:
child - the child node to remove

removeChild

public void removeChild(com.bigllc.retsiq.api.RETSConstants.MetadataType type,
                        java.lang.String name)
Remove the child by type and name. Note that if there are duplicates by name then all the children with the same name are removed from the list.


hasDuplicateChildren

public boolean hasDuplicateChildren(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
Check if there are child nodes with the same key. This check only checks if the map and the list are of unequal size and should probably only be considered a hint. There may be scenarios where they are not the same and there aren't duplicates but I can't think of a valid case.


isChildOf

public boolean isChildOf(com.bigllc.retsiq.api.RETSConstants.MetadataType type)
Is the current node a child of the supplied type.

Parameters:
type - the type to test against
Returns:
true if it is a child type, false otherwise

getChildTypes

public com.bigllc.retsiq.api.RETSConstants.MetadataType[] getChildTypes()

getFullPath

public java.lang.String getFullPath()

getFullPathName

public java.lang.String getFullPathName()

getPathStack

public java.util.Stack<MetadataTableMap> getPathStack()
Get a stack of this node and all the parent node up to the system node. The first item in the stack will be the system node, the last is this node.

Returns:
a stack with all the ancestor node and this node

getReversePathStack

public java.util.Stack<MetadataTableMap> getReversePathStack()
As with getPathStack but with the node order reversed.

Returns:
a stack with all the ancestor node and this node

getDepth

public int getDepth()
Get the depth of this node in the metadata tree. The system node has a depth of 0.

Returns:
the depth of this node in the metadata tree

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object