com.starbase.starteam
Class QueryInfo

java.lang.Object
  |
  +--com.starbase.starteam.CacheRef
        |
        +--com.starbase.starteam.NamedCacheRef
              |
              +--com.starbase.starteam.QueryInfo
All Implemented Interfaces:
java.lang.Cloneable, ISecurable

public class QueryInfo
extends com.starbase.starteam.NamedCacheRef
implements ISecurable

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


Constructor Summary
QueryInfo(Type type, boolean bPublic, java.lang.String name, QueryNode node)
          Create a new QueryInfo object for the specified type.
 
Method Summary
 QueryInfo copy()
          Creates a copy of this QueryInfo object.
 void delete()
          Deletes this query from the repository.
 boolean equals(java.lang.Object source)
          returns true if this object instance is equal to the source
 boolean evaluate(Item item)
          Evaluate this QueryPart with respect to the specified item.
 AclEntry[] getACL()
          Returns the Access Control List for this query.
 int getID()
          Return the internal ID of the QueryInfo.
 java.lang.String getName()
          Return the name of the 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[] getPropertyIDs()
          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.
 Type getType()
          Return the type for this query.
 int getUserID()
          Return the user ID for the user who created this query.
 int hashCode()
          returns a unique hash for all instances of this type
 boolean hasPermission(int 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(QueryInfo query)
          Compares two QueryInfo objects.
 boolean isNew()
          Returns true if this query is newly created and not yet saved in the repository.
 boolean isPublic()
          Return true if the filter is publicly visible.
 void makePublic()
           
 void setACL(AclEntry[] acl)
          Modify the Access Control List for this query.
 void setName(java.lang.String name)
          Sets the name of the query.
 void setQueryNode(QueryNode node)
          Sets the boolean expression used to define this query.
 java.lang.String toDebugString()
          Returns a String with debug information about 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

QueryInfo

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

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

copy

public QueryInfo copy()
Creates a copy of this QueryInfo 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 QueryInfo object.
See Also:
QueryInfo.isEqualTo(com.starbase.starteam.QueryInfo)

isEqualTo

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

Parameters:
query - The QueryInfo to be compared with this one.
Returns:
true if no differences were found.
See Also:
QueryInfo.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 filter is publicly visible.

Returns:
true if the filter is publicly visible.

getID

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


getUserID

public int getUserID()
Return the user ID for the user who created this query. Returns -1 if it is a built-in query.

Returns:
the user ID for the user who created this query.

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()

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.

getPropertyIDs

public int[] getPropertyIDs()
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.

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.


getACL

public AclEntry[] getACL()
Returns the Access Control List for this query. This will return null if this query has no access control list.

Specified by:
getACL in interface ISecurable
Returns:
the access control list for this query. May return null.
See Also:
AclEntry

setACL

public void setACL(AclEntry[] 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:
setACL in interface ISecurable
Parameters:
acl - the new access control list or null if to be dropped.
See Also:
AclEntry

hasPermission

public boolean hasPermission(int permissions)
Returns true if desired permissions are granted for this query.

Specified by:
hasPermission 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

toDebugString

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

Returns:
a debug string for this query.

evaluate

public boolean evaluate(Item item)
Evaluate this QueryPart with respect to the specified item.

Parameters:
item - the item whose specified property value to test against
Returns:
true if the item satisfies the query and false otherwise.

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

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.