Configuring methods to invoke our Client API - SmartPlant Foundation - IM Update 44 - Customization & Programming - Hexagon

SmartPlant Foundation Customization

Language
English
Product
SmartPlant Foundation
Search by Category
Customization & Programming
SmartPlant Foundation / SDx Version
10

We have written the code portion of the Client API, but we need to configure the Client API within SmartPlant Foundation. Also, as stated earlier, methods, menus, and toolbars need to be configured as well. In addition, you will need some user access to expose this through the client. One of the easiest ways to get this going is through load files. For example, to invoke our Client API from a shortcut menu, here is a sample load file:

<SPFClientAPI>

<IObject UID="C_DoSomething" Name="DoSomething" Description="DoSomething" />

<ISPFClientAPI SPFIsACreateConfigurationAPI="True"

SPFAPIParam1=""

SPFAPIParam2=""

SPFAPIParam3=""

SPFAPIParam4=""

SPFAPIParam5=""

SPFAPIParam6=""

SPFAPIParam7=""

SPFAPIParam8=""

/>

<ISPFAdminItem />

</SPFClientAPI>

Notice the UID. Every UID in SmartPlant Foundation should be unique, so be very careful with these. To configure a method:

<SPFMethod>

<IObject UID="MTH_DoSomething" Name="DoSomething" Description="Do Something" />

<ISPFAdminItem />

<ISPFGUIDisplay SPFGUIDisplayAs="Do Something (TRN)" /> <ISPFMethod SPFAvailableinDesktop="True" SPFAvailableinWeb="False"

SPFArgument1=""

SPFArgument2=""

SPFArgument3=""

SPFArgument4=""

SPFArgument5=""

/>

</SPFMethod>

There must be a relation between the Client API and the method.

<Rel>

<IObject UID="C_DoSomething.MTH_DoSomething" />

<IRel UID2="MTH_DoSomething" DefUID="SPFClientAPIMethods" UID1="C_DoSomething" OrderValue="0" IsRequired="False" />

</Rel>

To expose this item on a context menu, we need to associate the method with an InterfaceDef. In this example the method will appear on the shortcut menu of a column set.

<Rel>

<IObject UID="ISPFColumnSet.MTH_DoSomething" />

<IRel UID2="MTH_DoSomething" DefUID="SPFInterfaceDefMethod" UID1="ISPFColumnSet" OrderValue="0" IsRequired="False" />

</Rel>

To expose this item from a menu item:

<SPFMenuItem>

<IObject UID="MI_DoSomething" Name="DoSomething" Description="DoSomething (TRN)..." />

<ISPFAdminItem />

<ISPFGUIAccessControl />

<ISPFGUIDisplay SPFGUIDisplayAs="DoSomething (TRN)..." />

<ISPFMenuItem SPFIcon="" SPFSeparatorRequired="False" />

<ISPFSubscribableItem />

</SPFMenuItem>

<Rel>

<IObject UID="MI_DoSomething.MTH_DoSomething" />

<IRel UID1="MI_DoSomething" UID2="MTH_DoSomething" DefUID="SPFGUIAccessControlMethod" IsRequired="False" OrderValue="0" />

</Rel>

<Rel>

<IObject UID="MN_File.DoSomething" />

<IRel UID1="MN_File" UID2="MI_DoSomething" DefUID="SPFMenuItems" IsRequired="False" OrderValue="10" />

</Rel>

To grant access to the method, we need to create an SPFAccessGroupMethod relationship:

<Rel>

<IObject UID="MAG_VIEWONLY.MTH_DoSomething" />

<ISPFAccessGroupMethod />

<IRel UID2="MTH_DoSomething" DefUID="SPFAccessGroupMethod" UID1="MAG_VIEWONLY" OrderValue="0" IsRequired="False" />

</Rel>

In this example, use the following load file:

<Container ContainerID="Custom">

<SPFClientAPI>

<IObject UID="C_DoSomething" Name="DoSomething" Description="DoSomething" />

<ISPFClientAPI SPFIsACreateConfigurationAPI="True"

SPFAPIParam1=""

SPFAPIParam2=""

SPFAPIParam3=""

SPFAPIParam4=""

SPFAPIParam5=""

SPFAPIParam6=""

SPFAPIParam7=""

SPFAPIParam8=""

/>

<ISPFAdminItem />

</SPFClientAPI>

<SPFMethod>

<IObject UID="MTH_DoSomething" Name="DoSomething" Description="Custom Dialog..." />

<ISPFAdminItem />

<ISPFGUIDisplay SPFGUIDisplayAs="Do Something (TRN)" /> <ISPFMethod PFAvailableinDesktop="True" SPFAvailableinWeb="False"

SPFArgument1=""

SPFArgument2=""

SPFArgument3=""

SPFArgument4=""

SPFArgument5=""

/>

</SPFMethod>

<Rel>

<IObject UID="C_DoSomething.MTH_DoSomething" />

<IRel UID2="MTH_DoSomething" DefUID="SPFClientAPIMethods" UID1="C_DoSomething" OrderValue="0" IsRequired="False" />

</Rel>

<Rel>

<IObject UID="MAG_SystemAdmin.MTH_DoSomething" />

<ISPFAccessGroupMethod />

<IRel UID2="MTH_DoSomething" DefUID="SPFAccessGroupMethod" UID1="MAG_SystemAdmin" OrderValue="0" IsRequired="False" />

</Rel>

<Rel>

<IObject UID="ISPFColumnSet.MTH_DoSomething" />

<IRel UID2="MTH_DoSomething" DefUID="SPFInterfaceDefMethod" UID1="ISPFColumnSet" OrderValue="0" IsRequired="False" />

</Rel>

<SPFMenuItem>

<IObject UID="MI_DoSomething" Name="DoSomething" Description="DoSomething (TRN)..." />

<ISPFAdminItem />

<ISPFGUIAccessControl />

<ISPFGUIDisplay SPFGUIDisplayAs="DoSomething (TRN)..." />

<ISPFMenuItem SPFIcon="" SPFSeparatorRequired="False" />

<ISPFSubscribableItem />

</SPFMenuItem>

<Rel>

<IObject UID="MI_DoSomething.MTH_DoSomething" />

<IRel UID1="MI_DoSomething" UID2="MTH_DoSomething" DefUID="SPFGUIAccessControlMethod" IsRequired="False" OrderValue="0" />

</Rel>

<Rel>

<IObject UID="MN_File.DoSomething" />

<IRel UID1="MN_File" UID2="MI_DoSomething" DefUID="SPFMenuItems" IsRequired="False" OrderValue="10" />

</Rel>

</Container>