It's all about the answers!

Ask a question

How to update a Workspace in Server side deliver advisor


Ian Hodges (271013) | asked Oct 16 '15, 10:13 a.m.
 Hi,

In a server side Deliver Advisor I wish to change the default flow target of the source workspace.  I have code as follows:

     IWorkspace workingWorkspace = (IWorkspace)workspace.getWorkingCopy();
        CurrentFlows flows = ((Workspace) workingWorkspace).getCurrentFlows();
            flows.setDefaultAcceptFlow(shipUUID);
            flows.setDefaultDeliverFlow(shipUUID);
            ((Workspace) workingWorkspace).setCurrentFlows(flows);

However, the update seems not to persist, I tried calling IRepositoryItemService.saveItem, but that results in an Access Violation.   

How do I save the working copy of the workspace?  I'm sure there must be a method somewhere, but I can't spot it.

Regards..

Comments
sam detweiler commented Oct 21 '15, 11:05 a.m.

As Chris mentions, any changes must be done in a Participant plugin. Note that the original transaction has been committed before the participant is called.  The participant could cause another transaction, but cannot modify the original

One answer



permanent link
Chris McGee (50511117) | answered Oct 21 '15, 11:01 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Making changes to items is not permitted in advisor code, that is why the transaction is being rolled back. Advisors are meant to validate the changes are either reject the delivery or allow it to proceed.

I hope that this helps,
Chris

Comments
Ian Hodges commented Oct 22 '15, 6:54 a.m.

Thanks Chris, good point I had overlooked that.

So if i make this a Participant rather than an Advisor is IRepositoryItemService.saveItem()

the correct method to use to save the Workspace?

Regards,
Ian..


Chris McGee commented Oct 22 '15, 8:34 a.m.
FORUM MODERATOR / JAZZ DEVELOPER

Hi Ian,

I don't have expertise in Participants. Hopefully, Sam has some more details.

Cheers,
Chris


sam detweiler commented Oct 22 '15, 10:49 a.m.

well, if the participant service class is created as an extension like this
public class xxx extends AbstractScmService implements IOperationParticipant

then
private static IScmService fscmService = null;
fscmService = getScmService();

will get you the entrypoint of the SCM service handler.

there are tons of methods for that handler.
if u setup the SDK properly, in eclipse,
fscmService.   will list them all (note the trailing .)

Your answer


Register or 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.