Annotation Interface Platform.DataSet

Enclosing class:
Platform

@Target(TYPE) @Retention(RUNTIME) @Documented public static @interface Platform.DataSet
Annotation interface that can be used to set up a dataset.

A dataset is aimed to apply a set of operations related to the whole schema or a specific company. More in detail, it should contains the business logic to apply, un-apply or update SQL DML or DDL commands or, in general, any logic whose aims is to provide an enhanced upgrade-ability of the application.


Basic Schema DataSet definition:

A Dataset is an annotated DataSet

 {@literal @}DataSet(
         name = "my-dataset",
         requirements = "geocall.core.9.0.0",
         scope = DataSet.Scope.SCHEMA,
         version = "1.0"
 )
 public class MyDataset extends DataSer {
     {@literal @}Override
     protected void install(Company company, PoolKit pk) throws DAException, DAValidateException {
         // DML install logic
     }
     {@literal @}Override
     protected void uninstall(Company company, PoolKit pk) {
         // DML uninstall logic
     }

     {@literal @}Override
     protected void update(Company company, String appliedVersion, PoolKit pk) {
         switch (appliedVersion) {
             case "1.0":
                 // DML update logic to upgrade from the version 1.0
                 break;
             case "1.1":
                 // DML update logic to upgrade from the version 1.0
                 break;
         }
     }
 }
 
this defines a new DataSet, whose name is my_dataset; it requires the geocall.core.9.0.0 level has been previously apply in order to be executed, and it is a SCHEMA dataset and so it will be applied once inside the current DB schema, no matter how many companies has been configured.

Complex requirement configuration:


 {@literal @}DataSet(
         name = "fill_user_tax_code",
         requirements = {"geocall.core.9.0.0", "geocall.ux.9.0.0", "geocall.ux.9.0.1"},
         scope = DataSet.Scope.SCHEMA,
         version = "1.0"
 )
 public class FillUserTaxCode extends DataSet {
     ...
 }
 
The aim of this example is to define a DML statement that calculate and update the user's tax code based on the information present in the name, surname, birth date fields (obviously that are not sufficient to calculate the tax code, but for kind of simplicity, lets consider only these three fields n this example). As you can see, this class defines a DataSet whose name is fill_user_tax_code, it is a SCHEMA dataset, which means that it will be applied once per schema. The most important aspect to note in this example, is the requirement of the dataset. In fact, to be applied, this dataset requires that the levels geocall.core.9.0.0, geocall.ux.9.0.0 and geocall.core.9.0.1 has been previously applied. If only one of these three level have not been applied, this dataset can not be executed.
  • Element Details

    • name

      String name
      Returns:
      a string representing the name of this dataset.

      Pay attention that this uniquely identify a dataset; if within the same layer there are more dataset defined with the same name, only the first will be taken into account.

    • description

      String description
      Returns:
      a brief description of the behaviour of the current dataset
      Default:
      ""
    • version

      String version
      Returns:
      the current version of this dataset. This version string should be increased every time the dataset is changed
    • requirements

      Returns:
      a configuration that define the required dependencies
      Default:
      @overit.geocall.platform.Platform.DataSet.Requirements
    • scope

      Returns:
      the dataset application scope. Allowed values are:
    • removable

      boolean removable
      Returns:
      a configuration that define if the current dataset can be uninstalled
      Default:
      true
    • runInvalidation

      boolean runInvalidation
      Returns:
      a configuration that define if the current dataset should invalidate all StaticView after the execution
      Default:
      false