External CustomField Type

  • Objectives :

    ExternalCFType is provided to manage External entities.

    This feature has been developed, because Options configured for a Custom Fields are only simple values

    There was nothing, if you need to introduce a more complex value.



    For example, you need to introduce a CustomField to manage list of Product to support, with current JIRA features, you will able to define a CustomField Configuration with all values proposed through a SelectBox.

    In some case, this simple value is not enough. Perhaps, it would be interested by displaying some others attributes :

    • Product Version
    • Editor Name
    • Contact Name
    • Contact Tel.
    • ...
    There is no default plugin module defined. To be usable, you will have to define in your plugin, the final CustomfieldType to use.

  • Usage :

    In your JIRA configuration, you will have to include an OFBIZ definition of the required entity.



    For exemple, create a file WEB-INF\classes\entitydefs\entitymodel.YourModel.xml as follow :
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE entitymodel PUBLIC "-//OFBiz//DTD Entity Model//EN" "http://www.ofbiz.org/dtds/entitymodel.dtd">
    <entitymodel>
    	<title>Entity Model for You External Entity</title>
    	<description>...</description>
    	<version>1.0</version>
    
    	<entity entity-name="Product" table-name="XXX_Product" package-name="">
          <field name="id" type="numeric"/>
    		<field name="name" type="short-varchar" />
    		<field name="description" type="short-varchar" />
    		<field name="version" type="short-varchar" />
    		...
    		<prim-key field="id" />
    	</entity>
    
    </entitymodel>
    After, you will add in entitygroup.xml file, the entity as follow :

    In your JIRA configuration, you will have to include an OFBIZ definition of the required entity.

    For exemple, create a file WEB-INF\classes\entitydefs\entitymodel.YourModel.xml as follow :
    <!-- Entity Product for Software Product description -->
    <entity-group group="default" entity="Product"/>


    And finally, you will add a reference of your entitymodel.YourModel.xml in the entityengine.xml

    It is the same procedure followed in Minyaa Suite installation.

    At this step, when restarting JIRA, the table defined for your entity will be created in the Database

    You will have to insert values in this new table.

    In a your plugin, you will be able to declare a new CustomField as follow :

    <atlassian-plugin key="your.company.plugin.key" name="Your Plugin">
    ...
    	<customfield-type key="yourCustomfieldTypeKey" name="yourCustomfieldTypeName" class="com.atlassian.jira.issue.customfields.impl.ExternalCFType">
    		<description>Your Customfield Description.</description>
    		<resource type="velocity" name="edit" location="templates/plugins/customfields/edit/edit-external.vm" />
    		<resource type="velocity" name="view" location="templates/plugins/customfields/edit/view-external.vm" />
    		<resource type="i18n" name="i18n" location="your.company.package.yourcustomfield" />
    		<param name="entityName" value="Product" />
    		<param name="entityValue" value="name" />
    	</customfield-type>
    ...
    </atlassian-plugin>


    Now, you declare through JIRA Administration interface a new CutosmField using the yourCustomfieldTypeName.

    When in the Edit mode, you will have to enter the ID attribute.

    When in the View mode, Customfield will display Name attribute, as it is defined in the customfield-type module.