diff --git a/catalogue-binding-plugin/README.md b/catalogue-binding-plugin/README.md index 47da4ee..4b9aa65 100644 --- a/catalogue-binding-plugin/README.md +++ b/catalogue-binding-plugin/README.md @@ -24,29 +24,36 @@ The "Catalogue Binding Plugin" requires a handler registered in the UCD so defin "_configuration": { "subscribeEvents": [ { - "event": "{EVENT_NAME_1}" + "event": "{EVENT_1}", + "when": [ + { + "target_phase": [ + "{TARGET_PHASE}" + ], + "last_invoked_step": "{LAST_INVOKED_STEP}" + } + ] }, { - "event": "{EVENT_NAME_2}" + "event": "{EVENT_2}" } ], - "freemarker_template_host": {FREEMARKER_TEMPLATE_HOST} - "freemarker_template_path": {PATH_TO_FREEMARKER_TEMPLATE_NAME.ftl}, + "freemarker_template_host": "{FREEMARKER_TEMPLATE_HOST}", + "freemarker_template_path": "{PATH_TO_FREEMARKER_TEMPLATE_NAME.ftl}" } } ``` -where the supported events are: +where: + +* `{EVENT_X}` (mandatory) - can be ```PROJECT_CREATED, PROJECT_UPDATED, PROJECT_DELETED, LIFECYCLE_STEP_PERFORMED``` +* `{TARGET_PHASE}` (optional) - can be: `DRAFT`, `Pending Approval`, `Published`, `Any`; +* `{LAST_INVOKED_STEP}` (optional) can be: `SUBMIT-FOR-REVIEW​`, `APPROVE-SUBMITTED`, `REJECT-DRAFT​`, `UNPUBLISH`; -``` - "PROJECT_CREATED" - "PROJECT_UPDATED" - "PROJECT_DELETED" - "LIFECYCLE_STEP_PERFORMED" -``` - and `{FREEMARKER_TEMPLATE_HOST}` is the host where the FREEMARKER_TEMPLATE.ftl is located and the `{FREEMARKER_TEMPLATE_NAME.ftl}` is the (complete) path to the FREEMARKER_TEMPLATE.ftl file. -The template pointed by `{FREEMARKER_TEMPLATE_HOST}/{PATH_TO_FREEMARKER_TEMPLATE_NAME.ftl}` is applied to transform a Geoportal project to Catalogue Item object. +The template pointed by `{FREEMARKER_TEMPLATE_HOST}/{PATH_TO_FREEMARKER_TEMPLATE_NAME.ftl}` URL is applied to transform a Geoportal project to Catalogue Item object. + +NB. The configuration must contain the `{TARGET_PHASE}` and `{LAST_INVOKED_STEP}` when the `{EVENT_X}` is equal to `LIFECYCLE_STEP_PERFORMED` ## Change log See [CHANGELOG.md](CHANGELOG.md). diff --git a/catalogue-binding-plugin/src/main/java/org/gcube/application/cms/cataloguebinding/EventsSubscribed.java b/catalogue-binding-plugin/src/main/java/org/gcube/application/cms/cataloguebinding/EventSubscribed.java similarity index 100% rename from catalogue-binding-plugin/src/main/java/org/gcube/application/cms/cataloguebinding/EventsSubscribed.java rename to catalogue-binding-plugin/src/main/java/org/gcube/application/cms/cataloguebinding/EventSubscribed.java