Wiki source code of Plugin-Entwicklung
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | {{content/}} |
2 | |||
![]() |
17.31 | 3 | == Plugins for extending {{formcycle/}} == |
![]() |
1.1 | 4 | |
![]() |
17.31 | 5 | Many services and functions of {{formcycle/}} can be customized and extended by using plugins. Each [[plugin type>>doc:Formcycle.PluginDevelopment.Types.WebHome]] extends a certain aspect of {{formcycle/}}, such as workflow processing or preprocessing forms. To create a custom plugin, you need to setup a Java project first of all. |
![]() |
1.1 | 6 | |
![]() |
17.31 | 7 | == API documentation == |
![]() |
1.1 | 8 | |
![]() |
17.31 | 9 | The API documentations for {{formcycle/}} can be found here: [[Javadocs>>https://docs.formcycle.eu/]] |
![]() |
1.1 | 10 | |
![]() |
17.31 | 11 | == Project setup == |
![]() |
1.1 | 12 | |
![]() |
17.31 | 13 | Setup a new Java project with the IDE of your choice. {{formcycle/}} uses the build management system [[Apache Maven>>url:https://maven.apache.org/]]) to resolve dependencies. Dependencies are provided by our public artifactory {{code language="none"}}http://artifactory.xima-services.de/artifactory/fc-plugin-dev{{/code}}. It contains all components needed for developing plugins. The main artifact you will need is the artifact [[fc-plugin-common>>url:http://artifactory.xima-services.de/artifactory/fc-plugin-dev/de/xima/fc/fc-plugin-common/]], containing all Java interfaces available for plugins. |
![]() |
1.1 | 14 | |
![]() |
17.31 | 15 | Maven uses configuration files named {{code language="none"}}pom.xml{{/code}} (project object model). A pom for plugin development might look as follows: |
16 | |||
17 | {{panel title="Example for a pom.xml" initial="hidden" triggerable="true" fullwidth="true"}} | ||
![]() |
1.1 | 18 | {{code language="xml"}} |
19 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
20 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
21 | |||
22 | ... | ||
23 | |||
24 | <properties> | ||
25 | <!-- Configuration --> | ||
26 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
27 | |||
28 | <!-- Dependencies --> | ||
![]() |
17.31 | 29 | <xfc-version>4.2.3</xfc-version> |
![]() |
1.1 | 30 | |
31 | <!-- Plugins --> | ||
![]() |
17.31 | 32 | <maven-compiler-plugin-version>3.3</maven-compiler-plugin-version> |
33 | <maven-jar-plugin-version>2.4</maven-jar-plugin-version> | ||
![]() |
1.1 | 34 | </properties> |
35 | |||
36 | <repositories> | ||
37 | <repository> | ||
38 | <id>xima</id> | ||
39 | <name>fc-plugin-dev</name> | ||
![]() |
17.31 | 40 | <url>http://artifactory.xima-services.de/artifactory/fc-plugin-dev</url> |
![]() |
1.1 | 41 | </repository> |
42 | </repositories> | ||
43 | |||
44 | <dependencies> | ||
45 | <dependency> | ||
46 | <groupId>de.xima.fc</groupId> | ||
47 | <artifactId>fc-plugin-common</artifactId> | ||
![]() |
17.31 | 48 | <version>${xfc-version}</version> |
![]() |
1.1 | 49 | <scope>provided</scope> |
50 | </dependency> | ||
51 | </dependencies> | ||
52 | |||
53 | <build> | ||
54 | <plugins> | ||
55 | <plugin> | ||
56 | <groupId>org.apache.maven.plugins</groupId> | ||
57 | <artifactId>maven-compiler-plugin</artifactId> | ||
![]() |
17.31 | 58 | <version>${maven-compiler-plugin-version}</version> |
![]() |
1.1 | 59 | <configuration> |
![]() |
17.31 | 60 | <source>1.7</source> |
61 | <target>1.7</target> | ||
![]() |
1.1 | 62 | <encoding>UTF-8</encoding> |
63 | </configuration> | ||
64 | </plugin> | ||
65 | |||
66 | <plugin> | ||
67 | <groupId>org.apache.maven.plugins</groupId> | ||
68 | <artifactId>maven-jar-plugin</artifactId> | ||
![]() |
17.31 | 69 | <version>${maven-jar-plugin-version}</version> |
![]() |
1.1 | 70 | <configuration> |
71 | <archive> | ||
72 | <manifest> | ||
73 | <addDefaultImplementationEntries>true</addDefaultImplementationEntries> | ||
74 | </manifest> | ||
75 | <manifestEntries> | ||
![]() |
17.31 | 76 | <formcycle-version-requirement>${xfc-version}</formcycle-version-requirement> |
![]() |
17.3 | 77 | <Build-Time>${maven.build.timestamp}</Build-Time> |
![]() |
1.1 | 78 | </manifestEntries> |
79 | </archive> | ||
80 | </configuration> | ||
81 | </plugin> | ||
82 | |||
83 | </plugins> | ||
84 | </build> | ||
85 | </project> | ||
86 | |||
87 | {{/code}} | ||
88 | {{/panel}} | ||
89 | |||
![]() |
17.31 | 90 | Certain plugins may require additional classes and functionality of the {{formcycle/}} system, which is provided by the artifact //fc-logic//. To add it as a dependency, modify the pom as follows: |
![]() |
1.1 | 91 | |
92 | {{code language="xml"}} | ||
93 | ... | ||
94 | <dependency> | ||
95 | <groupId>de.xima.fc</groupId> | ||
96 | <artifactId>fc-logic</artifactId> | ||
![]() |
17.31 | 97 | <version>${xfc-version}</version> |
![]() |
1.1 | 98 | <scope>provided</scope> |
99 | </dependency> | ||
100 | ... | ||
101 | {{/code}} | ||
102 | |||
![]() |
17.31 | 103 | This artifact becomes necessary especially when working with databases or the [[workflow processing>>doc:Formcycle.PluginDevelopment.Types.IPluginProcessing.WebHome]]. You can also [[download a template for a pom file>>attach:pom.xml||rel="__blank"]] that includes the //fc-logic// artifact. |
![]() |
1.1 | 104 | |
![]() |
17.31 | 105 | {{info}} |
106 | For version of {{formcycle/}} earlier than 4.1.1, you need to exclude the non-public dependency on the //aspose-processor// of the //fc-logic// artifact. | ||
107 | {{/info}} | ||
![]() |
1.1 | 108 | |
![]() |
17.31 | 109 | Furthermore, note that all dependencies must be declared with the //provide// scope. This prevent class path issues and keeps the plugin size small. When possible, use libraries already in use by {{formcycle/}}, eg. certain Apache Common libraries. |
110 | |||
![]() |
1.1 | 111 | {{info}} |
![]() |
17.31 | 112 | All dependencies must be declared with the scope //provided//. |
![]() |
1.1 | 113 | {{/info}} |
114 | |||
![]() |
17.31 | 115 | Developing a plugin for {{formcycle/}} can be as simple as implementing one of the plugin interfaces. To install a plugin, upload them on the administrative interface either as a [[client>>doc:Formcycle.UserInterface.Client.Plugins]] or [[system plugin>>doc:Formcycle.SystemSettings.UserInterface.SystemPlugins]]. |
![]() |
1.1 | 116 | |
![]() |
17.31 | 117 | == Demo plugins == |
![]() |
1.1 | 118 | |
![]() |
17.31 | 119 | As an introduction and to help you getting started with developing plugins, we provide several fully commented demo maven projects for each plugin type [[on our download pages>>url:https://customer.formcycle.eu/index.php/s/PgdMrNOvbYEzhmr]]. After downloading them, you can import them into the IDE of your choice, compile them and upload them to {{formcycle/}}. |
120 | |||
121 | == Special terms == | ||
122 | |||
123 | Some Java methods and classes contain German technical terms as used by {{formcycle/}}. For reference, see the following list for their English counterparts. | ||
124 | |||
125 | {{table dataTypeAlpha="0-1" preSort="0-asc"}} | ||
126 | |||
127 | |=German|=English|=Example | ||
128 | |Mandant|[[Client>>doc:Formcycle.SystemSettings.UserInterface.Clients]]|{{code language="Java"}}public Mandant getMandant(){{/code}} (get client) | ||
129 | |Benutzer|[[User>>doc:Formcycle.UserInterface.UserSettings.WebHome]]|{{code language="Java"}}public Benutzer getCurrentBenutzer(){{/code}} (get user currently logged in) | ||
130 | |Projekt|Project, a former term for a //form// containing files and multiple form versions|{{code language="Java"}}public Projekt getProjekt(){{/code}} | ||
131 | |Aktion|[[Action>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.Actions.WebHome]] (workflow)|{{code language="Java"}}public Aktion getFolgeAktion(){{/code}} (get next action) | ||
132 | |Weiterverarbeitung|Further processing|{{code language="Java"}}public EWeiterverarbeitung_Aktion getWeiterverarbeitungBeiFehler(){{/code}} (how to continue when an error has occurred) | ||
133 | |Bedingung|[[Condition>>doc:Formcycle.UserInterface.MyForms.WorkflowProcessing.ActionConditions]] (action)|{{code language="Java"}}public Bedingung getBedingung(){{/code}} (get the condition of an action) | ||
134 | |Datei|[[File>>doc:Formcycle.UserInterface.FilesAndTemplates.Files]]|{{code language="Java"}}public FormEingangDatei getDatei(){{/code}} (get attached file) | ||
135 | |Textbaustein|[[Template>>doc:Formcycle.UserInterface.FilesAndTemplates.WebHome]]|{{code language="Java"}}public ETextbausteinKategorie getKategorie(){{/code}} (get template type) | ||
136 | |Vorgang|Form record|{{code language="Java"}}public Postfach getByVorgang(UserContext uc, Vorgang vorgang){{/code}} (get inbox for form record) | ||
137 | |Postfach|[[Inbox>>doc:Formcycle.Inbox.WebHome]]|{{code language="Java"}}public Postfach getCurrentPostfach(){{/code}} (get current inbox) | ||
138 | |Rolle|[[Role>>doc:Formcycle.UserInterface.UserSettings.Roles]]|{{code language="Java"}}public List<Rolle> getRollen(){{/code}} (get all roles for a user) | ||
139 | |Datenquelle|[[Data source>>doc:.Types.IPluginDataSource]]|{{code language="Java"}}public IPluginDataSourceRetVal executeDatenquelle(...){{/code}} (get serializable JSON array from a data source) | ||
140 | |Beschreibung|Description|{{code language="Java"}}public String getBeschreibung(){{/code}} | ||
141 | |Kategory|Category|{{code language="Java"}}public ETextbausteinKategorie getKategorie(){{/code}} | ||
142 | |||
143 | {{/table}} |