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

How to update a Workspace in Server side deliver advisor

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

0 votes

Comments

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

0 votes

Comments

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

Hi Ian,

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

Cheers,
Chris

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

Question asked: Oct 16 '15, 10:13 a.m.

Question was seen: 2,679 times

Last updated: Oct 22 '15, 10:49 a.m.

Confirmation Cancel Confirm