Quantcast
Channel:
Viewing all articles
Browse latest Browse all 43849

Forum Post: RE: Searching an item faster

$
0
0
1)  What would I need to distribute from the SDK ...(assuming the Java route) ? From the 14.0 SDK on wards, you only need the .jar files starteam140-resources.jar, starteam140.jar, ss.jar and jsafe.jar, from the installed lib folder. 2) ... but it appears that Java 1.7 is being used .. I am not absolutely certain of this, but if you distributed the 4 .jar files from above, I think your code would run with JDK 1.5 or JDK 1.6 3)  Back in the 11.0 automation, is it possible to get the results of a query stored on the server.  .. Yes, call the StQueryInfo.evaluate() method on each ChangeRequest in the collection. The ones that return true are the ones that satisfy your query. iterating through everything is not very efficient It's not if each CR fetches its properties lazily when you try to examine its values, thereby causing a network round trip (your application to StarTeam server and back) per CR. It can be made efficient, even woth the 11.0 SDK, simply by pre-populating the values of all CRs before examining them. This results in a single network round trip. some pseudo-code... String[] propertyNames = server.typeForName("ChangeRequest").getProperties(){.getName()} view.getRootFolder().populateNow("ChangeRequest", propertyNames, -1); over each folder from the root descending  ChangeRequest[] crs = folder.getItems("ChangeRequest");  over each ChangeRequest     stqueryInfo.evaluate(cr); don't forget to call view.close() when done to release all the memory built up within the SDK. please take a look at the wiki pages that touch upon writing well behaved SDK applications. community.microfocus.com/.../623.developing-optimized-custom-sdk-applications.aspx community.microfocus.com/.../24080.memory-management-and-the-starteam-sdk.aspx Though written for the 12.0+ sdk's they are still relevant for 11.0, albeit depending upon the older namespace. fwiw, there is a new class called the CommandProcessor in the 14.0 SDK that allows you to execute a 'sql like' query which solves the same class of problem. this is the full syntax. select * | access-rights | changes | linked-items | lifecycle | {propertyName, propertyName,...} | filter = 'filterName' from type 'typeName' {history} {deleted} {at [label = "label" | promotionstate = "promotion state" | datetime = "date" {-pattern "pattern"}] into fileName { separator 'fieldSeparator' } { headers 'on' | 'off' where {{ attached-label = 'labelName' } | { query = 'myquery' } | propertyName relation value and/or propertyName relation value and/or...} {for} {folder = 'myfolder' {recurse} or folder = 'myfolderhierarchy' {recurse} or folder = . {recurse}} or ...} order by {propertyName, propertyName,...} | orderFilter = 'myOrderFilter' [-p "userName:password@hostName:endpoint/projectName/[viewName/] [folderHierarchy/]"] in your case, you could issue a dynamic query like this new CommandProcessor().execute("select * from changerequest where status = Open -p \"user:pwd@host:port/project/view/\""); or a 'saved' query like this new CommandProcessor().execute("select * from changerequest where query = \"my special saved status query\" -p \"user:pwd@host:port/project/view/\"");

Viewing all articles
Browse latest Browse all 43849

Trending Articles