You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

This page will help you to build your own Worklog Field.

Prerequisites

You will need to follow below prerequisites :

Module Types provided by Minyaa Time

To allow to develop your own Worklog Field, Minyaa Time provides 2 disctints Module Types :

  • <plugin-model /> : It allows a plugin to defined additional OFBiz Entity Configurations.
  • <worklog-field /> : It allows to define a new Worklog Field


Your Worklog Field Plugin step by step ..

Step 1. Create the plugin skeleton

Here, you will create your plugin skeleton with your preferred solution :

Step 2. Update your Maven POM ...

... related the dependencies

In terms of dependencies, you will need to append Minyaa Time (here for JIRA 7.3.x using Minyaa Time 1.16)

<project ...>
	<dependencies>
		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-api</artifactId>
			<version>${jira.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>fr.alkaes.minyaa</groupId>
			<artifactId>jira-plugin-minyaa-time</artifactId>
			<version>${minyaa.time.version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	...
	<properties>
		<jira.version>7.3.0</jira.version>
		<jira.data.version>${jira.version}</jira.data.version>
		<minyaa.time.version>7300.1.16</minyaa.time.version>
	</properties>
</project>

... related the Maven JIRA Plugin

Since the components implemented in your plugin will have to be loaded by Minyaa Time, you will have to make them exportable.

Here, we assume that your Worklog Fields have com.yourcompany.jira.worklogfields as package.

<project ...>
	<build>
		<plugins>
			<plugin>
				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>maven-jira-plugin</artifactId>
				<version>${amps.version}</version>
				<extensions>true</extensions>
				<configuration>
					<productVersion>${jira.version}</productVersion>
					<productDataVersion>${jira.data.version}</productDataVersion>
					<instructions>
						<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
						<Spring-Context>*;timeout:=60</Spring-Context>
						<Import-Package> 
							*;resolution:=optional 
						</Import-Package>
						<Export-Package>com.yourcompany.jira.worklogfields.*</Export-Package>
					</instructions>
				</configuration>
			</plugin>
			...
		</plugins>
	</build>
	...
	<properties>
		<amps.version>6.2.2</amps.version>
		<jira.version>7.3.0</jira.version>
		<jira.data.version>${jira.version}</jira.data.version>
		...
	<properties>
</project>

Step 3. Create your Worklog Fields Classes

Then, you will have to develop your first Worklog Field class ...

Minyaa Time provides the WorklogField interface

public interface WorklogField { /** * @return the Module Descriptor for Worklog Field */ WorklogFieldModuleDescriptor getDescriptor(); /** * @return the Key of the field as defined in its descriptor */ public String getKey(); /** * @return the Name of the OFBiz Entity where the field will be stored */ public String getEntityName(); /** * @return the Name of the field as it will be used in the OFBiz Entity */ public String getFieldName(); /** * @return the Id of the field as it will be used in the HTML Form */ public String getId(); /** * @return a generated Complete Key used to identify the field among all fields provided by any plugin */ public String getCompleteKey(); /** * @return the key of the field as defined in its descriptor */ public WorklogField newWorklogField(); /** * @return the display name as it will be displayed in the GUI (No I18n supported yet) */ public String getDisplayName(); /** * @return the value as it is passed from HTML Form */ public Object getValue(); /** * Sets the value of field */ public void setValue(Object value); /** * @return the default value of (user uninitialized) field */ public Object getDefaultValue(); /** * Performs syntax and semantic (eg. hours between 0 and 23) field validation. * @param worklogFields Map of all passed Worklog Fields. It may be required to perform validation against other passed Worklog Fields * @return true if field validated OK, false otherwise */ public boolean validate(final Map<String,WorklogField> worklogFields); /** * NOTE YET USED !! * Calculates field visibility depending on its value or/and potentially other field values * @param worklogFields Map of all passed Worklog Fields. It may be required to evaluate other passed Worklog Fields * @return true if hidden, false otherwise */ public boolean hide(final List _worklogFields); /** * @return display type is the input control type (text, select, radio, checkbox, ...) to use in the HTML Form */ public String getDisplayType(); /** * @return The Native Value is the Raw value as it has to be stored by OFBiz */ public Object getNativeValue(); public void formatForDisplay(); public Worklog getWorklog(); public void setWorklog(final Worklog _worklog); public String getValidationError(); } 

and also an abstract implementation : fr.alkaes.myaatm.worklog.fields.AbstractWorklogField.

When you will implement your own Worklog Field, you WILL HAVE TO use it.

Here the source of fr.alkaes.myaatm.worklog.fields.impl.Chargeable, a Worklog Field provided by default in Minyaa Time (just a sample for the moment).

<project ...>
</project>

Step 3. Configure your Worklog Fields Modules

<project ...>
</project>


Step 4. Configure your OFBiz Entity


Step 5. Build and Deploy


<project ...>
</project>

 

On this page:

This page will help you to build your own Worklog Field.

Prerequisites

You will need to follow below prerequisites :

Module Types provided by Minyaa Time

To allow to develop your own Worklog Field, Minyaa Time provides 2 disctints Module Types :

  • <plugin-model /> : It allows a plugin to defined additional OFBiz Entity Configurations.
  • <worklog-field /> : It allows to define a new Worklog Field


Your Worklog Field Plugin step by step ..

Step 1. Create the plugin skeleton

Here, you will create your plugin skeleton with your preferred solution :

Step 2. Update your Maven POM ...

... related the dependencies

In terms of dependencies, you will need to append Minyaa Time (here for JIRA 7.3.x using Minyaa Time 1.16)

<project ...>
	<dependencies>
		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-api</artifactId>
			<version>${jira.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>fr.alkaes.minyaa</groupId>
			<artifactId>jira-plugin-minyaa-time</artifactId>
			<version>${minyaa.time.version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	...
	<properties>
		<jira.version>7.3.0</jira.version>
		<jira.data.version>${jira.version}</jira.data.version>
		<minyaa.time.version>7300.1.16</minyaa.time.version>
	</properties>
</project>

... related the Maven JIRA Plugin

Since the components implemented in your plugin will have to be loaded by Minyaa Time, you will have to make them exportable.

Here, we assume that your Worklog Fields have

com.yourcompany.jira.worklogfields

 as package

<project ...>
	<build>
		<plugins>
			<plugin>
				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>maven-jira-plugin</artifactId>
				<version>${amps.version}</version>
				<extensions>true</extensions>
				<configuration>
					<productVersion>${jira.version}</productVersion>
					<productDataVersion>${jira.data.version}</productDataVersion>
					<instructions>
						<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
						<Spring-Context>*;timeout:=60</Spring-Context>
						<Import-Package> 
							*;resolution:=optional 
						</Import-Package>
						<Export-Package>com.yourcompany.jira.worklogfields.*</Export-Package>
					</instructions>
				</configuration>
			</plugin>
			...
		</plugins>
	</build>
	...
	<properties>
		<amps.version>6.2.2</amps.version>
		<jira.version>7.3.0</jira.version>
		<jira.data.version>${jira.version}</jira.data.version>
		...
	<properties>
</project>
<project ...>
</project>

Step 2. Create your Worklog Fields Classes

Then, you will have to develop your first Worklog Field class ...

Minyaa Time provides

Step 3. Configure your Worklog Fields Modules


Step 4. Configure your OFBiz Entity


Step 5. Build and Deploy


 

On this page:

  • No labels