Mod_009: Opening p4b objects by using hyperlinks
Problem
As of version 5.2 it is possible to activate objects and diagrams in process4.biz using hyperlinks.
This will allow opening (activating) diagrams and objects
(in the already opened modeler client) by its GUID, name, or
property value.
Note that this can work only if P4B client is already open
(i.e. connected to the database).
We implement this by custom “application protocol”.
For example, it would be possible to open a diagram by clicking on the
link as in the following:
p4b://query/object?UUID=987191987123461
p4b://query/object?Name=MyApplication
p4b://query/diagram?Name=MyApplication&Type=Imported
You can just type the URL in the explorer for example (this will work if
the client is installed and running):
The URL is built according to the following syntactical rules:
*p4b://query/[object|diagram|associated_diagram|linked_diagram|used_in_diagram]?{DbName=Value}+
That is, “p4b://” followed with either “object”, “diagram”, or one of
“…_diagram” followed with the list of parameters.
Each of the parameters should be the db name of the property so that it
can be checked against the parameter value.
Query |
Description |
---|---|
p4b://query/object?Name=Object1 |
This query will open all objects named "Object1" |
p4b://query/diagram?Name=Diagram1 |
This query will open all diagrams named "Diagram1" |
p4b://query/linked_diagram?Menu32Item32Name=SalesTable |
This query will open all diagrams linked to objects having the property Menu32Item32Name that is equal to 'SalesTable' |
p4b://query/used_in_diagram?Menu32Item32Name=SalesTable |
This query will open all diagrams where objects with the property Menu32Item32Name that is equal to 'SalesTable' are used. |
p4b://query/associated_diagram?Menu32Item32Name=SalesTable |
This query will open both 'linked' diagrams and 'used in' diagrams (both of the above) |
All objects corresponding to the given property values can be opened
(the selection dialogue is shown, if there is more than 1 match).
If there is no object matching these properties, a message box appears.
If there are too many (>100) objects matching the given property set, a message box appears. The user is given the option to proceed or cancel the process.
More examples
Open objects by name:
p4b://query/object?Name=MyApplication
Open objects by class name and name:
p4b://query/object?ClassID=Process&Name=MyApplication
Open all diagrams that are either linked to or contain objects with the
property ‘MenuItemName’ equal to ‘SalesTable’:
p4b://query/associated_diagram?Menu32Item32Name=SalesTable
Open diagrams by UUID:
p4b://query/diagram?UUID=908712398719873
Open all objects having Property1=MyValue:
p4b://query/object?Property1=MyValue
Open all diagrams of the type “Imported”, created by admin:
p4b://query/diagram?DType=Imported&UserCreatedID=Admin
Implementation
This is to be implemented using the so-called “application protocol”.
The following registry info will be written to the registry by setup:
HKEY_CLASSES_ROOT\p4b\shell\open\command
“C:\Program Files\process4biz\P4BLaunch.exe” “%1”
This will make the explorer start the P4BLaunch.exe with the p4b hyperlink as a parameter when the user clicks on this hyperlink. The P4BLaunch.exe will analyze its command-line parameters, and pass them to the P4B modeler client, provided it is already running (if not it will just quit, or a message box may appear)
The modeler will parse the passed hyperlink, search the database for an object that satisfies the given parameters, and activate it if such an objects exists.