Pregunta

I am trying to to get the Priority and Status of a Story item. I am trying the following but I am not getting any results. Note, I am successfully getting the Name and Description in the below code. Just priority and status are not returning any values.

IAssetType scopes = _metaModel.getAssetType("Story");

IAttributeDefinition NameAttribute = scopes.getAttributeDefinition("Name");
IAttributeDefinition DescriptionAttribute = scopes.getAttributeDefinition("Description");
IAttributeDefinition PriorityAttribute = scopes.getAttributeDefinition("Priority");
IAttributeDefinition StatusAttribute = scopes.getAttributeDefinition("Status");

Query query = new Query(scopes);

query.getSelection().add(NameAttribute);
query.getSelection().add(DescriptionAttribute);
query.getSelection().add(PriorityAttribute);
query.getSelection().add(StatusAttribute);

QueryResult result = _services.retrieve(query);

Thank you Bhushan

¿Fue útil?

Solución

The first thing to check is meta.v1:

<Server Base URI>/meta.v1/Scope?xsl=api.xsl

The results tells me the Status and Priority attributes are relationships. That means you would have to look them up in a follow-on query to get a meaningful value. You are probably better off using a projection so you can get a text value. You probably want Status.Name and Priority.Name instead.

Although it does not affect the query itself, you have used the variable name scopes. Maybe you want to call the variable stories instead.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top