IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.traceability
Class TraceRelationship

java.lang.Object
  extended bycom.ibm.xtools.traceability.TraceRelationship
All Implemented Interfaces:
IAdaptable

public class TraceRelationship
extends Object
implements IAdaptable

The TraceRelationship represents a relationship of the results of the Model Query Command.

It could represent one of the following:

See Also:
ModelQueryCommand.getResults()

Field Summary
static int TYPE_IMPLIED_ACCESS_VIOLATION
          TYPE_IMPLIED_ACCESS_VIOLATION: implied relationship and there is an access violation.
static int TYPE_IMPLIED_REFINE
          TYPE_IMPLIED_REFINE: Implied Refine relationship.
static int TYPE_IMPLIED_USAGE
          TYPE_IMPLIED_USAGE: Implied Usage relationship.
static int TYPE_NONE
          TYPE_NONE: None type.
static int TYPE_REQPRO_LINK
          TYPE_REQPRO_LINK: This relationship represents a link between UML element and ReqPro element.
static int TYPE_UML
          TYPE_UML: This relationship represents a UML Relationship.
 
Constructor Summary
TraceRelationship(EObject source, EObject target, int type)
          Constructor.
TraceRelationship(Relationship umlRelationship)
          Constructor.
 
Method Summary
 boolean equals(Object object)
           
 Object getAdapter(Class adapter)
          Returns the wrapped UML relationship.
 EObject getSource()
          Returns the source element of this relationship.
 EObject getTarget()
          Returns the target element of this relationship.
 int getType()
          Return the type of this relationship.
 int hashCode()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_NONE

public static final int TYPE_NONE
TYPE_NONE: None type.

See Also:
Constant Field Values

TYPE_IMPLIED_REFINE

public static final int TYPE_IMPLIED_REFINE
TYPE_IMPLIED_REFINE: Implied Refine relationship.

See Also:
Constant Field Values

TYPE_IMPLIED_USAGE

public static final int TYPE_IMPLIED_USAGE
TYPE_IMPLIED_USAGE: Implied Usage relationship.

See Also:
Constant Field Values

TYPE_IMPLIED_ACCESS_VIOLATION

public static final int TYPE_IMPLIED_ACCESS_VIOLATION
TYPE_IMPLIED_ACCESS_VIOLATION: implied relationship and there is an access violation.

If the TraceRelationship type is set to this value, this relationship is an implied relationship and there is access violation.

You could solve this problem by doing one of the following:

See Also:
Constant Field Values

TYPE_REQPRO_LINK

public static final int TYPE_REQPRO_LINK
TYPE_REQPRO_LINK: This relationship represents a link between UML element and ReqPro element.

See Also:
Constant Field Values

TYPE_UML

public static final int TYPE_UML
TYPE_UML: This relationship represents a UML Relationship. To get the UML relationship element (org.eclipse.uml2.Relationship), call

See Also:
Constant Field Values
Constructor Detail

TraceRelationship

public TraceRelationship(Relationship umlRelationship)
Constructor.

Parameters:
umlRelationship - UML relationship.

TraceRelationship

public TraceRelationship(EObject source,
                         EObject target,
                         int type)
Constructor.

Parameters:
source - the source element
target - the target element
type - the type of the relationship. It could be set to any value of the TYPE_xxx contants.
Method Detail

getSource

public EObject getSource()
Returns the source element of this relationship.

If the type of this relationship is TYPE_UML, it will return the first source element of the UML Relationship sources. To get the whole list of sources of the UML relationship, you can get it directly from the wrapped UML relationship.

To get the UML Relationship element call:

Returns:
Returns the source.

getTarget

public EObject getTarget()
Returns the target element of this relationship.

If the type of this relationship is TYPE_UML, it will return the first target element of the UML Relationship targets. To get the whole list of sources of the UML relationship, you can get it directly from the wrapped UML relationship.

To get the UML Relationship element call:

Returns:
Returns the target.

getType

public int getType()
Return the type of this relationship.

Returns:
Returns the type of this relationship. It could be any value of the TYPE_xxx constants.

equals

public boolean equals(Object object)
See Also:
Object.equals(java.lang.Object)

toString

public String toString()
See Also:
Object.toString()

hashCode

public int hashCode()
See Also:
Object.hashCode()

getAdapter

public Object getAdapter(Class adapter)
Returns the wrapped UML relationship.

Specified by:
getAdapter in interface IAdaptable
Parameters:
adapter - if it is set to Relationship.class, it will return the wrapped UML Relationship.
Returns:
The wrapped UML relationship if the adapter parameter was set to Relationship.class and the type is set to TYPE_UML, otherwise it will return null.
See Also:
IAdaptable.getAdapter(java.lang.Class)

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.