com.starteam
Class ViewMemberCollection

java.lang.Object
  extended by com.starteam.StarTeamCollection
      extended by com.starteam.ViewMemberCollection
All Implemented Interfaces:
Lockable, java.lang.Iterable, java.util.Collection
Direct Known Subclasses:
ChangePackageCollection, TraceCollection

public class ViewMemberCollection
extends StarTeamCollection
implements Lockable

A Collection of ViewMembers. The collection can be built up from different types of ViewMembers, or all instances of the same type.


Nested Class Summary
static class ViewMemberCollection.BehaviorContainer
          A BehaviorContainer can be used to query for ViewMemberBehavior on the underlying collection of ViewMembers.
static class ViewMemberCollection.HistoryContainer
          a query for History on the underlying collection of ViewMembers returns a collection of ViewMemberCollections.
static class ViewMemberCollection.WebCacheViewMemberCollection
          A collection to perform transacted operations on web cache view members.
 
Constructor Summary
ViewMemberCollection()
          Construct an empty ViewMemberCollection
ViewMemberCollection(ViewMember viewMember)
          Construct a ViewMemberCollection with one contained ViewMember
ViewMemberCollection(ViewMember[] viewMembers)
          Construct a ViewMemberCollection from an array of ViewMember
ViewMemberCollection(ViewMemberCollection viewMembers)
          Construct a ViewMemberCollection from another collection
 
Method Summary
 void clear()
          Removes all of the elements from this collection.
 boolean contains(java.lang.Object o)
          Returns true if the specified object is a member of this collection overloaded to check for the key of an object, e.g.
 ViewMember find(int ID)
          find an element by its ID
 ViewMember find(java.lang.String name)
          find an element by its primary descriptor.
 ViewMember find(java.lang.String name, boolean ignoreCase)
          find an element by its primary descriptor.
 ViewMember getAt(int index)
          Returns the ViewMember at the given index into the virtual array, or null.
 CacheService getCache()
          Gets a cache service that can be used to populate, refresh or discard all of the view members in this collection, in bulk.
 ViewMemberCollection getFromHistory(DateTime dt)
          Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this DateTime Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label
 ViewMemberCollection getFromHistory(Label lbl)
          Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this Label Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label
 ViewMemberCollection getFromHistory(PromotionState ps)
          Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this PromotionState Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label attached to the PromotionState
 ViewMemberCollection.HistoryContainer getHistory()
          Returns a collection of History collections
 ViewMember getViewMember(int ID)
          return an element by ID
 ViewMember getViewMember(java.lang.String name)
          return an element by name.
 ViewMemberCollection.BehaviorContainer getViewMemberBehavior()
          returns the ViewMemberBehavior for a set of ViewMembers
 void lockExclusive()
          Obtains an exclusive lock on each member of this collection, without attempting to break an existing lock.
 void lockExclusive(boolean breakLock)
          Obtains an exclusive lock on each member of this collection If breakLock is true, and other users have some of these resources locked, then an attempt will be made to break those locks.
 void lockNonExclusive()
          Obtains a non-exclusive lock on each member of this collection.
 void modifyBookmark(boolean setFlagged)
          Modifies this list of member's book mark for the logged-in user.
 void modifyReadStatus(boolean markAsRead)
          Modifies this list of members's read status for the logged-in user.
 ViewMemberCollection reverse()
          returns a collection whose elements are in the reverse order of this one i.e.
static void setViewMemberBehavior(ViewMemberCollection.BehaviorContainer cntnr)
          Sets the behavior for the view members in the container The behavior is assigned in bulk, i.e.
 ViewMember[] sort()
          sort the collection by VMID
 ViewMember[] sort(boolean ignoreCase)
          sort the collection by name
 ViewMember[] sort(SortCompare sc)
          returns an array of ViewMembers whose elements are sorted using the provided comparer.
 void unlock()
          Removes the current user's lock from each member of this collection.
 
Methods inherited from class com.starteam.StarTeamCollection
add, addAll, addAll, addTo, attach, containsAll, detach, get, getSyncRoot, indexOf, insert, isEmpty, isFixedSize, isModified, isReadOnly, isSynchronized, iterator, positionOf, remove, removeAll, removeAt, resetCapacity, retainAll, set, size, toArray, toArray
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

ViewMemberCollection

public ViewMemberCollection()
Construct an empty ViewMemberCollection


ViewMemberCollection

public ViewMemberCollection(ViewMember viewMember)
Construct a ViewMemberCollection with one contained ViewMember

Parameters:
viewMember - the view member to add to the collection

ViewMemberCollection

public ViewMemberCollection(ViewMember[] viewMembers)
Construct a ViewMemberCollection from an array of ViewMember

Parameters:
viewMembers - the objects to add to the collection

ViewMemberCollection

public ViewMemberCollection(ViewMemberCollection viewMembers)
Construct a ViewMemberCollection from another collection

Parameters:
viewMembers - the objects to add to the collection
Method Detail

getAt

public ViewMember getAt(int index)
Returns the ViewMember at the given index into the virtual array, or null.

Parameters:
index - The index into the virtual array of the desired ViewMember.
Returns:
The ViewMember at the given index into the virtual array, or null.

getCache

public CacheService getCache()
Gets a cache service that can be used to populate, refresh or discard all of the view members in this collection, in bulk.

Returns:
CacheService a cache service that can be used to populate, refresh or discard members

lockExclusive

public void lockExclusive()
Obtains an exclusive lock on each member of this collection, without attempting to break an existing lock. A server exception will be thrown if any of the locks cannot be obtained.

Specified by:
lockExclusive in interface Lockable

lockExclusive

public void lockExclusive(boolean breakLock)
Obtains an exclusive lock on each member of this collection If breakLock is true, and other users have some of these resources locked, then an attempt will be made to break those locks. A server exception will be thrown if any of the locks cannot be obtained.

Specified by:
lockExclusive in interface Lockable
Parameters:
breakLock - true to break existing exclusive locks owned by other users

lockNonExclusive

public void lockNonExclusive()
Obtains a non-exclusive lock on each member of this collection. Other StarTeam users can also acquire a non-exclusive lock on these resources. A server exception will be thrown if any of the locks cannot be obtained.

Specified by:
lockNonExclusive in interface Lockable

unlock

public void unlock()
Removes the current user's lock from each member of this collection. If another user has an exclusive lock on one of the members, that lock will not be removed.

Specified by:
unlock in interface Lockable

getHistory

public ViewMemberCollection.HistoryContainer getHistory()
Returns a collection of History collections

Returns:
a collection of History collections

getViewMemberBehavior

public ViewMemberCollection.BehaviorContainer getViewMemberBehavior()
returns the ViewMemberBehavior for a set of ViewMembers

Returns:
the ViewMemberBehavior for a set of ViewMembers

setViewMemberBehavior

public static void setViewMemberBehavior(ViewMemberCollection.BehaviorContainer cntnr)
Sets the behavior for the view members in the container The behavior is assigned in bulk, i.e. as an atomic operation

Parameters:
cntnr - a Behavior Container comprising ViewMemebrs and their associated new behavior

getFromHistory

public ViewMemberCollection getFromHistory(Label lbl)
Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this Label Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label

Parameters:
lbl - the Label to base the historical revisions on
Returns:
an equivalent set of historical revisions of ViewMembers

getFromHistory

public ViewMemberCollection getFromHistory(DateTime dt)
Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this DateTime Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label

Parameters:
dt - the DateTime to base the historical revisions on
Returns:
an equivalent set of historical revisions of ViewMembers Note that this query is not view specific. So it is possible to retrieve a newer revision than the specified one, depending upon the value of the DateTime parameter

getFromHistory

public ViewMemberCollection getFromHistory(PromotionState ps)
Returns an equivalent set of historical revisions of the ViewMembers from this collection, at the versions at which they are attached to this PromotionState Note that the returned set may be smaller than the set in this collection since some of these items may not have been attached to the label attached to the PromotionState

Parameters:
ps - the PromotionState to base the historical revisions on
Returns:
an equivalent set of historical revisions of ViewMembers

reverse

public ViewMemberCollection reverse()
returns a collection whose elements are in the reverse order of this one i.e. the order of elements of a call to toArray() on the returned collection will be in reverse order w.r.t. the order of elements of a call to toArray on this collection

Returns:
a collection whose elements are in the reverse order of this one

sort

public ViewMember[] sort(SortCompare sc)
returns an array of ViewMembers whose elements are sorted using the provided comparer. Note that the caller should ensure that the properties used for comparison are pre-populated before calling this api, to avoid the overhead of single round trip queries per view member during the compare itself.

Parameters:
sc - a comparer used for the sort
Returns:
an array of ViewMembers whose elements are sorted using the provided comparer

getViewMember

public ViewMember getViewMember(java.lang.String name)
return an element by name. using a case insensitive match

Parameters:
name - the name
Returns:
the element

getViewMember

public ViewMember getViewMember(int ID)
return an element by ID

Parameters:
ID - the ID
Returns:
the element

find

public ViewMember find(java.lang.String name,
                       boolean ignoreCase)
find an element by its primary descriptor. Note that the elements in this collection are expected to have unique primary descriptors If they do not, then the first one found will be returned.

Parameters:
name - the primary descriptor
ignoreCase - true if case insensitive
Returns:
the element
See Also:
ViewMemberCollection.find(String)

find

public ViewMember find(java.lang.String name)
find an element by its primary descriptor. Note that the elements in this collection are expected to have unique primary descriptors If they do not, then the first one found will be returned. This overload of ViewMemberCollection.find(String, boolean) uses the Platform case sensitivity rules

Parameters:
name - the primary descriptor
Returns:
the element, if found
See Also:
ViewMemberCollection.find(String, boolean)

contains

public boolean contains(java.lang.Object o)
Returns true if the specified object is a member of this collection overloaded to check for the key of an object, e.g. int id or String name name based tests are case insensitive

Specified by:
contains in interface java.util.Collection
Overrides:
contains in class StarTeamCollection
Parameters:
o - the object to test for
Returns:
true if the specified object is a member of this collection

find

public ViewMember find(int ID)
find an element by its ID

Parameters:
ID - the ID
Returns:
the element

sort

public ViewMember[] sort(boolean ignoreCase)
sort the collection by name

Parameters:
ignoreCase - true if case insensitive sort is desired
Returns:
a collection sorted by name

sort

public ViewMember[] sort()
sort the collection by VMID

Returns:
a collection sorted by VMID

modifyReadStatus

public void modifyReadStatus(boolean markAsRead)
Modifies this list of members's read status for the logged-in user. Note that this is an "immediate" command, i.e., no update() call is required. Note also that only the currently logged-in user is affected. The result of getReadStatus() after this call may not be changed because its value will be based on cached information. To get the most up to date property values you should first call discard() on the item. This command is not supported for File items. All Files in the collection will be ignored

Parameters:
markAsRead - the new read status for the members of this collection
See Also:
ViewMember.isUnread()

modifyBookmark

public void modifyBookmark(boolean setFlagged)
Modifies this list of member's book mark for the logged-in user. Note that this is an "immediate" command, i.e., no update() call is required. Note also that only the currently logged-in user is affected. The result of getBookmark() after this call may not be changed because its value will be based on cached information. To get the most up to date property values you should first call discard() on the item.

Parameters:
setFlagged - this items new book mark
See Also:
ViewMember.isBookmarked()

clear

public void clear()
Removes all of the elements from this collection.

Specified by:
clear in interface java.util.Collection
Overrides:
clear in class StarTeamCollection


StarTeam SDK 14.0, Build 21
Copyright © 2003-2012 Borland Software Corporation. All rights reserved.