|
Project: stp | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcom.ibm.rational.stp.client.samples.QueryUtilities
com.ibm.rational.stp.client.samples.QueryCommand
public class QueryCommand
A sample CM API application for defining and executing ClearQuest queries using a command-line interface. Command line arguments are
Field Summary | |
---|---|
private static CqProvider |
g_provider
The CqProvider instance used by the class and its instances |
private static String |
g_repo
The target ClearQuest user database, derived from command-line input |
(package private) CqQuery.ListOptions |
m_countRows
Whether or not to count all rows: set by presence of -count |
(package private) long |
m_max
-max operand: The last row of the result set to return |
(package private) long |
m_min
-min operand: The first row of the result set to return |
(package private) com.ibm.rational.wvcm.stp.StpLocation |
m_oldName
-name operand: The name of an existing query |
(package private) com.ibm.rational.wvcm.stp.StpLocation |
m_primaryType
-from operand: the CqRecordType defining the type of records to query |
(package private) com.ibm.rational.wvcm.stp.StpLocation |
m_saveName
-save operand: the name under which the query is to be saved |
(package private) List<String> |
m_select
-select operand: Used to build the DisplayField[] for the query |
(package private) List<String> |
m_where
-where operand: Used to build the filtering expression for the query |
(package private) List<String> |
m_with
-with operand: Used to build the FilterLeaf[] for query parameters |
private static javax.wvcm.PropertyRequestItem.PropertyRequest |
QUERY_PROPERTIES
|
Fields inherited from class com.ibm.rational.stp.client.samples.QueryUtilities |
---|
RECORD_TYPE_WITH_FIELDS |
Constructor Summary | |
---|---|
QueryCommand()
|
Method Summary | |
---|---|
(package private) CqQuery |
buildQuery()
Constructs a CqQuery proxy in which the query specification data presented on the command line is stored. |
(package private) void |
collectArgs(String[] args)
Collects the command-line arguments into object fields. |
private String |
describe(CqQuery query)
Assembles a String containing information about the query executed. |
(package private) CqResultSet |
executeQuery(CqQuery input)
Executes the constructed query. |
private static List<String> |
getArgList(ListIterator<String> args)
Collects the arguments in the command line upto, but not including, the first argument that begins with "-" |
static void |
main(String[] args)
|
(package private) void |
printResults(CqQuery query,
CqResultSet results)
Display the rows returned by the query on the console |
(package private) void |
run(String[] args)
|
private static com.ibm.rational.wvcm.stp.StpLocation |
toSelector(com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace,
String str)
Converts command-line input specifying a resource into an StpLocation, adding domain and namespace if omitted by the user |
Methods inherited from class com.ibm.rational.stp.client.samples.QueryUtilities |
---|
parseDisplayField, parseDynamicFilter, parseFilter, parseFilterLeaf |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static CqProvider g_provider
private static String g_repo
com.ibm.rational.wvcm.stp.StpLocation m_oldName
com.ibm.rational.wvcm.stp.StpLocation m_saveName
com.ibm.rational.wvcm.stp.StpLocation m_primaryType
List<String> m_select
List<String> m_where
List<String> m_with
long m_min
long m_max
CqQuery.ListOptions m_countRows
private static final javax.wvcm.PropertyRequestItem.PropertyRequest QUERY_PROPERTIES
Constructor Detail |
---|
public QueryCommand()
Method Detail |
---|
void collectArgs(String[] args) throws javax.wvcm.WvcmException
args
- A String array containing the command-line arguments
javax.wvcm.WvcmException
- if StpLocation objects cannot be constructed from
the resource names on the command line.CqQuery buildQuery() throws javax.wvcm.WvcmException
javax.wvcm.WvcmException
CqResultSet executeQuery(CqQuery input) throws javax.wvcm.WvcmException
At this point, if the user followed the rules, we should be able to execute the query. If -save was specified, we need to define the query in the database and then use doExecute to get the results. If an existing query is being executed unmodified, then we use doExecute as well; Otherwise we use CqRecordType.doQuery() passing the data from the command line to ClearQuest.
javax.wvcm.WvcmException
void printResults(CqQuery query, CqResultSet results) throws javax.wvcm.WvcmException
query
- The query that was executed.results
- The CqResultSet containing the rows of the result
set.
javax.wvcm.WvcmException
- If interactions with the server fail or have failed
to obtained the necessary information.private String describe(CqQuery query) throws javax.wvcm.WvcmException
query
- A CqQuery proxy for the query to be described. Must define
the DISPLAY_FIELDS, PRIMARY_RECORD_TYPE, and FILTERING properties
if the query has not been saved; USER_FRIENDLY_LOCATION, otherwise.
javax.wvcm.WvcmException
void run(String[] args) throws javax.wvcm.WvcmException
javax.wvcm.WvcmException
public static void main(String[] args) throws Exception
args
-
Exception
private static List<String> getArgList(ListIterator<String> args)
args
- The command line argument iterator positioned on the argument
that precedes the arguments to be collected. Must not be
null.
private static com.ibm.rational.wvcm.stp.StpLocation toSelector(com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace, String str) throws javax.wvcm.WvcmException
namespace
- The expected namespace for the location. Must not be
null.str
- The location as input by the user. Expect simple name and
possibly repository information. Must not be null.
javax.wvcm.WvcmException
|
Generated Wed 11-Jun-2014 01:28 AM | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |