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

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.

0 votes


Accepted answer

Permanent link
The problem was related to the creation of the working copy. In fact using FULL_PROFILE instead of the DEFAULT_PROFILE the code works fine.

Thanks.
Ralph Schoon selected this answer as the correct answer

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,948

Question asked: Apr 21 '15, 3:27 a.m.

Question was seen: 2,506 times

Last updated: Apr 22 '15, 3:22 a.m.

Confirmation Cancel Confirm