Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to get the value of attributTye ProcessAreaList?

Hi

I am trying to get the value of the custom attribut type processAreaList using the below code but it's failing with the error mentioned below:


if (attribute.getAttributeType().equals("processAreaList")
&& attribute.getDisplayName().equals(
"Project_Areas")) {

System.out.println("processAreaList value :"
+ itemToBeModified.getValue(attribute));

List<ProcessAreaHandleImpl> processAreaList = (List<ProcessAreaHandleImpl>) itemToBeModified
.getValue(attribute);

System.out.println("processAreaList : "
+ processAreaList.size());

for (int p = 0; p < processAreaList.size(); p++) {

System.out.println("processAreaList" + (ProcessAreaHandle)processAreaList.get(p));
System.out.println(((IProcessArea) processAreaList.get(p)).getName());
}

}


Error:

java.lang.ClassCastException: com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl incompatible with com.ibm.team.process.common.IProcessArea
at com.hsbc.rtc.onboarding.RTCProjectOnBoarding.readOnBoradingWorkItem(RTCProjectOnBoarding.java:1082)
at com.hsbc.rtc.onboarding.RTCProjectOnBoarding.main(RTCProjectOnBoarding.java:484)


Same error is getting when I tried to cast the com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl to IProjectArea object.

Please let me know if anyone know how to get this resolved.

0 votes



One answer

Permanent link
You are trying to cast a handle to an item. You must fetch the item from the repository first, using the IRepositoryItemService fetchItem or fetchItems method.

By the way, ProcessAreaHandleImpl is an internal class, not API. This means it could change in a breaking manner without notificaion. Whenever possible, you want to use IProcessAreaHandle and IProcessArea.

Martha
Jazz Developer, Process component
Hi

I am trying to get the value of the custom attribut type processAreaList using the below code but it's failing with the error mentioned below:


if (attribute.getAttributeType().equals("processAreaList")
&& attribute.getDisplayName().equals(
"Project_Areas")) {

System.out.println("processAreaList value :"
+ itemToBeModified.getValue(attribute));

List<ProcessAreaHandleImpl> processAreaList = (List<ProcessAreaHandleImpl>) itemToBeModified
.getValue(attribute);

System.out.println("processAreaList : "
+ processAreaList.size());

for (int p = 0; p < processAreaList.size(); p++) {

System.out.println("processAreaList" + (ProcessAreaHandle)processAreaList.get(p));
System.out.println(((IProcessArea) processAreaList.get(p)).getName());
}

}


Error:

java.lang.ClassCastException: com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl incompatible with com.ibm.team.process.common.IProcessArea
at com.hsbc.rtc.onboarding.RTCProjectOnBoarding.readOnBoradingWorkItem(RTCProjectOnBoarding.java:1082)
at com.hsbc.rtc.onboarding.RTCProjectOnBoarding.main(RTCProjectOnBoarding.java:484)


Same error is getting when I tried to cast the com.ibm.team.process.internal.common.impl.ProjectAreaHandleImpl to IProjectArea object.

Please let me know if anyone know how to get this resolved.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,943

Question asked: Apr 26 '11, 9:37 a.m.

Question was seen: 5,422 times

Last updated: Apr 26 '11, 9:37 a.m.

Confirmation Cancel Confirm