I am using the VersionOne.APIClient to fetch the status of a V1 story
or defect and if not closed to add a change set to it (a URL to svn
viewer). My question is, can I do the same - attach a changeset or a
URL(s) to a task (TK-34234 for ex.) ? How to check the task state -
open or closed?
/**
* Creates a changeset associated with the given story or defect.
*
*/
public final boolean createChangeSet(String[] arg) {
The above may make your question about Task state moot. But, just in case, you can query Task state the same way you can Stories or Defects. If you are having a problem with that, let me know a bit more of the details.
Yours truly, Ian Buchanan Product Manager for Platform and Integrations
On Monday, August 27, 2012 6:13:44 AM UTC-4, veskojava wrote: > Hi guys,
> I am using the VersionOne.APIClient to fetch the status of a V1 story > or defect and if not closed to add a change set to it (a URL to svn > viewer). My question is, can I do the same - attach a changeset or a > URL(s) to a task (TK-34234 for ex.) ? How to check the task state - > open or closed?
> /** > * Creates a changeset associated with the given story or defect. > * > */ > public final boolean createChangeSet(String[] arg) {
On Mon, Aug 27, 2012 at 4:56 PM, ibuchanan <ian.bucha...@versionone.com> wrote:
> Vesko,
> Glad to hear you are making good use of the VersionOne Java SDK.
> ChangeSets have a relationship to PrimaryWorkitems, which include only
> Stories and Defects, not Tasks and Tests (which are considered
> SecondaryWorkitems). You can find this out from a query to "meta" as so:
> https://www14.v1host.com/v1sdktesting/meta.v1/ChangeSet?xsl=api.xsl
> The above may make your question about Task state moot. But, just in case,
> you can query Task state the same way you can Stories or Defects. If you are
> having a problem with that, let me know a bit more of the details.
> Yours truly,
> Ian Buchanan
> Product Manager for Platform and Integrations
> On Monday, August 27, 2012 6:13:44 AM UTC-4, veskojava wrote:
>> Hi guys,
>> I am using the VersionOne.APIClient to fetch the status of a V1 story
>> or defect and if not closed to add a change set to it (a URL to svn
>> viewer). My question is, can I do the same - attach a changeset or a
>> URL(s) to a task (TK-34234 for ex.) ? How to check the task state -
>> open or closed?
>> /**
>> * Creates a changeset associated with the given story or defect.
>> *
>> */
>> public final boolean createChangeSet(String[] arg) {
> --
> You received this message because you are subscribed to the Google Groups
> "VersionOne-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/versionone-dev/-/q0WDWquu8xYJ.
> To post to this group, send email to versionone-dev@googlegroups.com.
> To unsubscribe from this group, send email to
> versionone-dev+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/versionone-dev?hl=en.
Query query = new Query(task);
IAttributeDefinition numberAttribute = task.getAttributeDefinition("Number");
query.getSelection().add(numberAttribute);
IAttributeDefinition assetStateAttribute = task.getAttributeDefinition("AssetState");
query.getSelection().add(assetStateAttribute);
QueryFind qf = new QueryFind(number); // filter by task Number
query.setFind(qf);
QueryResult result = getServices().retrieve(query);
if (result.getAssets().length == 0) {
System.err.println("\nV1SvnAxway - No such: " + number);
}
Asset story = result.getAssets()[0]; // only one task with that Number
Attribute defectStatus = story.getAttribute(assetStateAttribute);
if (defectStatus.getOriginalValue().equals(64)) {
status = BaseAssetFilter.State.Active;
} else {
status = BaseAssetFilter.State.Closed;
}
However, defectStatus.getOriginalValue() always returns 128 no matter if the task is in progress or closed. Please advise.
> On Mon, Aug 27, 2012 at 4:56 PM, ibuchanan <ian.bucha...@versionone.com> wrote:
>> Vesko,
>> Glad to hear you are making good use of the VersionOne Java SDK.
>> ChangeSets have a relationship to PrimaryWorkitems, which include only
>> Stories and Defects, not Tasks and Tests (which are considered
>> SecondaryWorkitems). You can find this out from a query to "meta" as so:
>> https://www14.v1host.com/v1sdktesting/meta.v1/ChangeSet?xsl=api.xsl
>> The above may make your question about Task state moot. But, just in case,
>> you can query Task state the same way you can Stories or Defects. If you are
>> having a problem with that, let me know a bit more of the details.
>> Yours truly,
>> Ian Buchanan
>> Product Manager for Platform and Integrations
>> On Monday, August 27, 2012 6:13:44 AM UTC-4, veskojava wrote:
>>> Hi guys,
>>> I am using the VersionOne.APIClient to fetch the status of a V1 story
>>> or defect and if not closed to add a change set to it (a URL to svn
>>> viewer). My question is, can I do the same - attach a changeset or a
>>> URL(s) to a task (TK-34234 for ex.) ? How to check the task state -
>>> open or closed?
>>> /**
>>> * Creates a changeset associated with the given story or defect.
>>> *
>>> */
>>> public final boolean createChangeSet(String[] arg) {
>>> Thanks for your help!
>>> Vesko
>> --
>> You received this message because you are subscribed to the Google Groups
>> "VersionOne-dev" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/versionone-dev/-/q0WDWquu8xYJ.
>> To post to this group, send email to versionone-dev@googlegroups.com.
>> To unsubscribe from this group, send email to
>> versionone-dev+unsubscribe@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/versionone-dev?hl=en.
I think the problem is in the QueryFind. QueryFind is for conducing search operations. For example, if you wanted to find the word "Urgent" from a title like "Update Urgent Records". This is not the same as when you use the Search feature in the UI, which will search across a number of fields, not just one. I would have to stare at the SDK source code a bit longer to remember what happens when you don't specify which attribute you want to search so I'm not entirely sure what your code finds. I suspect it's just not the task you expect (hence, the AssetState is always the same).
Since you have the exact task number you want to match, you should just use a simple filter:
FilterTerm term = new FilterTerm(numberAttribute); term.Equal(number); query.Filter = term;
Unrelated, you should probably just use getValue() instead of getOriginalValue(). In your code, they will always evaluate to the same thing but getValue() removes the potentially confusing change detection triggers.
Also, you probably want to use the AssetState enumeration instead of BaseAssetFilter. Since it already encodes the possible AssetState values, it will save you from doing the extra if statement.
> Query query = new Query(task); > IAttributeDefinition numberAttribute = > task.getAttributeDefinition("Number"); > query.getSelection().add(numberAttribute); > IAttributeDefinition assetStateAttribute = > task.getAttributeDefinition("AssetState"); > query.getSelection().add(assetStateAttribute); > QueryFind qf = new QueryFind(number); // filter by task Number > query.setFind(qf);
> QueryResult result = getServices().retrieve(query); > if (result.getAssets().length == 0) { > System.err.println("\nV1SvnAxway - No such: " + number); > } > Asset story = result.getAssets()[0]; // only one task with that > Number > Attribute defectStatus = story.getAttribute(assetStateAttribute); > if (defectStatus.getOriginalValue().equals(64)) { > status = BaseAssetFilter.State.Active; > } else { > status = BaseAssetFilter.State.Closed; > }
> However, defectStatus.getOriginalValue() always returns 128 no matter if > the task is in progress or closed. Please advise.
> Thanks a lot, > Vesko
> On 28.08.12 09:19, Veselin Chiporikov wrote: > > Thanks Ian, I'll take a look into this.
> > Regards, > > Vesko
> > On Mon, Aug 27, 2012 at 4:56 PM, ibuchanan <ian.bu...@versionone.com<javascript:>> > wrote: > >> Vesko,
> >> Glad to hear you are making good use of the VersionOne Java SDK.
> >> ChangeSets have a relationship to PrimaryWorkitems, which include only > >> Stories and Defects, not Tasks and Tests (which are considered > >> SecondaryWorkitems). You can find this out from a query to "meta" as > so: > >> https://www14.v1host.com/v1sdktesting/meta.v1/ChangeSet?xsl=api.xsl
> >> The above may make your question about Task state moot. But, just in > case, > >> you can query Task state the same way you can Stories or Defects. If > you are > >> having a problem with that, let me know a bit more of the details.
> >> Yours truly, > >> Ian Buchanan > >> Product Manager for Platform and Integrations
> >> On Monday, August 27, 2012 6:13:44 AM UTC-4, veskojava wrote: > >>> Hi guys,
> >>> I am using the VersionOne.APIClient to fetch the status of a V1 story > >>> or defect and if not closed to add a change set to it (a URL to svn > >>> viewer). My question is, can I do the same - attach a changeset or a > >>> URL(s) to a task (TK-34234 for ex.) ? How to check the task state - > >>> open or closed?
> >>> /** > >>> * Creates a changeset associated with the given story or defect. > >>> * > >>> */ > >>> public final boolean createChangeSet(String[] arg) {
> >>> Thanks for your help! > >>> Vesko > >> -- > >> You received this message because you are subscribed to the Google > Groups > >> "VersionOne-dev" group. > >> To view this discussion on the web visit > >> https://groups.google.com/d/msg/versionone-dev/-/q0WDWquu8xYJ. > >> To post to this group, send email to version...@googlegroups.com<javascript:>.
> >> To unsubscribe from this group, send email to > >> versionone-de...@googlegroups.com <javascript:>. > >> For more options, visit this group at > >> http://groups.google.com/group/versionone-dev?hl=en.
> I think the problem is in the QueryFind. QueryFind is for conducing > search operations. For example, if you wanted to find the word > "Urgent" from a title like "Update Urgent Records". This is not the > same as when you use the Search feature in the UI, which will search > across a number of fields, not just one. I would have to stare at the > SDK source code a bit longer to remember what happens when you don't > specify which attribute you want to search so I'm not entirely sure > what your code finds. I suspect it's just not the task you expect > (hence, the AssetState is always the same).
> Since you have the exact task number you want to match, you should > just use a simple filter:
> FilterTerm term = new FilterTerm(numberAttribute);
> term.Equal(number);
> query.Filter = term;
> Unrelated, you should probably just use getValue() instead of > getOriginalValue(). In your code, they will always evaluate to the > same thing but getValue() removes the potentially confusing change > detection triggers.
> Also, you probably want to use the AssetState enumeration instead of > BaseAssetFilter. Since it already encodes the possible AssetState > values, it will save you from doing the extra if statement.
> Hope that helps,
> Ian
> On Tuesday, August 28, 2012 11:20:17 AM UTC-4, veskojava wrote:
> Hi again,
> I was trying to use the same way for getting the status of a task,
> as I
> use for story, e.g.
> Query query = new Query(task);
> IAttributeDefinition numberAttribute =
> task.getAttributeDefinition("Number");
> query.getSelection().add(numberAttribute);
> IAttributeDefinition assetStateAttribute =
> task.getAttributeDefinition("AssetState");
> query.getSelection().add(assetStateAttribute);
> QueryFind qf = new QueryFind(number); // filter by task
> Number
> query.setFind(qf);
> QueryResult result = getServices().retrieve(query);
> if (result.getAssets().length == 0) {
> System.err.println("\nNo such: " + number);
> }
> Asset story = result.getAssets()[0]; // only one task
> with that
> Number
> Attribute defectStatus =
> story.getAttribute(assetStateAttribute);
> if (defectStatus.getOriginalValue().equals(64)) {
> status = BaseAssetFilter.State.Active;
> } else {
> status = BaseAssetFilter.State.Closed;
> }
> However, defectStatus.getOriginalValue() always returns 128 no
> matter if
> the task is in progress or closed. Please advise.
> Thanks a lot,
> Vesko
> On 28.08.12 09:19, Veselin Chiporikov wrote:
> > Thanks Ian, I'll take a look into this.
> > Regards,
> > Vesko
> > On Mon, Aug 27, 2012 at 4:56 PM, ibuchanan
> <ian.bu...@versionone.com <javascript:>> wrote:
> >> Vesko,
> >> Glad to hear you are making good use of the VersionOne Java SDK.
> >> ChangeSets have a relationship to PrimaryWorkitems, which
> include only
> >> Stories and Defects, not Tasks and Tests (which are considered
> >> SecondaryWorkitems). You can find this out from a query to
> "meta" as so:
> >> The above may make your question about Task state moot. But,
> just in case,
> >> you can query Task state the same way you can Stories or
> Defects. If you are
> >> having a problem with that, let me know a bit more of the details.
> >> Yours truly,
> >> Ian Buchanan
> >> Product Manager for Platform and Integrations
> >> On Monday, August 27, 2012 6:13:44 AM UTC-4, veskojava wrote:
> >>> Hi guys,
> >>> I am using the VersionOne.APIClient to fetch the status of a
> V1 story
> >>> or defect and if not closed to add a change set to it (a URL
> to svn
> >>> viewer). My question is, can I do the same - attach a
> changeset or a
> >>> URL(s) to a task (TK-34234 for ex.) ? How to check the task
> state -
> >>> open or closed?
> >>> /**
> >>> * Creates a changeset associated with the given story or
> defect.
> >>> *
> >>> */
> >>> public final boolean createChangeSet(String[] arg) {
> -- > You received this message because you are subscribed to the Google > Groups "VersionOne-dev" group.
> To view this discussion on the web visit > https://groups.google.com/d/msg/versionone-dev/-/-kSz1luiWWIJ.
> To post to this group, send email to versionone-dev@googlegroups.com.
> To unsubscribe from this group, send email to > versionone-dev+unsubscribe@googlegroups.com.
> For more options, visit this group at > http://groups.google.com/group/versionone-dev?hl=en.