com.ibm.ram.common.data
Class RelationshipInfo

java.lang.Object
  extended by com.ibm.ram.common.data.RelationshipInfo

public class RelationshipInfo
extends java.lang.Object

Relationship info, such as range and id.

A kludge since this needs to be fitted in to the older style.

Since:
7.5.1

Field Summary
static RelationshipInfo EMPTY_INFO
          A singleton instance of an empty RelationshipInfo.
 
Constructor Summary
RelationshipInfo()
          An empty relationship info.
RelationshipInfo(int id, int stateid, int toid, RelationshipRange range, boolean source, boolean reverseRange)
          Construct.
RelationshipInfo(int id, RelationshipRange range, boolean source, boolean reverseRange)
          Construct without state.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getId()
           
static RelationshipInfo getInfoWithoutId(RelationshipInfo info)
          Get an info that is without an id, state, toAssetId.
 RelationshipRange getRange()
           
 int getStateId()
           
 int getToAssetId()
          Get the asset database id that this relationship is pointing to.
 int hashCode()
           
 boolean isReverseRange()
           
 boolean isSource()
           
 void setId(int id)
           
 void setRange(RelationshipRange range)
           
 void setReverseRange(boolean reverseRange)
           
 void setSource(boolean source)
           
 void setStateId(int stateId)
           
 void setToAssetId(int toid)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

EMPTY_INFO

public static final RelationshipInfo EMPTY_INFO
A singleton instance of an empty RelationshipInfo.

Since:
7.5.1
Constructor Detail

RelationshipInfo

public RelationshipInfo()
An empty relationship info.

Since:
7.5.1

RelationshipInfo

public RelationshipInfo(int id,
                        RelationshipRange range,
                        boolean source,
                        boolean reverseRange)
Construct without state.

Parameters:
id -
range -
Since:
7.5.1

RelationshipInfo

public RelationshipInfo(int id,
                        int stateid,
                        int toid,
                        RelationshipRange range,
                        boolean source,
                        boolean reverseRange)
Construct.

Parameters:
id - the id of the relationship entry
stateid - the state id of the relation entry
toid - the asset pointed to by this entry
range - the range of relationship entry
source - true if pointing to a source, false if pointing to a target.
reverseRange - true if this is a source end of a range (i.e. pointing back to owner of the range from the target within the range).
Since:
7.5.1
Method Detail

getInfoWithoutId

public static RelationshipInfo getInfoWithoutId(RelationshipInfo info)
Get an info that is without an id, state, toAssetId. This is used for comparing general relationship (those without ids) to see if the same or not.

Parameters:
info -
Returns:
if incoming info is null then an info will be created that is 0 id, 0 state, 0 toasset id, no range, not source, not reverse.
Since:
7.5.1

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

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

toString

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

getRange

public RelationshipRange getRange()
Returns:
Returns the range. null if not a range. If this instance returns isSource() this method may return null even if it is range. In that case isReverseRange() would be true.
Since:
7.5.1

getId

public int getId()
Returns:
Returns the id of the Relationship.
Since:
7.5.1

isSource

public boolean isSource()
Returns:
true if this comes from a related asset that points to the source asset from the target side. false if this comes from a related asset that points to the target asset from the source side.
Since:
7.5.1

isReverseRange

public boolean isReverseRange()
Returns:
true if this isSource() and the source is a range relationship.
Since:
7.5.1

getStateId

public int getStateId()
Returns:
the stateid, if set, else 0 if not set.
Since:
7.5.1

getToAssetId

public int getToAssetId()
Get the asset database id that this relationship is pointing to. If this is not source, then it is the target asset dbid, if source then it is the source assete dbid.

Returns:
Since:
7.5.1

setRange

public void setRange(RelationshipRange range)
Parameters:
range - The range to set.
Since:
7.5.1

setId

public void setId(int id)
Parameters:
id - The id to set.
Since:
7.5.1

setStateId

public void setStateId(int stateId)
Parameters:
stateId - The stateid to set.
Since:
7.5.1

setSource

public void setSource(boolean source)
Parameters:
source - The source to set.
Since:
7.5.1

setReverseRange

public void setReverseRange(boolean reverseRange)
Parameters:
reverseRange - The reverseRange to set.
Since:
7.5.1

setToAssetId

public void setToAssetId(int toid)
Parameters:
toid - The toid to set.
Since:
7.5.1