Error on saving workitem - Team Concert Extension - On State Change Participant
I have built a workflow where a role is not allowed to modify a contributor type field.
And I have built an extension that runs on work item state change participant.
On that extension I modify the field that the role can't modify. I want that this field could be modified by the extension but no by the user with the denied role.
The code that I execute is this:
IWorkItemCommon wiCommon = getService(IWorkItemCommon.class);
IAttribute attAbogado = wiCommon.findAttribute(projectArea, "abogado", monitor);
IAttribute attOwner = wiCommon.findAttribute(projectArea, IWorkItem.OWNER_PROPERTY, monitor);
IWorkItem workingCopy = (IWorkItem) fWorkItemServer.getAuditableCommon().resolveAuditable(newState, IWorkItem.FULL_PROFILE, monitor).getWorkingCopy();
workingCopy.setValue(attAbogado, oAbogadoPorAsignar);
workingCopy.setValue(attOwner, oAbogadoPorAsignar);
//fWorkItemServer.saveWorkItem2(workingCopy, null, null);
HashSet additionalSaveParameters = new HashSet();
additionalSaveParameters.add(IAdditionalSaveParameters.SKIP_VALIDATION_ATTRIBUTE_NAME);
//IAdditionalSaveParameters additionalSaveParameters = new IAdditionalSaveParameters();
fWorkItemServer.saveWorkItem3(workingCopy, null, null, additionalSaveParameters);
System.setProperty(projectArea.getItemId().toString() + " - " + projectArea.getName() + " - " + POOL_DE_ABOGADOS_ANTERIOR, getStringPoolAbogadosActual(aAbogados));
System.setProperty(projectArea.getItemId().toString() + " - " + projectArea.getName() + " - " + ABOGADO_POR_ASIGNAR, getProximoAbogadoPorAsignar(oAbogadoPorAsignar.getItemId().toString(), aAbogados));
I thought that the addtional parameters had an option for not to validate permissions but I think I was wrong.
The field es "abogado" and the following is the error that I'm geting:
Excepción al ejecutar acción subsiguiente. Se ha producido una excepción no manejada durante "Build on State Change".
CRJAZ6053E No se puede completar la operación 'Guardar elemento de trabajo'. Se requiere permiso para completar la operación.
Comments
sam detweiler
Apr 30 '14, 11:18 a.m.Juan Martín Alberti
Apr 30 '14, 12:49 p.m.sam detweiler
Apr 30 '14, 2:45 p.m.