...
Provide a unique name and optionally description
Define properties for the new issue tracking system. Properties are configuration values used by FlexDeploy to connect to the new system. The values of the properties that you define here are set on Issue Tracking Instances, folders, and projects.
If you define properties, you can indicate display and validation details. You can also indicate if a property is required and/or encrypted.
Enter a unique Name before adding any properties
Provide either Java Implementation or Groovy API. If both are supplied, the Java Implementation is used. Java implementation means that you are giving the classpath for a java class which you are placing the jar for in the libext folder apiext folder. This is a change from 7.0 and earlier, where they went in libext. Groovy is defined on the Groovy Api API tab. A Groovy script would allow for dynamic update, whereas use of Java code will require restart of server.
Click Save.
...
Your Implementation must extend https://flexagon.com/function-sdk/8.0/flexagon/fd/model/integration/its/api/IssueTrackingSystem.html in order to be used by FlexDeploy. If you are not going to allow calling a method, you can leave the body blank, or throw an error in the body, but the method must be defined. If you choose to make a Java implementation, your IDE will verify that you have implemented all the required methods. If you choose the Groovy implementation, then the FlexDeploy UI will validate that your class contains the necessary methods. Groovy implementations can be used even with 3rd party jars that you place in libext apiext, and allow for easier iterations. The advantage of a Java implementation is a potentially tighter integration with source control.
...
Groovy Implementation
Here are the high level steps for a Java Groovy implementation. You can use any IDE to prepare this implementation.
Create java class that extends flexagon.fd.model.integration.its.api.IssueTrackingSystem. Example shown below has testConnection method implemented which uses properties map to retrieve the configuration values to connect to the issue tracking system.
All properties defined are available in Map returned by getProperties method.
Java Example
Expand | |||||
---|---|---|---|---|---|
| |||||
|
In order to compile your java class, you will need FlexDeployAPI.jar on classpath.
Implement all the methods defined by https://flexagon.com/function-sdk/8.0/flexagon/fd/model/integration/its/api/IssueTrackingSystem.html .
For any failure connecting to the system or if any issues with the data, then you can throw exception. For example throw new ApiException("Invalid credentials.", "");
Once you are ready with unit testing, you can prepare Jar file for your credential store java class and other utility classes. This jar file can be placed on server classpath now.
Put this jar file in apache-tomcat-flexdeploy/libext folder.
If you are using any third party libraries from your Java implementation, then those jar files will also need to be added to same libext folder.
Groovy Implementation
Here are the high level steps for a Groovy implementation. You can use any IDE to prepare this implementation.
As groovy is able to access FlexDeploy variables and Java classes, you can take advantage of Java libraries from Groovy script. For example, if there is Java library used to access the issue tracking system, you can places those in lib folder and use those classes from Groovy script. This allows you to keep dynamic part of implementation in Groovy and use Java library.
Create a groovy class. The example shown below has testConnection and some other methods implemented.
You need to implement all methods defined in https://flexagon.com/function-sdk/8.0/flexagon/fd/model/integration/its/api/IssueTrackingSystem.html
All properties defined are available as groovy binding variables. For example, properties can be accessed directly like REDMINE_URL, REDMINE_USER_NAME, REDMINE_PASSWORD, etc,
Groovy Example
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
As groovy is able to access FlexDeploy variables and Java classes, you can take advantage of Java libraries from Groovy script. For example, if there is Java library used to access the issue tracking system, you can places those in lib folder and use those classes from Groovy script. This allows you to keep dynamic part of implementation in Groovy and use Java library.
Create a groovy class. The example shown below has methods implemented.
View file name RedmineIssueTrackingSystem.groovy You need to implement all methods defined in https://flexagon.com/function-sdk/8.0/flexagon/fd/model/integration/its/api/IssueTrackingSystem.html
All properties defined are available as groovy binding variables. For example, properties can be accessed directly like REDMINE_URL, REDMINE_USER_NAME, REDMINE_PASSWORD, etc,
Implement all the methods described in the table in the API Implementation section
For any failure connecting to the system or if any issues with the data, then you can throw exception. For example, throw new ApiException("Invalid credentials.", "");
Groovy Utilities
There are a number of functions available for use in your custom groovy implementation scripts. View suggestions while editing in the script editing windows by typing Ctrl + Space.
Class | Description |
---|---|
Functions for printing log messages to fd logs | |
Functions for making REST API calls |
Code Block | ||
---|---|---|
| ||
def builder = new groovy.json.JsonBuilder()
def root = builder.issue
{
notes "${pComment}"
}
String payload = builder.toString();
def client = REST.getClient().url(REDMINE_URL + REDMINE_REST_PATTERN);
client.basicauth(REDMINE_USER_NAME, REDMINE_PASSWORD);
client.put(payload);
LOG.info("Rest API create call successful"); |
Java Implementation
Here are the high level steps for a Java implementation. You can use any IDE to prepare this implementation.
Create java class that extends flexagon.fd.model.integration.its.api.IssueTrackingSystem. Example shown below has testConnection method implemented which uses properties map to retrieve the configuration values to connect to the issue tracking system.
All properties defined are available in Map returned by getProperties method.
View file name RedmineServiceIntegration.java
In order to compile your java class, you will need FlexDeployAPI.jar on classpath.
Implement all the methods defined by https://flexagon.com/function-sdk/8.0/flexagon/fd/model/integration/its/api/IssueTrackingSystem.html .
For any failure connecting to the system or if any issues with the data, then you can throw exception. For example , throw new ApiException("Invalid credentials.", "");
Groovy Utilities
There are a number of functions available for use in your custom groovy implementation scripts. View suggestions while editing in the script editing windows by typing Ctrl + Space.
...
Class
...
Description
...
...
Functions for printing log messages to fd logs
...
...
Functions for making REST API calls
...
language | groovy |
---|
...
Once you are ready with unit testing, you can prepare Jar file for your java class and other utility classes. This jar file can be placed on server classpath now.
Put this jar file in $FLEXDEPLOY_HOME/apiext folder. This folder should be next to the apache-tomcat-flexdeploy folder. This is a change from versions prior to 8.0.
If you are using any third party libraries from your Java implementation, then those jar files will also need to be added to same apiext folder. Keep in mind that this can cause issues with server functioning, so be prepared to remove your additional library files.
To pickup changes to your API, the FlexDeploy server must be restarted.