How to query for user story time in Rally - java

Using Java, I would like to query Rally for the amount of time that user stories in a specific project took to complete become "Accepted". I have some familiarity with the Rally API already, and have already used it to gather defect data.
Does anyone have any suggestions on how to do this? Thanks!
References:
http://rallytools.github.io/RallyRestToolkitForJava/
https://github.com/RallyTools/RallyRestToolkitForJava/wiki/User-Guide
I also have access to the Rally Web Services API Documentation v2.0 at https://rally1.rallydev.com/slm/doc/webservice/

Instead of looking for "Defects" do a query for "HeirarchicalRequirements"
QueryRequest ustore = new QueryRequest("hierarchicalrequirement");
ustore.setLimit(Integer.MAX_VALUE);
ustore.setFetch(new Fetch("FormattedID","Name","Parent","Feature","Blocked","PlanEstimate","ScheduleState","Release","Iteration","Owner","Project"));
ustore.setQueryFilter(new QueryFilter("Feature.Name","=",feature.getName()));
QueryResponse usResp = restApi.query(ustore);

Search rally tag for Lookback API posts. LBAPI provides historic data.
Even though LBAPI is language agnostic, Rally REST Toolkit for Java does not have a built-in support for it. Currently only javascript AppSDK2 has built-in support for it through snapshotstore.
Unlike Lookback API, WS API gives only the current state of objects. Of course historic data can be gathered from WS API by parsing RevisionHistory,but parsing revisions is expensive and inefficient.
In WS API HierarchicalRequirement has AcceptedDate attribute. This can be accessed directly without having to parse revision history. There is no equivalent for Completed date. You would have to parse revision history to find a revision when a story was set to Completed.

Related

What is equivalent of cts:element-query in MarkLogic Java API

I have a MarkLogic query written in XQuery and I would like to convert it to Java API using StructuredQueryBuilder. Unfortunately, I can't find Java equivalent for cts:element-query. Can you please show me how to implement it in Java?
The query that I want to convert:
cts:element-query(fn:QName("http://www.example.com/2009/pfi2","content"), cts:word-query("florists", ("case-insensitive","lang=en"), 4.5), ())
The StructuredQueryBuilder.containerQuery() method constructs a search:container-query in the Search API. On the enode, the REST API converts the search:container-query to cts:element-query() or cts:json-property-query() or cts:json-property-scope-query() as appropriate.
For more detail, see:
http://docs.marklogic.com/javadoc/client/com/marklogic/client/query/StructuredQueryBuilder.html#containerQuery-com.marklogic.client.query.StructuredQueryBuilder.ContainerIndex-com.marklogic.client.query.StructuredQueryDefinition-
http://docs.marklogic.com/guide/search-dev/structured-query#id_87231
The other way to provide the query in the Java API is to serialize the cts:element-query() as JSON or XML to learn the query structure and then use a DOM to construct the query and pass the query as a RawCtsQueryDefinition payload.
For that approach, see:
http://docs.marklogic.com/guide/java/searches#id_45762
http://docs.marklogic.com/javadoc/client/com/marklogic/client/query/RawCtsQueryDefinition.html
Hoping that helps,

How to fetch Models with a property query based in Hyperledger Fabric Java chaincode

I am developing a simple Hyperledger Fabric Wallet type application in Java chaincode with basically 2 models: Wallet and MoneyTransfer. MoneyTransfer has the data, amount and ids for "fromWallet" and "targetWallet".
I have not found examples of how to do a query in the ChaincodeStub to fetch, for example, all MoneyTransfer's for a specific walletId. Is this possible or models can only be fetched by id?
Any URL for doc or help on how to do this? (Samples I have found just fetch models by Id but don't perform queries based on specific properties in the models) Thanks.
Using CouchDB as the state database you should be able to write JSON objects into the state database and run "rich" queries against a particular property in the JSON object. There are samples for doing this in Javascript and in Go, but I don't know if there are any for Java.
These docs give the background:
https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_tutorial.html
https://hyperledger-fabric.readthedocs.io/en/latest/couchdb_as_state_database.html

Transform Cassandra query result to POJO with Astyanax

I am working in a Spring web application using Cassandra with Astyanax client. I want to transform result data retrieved from Cassandra queries to a POJO, but I do not know which library or Astyanax API support this.
For example, I have User column family (CF) with some basic properties (username, password, email) and other related additional information can be added to this CF. Then I fetch one User row from that CF by using OperationResult> to hold the data returned, like this:
OperationResult<ColumnList<String>> columns = getKeyspace().prepareQuery(getColumnFamily()).getRow(rowKey).execute();
What I want to do next is populating "columns" to my User object. Here, I have 2 problems and could you please help me solve this:
1/ What is the best structure of User class to hold the corresponding data retrieved from User CF? My suggestion is:
public class User {
String userName, password, email; // Basic properties
Map<String, Object> additionalInfo;
}
2/ How can I transform the Cassandra data to this POJO by using a generic method (so that it can be applied to every single CF which has mapped POJO)?
I am so sorry if there are some stupid dummy things in my questions, because I have just approached NoSQL concepts and Cassandra as well as Astyanax for 2 weeks.
Thank you so much for your help.
You can try Achilles : https://github.com/doanduyhai/achilles, an JPA compliant Entity Manager for Cassandra
Right now there is a complete implementation using Thrift API via Hector.
The CQL3 implementation using Datastax Java Driver is in progress. A beta version will be available in few months (July-August 2013)
CQL3 is great but it's still too low level because you need to extract the data yourself from the ResultSet. It's like coming back to the time when only JDBC Template was available.
Achilles is there to fill the gap.
I would suggest you to use some library like Playorm using which you can easily perform CRUD operations on your entities. See this for an example that how you can create a User object and then you can get the POJO easily by
User user1 = mgr.find(User.class, email);
Assuming that email is your NoSqlId(Primary key or row key in Cassandra).
I use com.netflix.astyanax.mapping.Mapping and com.netflix.astyanax.mapping.MappingCache for exactly this purpose.

Rally rest recyclebin

In the Rally REST Java API (1.40), how can I create a QueryRequest to find a specific DELETED item by FormattedID.
QueryRequest queryRequest = new QueryRequest("recyclebinentry");
I see in an unrestricted query ( e.g. no filter set ), the value for the FormattedID is returned in the "ID" property, but using that property or FormattedID in a query results in the queryResponse.wasSuccessful() being false.
Unfortunately, the Recycle Bin offers only very limited query-ability. As you've found, FormattedID is not accepted, nor are DeletedBy, Name, Type, or other useful identifying fields. The best you can really do is filter by DeletionDate. For example (DeletionDate >= "2013-03-01T15:00:00Z") to narrow your results. Then manually search on the client-side.
I'd recommend posting this as a Feature Request to Rally Ideas, since this is a commonly requested item.

Search twitter by language

In twitter by using lang operator you can search for retrieving tweets from a particular language: For example, the following search will return tweets only in english:
https://twitter.com/search?q=lang:en
Is there a way to achieve this using twitter api, especially using twitter4j. I know there is a language attribute for search but it also requires at least one keyword to make a search, I would like to search by a particular language without giving any keyword query. The following command in java driver returns the following error:
Query searchQuery = new Query() //
.count(resultsPerPage) //
.since(since)//
.lang("en");
400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting(https://dev.twitter.com/pages/rate-limiting). In API v1.1, a request without authentication is considered invalid and you will get this response.
message - Query parameters are missing
code - 25
Cheers
You must pass the same do you use in the twitter search, your query will be like:
new Query("lang:en")
Using twitter4j,
Query query = new Query();
query.setLang("en");
query.setQuery(searchQuery);

Categories