Page tree
Skip to end of metadata
Go to start of metadata

 

Steps to migrate DPUs from 1.5.5 release of UnifiedViews to UnifiedViews 2.0.0. Sample of the adjusted DPU: https://github.com/UnifiedViews/Plugins/blob/master/t-zipper

  1. Adjust pom.xml:
    1. proper parent project for DPUs:
      1. <parent>
         <groupId>eu.unifiedviews</groupId>
         <artifactId>uv-pom-dpu</artifactId>
         <version>2.0.0-SNAPSHOT</version>
        </parent> 
      2. Note: It is possible to create project/organisational specific pom.xml the DPUs will be using with project/org specific dependencies and other stuff; such pom.xml has uv-pom-dpu (see above) as parent, but the particular DPUs use the project/organisational specific pom.xml. The generally usable pom for DPUs "uv-pom-dpu" should NOT be adjusted with project specific things, it is a generic pom.xml for everyone.
    2. Adjust dependencies as in the sample pom.xml: https://github.com/UnifiedViews/Plugins/blob/master/t-zipper/pom.xml
    3. Check that pom.xml looks similarly as: https://github.com/UnifiedViews/Plugins/blob/master/t-zipper/pom.xml 
  2. Adjust main class of the DPU
    1. Main class for DPUs is AbstractDPU
      1. Sample: public class Zipper extends AbstractDpu<ZipperConfig_V1> {, https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/Zipper.java
    2. Constructor of the main DPU class 
      1. See the example https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/Zipper.javapublic Zipper() { .. }, where the DPU constructor may have certain extensions allowed. 
    3. Main code (content of the method execute()) is put to the method innerExecute(), 
      see  protected void innerExecute() throws DPUException in https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/Zipper.java 
    4. DPUContext can be accessed as: ctx.getExecMasterContext().getDpuContext()
    5. In order to migrate configuration prior to 1.6 in DPUs 2.0, public field must be declared:
      @ExtensionInitializer.Init(param = "eu.unifiedviews.plugins.transformer.zipper.ZipperConfig__V1")
      public ConfigurationUpdate _ConfigurationUpdate;
      "eu.unifiedviews.plugins.transformer.zipper.ZipperConfig__V1" should be replaced with "XStream-like" configuration class name. 
    6. getConfigurationDialog() function is no longer required.

  3. Adjust dialog class of the DPU
    1. Main class for dialogs is AbstractDialog
      1. Sample: public class ZipperVaadinDialog extends AbstractDialog<ZipperConfig_V1> {, https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/ZipperConfig_V1.java
    2. Dialog for DPU is initialized within method buildDialogLayout(), see https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/ZipperVaadinDialog.java
  4. Localization (if needed, relevant mainly for EEA/eDem)
    1. in the new versions, it is not necessary to explicitely initialize Localization within DPU
    2. using localized message in the events, you may use ContextUtils.sendError(ctx, "zipper.errors.zip.failed"""); https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/Zipper.java
    3. using localized message in GUI, you may use: desc.append(ctx.tr("zipper.dialog.zip.description")); see https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/java/eu/unifiedviews/plugins/transformer/zipper/ZipperVaadinDialog.java 
    4. For working with messages and exception ContextUtils should be used, text passed through ContextUtilis are localized.
  5. Resources - following resources are required to be present:
    1. about.html - DPU description that is visible in configuration dialog, example: https://github.com/UnifiedViews/Plugins/blob/dpu/t-xslt-2.0.0/t-xslt/src/main/resources/about.html
    2. resources.properties - localization
    3. build-info.properties
      1. basic version: https://github.com/UnifiedViews/Plugins/blob/dpu/t-zipper-1.6.1/t-zipper/src/main/resources/build-info.properties 
      2. advanced (git support): https://github.com/mff-uk/DPUs/blob/master/dpu/e-textHolder/src/main/resources/build-info.properties where lined with git.repository.link is optional. If set then should be equal to name of git repository without final slash (https://github.com/mff-uk/DPUs)
  • No labels