set category and typology on a working copy
Hi,
i'm trying to set category and typology on a working copy but an com.ibm.team.repository.common.internal.ImmutablePropertyException has been raised during the execution of the code.
This is the piece of code that raises the exception:
ServiceManagementAutomaticFieldsManagementBean bean = map.get(macroCategoriaLiteral + SEPARATOR + categoriaLiteral + SEPARATOR + sottoCategoriaLiteral);
if (bean != null) {
IWorkItemType workItemType = null;
for (IWorkItemType iWorkItemType : findWorkItemTypes) {
if (iWorkItemType.getDisplayName().equalsIgnoreCase(bean.getTypology())) {
workItemType = iWorkItemType;
break;
}
}
//serviceManager.getWiService().findCategoryByNamePath(newStateWi.getProjectArea(), namePath, monitor)
ICategory correctCategory = null;
for (ICategory iCategory : categories) {
if (iCategory.getName().equalsIgnoreCase(bean.getCompetenceCenter())) {
correctCategory = iCategory;
break;
}
}
IWorkItemType findWorkItemType = serviceManager.getWiService().findWorkItemType(newStateWi.getProjectArea(), newStateWi.getWorkItemType(), null);
IWorkItem workingCopy = (IWorkItem)serviceManager.getWiService().findWorkItemById(newStateWi.getId(), IWorkItem.DEFAULT_PROFILE, null).getWorkingCopy();
boolean test = workingCopy.isWorkingCopy();
serviceManager.getWiService().updateWorkItemType(workingCopy, workItemType, findWorkItemType, null);
workingCopy.setCategory(correctCategory);
serviceManager.getWiService().saveWorkItem2(workingCopy, saveParameter.getNewReferences(), null);
}
During the updateWorkItemType() and setCategory() invocation the exception is raised.
Any idea?
Thanks.
i'm trying to set category and typology on a working copy but an com.ibm.team.repository.common.internal.ImmutablePropertyException has been raised during the execution of the code.
This is the piece of code that raises the exception:
ServiceManagementAutomaticFieldsManagementBean bean = map.get(macroCategoriaLiteral + SEPARATOR + categoriaLiteral + SEPARATOR + sottoCategoriaLiteral);
if (bean != null) {
IWorkItemType workItemType = null;
for (IWorkItemType iWorkItemType : findWorkItemTypes) {
if (iWorkItemType.getDisplayName().equalsIgnoreCase(bean.getTypology())) {
workItemType = iWorkItemType;
break;
}
}
//serviceManager.getWiService().findCategoryByNamePath(newStateWi.getProjectArea(), namePath, monitor)
ICategory correctCategory = null;
for (ICategory iCategory : categories) {
if (iCategory.getName().equalsIgnoreCase(bean.getCompetenceCenter())) {
correctCategory = iCategory;
break;
}
}
IWorkItemType findWorkItemType = serviceManager.getWiService().findWorkItemType(newStateWi.getProjectArea(), newStateWi.getWorkItemType(), null);
IWorkItem workingCopy = (IWorkItem)serviceManager.getWiService().findWorkItemById(newStateWi.getId(), IWorkItem.DEFAULT_PROFILE, null).getWorkingCopy();
boolean test = workingCopy.isWorkingCopy();
serviceManager.getWiService().updateWorkItemType(workingCopy, workItemType, findWorkItemType, null);
workingCopy.setCategory(correctCategory);
serviceManager.getWiService().saveWorkItem2(workingCopy, saveParameter.getNewReferences(), null);
}
During the updateWorkItemType() and setCategory() invocation the exception is raised.
Any idea?
Thanks.