com.starbase.starteam
Class Link

java.lang.Object
  |
  +--com.starbase.starteam.Link

public class Link
extends java.lang.Object

Represents an instance of an association between two items.


Constructor Summary
Link(Item parent, boolean bPinParent, Item child, boolean bPinChild, java.lang.String comment)
          Deprecated. Use Link(Item parent, Item child) instead.
Link(Item parent, int parentRevision, Item child, int childRevision)
          Creates a new link object.
Link(Item parent, Item child)
          Creates a new link object.
 
Method Summary
 Link copy()
          Copies this link, creating a new one with the same content.
 void delete()
          Terminates the association of the linked items.
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
 LinkEndpoint getChildEndpoint()
          Returns a reference to the "child" item in this link.
 java.lang.String getComment()
          Returns the comment associated with this link.
 OLEDate getCreatedTime()
          Returns the time at which this link was created.
 int getCreatedUserID()
          Returns the user ID of the user who created this link.
 int getID()
          Returns an integer that identifies this link.
 LinkEndpoint getParentEndpoint()
          Returns a reference to the "parent" item in this link.
 int getParentFolderItemID()
          Returns the ItemID of the linked item's parent folder if the item is in the current view, otherwise -1.
 Server getServer()
          Returns the server object to which the parent endpoint of this link belongs.
 View getView()
          Returns the view to which the parent endpoint of this link belongs.
 int hashCode()
          returns a unique hash for all instances of this type
 boolean isEqualTo(Link other)
          Determines whether or not the contents of two links are the same.
static Link linkAndPin(Item parent, Item child, java.lang.String comment, boolean updateExistingLink)
          Creates a new link between two items and pins the link endpoints to the specified item revisions.
 void pinChild(Item newChild)
          Pin the child endpoint of the link.
 void pinParent(Item newParent)
          Pin the parent endpoint of the link.
 Item resolveChild()
          Resolves the child endpoint of this link.
 Item resolveParent()
          Resolves the parent endpoint of this link.
 void setComment(java.lang.String comment)
           
 java.lang.String toDebugString()
           
 void unpinChild()
          Unpin the child endpoint of the link.
 void unpinParent()
          Unpin the parent endpoint of the link.
 void update()
          Persists the link.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Link

public Link(Item parent,
            Item child)
Creates a new link object.

Parameters:
parent - The parent end of the link. The link becomes visible at the first revision of this item's branch.
child - The child end of the link. The link becomes visible at the first revision of this item's branch.

Link

public Link(Item parent,
            int parentRevision,
            Item child,
            int childRevision)
Creates a new link object.

Parameters:
parent - The parent end of the link.
parentRevision - The revision number of the first revision in the parent item's history for which this link is visible. If the value is -1, defaults to the first revision in the parent item's branch.
child - The child end of the link.
childRevision - The revision number of the first revision in the child item's history for which this link is visible. If the value is -1, defaults to the first revision in the child item's branch.

Link

public Link(Item parent,
            boolean bPinParent,
            Item child,
            boolean bPinChild,
            java.lang.String comment)
Deprecated. Use Link(Item parent, Item child) instead.

Creates a new link object.

Parameters:
parent - The parent end of the link.
bPinParent - If true, pin the parent item at the revision specified by the item.
child - The child end of the link.
bPinChild - If true, pin the child item at the revision specified by the item.
comment - The comment to assocate with this link.
Method Detail

getChildEndpoint

public LinkEndpoint getChildEndpoint()
Returns a reference to the "child" item in this link. Since links are not directional, the terms parent and child are arbitrary. Parent refers to the item from which this link was enumerated.

Returns:
a reference to the "child" item in this link. Since links are not directional, the terms parent and child are arbitrary. Parent refers to the item from which this link was enumerated.

getID

public int getID()
Returns an integer that identifies this link.

Returns:
an integer that identifies this link.

getParentFolderItemID

public int getParentFolderItemID()
Returns the ItemID of the linked item's parent folder if the item is in the current view, otherwise -1. Only available for server api revision 1.16 and later; earlier revisions will always return -1.

Returns:
the ItemID of the linked Item's parent Folder or -1 if unavailable.

getCreatedTime

public OLEDate getCreatedTime()
Returns the time at which this link was created.

Returns:
the time at which this link was created.

getCreatedUserID

public int getCreatedUserID()
Returns the user ID of the user who created this link.

Returns:
the user ID of the user who created this link.

getView

public View getView()
Returns the view to which the parent endpoint of this link belongs.

Returns:
the view to which the parent endpoint of this link belongs.

getServer

public Server getServer()
Returns the server object to which the parent endpoint of this link belongs.

Returns:
the server object to which the parent endpoint of this link belongs.

getComment

public java.lang.String getComment()
Returns the comment associated with this link.

Returns:
the comment associated with this link.

setComment

public void setComment(java.lang.String comment)

resolveParent

public Item resolveParent()
Resolves the parent endpoint of this link. The referenced Item may reside in any view on the server. However, the returned Item is always a disembodied Item. Many normal Item operations are not supported on disembodied Items.

Returns:
A disembodied item representing the resolved parent endpoint.
See Also:
Link.resolveChild(), View.getDisembodiedItem(int, com.starbase.starteam.Type), View.getHistoryForItemID(int, com.starbase.starteam.Type), Item.isDisembodied()

resolveChild

public Item resolveChild()
Resolves the child endpoint of this link. The referenced Item may reside in any view on the server. However, the returned Item is always a disembodied Item. Many normal Item operations are not supported on disembodied Items.

Returns:
A disembodied item representing the resolved child enpoint.
See Also:
Link.resolveParent(), View.getDisembodiedItem(int, com.starbase.starteam.Type), View.getHistoryForItemID(int, com.starbase.starteam.Type), Item.isDisembodied()

getParentEndpoint

public LinkEndpoint getParentEndpoint()
Returns a reference to the "parent" item in this link. Since links are not directional, the terms parent and child are arbitrary. Parent refers to the item from which this link was enumerated.

Returns:
a reference to the "parent" item in this link. Since links are not directional, the terms parent and child are arbitrary. Parent refers to the item from which this link was enumerated.

pinParent

public void pinParent(Item newParent)
Pin the parent endpoint of the link.

Parameters:
newParent - the Item to which this endpoint should be pinned. Note that this item must lie in the history path of the original item for the endpoint, and cannot be an earlier revision than the earliest revision for the endpoint.

unpinParent

public void unpinParent()
Unpin the parent endpoint of the link.


pinChild

public void pinChild(Item newChild)
Pin the child endpoint of the link.

Parameters:
newChild - the Item to which this endpoint should be pinned. Note that this item must lie in the history path of the original item for the endpoint, and cannot be an earlier revision than the earliest revision for the endpoint.

unpinChild

public void unpinChild()
Unpin the child endpoint of the link.


delete

public void delete()
Terminates the association of the linked items.


update

public void update()
Persists the link.


linkAndPin

public static Link linkAndPin(Item parent,
                              Item child,
                              java.lang.String comment,
                              boolean updateExistingLink)
Creates a new link between two items and pins the link endpoints to the specified item revisions.

Parameters:
parent - the parent end of the link
child - the child end of the link
comment - the link comment
updateExistingLink - if true this will modify a link that already exists between the two items rather than creating a new link.
Returns:
the resulting link

toDebugString

public java.lang.String toDebugString()

isEqualTo

public boolean isEqualTo(Link other)
Determines whether or not the contents of two links are the same.

Parameters:
other - The link to be compared to this one.
Returns:
true if the links are the same; false otherwise.

copy

public Link copy()
Copies this link, creating a new one with the same content.

Returns:
A new copy of this link.

equals

public boolean equals(java.lang.Object source)
returns true if this object instance is equal to the source

Overrides:
equals in class java.lang.Object
Parameters:
source - Object the source to comapre with
Returns:
boolean true if this object is equal to the source

hashCode

public int hashCode()
returns a unique hash for all instances of this type

Overrides:
hashCode in class java.lang.Object
Returns:
int a unique hash for all instances of this type


StarTeam SDK 10.4, Build 36
Copyright © 2003-2008 Borland Software Corporation. All rights reserved.