com.starteam
Class Query

java.lang.Object
  extended by com.starteam.NamedCacheRef
      extended by com.starteam.Query
All Implemented Interfaces:
ISecurable, java.lang.Cloneable

public final class Query
extends NamedCacheRef
implements ISecurable

The Query class implements a query condition to be applied to items of a certain type. Query objects are used in conjunction with Filter objects for describing what items to display to the user and how to display them.


Nested Class Summary
static class Query.Context
          User context for evaluating the query
static class Query.WebCacheQuery
          Base accessor for cached SDK types encapsulating the statefulness of objects obtained from the artifact cache.
 
Constructor Summary
Query(ViewMember.Type type, boolean bPublic, java.lang.String name, QueryNode node)
          Create a new Query object for the specified type.
 
Method Summary
 Query copy()
          Creates a copy of this Query object.
 void delete()
          Deletes this query from the repository.
 boolean equals(java.lang.Object another)
          Returns true if the specified Object identifies the same exact Query.
 boolean evaluate(Query.Context context, ViewMember viewMember)
          Evaluates the query on the given view member, based on the given user context.
 User getCreatedBy()
          Return the user who created this query.
 DateTime getCreatedTime()
          Return the created time of this query.
 java.lang.String getDebugString()
          Returns a String with debug information about this query.
 int getID()
          Return the internal ID of the Query.
 User getModifiedBy()
          Return the user who last modified this query.
 DateTime getModifiedTime()
          Return the last modified time of this query.
 java.lang.String getName()
          Return the name of the query.
 User getOwnedBy()
          Return the user who owns this query.
 ISecurableContainer getParentContainer()
          If there are no access rights explicitly assigned to this object, then the effective access rights come from a parent container.
 int getPresentationID()
          Returns the unique integer identifier for this query.
 Project[] getProjects()
          return the set of projects associated with this query
 PropertyCollection getProperties()
          Returns the property IDs used by any of the QueryNode and QueryPart objects comprising this query.
 QueryNode getQueryNode()
          Return the boolean expression defining this query.
 ACE[] getRights()
          Returns the Access Control List for this query.
 Server getServer()
          return the Server instance for this Query
 Type getType()
          Return the type for this query.
 int hashCode()
          Returns a hash code for this Query.
 boolean hasPermissions(PermissionCollection permissions)
          Returns true if desired permissions are granted for this query.
 boolean isDeleted()
          Returns true if this query has been deleted.
 boolean isDirty()
          Returns true if the query has unsaved modifications.
 boolean isEqualTo(Query query)
          Compares two Query objects.
 boolean isNew()
          Returns true if this query is newly created and not yet saved in the repository.
 boolean isPublic()
          Return true if the query is publicly visible.
 void makePublic()
          Make this query public.
 void setName(java.lang.String name)
          Sets the name of the query.
 void setProjects(Project[] pp)
          Creates an association between a set of Projects and this query.
 void setQueryNode(QueryNode node)
          Sets the boolean expression used to define this query.
 void setRights(ACE[] acl)
          Modify the Access Control List for this query.
 java.lang.String toString()
          Returns the name of the query.
 void update()
          Store this query in the repository.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Query

public Query(ViewMember.Type type,
             boolean bPublic,
             java.lang.String name,
             QueryNode node)
Create a new Query object for the specified type.

Parameters:
type - the Item type to which this query can be applied. Cannot be null.
bPublic - true if the Query is to be publicly visible or not.
name - the name of the Query object. Cannot be null.
node - the boolean expression defining the query. Cannot be null.
Method Detail

getServer

public Server getServer()
return the Server instance for this Query

Specified by:
getServer in interface ISecurable
Returns:
Server the Server instance for this Query

getProjects

public Project[] getProjects()
return the set of projects associated with this query

Returns:
the set of projects associated with this query

setProjects

public void setProjects(Project[] pp)
Creates an association between a set of Projects and this query. Project Query relationships were introduced in server release 14.0 specify NULL to disassociate any projects from this query

Parameters:
pp - the set of projects to associate with this query

copy

public Query copy()
Creates a copy of this Query object. Useful to applications that want to save a snapshot of the query in a given state, for example, before calling Type.refreshFiltersAndQueries().

Returns:
A copy of this Query object.
See Also:
Query.isEqualTo(com.starteam.Query)

isEqualTo

public boolean isEqualTo(Query query)
Compares two Query objects.

Parameters:
query - The Query to be compared with this one.
Returns:
true if no differences were found.
See Also:
Query.copy()

isDirty

public boolean isDirty()
Returns true if the query has unsaved modifications.

Returns:
true if the query has unsaved modifications.

isPublic

public boolean isPublic()
Return true if the query is publicly visible.

Returns:
true if the query is publicly visible.

getID

public int getID()
Return the internal ID of the Query.

Specified by:
getID in interface ISecurable
Returns:
internal query ID

getPresentationID

public int getPresentationID()
Returns the unique integer identifier for this query. on pre 14.0 servers, it returns the queryID

Returns:
the unique integer identifier for this query.

getOwnedBy

public User getOwnedBy()
Return the user who owns this query. Returns null if it is a public query.

Returns:
the user who owns this query.

getCreatedBy

public User getCreatedBy()
Return the user who created this query. This property is available starting from the 12.5 release of the Starteam server.

Returns:
the User Object who created this query.

getCreatedTime

public DateTime getCreatedTime()
Return the created time of this query. This property is available starting from the 12.5 release of the Starteam server.

Returns:
the created time of this query.

getModifiedTime

public DateTime getModifiedTime()
Return the last modified time of this query. This property is available starting from the 12.5 release of the Starteam server.

Returns:
the last modified time of this query. This property is available starting from the 12.5 release of the Starteam server.

getModifiedBy

public User getModifiedBy()
Return the user who last modified this query. This property is available starting from the 12.5 release of the Starteam server.

Returns:
the user who last modified this query. This property is available starting from the 12.5 release of the Starteam server.

getType

public Type getType()
Return the type for this query.

Specified by:
getType in interface ISecurable
Returns:
the type for this query.
See Also:
ISecurable.getParentContainer(), Type

makePublic

public void makePublic()
Make this query public. You must call update() to make the change take take effect.


getName

public java.lang.String getName()
Return the name of the query.

Returns:
the name of the query.

setName

public void setName(java.lang.String name)
Sets the name of the query. Cannot be null.

Parameters:
name - the name to be given to this query

getQueryNode

public QueryNode getQueryNode()
Return the boolean expression defining this query.

Returns:
the boolean expression defining this query.

setQueryNode

public void setQueryNode(QueryNode node)
Sets the boolean expression used to define this query. Cannot be null.

Parameters:
node - the new expression to define this query. Cannot be null.

getProperties

public PropertyCollection getProperties()
Returns the property IDs used by any of the QueryNode and QueryPart objects comprising this query.


isNew

public boolean isNew()
Returns true if this query is newly created and not yet saved in the repository.

Returns:
true if this query is newly created and not yet saved in the repository.

isDeleted

public boolean isDeleted()
Returns true if this query has been deleted.

Specified by:
isDeleted in interface ISecurable
Returns:
true if this query has been deleted.

update

public void update()
Store this query in the repository. If the query is new then a new query will be added, if it exists then it will be modified. It is possible that the ID (getID()) for the query will change after calling this method even for an existing query. This method cannot be called on a deleted query.


delete

public void delete()
Deletes this query from the repository.


getRights

public ACE[] getRights()
Returns the Access Control List for this query. This will return null if this query has no access control list. From 12.0 release of the server onwards, MPX events are sent by the server upon ACL updates. So, the server calls are optimized when mpx is enabled. For servers prior to 12.0 release, The access control list is not cached, and will be fetched from the server on demand. Cached lists are accessible via the AccessRightsManager

Specified by:
getRights in interface ISecurable
Returns:
the access control list for this query or NULL.
See Also:
AccessRightsManager.getRights(ISecurable)

setRights

public void setRights(ACE[] acl)
Modify the Access Control List for this query. If the input parameter is null then the access control list will be dropped.

Specified by:
setRights in interface ISecurable
Parameters:
acl - the new access control list or null if to be dropped.
See Also:
ACE

hasPermissions

public boolean hasPermissions(PermissionCollection permissions)
Returns true if desired permissions are granted for this query.

Specified by:
hasPermissions in interface ISecurable
Parameters:
permissions - the desired permissions
Returns:
true if all the requested permissions are granted; false if at least one of the requested permissions is denied.
See Also:
Permission

toString

public java.lang.String toString()
Returns the name of the query.

Overrides:
toString in class java.lang.Object

getDebugString

public java.lang.String getDebugString()
Returns a String with debug information about this query.

Returns:
a debug string for this query.

evaluate

public boolean evaluate(Query.Context context,
                        ViewMember viewMember)
Evaluates the query on the given view member, based on the given user context.

Parameters:
context - user context to be used
viewMember - given view member
Returns:
result of the query evaluation

getParentContainer

public ISecurableContainer getParentContainer()
If there are no access rights explicitly assigned to this object, then the effective access rights come from a parent container.

Specified by:
getParentContainer in interface ISecurable
Returns:
This object's parent container.
See Also:
ISecurableContainer

hashCode

public int hashCode()
Returns a hash code for this Query.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this Query.

equals

public boolean equals(java.lang.Object another)
Returns true if the specified Object identifies the same exact Query.

Overrides:
equals in class java.lang.Object
Parameters:
another - the object to be compared to for equality
Returns:
true if the specified object identifies the same query as this one.


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