Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Attach changeset(or URL) to a task
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Veselin Chiporikov  
View profile  
 More options Aug 27 2012, 6:13 am
From: Veselin Chiporikov <vesko...@gmail.com>
Date: Mon, 27 Aug 2012 13:13:44 +0300
Local: Mon, Aug 27 2012 6:13 am
Subject: Attach changeset(or URL) to a task
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) {

        String oName = arg[0];
        String oDate = arg[1];
        String rev = arg[2];
        String cMessage = arg[3];

        String displayID = "D-1111" // for ex.

        Object story;
        Boolean exit = false;
        try {
            if (displayID.indexOf('D') == 0) {
                story = getInstance().get().defectByDisplayID(displayID);
            } else {
                story = getInstance().get().storyByDisplayID(displayID);
            }
            ChangeSet cs = getInstance().create().changeSet("'" +
oName + "'" + " on '" + oDate + "'",
                    rev);

            cs.getPrimaryWorkitems().add((PrimaryWorkitem) story);
            cs.setDescription(cMessage);
            cs.createLink("ChangeSet: " + revision,
getProperties().getProperty(V1Constants.LINK_URL) + revision, true);
            cs.save();
        } finally {
            exit = true;
        }

        return exit;
    }

Thanks for your help!
Vesko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ibuchanan  
View profile   Translate to Translated (View Original)
 More options Aug 27 2012, 9:56 am
From: ibuchanan <ian.bucha...@versionone.com>
Date: Mon, 27 Aug 2012 06:56:37 -0700 (PDT)
Local: Mon, Aug 27 2012 9:56 am
Subject: Re: Attach changeset(or URL) to a task

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*<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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Veselin Chiporikov  
View profile  
 More options Aug 28 2012, 2:19 am
From: Veselin Chiporikov <vesko...@gmail.com>
Date: Tue, 28 Aug 2012 09:19:34 +0300
Local: Tues, Aug 28 2012 2:19 am
Subject: Re: Attach changeset(or URL) to a task
Thanks Ian, I'll take a look into this.

Regards,
Vesko


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vesko321@gmail.com  
View profile  
 More options Aug 28 2012, 11:20 am
From: "vesko...@gmail.com" <vesko...@gmail.com>
Date: Tue, 28 Aug 2012 18:20:13 +0300
Local: Tues, Aug 28 2012 11:20 am
Subject: Re: Attach changeset(or URL) to a task
Hi again,

I was trying to use the same way for getting the status of a task, as I
use for story, e.g.

String number = "TK-111111" for ex.

         BaseAssetFilter.State status;
         IAssetType task;

         task =
getInstance().getApiClient().getServices().getAssetType("Task");

         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:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ibuchanan  
View profile  
 More options Aug 28 2012, 7:05 pm
From: ibuchanan <ian.bucha...@versionone.com>
Date: Tue, 28 Aug 2012 16:05:14 -0700 (PDT)
Local: Tues, Aug 28 2012 7:05 pm
Subject: Re: Attach changeset(or URL) to a task

Vesko,

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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
vesko321@gmail.com  
View profile  
 More options Aug 29 2012, 10:32 am
From: "vesko...@gmail.com" <vesko...@gmail.com>
Date: Wed, 29 Aug 2012 17:32:26 +0300
Local: Wed, Aug 29 2012 10:32 am
Subject: Re: Attach changeset(or URL) to a task

Ian,

Your advices helped me a lot! Thank you very much for your time!

Regards,
Vesko

On 29.08.12 02:05, ibuchanan wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »