||
Skip to end of metadata
Go to start of metadata

WSO2 Governance Registry supports building arbitrary asset models using its support for Configurable Governance Artifacts (RXT). In this example, we will be learning how to build a Request Backlog for Governance Registry. Whilst we would recommend using a full blown issue tracking system such as Atlassian JIRA in a production system, there often can be the requirement to have a miniature version as a part of the Registry itself. This would allow users to create issues that would later get actioned. The reporter of the issue can also take advantage of the Notifications functionality provided by the Governance Registry to get updated as the request gets processed.

This sample will make use of three significant features of Governance Registry.

  1. Configurable Governance Artifacts (RXT)
  2. Notifications
  3. Lifecycle Management

Please follow the step-by-step process to setup and run this sample while learning how to make use of various features of Governance Registry:

Creating The Registry Extension File

1. Start the WSO2 Governance Registry. See Running the Product for more information.

2. Navigate to the Resource Browser of Governance Registry and add a new resource as text content with the following parameters:

  1. Name - /_system/governance/repository/components/org.wso2.carbon.governance/types/issue.rxt
  2. Media Type - application/vnd.wso2.registry-ext-type+xml
  3. Content - (Copy the content below)
<?xml version="1.0"?>
<artifactType type="application/vnd.wso2-issue+xml" shortName="backlog" singularLabel="Issue" pluralLabel="Backlog" hasNamespace="false" iconSet="5">
	<storagePath>/backlog/@{details_project}/@{details_title}</storagePath>
	<nameAttribute>details_title</nameAttribute>
	<ui>
        <list>
            <column name="Issue">
                <data type="path" value="details_title" href="@{storagePath}"/>
            </column>
            <column name="Type">
                <data type="text" value="details_type"/>
            </column>
            <column name="Priority">
                <data type="text" value="details_priority"/>
            </column>
        </list>
	</ui>
	<content>
        <table name="Details">
            <field type="text" required="true">
                <name>Title</name>
            </field>
            <field type="options">
                <name label="Project">Project</name>
                <values>
                    <value>SERVICE</value>
                    <value>API</value>
                </values>
            </field>
            <field type="options">
                <name label="Type">Type</name>
                <values>
                    <value>Incident</value>
                    <value>Task</value>
                    <value>Query</value>
                    <value>Improvement</value>
                </values>
            </field>
            <field type="options">
                <name label="Priority">Priority</name>
                <values>
                    <value>Level 1</value>
                    <value>Level 2</value>
                    <value>Level 3</value>
                </values>
            </field>
            <field type="text-area">
                <name>Description</name>
            </field>
            <field type="text">
                <name>Due Date</name>
            </field>
            <field type="text">
                <name>Assignee</name>
            </field>
        </table>
    </content>	
</artifactType>

Click the "Add" button to finish adding the text content.

Read more on Text Content Creation.

3. Sign-out and Sign-in.

4. Now you can see "Issue" and "Backlog" in the "Metadata Add" and "Metadata List" panes.

See also Deploying an Extension File.

Creating New Issues

1. Click "Issue" in the "Add" pane.

2. Fill in the issue details. In this case, John Smith has reported an issue requesting a new service.

Click the "Save" button to submit the form.

3. You should now see you issue appearing on the backlog.

Creating an Issue Lifecycle

1. From the left navigation menu, under "Extensions" select the "Lifecycles" item.

2. Click "Add New Lifecycle" to add a new lifecycle.

3. Copy the content below into the text area:

<aspect name="IssueLifecycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
    <configuration type="literal">
        <lifecycle>
            <scxml xmlns="http://www.w3.org/2005/07/scxml"
                   version="1.0"
                   initialstate="Open">
                <state id="Open">
                    <datamodel>
                        <data name="transitionValidation">
                            <validation forEvent="Start" class="org.wso2.carbon.governance.registry.extensions.validators.AttributeExistenceValidator">
                                <parameter name="attributes" value="details_assignee"/>
                            </validation>
                        </data>
                    </datamodel>
                    <transition event="Start" target="In.Progress"/>
                    <transition event="Close" target="Closed"/>
                </state>
                <state id="Reopened">
                    <datamodel>
                        <data name="transitionValidation">
                            <validation forEvent="Start" class="org.wso2.carbon.governance.registry.extensions.validators.AttributeExistenceValidator">
                                <parameter name="attributes" value="details_assignee"/>
                            </validation>
                        </data>
                    </datamodel>
                    <transition event="Start" target="In.Progress"/>
                    <transition event="Close" target="Closed"/>
                </state>
                <state id="In.Progress">
                    <transition event="Resolve" target="Resolved"/>
                    <transition event="Close" target="Closed"/>
                </state>
                <state id="Resolved">
                    <transition event="Reopen" target="Reopened"/>
                    <transition event="Close" target="Closed"/>
                </state>
                <state id="Closed">
                    <transition event="Reopen" target="Reopened"/>
                </state>
            </scxml>
        </lifecycle>
    </configuration>
</aspect>

Click the "Save" button to finish adding the lifecycle configuration.

4. The lifecycle should now be successfully added.

See also Adding Lifecycles.

Associating The Lifecycle to Issues

1. Navigate to the Backlog to see the issue list, and open an issue that has already been raised. In this example, we'll be taking the Add New Time Tracker Service issue.

Tip

You need to click on the title of the issue to open it in the Resource Browser. This is possible because we have configured our registry extension in way that the title of the issue will hyperlink to the corresponding resource on the Resource Browser. Learn more about the UI Element of the Governance Artifact Configuration Model.

2. Expand the Lifecycle portlet and select the IssueLifecycle from the drop down.

Click the "Add" button to associate the IssueLifecycle with the Add New Time Tracker Service issue.

3. You should now see that the Lifecycle has been successfully associated.

4. Navigate to the Backlog to see the Lifecycle state now being listed on the issue list.

See also Lifecycle.

Subscribing To Notifications

1. Open /_system/governance/backlog in the Resource Browser. See also Managing the Assets.

2. Add a hierarchical subscription covering all resources including grand children for the Change LC State event for internal/everyone.

Tip

Subscribing internal/everyone would mean that each and every user on Governance Registry (which includes John Smith) will get notified. We have selected Management Console as the notification method. This might not always be the case. See Subscriptions for more information. Please also note you need to enable the work list for Management Console notifications to work. Read more on Configuration for Work List. If the server is already running, you will have to shutdown and restart the server. If you have not done this before, please make the necessary changes and repeat from the previous step.

3. Click the "Subscribe" button to add the subscription.

4. Navigate to the Backlog to see the issue list, and open an issue that has already been raised. In this example, we'll be taking the Add New Time Tracker Service issue.

Tip

You need to click on the title of the issue to open it in the Resource Browser. This is possible because we have configured our registry extension in way that the title of the issue will hyperlink to the corresponding resource on the Resource Browser. Learn more about the UI Element of the Governance Artifact Configuration Model.

5. Expand the Lifecycle portlet and press the "Start" button.

6. Refresh the page and observe the notification appearing on the Management Console.

See also Management Console Notifications.

7. Resolve the issue by clicking on the "Resolve" button in the Lifecycle portlet.

8. Refresh the page to observe more notifications.

This brings to the end of this sample. The focus of this sample was a very basic yet complete issue tracker using Governance Registry. Read through the various links to get a better understanding on how to fine tune this sample to meet specific requirements.

  • No labels