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

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.

0 votes

Comments

your extension will be called immediately again because of the save.  YOUR code has to check if the extra parameter is passed and behave differently if it is.

if the save parm is not present, then u reject the change if the wrong person is making the change, or allow the change, make the change, cause another save, and then ignore the recursion.

but you might need to do this in two parts.
advisor to prevent wrong user
and participant to set the field.. (and ignore the recursion)

Sam,


Thanks for your aswer.

I think you understood me wrong.

The person who is saving has no right to modify the field but the extension must modify the field when that user saves.

I need the extension modify the field when the user that has no right to modify the field is saving. 

yeh, that should be no problem.
you have to allow the operation to execute with permissions even tho you will fix it after the fact.
but your extension will be called again when you DO save the workitem.

note that the field is set wrong before your participant runs.


Be the first one to answer this question!

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,938
× 17
× 16
× 9

Question asked: Apr 30 '14, 11:04 a.m.

Question was seen: 5,795 times

Last updated: Apr 30 '14, 2:45 p.m.

Confirmation Cancel Confirm