iitb.con.core
Class Relation

java.lang.Object
  extended by iitb.con.core.Type
      extended by iitb.con.core.Relation

public class Relation
extends Type

Relation is associated with two entities.
Relation class provides methods to create and remove the relations among the entities.
The relation is created between two items, which is considered as left-item and right-item. To remove any item, set NULL.

See Also:
Type, RelationInstance

Field Summary
static byte BIDIRECTIONAL
          Relation direction bidirectional for left- and right-item
static byte LEFT_TO_RIGHT
          Relation direction from left item to right item
 java.lang.String leftRole
          Relation's left role name
 java.lang.String rightRole
          Relation's right role name
 
Fields inherited from class iitb.con.core.Type
id, name
 
Constructor Summary
Relation()
           
Relation(java.lang.String name)
          Constructs the Relation with name
Relation(java.lang.String name, java.lang.String leftRole, java.lang.String rightRole)
          Constructs the Relation with name and roles
 
Method Summary
 byte getDirection()
          Returns the direction kind in the relation.
0 - LEFT_TO_RIGHT
1 - BIDIRECTIONAL
static java.lang.String getDirectionString(byte direction)
          Returns the direction kind in the relation as string.
 short getLeftEntityId()
          Returns the left entity id of the relation
 short getRightEntityId()
          Returns the right entity id of the relation
 Result setDirection(byte direction)
          Sets the direction kind of the Relation.
 Result setLeft(Entity entity)
          Sets the entity type for the left item.
 Result setLeftEntityId(short leftEntityId)
          Set the left entity id of the relation.
 Result setRight(Entity entity)
          Sets the entity type for the right item.
 Result setRightEntityId(short rightEntityId)
          Set the right entity id of the relation.
 
Methods inherited from class iitb.con.core.Type
addAttribute, addAttribute, getAllAttributes, getAllRepeatingAttributes, getAllSingleValuedAttributes, getAttribute, getAttributesCount, hasAttribute, removeAttribute, setAllAttributes, setAttribute, setAttribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BIDIRECTIONAL

public static byte BIDIRECTIONAL
Relation direction bidirectional for left- and right-item


LEFT_TO_RIGHT

public static byte LEFT_TO_RIGHT
Relation direction from left item to right item


leftRole

public java.lang.String leftRole
Relation's left role name


rightRole

public java.lang.String rightRole
Relation's right role name

Constructor Detail

Relation

public Relation()

Relation

public Relation(java.lang.String name)
Constructs the Relation with name

Parameters:
name - relation name

Relation

public Relation(java.lang.String name,
                java.lang.String leftRole,
                java.lang.String rightRole)
Constructs the Relation with name and roles

Parameters:
name - relation name
leftRole - left role name
rightRole - right role name
Method Detail

getDirection

public byte getDirection()
Returns the direction kind in the relation.
0 - LEFT_TO_RIGHT
1 - BIDIRECTIONAL

Returns:
byte - direction

getDirectionString

public static java.lang.String getDirectionString(byte direction)
Returns the direction kind in the relation as string.

Parameters:
direction - relation's direction kind
Returns:
relation's direction kind string

getLeftEntityId

public short getLeftEntityId()
Returns the left entity id of the relation

Returns:
the leftEntityId

getRightEntityId

public short getRightEntityId()
Returns the right entity id of the relation

Returns:
the rightEntityId

setDirection

public Result setDirection(byte direction)
Sets the direction kind of the Relation.

Parameters:
direction - direction link
Returns:
Result

setLeft

public Result setLeft(Entity entity)
Sets the entity type for the left item. Only the entity id is set.

Parameters:
entity - Entity
Returns:
Result

setLeftEntityId

public Result setLeftEntityId(short leftEntityId)
Set the left entity id of the relation. The entity id should be greater than zero.

Parameters:
leftEntityId - the leftEntityId to set
Returns:
Result

setRight

public Result setRight(Entity entity)
Sets the entity type for the right item. Only the entity id is set.

Parameters:
entity - Entity
Returns:
Result

setRightEntityId

public Result setRightEntityId(short rightEntityId)
Set the right entity id of the relation. The entity id should be greater than zero.

Parameters:
rightEntityId - the rightEntityId to set
Returns:
Result