It's all about the answers!

Ask a question

Error while fetching the parent work item type


Mahesh Vasamsetti (172) | asked Aug 06 '15, 9:53 a.m.
edited Aug 07 '15, 2:42 a.m. by Ralph Schoon (55.5k23642)
ISaveParameter data = (ISaveParameter) serviceUtils.getOperation().getOperationData();
List<IEndPointDescriptor> parentList = data.getNewReferences().getChangedReferenceTypes();
System.out.println("parent list size::::"+parentList.size());
System.out.println("1:::::"+parentList.get(0).getDisplayName());

output: 
parent list size::::0
09:26:25,992 [526458721@qtp-1491425509-9 @@ 09:25 TestJazzAdmin1 <com.ibm.team.repository.transport.client.RemoteTeamService spnego-enabled@127.0.0.1> /jazz/service/com.ibm.team.workitem.common.internal.IWorkItemRepositoryService] ERROR c.extensions.workitem.service.impl.TaskServiceImpl - Index: 0, Size: 



Comments
Ralph Schoon commented Aug 06 '15, 10:44 a.m. | edited Sep 26 '15, 11:54 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

For the next questions you want to ask, please see this guidance: How should I ask a question in the Forum if I want to receive useful answers?

For this one: I can't see an error. This is probably just wrong usage of the API. See https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ for an example.


Mahesh Vasamsetti commented Aug 07 '15, 1:13 a.m. | edited Sep 26 '15, 11:54 p.m.

Thank you Ralph Schoon. I Appreciate your quick response and useful suggestions all the time. I understand your frustration, you may be seeing such questions all the time, so may be thinking like waste of time.


- I am new to this API, started 2 weeks back 
- Gone through the search and got almost same/similar answers (not useful for me)
- Few questions are useful and got few lines of useful code but while running the code got issues then only I posted it as a question here. 

Sorry, but I suggest, there must be some tab for beginners, something like 'beginners guide', people like me will go through it first before posting question here.

When it come to above post and considering my other posts, i am not getting the data from the repository. used the same code that copied from the multiple answers, not able to get the user details and parent/child details associated with the currently using work item. I am not sure whether users are configured properly or not (if this is the case, how/where to check the user configuration at jetty server). I am missing something..... 

Accepted answer


permanent link
Ralph Schoon (55.5k23642) | answered Aug 07 '15, 2:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Aug 07 '15, 2:43 a.m.
I try to provide a beginners guide here: https://rsjazz.wordpress.com/

I understand the API is not trivial - I am working against it for several years now and I still find a lot of cases where I don't know the API and have to search for examples in the SDK or in the net. This happens almost every time I try something new. So regardless how many beginner guides we would write, every beginner will always feel that there should be something else in there.

Setting up Rational Team Concert for API Development and the Extensions Workshop and Understanding and Using the RTC Java Client API and What API's are Available for RTC and What Can You Extend? and various other posts are meant to be beginners guides. There are many examples on the blog that you can follow, assuming you have set up your environment for debugging as described in the Extensions Workshop.

In the link I mentioned in my initial answer all those are kind of accessible in the introduction "If you are just starting".
In addition if you download the code and actually look into the code you find this code piece:

	private IWorkItemHandle findParentHandle(ISaveParameter saveParameter,
			IProgressMonitor monitor) throws TeamRepositoryException {

		// Check to see if the references contain a 'Parent' link
		List references = saveParameter.getNewReferences()
				.getReferences(WorkItemEndPoints.PARENT_WORK_ITEM);
		if (references.isEmpty())
			return null;

		// Traverse the list of references (there should only be 1 parent) and
		// ensure the reference is to a work item then return a handle to that
		// work item
		for (IReference reference : references)
			if (reference.isItemReference()
					&& ((IItemReference) reference).getReferencedItem() instanceof IWorkItemHandle)
				return (IWorkItemHandle) ((IItemReference) reference)
						.getReferencedItem();

		return null;
	}

I don't know if you actually read the post that I send in my first answer. I don't have the impression you did. So I question why I actually spend the precious time to
  1. Create the examples
  2. Answer the question 

However, more examples code for the link API can be found here: https://rsjazz.wordpress.com/?s=link

Mahesh Vasamsetti selected this answer as the correct answer

Comments
Ralph Schoon commented Aug 07 '15, 3:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

PS: the call you use in your example will return the end point descriptors where there are changes e.g. new references added or referenced deleted.

See the documentation in the API.



Mahesh Vasamsetti commented Aug 13 '15, 1:33 a.m.

 This is working for me. Thank you so much...


- Mahesh

Your answer


Register or to post your answer.