Model Manager Directory

In order to extend Database Model, Minyaa introduces a Abstract Model Manager.

Its allows you to extend Database Model by creating your own Model Manager.

Before Minyaa 2.2, extension was done by modifying directly the OFBiz files !

This previous solution had many constraints :

  • Restart after Minyaa installation,
  • Risk of incoherence if the installation was stopped before the end,
  • Need to force a stop on Trial License expiration (this point should be resolved with 2.3 or over)
Atlassian is providing a new solution to extend Database : AO Plugin. But it is reserved to Plugin V2 and comes with some other constraints.

With Minyaa, we choose to provide a way to extend Database Model, availalable for Plugin V1, and allowing to use JIRA entities in queries based on the new added entities.

How it is working ?

Each plugin defines its Database Model Extension as resouces, and Minyaa is access to OFBiz APIs to append the provided configurations

To extend Database Model, you have to register your own Model Manager.

How to built you own Model Manager ?

In your plugin, follow below steps :
  1. Create ModelManager extending the AbstractPluginModelManager as follow

    				
    package com.yourcompany.model;
    
    import com.minyaa.model.AbstractPluginModelManager;
    
    public class YourModelManager implements AbstractPluginModelManager {
    	private static String entityModelFileName = "edit-webapp/WEB-INF/classes/entitydefs/entitymodel.yourcompany.xml";
    
    	private static String entityGroupModelFileName = "edit-webapp/WEB-INF/classes/entitydefs/entitygroup.yourcompany.xml";
    	
    	public YourModelManager(final PluginModelManagerDirectory _pluginModelManagerDirectory) {
    		super(_pluginModelManagerDirectory);
    	}
    
    	/**
    	 * @see com.minyaa.model.PluginModelManager.getEntityModelFileName() 
    	 */
    	public String getEntityModelFileName() {
    		return entityModelFileName;
    	}
    	
    	/**
    	 * @see com.minyaa.model.PluginModelManager.getEntityGroupModelFileName()
    	 */
    	public String getEntityGroupModelFileName() {
    		return entityGroupModelFileName;
    	}
    
    	/**
    	 * @see com.minyaa.model.PluginModelManager.getPluginKey()
    	 */
    	public String getPluginKey() {
    		return "com.yourcompany.plugin";
    	}
    }
    


  2. Create the Entity OFBiz configuration file edit-webapp/WEB-INF/classes/entitydefs/entitymodel.yourcompany.xml

    				
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE entitymodel PUBLIC "-//OFBiz//DTD Entity Model//EN" "http://oss.org.cn/ossdocs/applications/ofbiz/ofbiz-2.1.1-docs/website/dtds/entitymodel.dtd">
    
    <entitymodel>
    	<title>Entity Model for Your Plugin</title>
    	<description>Entities added to store Your Data</description>
    	<author>You</author>
    	<version>X.Y</version>
    	
    	<entity entity-name="YourEntity" table-name="companyprefix_your_entity" package-name="">
    	...
    	</entity>
    
    </entitymodel>
    


  3. Create the Group OFBiz configuration file edit-webapp/WEB-INF/classes/entitydefs/entitygroup.yourcompany.xml

    				
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE entitygroup PUBLIC "-//OFBiz//DTD Entity Group//EN" "http://oss.org.cn/ossdocs/applications/ofbiz/ofbiz-2.1.1-docs/website/dtds/entitygroup.dtd">
    
    <entitygroup>
        <entity-group group="default" entity="YourEntity"/>
    </entitygroup>
    


  4. Define your NotificationTypeProvider as component in atlassian-plugin.xml :

    				
    <atlassian-plugin key="jira.plugin.yourcompany.model" name="Your Company Plugin for Database Model Extension">
    	<plugin-info>
            <description>${pom.description}</description>
            <version>${pom.version}</version>
            <vendor name="${pom.organization.name}" url="${pom.organization.url}"/>
    	</plugin-info>
    	...
    	<component key="YourModelManager" name="YourModelManager" class="com.yourcompany.model.YourModelManager" />
    	...
    </atlassian-plugin>
    


Existing Model Manager

Minyaa uses already Model Manager :
Provider Details
com.minyaa.model.MinyaaCoreModelManager Database Model Extension for Minyaa Core
com.minyaa.model.MinyaaTimeModelManager Database Model Extension for Minyaa Time
com.minyaa.model.MinyaaSpreadModelManager Database Model Extension for Minyaa Spread