Hexagon Geospatial
MENU

Shared Samples

GeoMedia Smart Client Workflow Manager provides tools for building and delivering highly-constrained, map-based workflows for the office or the field.
Showing results for 
Search instead for 
Do you mean 

Plugin Framework

by Community Manager on ‎01-19-2016 05:00 AM (658 Views)

Abstract

The plugin framework sample is intended to make beginners familiar with GMSC Client plugin programming.

The main concept of using GMSC client plugins and the corresponding configuration is shown.  

Bitbucket Link

https://bitbucket.org/HGDN/hgdn_gmsc/src/2eef0f0f7111d9de952d94e8f91052c2bc6946c7/Client/PluginFrame...

Description

The main purpose of this sample is to show developers how to create plugins and how to configure plugin and action parameters. These plugins are part of the sample:

  • PluginTaskOnStartup
  • PluginTaskOnShutdown
  • ActionWithParameters
  • PluginWithParameters
  • RestrictedPlugin

PluginTaskOnStartup and PluginTaskOnShutdown

are two simple plugins that quickly show that you can execute some code on startup or shutdown. 

ActionWithParameters

shows how to configure a PluginAction using additional parameters that might be configured in the Administrator. 

Whenever an action requires parameters, the plugin and the action must be registered in the database. Therefore the plugin needs a unique identifier and on action level the action parameter must be configured.  

@Plugin(id = "020205e1-3715-484b-bf80-9cf6c3d7e162", alias = "ActionWithParameters", vendor = "Hexagon Geospatial")
public class ActionWithParameters extends AbstractPlugin
{
	@Action(parameters={@Parameter(name="MyActionParamter1",type=ParameterType.BOOLEAN, description="Description for my ActionParamter 1", defaultValue="false"),
			@Parameter(name="MyActionParamter2",type=ParameterType.NUMERIC, description="Description for my ActionParamter 2", defaultValue="2"),})
	public void showActionParamters(final RPAction action)

To register the plugin and action configuration on the server side, the administrator has to execute these statements:

 

  1. Register the plugin using the unique identifier and the alias:
    Insert Into RPI_PLUGIN values ('020205e1-3715-484b-bf80-9cf6c3d7e162', 'ActionWithParameters');
  2. Register the action:
    Insert Into RPI_PLUGINACTION(ID, actioncommand, NAME, PLUGIN_ID,TOOLTIP) Values(dbo.newid(), 'showActionParamters','Show the action parameters', '020205e1-3715-484b-bf80-9cf6c3d7e162', 'Show the action parameters');
  3. Assign the action parameters:
    Insert Into RPI_ACTIONPARAMETER(ID,NAME,DESCRIPTION,PLUGINACTION_ID,ACTIONVALUE,PARAMTYPE) VALUES(dbo.newid(), 'MyActionParamter1', 'Description for my ActionParamter 1', (Select ID From RPI_PLUGINACTION Where ACTIONCOMMAND = 'showActionParamters'), null,'string');
  4. Configure the action in the Administrator

The action itself only opens a dialog showing the current parameter configuration to the user. 

PluginWithParameters

shows how to configure a Plugin using additional parameters that might be configured in the database. 

Whenever a plugin requires parameters, the plugin must be registered  and the plugin parameters must be created and configured in the database: 

Insert Into RPI_PLUGIN values ('992ee008-05de-4640-b79e-37727d6ce9a3', 'PluginWithParameters');
Insert Into RPI_PLUGINPARAMETER values (dbo.newid(), 'MyParamter1', 'Description for my Paramter 1', '992ee008-05de-4640-b79e-37727d6ce9a3', 'string', 5);

The plugin contains one parameterless action that opens a dialog to display the plugin parameters. 

RestrictedPlugin

shows how to configure a Plugin to only show up if the user has a certain claim assigned: 

@Plugin(alias = "RestrictedPlugin", vendor = "Hexagon Geospatial", requiredClaim = @Claim(name="MyRestrictedPluginClaim"))
public class RestrictedPlugin extends AbstractPlugin 
{ @Action(actionLocation = ActionLocation.PLUGINTAB) public void sayHello()
{ GUIToolkit.showInfo("Welcome to My Restricted Plugin!"); } }

Claims may be added to the system on database level: 

Insert Into SEC_CLAIM values (dbo.newid(),'MyRestrictedPluginClaim','Client','GMSC',null,null,null)

And the administrator may assign the client claim to the corresponding roles.

 

 

 

Overview
Contributors