How to run operation advisor/participant when a project area is saved
We would run our own follow-up action (i.e., operationParticipant) when a Project Area is saved.
public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig, IParticipantInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException { Object objData = operation.getOperationData(); if (objData instanceof ProjectAreaSaveOperation) { // ...
Accepted answer
public void run(AdvisableOperation operation, IProcessConfigurationElement participantConfig, IParticipantInfoCollector collector, IProgressMonitor monitor) throws TeamRepositoryException {
Object objData = operation;
if (!(operation instanceof ProjectAreaSaveOperation)) { return; } ProjectAreaSaveOperation data = (ProjectAreaSaveOperation) objData; List<String> actions = Arrays.asList(data.getActions()); if (!actions.contains(ProjectAreaSaveOperation.ACTION_MODIFY_MEMBERS)) { return; } // ...
One other answer
<behavior> <role id="team-member"> <project-operation id="com.ibm.team.process.server.saveProjectArea"> <followup-actions> <followup-action id="it.secservizi.rtc.admin.server.postop.Foo" /> </followup-actions> </project-operation> </role> </behavior>to the Process Configuration Source of the Project Area, then the operation partecipant is invoked!
Comments
I do not see a save project area event in the process configuration.
We have to manually modify the Process Configuration Source (i.e., the XML source) to invoke a "com.ibm.team.process.server.saveProjectArea" partecipant.
Where are you putting this XML node in your Process Configuration Source? There is a block of "project-operation" settings under the "Permissions" node, but not the "behavior" node. If you try to add the XML you have listed above to the permissions node, "followup-actions" is not a legal element at this location.
Similarly, there are "followup-actions" defined for the behavior, but you evidently cannot define "project-operation" elements in this behavior node. The tool flags this as not being one of {"http://com.ibm.team.process":operation} types.
You, sir, are the man! Thanks so much. This will help us a lot in our environment.
Scenario: We have a single process parent that we use to provide configurations for multiple child project areas (i.e., the "Process Sharing" feature). Sometimes end-users don't know what they are doing and they break inheritance from the process parent. We've wanted a tool for a long time that gives us the ability to validate that action and we might have what we need now.
One more question: What do I need to import to have access to the data type "ProjectAreaSaveOperation"?
Never mind, I figured it out. Evidently I needed to add the package "com.ibm.team.process.internal.service" and then import com.ibm.team.process.internal.service.ProjectAreaSaveOperation
Glad to know we helped you. :) Cheers.
Comments
Jared Burns
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Jan 15 '13, 1:54 p.m.Can you give some background on what you're trying to accomplish? What do you want to do in a follow-up action on project area save?
SEC Servizi
Jan 16 '13, 4:13 a.m.We are trying to programmatically create a new repository worspace when a user is add to a project area.