Skip to main content

Delete relation condition Sample

This sample shows how to add a custom condition in Delete Relation menu to prevent user from deleting relationship if parent is part of any running workflow

Instruction to try out the sample

  • Build the plugin using npm run build from SDK workspace root.
  • Copy D2-Delete-Relation-Condition-1.0.0.jar from 'dist' folder in workspace root and paste it inside WEB-INF/lib folder of a deployed D2 SmartView application.
  • Copy D2-Delete-Relation-Condition-1.0.0.jar from 'dist' folder in workspace root and paste it inside WEB-INF/classes/plugins folder of a deployed D2 Config application.
  • Add an entry for plugin D2-Delete-Relation-Condition-1.0.0.jar in D2-Config.properties file inside WEB-INF/classes folder of a deployed D2 Config application.
  • Restart application server on which D2 SmartView and D2 Config are deployed.
  • Login into D2 Config and add the condition in Delete Relation menu under Menu Smart View.

Source code structure

D2-Delete-Relation-Condition
¦ pom.xml
¦
+---src
¦ +---main
¦ | +---java
¦ | ¦ +---com
¦ | ¦ +---emc
¦ | ¦ ¦ D2PluginVersion.java
¦ | ¦ ¦
¦ | ¦ +---opentext
¦ | ¦ +---d2
¦ | ¦ +---rest
¦ | ¦ ¦ +---context
¦ | ¦ ¦ +---jc
¦ | ¦ ¦ PluginRestConfig_Deleterelationcondition.java
¦ | ¦ ¦
¦ | ¦ +---smartview
¦ | ¦ +---deleterelationcondition
¦ | ¦ ¦ DeleterelationconditionPlugin.java
¦ | ¦ ¦
¦ | ¦ +---api
¦ | ¦ ¦ DeleterelationconditionVersion.java
¦ | ¦ ¦
¦ | ¦ +---rest
¦ | ¦ package-info.java
¦ | ¦ ¦
¦ | ¦ +---webfs
¦ | ¦ +---ui
¦ | ¦ +---conditions
¦ | ¦ +---relations
¦ | ¦ DeleteRelationConditionally.java
¦ | ¦
¦ | +---resources
¦ | ¦ ¦ deleterelationcondition-version.properties
¦ | ¦ ¦ D2Plugin.properties
¦ | ¦ ¦
¦ | ¦ +---com
¦ | ¦ +---opentext
¦ | ¦ +---plugin
¦ | ¦ +---deleterelationcondition
¦ | ¦ +---webfs
¦ | ¦ +---ui
¦ | ¦ +---conditions
¦ | ¦ ¦ relations_en.properties
¦ | ¦ ¦
¦ | ¦ +---relations
¦ | ¦ DeleteRelationConditionally_en.properties

Files and their purpose

Following are the list of function oriented source files and their purpose. Other source files present within the plugin are part of common infrastructure code and explained in Understanding D2SV plugin project.

  • src/main/java/com/opentext/plugin/deleterelationcondition/webfs/ui/conditions/relations/DeleteRelationConditionally.java - Here we are defining the ICondition class which can be used to add a condition in the Delete Relation menu.
  • src/main/resources/com/opentext/plugin/deleterelationcondition/webfs/ui/conditions/relations/DeleteRelationConditionally_en.properties defines labels for the condition in D2 Config
  • src/main/resources/com/opentext/plugin/deleterelationcondition/webfs/ui/conditions/relations_en.properties defines group label for the condition in D2 Config