org.ofbiz.entity.model
Class ModelRelation

java.lang.Object
  extended by org.ofbiz.entity.model.ModelChild
      extended by org.ofbiz.entity.model.ModelRelation
All Implemented Interfaces:
java.io.Serializable

public class ModelRelation
extends ModelChild

Generic Entity - Relation model class

See Also:
Serialized Form

Field Summary
protected  java.lang.String fkName
          the name to use for a database foreign key, if applies
protected  boolean isAutoRelation
           
protected  java.util.List<ModelKeyMap> keyMaps
          keyMaps defining how to lookup the relatedTable using columns from this table
protected  ModelEntity mainEntity
          the main entity of this relation
protected  java.lang.String relEntityName
          the name of the related entity
protected  java.lang.String title
          the title, gives a name/description to the relation
protected  java.lang.String type
          the type: either "one" or "many" or "one-nofk"
 
Fields inherited from class org.ofbiz.entity.model.ModelChild
description, parentModelEntity
 
Constructor Summary
ModelRelation()
          Default Constructor
ModelRelation(ModelEntity mainEntity, org.w3c.dom.Element relationElement)
          XML Constructor
ModelRelation(java.lang.String type, java.lang.String title, java.lang.String relEntityName, java.lang.String fkName, java.util.List<ModelKeyMap> keyMaps)
          Default Constructor
 
Method Summary
 void addKeyMap(ModelKeyMap keyMap)
           
 boolean equals(java.lang.Object other)
           
 ModelKeyMap findKeyMap(java.lang.String fieldName)
          Find a KeyMap with the specified fieldName
 ModelKeyMap findKeyMapByRelated(java.lang.String relFieldName)
          Find a KeyMap with the specified relFieldName
 java.lang.String getCombinedName()
           
 java.lang.String getFkName()
           
 ModelKeyMap getKeyMap(int index)
           
 java.util.List<ModelKeyMap> getKeyMapsClone()
           
 java.util.Iterator<ModelKeyMap> getKeyMapsIterator()
          keyMaps defining how to lookup the relatedTable using columns from this table
 int getKeyMapsSize()
           
 ModelEntity getMainEntity()
          Deprecated. the main entity of this relation
 java.lang.String getRelEntityName()
          the name of the related entity
 java.lang.String getTitle()
          the title, gives a name/description to the relation
 java.lang.String getType()
          the type: either "one" or "many" or "one-nofk"
 boolean isAutoRelation()
           
 java.lang.String keyMapRelatedUpperString(java.lang.String separator, java.lang.String afterLast)
           
 java.lang.String keyMapString(java.lang.String separator, java.lang.String afterLast)
           
 java.lang.String keyMapUpperString(java.lang.String separator, java.lang.String afterLast)
           
 ModelKeyMap removeKeyMap(int index)
           
 void setAutoRelation(boolean isAutoRelation)
           
 void setFkName(java.lang.String fkName)
           
 void setMainEntity(ModelEntity mainEntity)
          Deprecated.  
 void setRelEntityName(java.lang.String relEntityName)
           
 void setTitle(java.lang.String title)
           
 void setType(java.lang.String type)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document document)
           
 
Methods inherited from class org.ofbiz.entity.model.ModelChild
getDescription, getModelEntity, setDescription, setModelEntity
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

title

protected java.lang.String title
the title, gives a name/description to the relation


type

protected java.lang.String type
the type: either "one" or "many" or "one-nofk"


relEntityName

protected java.lang.String relEntityName
the name of the related entity


fkName

protected java.lang.String fkName
the name to use for a database foreign key, if applies


keyMaps

protected java.util.List<ModelKeyMap> keyMaps
keyMaps defining how to lookup the relatedTable using columns from this table


mainEntity

protected ModelEntity mainEntity
the main entity of this relation


isAutoRelation

protected boolean isAutoRelation
Constructor Detail

ModelRelation

public ModelRelation()
Default Constructor


ModelRelation

public ModelRelation(java.lang.String type,
                     java.lang.String title,
                     java.lang.String relEntityName,
                     java.lang.String fkName,
                     java.util.List<ModelKeyMap> keyMaps)
Default Constructor


ModelRelation

public ModelRelation(ModelEntity mainEntity,
                     org.w3c.dom.Element relationElement)
XML Constructor

Method Detail

getCombinedName

public java.lang.String getCombinedName()

getTitle

public java.lang.String getTitle()
the title, gives a name/description to the relation


setTitle

public void setTitle(java.lang.String title)

getType

public java.lang.String getType()
the type: either "one" or "many" or "one-nofk"


setType

public void setType(java.lang.String type)

getRelEntityName

public java.lang.String getRelEntityName()
the name of the related entity


setRelEntityName

public void setRelEntityName(java.lang.String relEntityName)

getFkName

public java.lang.String getFkName()

setFkName

public void setFkName(java.lang.String fkName)

getMainEntity

public ModelEntity getMainEntity()
Deprecated. the main entity of this relation


setMainEntity

public void setMainEntity(ModelEntity mainEntity)
Deprecated. 


getKeyMapsIterator

public java.util.Iterator<ModelKeyMap> getKeyMapsIterator()
keyMaps defining how to lookup the relatedTable using columns from this table


getKeyMapsClone

public java.util.List<ModelKeyMap> getKeyMapsClone()

getKeyMapsSize

public int getKeyMapsSize()

getKeyMap

public ModelKeyMap getKeyMap(int index)

addKeyMap

public void addKeyMap(ModelKeyMap keyMap)

removeKeyMap

public ModelKeyMap removeKeyMap(int index)

findKeyMap

public ModelKeyMap findKeyMap(java.lang.String fieldName)
Find a KeyMap with the specified fieldName


findKeyMapByRelated

public ModelKeyMap findKeyMapByRelated(java.lang.String relFieldName)
Find a KeyMap with the specified relFieldName


keyMapString

public java.lang.String keyMapString(java.lang.String separator,
                                     java.lang.String afterLast)

keyMapUpperString

public java.lang.String keyMapUpperString(java.lang.String separator,
                                          java.lang.String afterLast)

keyMapRelatedUpperString

public java.lang.String keyMapRelatedUpperString(java.lang.String separator,
                                                 java.lang.String afterLast)

isAutoRelation

public boolean isAutoRelation()
Returns:
Returns the isAutoRelation.

setAutoRelation

public void setAutoRelation(boolean isAutoRelation)
Parameters:
isAutoRelation - The isAutoRelation to set.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document document)