Please follow the documentation on how to create a client-side connection to use the Governance API before following these examples.
Lifecycle transition operations of the Governance API can be used to do the Lifecycle operation of the artifacts. These operations are available with all artifacts available in Governance Registry like Services, WSDLs, Schemas, Policies, GenericArtifacts and GovernanceArtifacts. The following is the list of Lifecycle transition operations available with the Governance API.
- Associating a Lifecycle to an Artifact
- Checking Associated Lifecycle Name of an Artifact
- Checking the Current State of the Lifecycle Associated with the Artifact
- Get the Checklist Item List
- Checking Checklist Item
- Checking Whether a Checklist Item is Checked
- Unchecking Checklist Item
- Get Voting Event List
- Voting for an Event
- Checking Whether the Current User Already Voted for an Event
- Unvoting for an Event, Current User Already Voted
- Get all Action List
- Invoking Actions
Associating a Lifecycle to an Artifact
This method is used to associate a Lifecycle to an artifact. See here for more information on Lifecycles and their creation.
artifact.attachLifecycle(lifecycleName);
"lifecycleName" is the name of the Lifecycle which the artifact need to associate with.
Checking Associated Lifecycle Name of an Artifact
This method is used to get the Lifecycle name of the associated Lifecycle of an artifact.
String lifecycleName = artifact.getLifecycleName();
Checking the Current State of the Lifecycle Associated With the Artifact
This method is used to get the current state of the artifact in its Lifecycle.
String lifecycleState = artifact.getLifecycleState();
Get the Checklist Item List
This method is used to get all the checklist item names of the current state of the associated artifact.
String[] checklistItems = artifact.getAllCheckListItemNames();
Checking Checklist Item
This method is used to check a checklist item on the current state of the associated artifact.
artifact.checkLCItem(checkListItemIndex);
"checkListItemIndex" is the index of the checklist name on the checklist items list returned by the artifact.getLCCheckListItemNames() method.
Checking Whether a Checklist Item is Checked
This method is used to check whether a checklist item of the current state is clicked or not.
boolean lcItemChecked = artifact.isLCItemChecked(checkListItemIndex);
"checkListItemIndex" is the index of the checklist name on the checklist items list returned by the artifact.getAllCheckListItemNames() method.
Unchecking Checklist Item
This method is used to reverse a checked check list item of the current state of the associated artifact.
artifact.uncheckLCItem(checkListItemIndex);
"checkListItemIndex" is the index of the checklist name in the checklist items list returned by artifact.getAllCheckListItemNames() method.
Get Voting Event List
This method is used to get the event list which needs a certain amount of votes before it is invoked.
String[] votingEvents = artifact.getAllVotingItems();
Voting for an Event
This method is used to vote for an event.
artifact.vote(eventIndex);
"eventIndex" is the index of the voting event in the voting events list returned by artifact.getAllVotingItems() method.
Checking Whether the Current User Already Voted for an Event
This method is used to check whether the current user has already voted on an event.
boolean currentUserVoted = artifact.isVoted(eventIndex);
"eventIndex" is the index of the voting event in the voting events list returned by artifact.getAllVotingItems() method.
Unvoting for an Event, Current User Already Voted
This method is used to reverse the vote for an event.
artifact.unvote(eventIndex);
"eventIndex" is the index of the voting event in the voting events list returned by artifact.getVotingItems() method.
Get all Action List
This method is used to get all the actions of current Lifecycle state.
artifact.getAllLifecycleActions();
Invoking Actions
These methods are used to invoke an action in the current Lifecycle state.
artifact.invokeAction(action);
artifact.invokeAction(action, parameterMap);
The second method allows to parse a parameter map which can be used in transition executors.