It's all about the answers!

Ask a question

how to assigning a BuildEngine to a BuildDefinition using the plain java API


Steffen Kriese (381921) | asked Jun 05 '14, 10:00 a.m.
Hello,

I have created a IBuildDefinition and a IBuildEngine with the plain java api.
The GUI allows me to add "supported build definition" to a build engine or to add a "supporting build engine" to a build definition. How can I do the same in the java api?
A code spinet would be great. 

thanx in advance, Steffen

Comments
Bradley Mosher commented Oct 09 '14, 2:23 p.m. | edited Oct 09 '14, 3:54 p.m.

 It would be great if someone had an answer to this one. I am running into the same issue. 


Geoffrey Clemm commented Oct 09 '14, 3:56 p.m. | edited Nov 29 '14, 2:43 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Remember to post "please answer" requests like this as a "comment", not as an "answer".  When you posting this kind of comment as an "answer", you actually decrease the chance you'll get a real answer, since it takes the question out of the "unanswered question" queue.  (I've converted your "answer" to be a "comment").


sam detweiler commented Oct 09 '14, 4:46 p.m. | edited Nov 29 '14, 2:44 p.m.

ugly system.. I comment.. sometimes that IS the answer.. sometimes not.

that distinction should go away (IMHO)


Geoffrey Clemm commented Nov 29 '14, 11:32 a.m. | edited Nov 29 '14, 2:46 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Without the distinction between a comment and an answer, there would be no way to run the query for unanswered questions.   In most cases, the poster knows whether or not they are posting a proposed answer.   In those cases where the poster thinks they are making a comment, but the comment turns out to be an answer, the poster or a moderator can easily retype the comment to be an answer.


sam detweiler commented Nov 29 '14, 1:51 p.m. | edited Nov 29 '14, 2:47 p.m.

they should all be called replies, and there should be a checkbox to 'accept' one as THE answer.

then you could still query for topics without an answer.

the size restriction on todays 'comments' also should be eliminated.

you keep making it sound like the forums are for your benefit, instead of ours.


Geoffrey Clemm commented Nov 29 '14, 2:36 p.m. | edited Nov 29 '14, 2:47 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

In practice, only a minority of the answers are marked as "accepted", probably because neither the questioner or the answerer is sure at the time of posting whether a particular answer is the "right" or "best" answer.  But most responders do seem to be aware of whether their response is an answer, or just a comment.   What problem are you thinking would be addressed by not distinguishing between comments and questions?  (Other than avoiding the embarrassment of having Ralph point out when you have neglected to do so :-).
"Our benefit" or "your benefit"?   Really?   The query for whether there are unanswered questions is a way to make it easier to check whether there are unanswered questions.   I believe "we" all benefit when unanswered questions are identified and answered.


sam detweiler commented Nov 29 '14, 6:16 p.m.

"In practice, only a minority of the answers are marked as "accepted", probably because neither the questioner or the answerer is sure at the time of posting whether a particular answer is the "right" or "best" answer. "

exactly..  I try to help in as many ways as I can. Many times I want to post some content for the benefit of the requestor, but the 'comment' object content limit is too small.
I don't KNOW that my content is AN or THE 'ANSWER'

converting a comment to an answer changes the order of the responses..

your or our benefit... I don't EVER search for questions without an answer.. I assume that is an admin function.  I also never search for a question with AN accepted answer..  that distinction is generally useless for me.  I learn something from EVERY post I read.  and I hope that I contribute content back on every post I make. Even if it is to help all of us understand the requestors issue more clearly.

showing 5 of 7 show 2 more comments

3 answers



permanent link
sam detweiler (12.5k6195201) | answered Nov 28 '14, 7:18 a.m.
Exception in thread "main" com.ibm.team.repository.common.internal.Immutable...

unless you explicitly request it, all objects are really read-only. (Immutable)
to get a modifiable version, you must get is workingcopy..

IBuildEngine buildEngine = (IBuildEngine)buildEngine.getWorkingCopy();
then you have to save the changed object.
buildClient.save(buildEngine,null);

permanent link
sam detweiler (12.5k6195201) | answered Oct 09 '14, 4:52 p.m.
edited Nov 29 '14, 6:18 p.m.
this is one of the bad side effects apis..

IBuildEngine.getSupportedBuildDefinitions().add(IBuildDefinitionHandle);

the build engine will update the build definition list with the supplied id.

Comments
Ralph Schoon commented Nov 28 '14, 3:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

This is how EMF works. Like it or not. All this is based on EMF and EMF is efficient but uses these side effects for multiplicity.


sam detweiler commented Nov 28 '14, 3:34 p.m.

I disagree. But moot point now. 


permanent link
Steen Larsen (327) | answered Nov 28 '14, 6:06 a.m.
 @Sam, I also try to solve this out.

ITeamBuildClient buildClient = (ITeamBuildClient) jazzapi.repo.getClientLibrary(ITeamBuildClient.class);
IBuildDefinition buildDefinition = buildClient.getBuildDefinition("MyBuildDefinition", null);
IBuildDefinitionHandle buildDefinitionHandle = (IBuildDefinitionHandle) buildDefinition.getItemHandle(); 
IBuildEngine buildEngine = buildClient.getBuildEngine("MyEngine", null);
buildEngine.getSupportedBuildDefinitions().add(buildDefinitionHandle);

Exception in thread "main" com.ibm.team.repository.common.internal.ImmutablePropertyException
at com.ibm.team.repository.common.internal.util.ItemUtil$ProtectAdapter.notifyChanged(ItemUtil.java:2070)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:255)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:310)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
at dk.test.Snippet.main(Snippet.java:53)

What am I missing?

Thanks, Steen

Comments
Steen Larsen commented Nov 28 '14, 7:27 a.m.

Perfect...

Thanks.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.