Project: stp

com.ibm.rational.stp.client.samples
Class CreateRecordCommand

Object
  extended by com.ibm.rational.stp.client.samples.CreateRecordCommand

public class CreateRecordCommand
extends Object

A sample CM API application that demonstrates the use of the API to create or update a ClearQuest record in a command line context.

The first argument is either the type of the record to be created or the name of a record to be modified. Standard CM API selector syntax must be used. The target user database must be specified in the repo field, but the domain and the namespace fields may be omitted as they are understood to be cq and record, respectively. The command-line options supported are

-user user-name
User logon name. Defaults to "admin"
-pass password
Password for the given user logon name. Defaults to ""
-action action name
The action to be used to update the record. Defaults to the default Modify-type action defined for the record type.
[-set] field-name field-value
Specify a new value for a field
-setlist field-name field-value+
Specify a list of new values for a field. The value list is terminated by the end of the command line or the next argument beginning with a hyphen
-show
Causes the current value of all fields to be displayed after the operation completes. (If a record is identified by the first parameter, no fields are specified, and no action is given, no operation is actually performed: just the fields of the specified record are displayed.)


Field Summary
private static javax.wvcm.PropertyNameList FIELD_METAPROPERTIES
          Generally useful field meta-properties
private static CqProvider g_provider
          The CqProvider instance used by the class
private static String g_repo
          The database in which the record will be created determined from the command line inputs
static javax.wvcm.PropertyRequestItem.PropertyRequest RECORD_REQUEST
          Property request for retrieving the user-friendly name of a resource
 
Constructor Summary
CreateRecordCommand()
           
 
Method Summary
static void main(String[] args)
          Creates a new record using field values specified on the command line
(package private) static com.ibm.rational.wvcm.stp.StpLocation normalize(com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace, String name)
          Creates an StpLocation given a partial specification of its selector
static CqRecord run(String[] args, javax.wvcm.PropertyRequestItem.PropertyRequest wanted)
          Creates a new record using field values specified on the command line
private static Object showValue(String pad, Object value)
           
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_METAPROPERTIES

private static final javax.wvcm.PropertyNameList FIELD_METAPROPERTIES
Generally useful field meta-properties. *


RECORD_REQUEST

public static final javax.wvcm.PropertyRequestItem.PropertyRequest RECORD_REQUEST
Property request for retrieving the user-friendly name of a resource


g_provider

private static CqProvider g_provider
The CqProvider instance used by the class


g_repo

private static String g_repo
The database in which the record will be created determined from the command line inputs

Constructor Detail

CreateRecordCommand

public CreateRecordCommand()
Method Detail

normalize

static com.ibm.rational.wvcm.stp.StpLocation normalize(com.ibm.rational.wvcm.stp.StpLocation.Namespace namespace,
                                                       String name)
                                                throws javax.wvcm.WvcmException
Creates an StpLocation given a partial specification of its selector

Parameters:
name - A String containing at least the name field of the selector
namespace - The namespace required by context
Returns:
An StpLocation for the given location
Throws:
javax.wvcm.WvcmException - if the specified location is malformed.

main

public static void main(String[] args)
                 throws Exception
Creates a new record using field values specified on the command line

Parameters:
args - An array of String objects, each containing a command option or command option argument as described in the class overview comments.
Throws:
Exception - If things go wrong.

run

public static CqRecord run(String[] args,
                           javax.wvcm.PropertyRequestItem.PropertyRequest wanted)
                    throws Exception
Creates a new record using field values specified on the command line

Parameters:
args - An array of String objects, each containing a command option or command option argument as described in the class overview comments.
wanted - Target properties to be included in the returned proxy. Must include USER_FRIENDLY_LOCATION
Returns:
A proxy for the created/modified record if the operation was successful; otherwise null
Throws:
Exception - If things go wrong.

showValue

private static Object showValue(String pad,
                                Object value)

Generated Tue 12-Aug-2014 11:05 PM

Copyright © IBM 2014. All rights reserved.