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:
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.
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.
One answer
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
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.