Wednesday, December 21, 2011

WSO2 Governance Registry-Configurable Governance Artifacts part-2

In the first part I discussed about creating a registry extension file up to content element. In this post I try to cover how to create a content which describe the data model of the artifact.
Here is a sample content.

    <table name="Details">
        
            Name
        
        
            Date
        
        
            Venue
        
    </table>
    <table name="Rules">
        
            Gender
            
                male
                female
            
        
        
            Description
        
        
            Auther
        
    </table>
    <table name="Participants">
        
            HouseName
        
        
            Contact
            
                TitansLegionsCloud BotsWild Boars
            
        
    </table>
    <table name="Service Lifecycle">
        
            Lifecycle Name
            
        
    </table>
    <table name="SLA" columns="3">
        
            Document TypeURLComment
        
        
            SLA
        
        
            SLA1
        
        
            SLA2
        
    </table>

Artifact datamodel can be sub-catagorized under different topics. This separation can be acheive by introducing table element. You can see there are five table elements in the above sample registry extension file. table element consists of different fields. There are several types of fields.
  • text
  • text-area
  • options
  • option-text

Now lets look at how each type and some of their attributes associated with it.

text
Defines a text field.

 Name



path and url attributes

 SLA

path attribute is set then input expected to be a path. Also enabling this gives the option of browsing within the repository. But you can type the path as well.
If url attribute is set then the input expected to be a url.
If the input is a url or a path to a source in the repository then you can use both as in the example appear.


text-area
Defines a text area field.

 Description


options
Defines a field with a combo-box with the given values.

 Gender
 
  male
  female
 


option-text
Defines a composite field with a options field and a text field. Values of the options field need to define as a child element of field.

 Contact
 
  TitansLegionsCloud BotsWild Boars
 


maxoccurs attribute

 Contact
 
  TitansLegionsCloud BotsWild Boars
 

This attribute enables store multiple entries under same field.


Here is how it looks like after saving multiple values.


Since maximum occurrance is unbounded this can keep unlimited entries. If you want limit the number you can define maxoccurs to bounded value.

Associating a lifecycle using options field


options field can be use to select a lifecycle to the artifact instance using above code. This will list down the existing lifecycles to choose one which will associated with the instance. Not associating a lifecycle is also possible. This can be done by adding the following field.

 Lifecycle Name
 


Multi-type attributes

reqired attribute
required attribute makes a field required in order to create a artifact instance. In here I used the reqired attribute for text type, it can be used with other types also. Required fields are indicated using a red star as shown in the figure below.

 Name




Table attributes

columns attribute
columns attribute is use to set the number of fields in each row. Following fields are put in to the table in the order of they appear. Also number of heading child elements in the subheading element needs to be same as the number of columns.
<table name="External Links" columns="3">
 
  Document TypeURLComment
 
 
  URL
 
 
  URL1
 
 
  URL2
 
</table>



Now we have an idea about elements of registry extension file. In the next part we will see how we can add this extension to the WSO2 Governance Registry.

1 comment:

  1. can you do multiple columns with option-text? in the three column example, if i added maxoccurs="unbound", after saving the data, the property table doesn't seem to retain the affiliation of the record (i.e. say i added two rows, by just lookig at the reg_property table, i would not know the which url1 belongs to which row. any way around this? in option text, only field is related to each option). please advise.

    ReplyDelete