STEP 4: Use
the Metadata explorer to create the Metadata to be published to the IBF Service. (continued):
h) Visualize the UI: Before one gets started with
creating the Metadata to describe the User interface, it is a good idea to identify
the form in which data will be presented to the user. Given below is how we would
like to display the data returned by the GreetingService application to the end user.
i) Define a title/caption for the UI: As seen in
the above figure, the Title bar tells the user that they are looking at a Greeting
Message for a friend named Harry.The existing
Metadata requires the following modifications to deliver this functionality to the
end user.
1.
The View element defines how an Entity is displayed to the end user. So, naturally
the starting point for describing metadata for the GreetingService user interface
will be the view “GretingMessage”. IBF provides a “Menu Item Definition” node, as
shown below, which can be used to define what should be appear in the
Information
Bridge
window menu for the end user.
Right click “Menu Item Definition” node associated
with “GreetingMessage” view & select Properties. Set the MenuType property to
1 to indicate that the menu item will be displayed to the end user.
2. Click the button labeled “…” associated with
the property MenuDefinitionOperationInstance to open up Menu Item Definition dialog
box and select the checkbox labeled “Use an operation to define the menu item name
& description” as shown below.
3. MenuDefinitionOperationInstance outputs XML that
is used by OperationQueryMenu to display the caption and ToolTip for a menu item.
Given below is an overview of the steps to be done in order to output the XML
-Create
an operation of the type OperationTransformationAggregation that takes one or more
XML input corresponding to pre-defined schemas and transforms them to XML confirming
to the following schema, which is used by the IBF client engine to show the caption
on the title bar.
Schema Name: MenuDefinitionSchema
<xs:element name="ViewProperties" type="ViewPropertiesType"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType
name="ViewPropertiesType" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:sequence>
<xs:any
namespace="##any" processContents="lax" minOccurs="0" />
</xs:sequence>
<xs:attribute
name="Caption" type="xs:string" use="optional" default="" />
<xs:attribute
name="Description" type="xs:string" use="optional" default="" />
</xs:complexType>
</xs:element>
-Create
transformation instances to provide input XML for the Operation created above.
Now let us get into the details of the above two steps.
We will first define the transformation that will
provide input to the operation of type OperationTransformationAggregation. When the
user moves the mouse over the name Harry & selects “Show Details” from the Smart
Tag menu, a XML string confirming to FriendSchema is passed to IBF. We will need to
extract the value of the name attribute of the FriendSchema to make it a part of the
value to be assigned to the Caption Attribute of the MenuDefinitionSchema. In effect,
we shall transform the FriendSchema to MenuDefinitionSchema. To define this transformation
-In
the Transformations folder, double click the node labeled “[Add Transformation…]”
to open the Add Transformation dialog box.
-Enter
the Transformation name as “MenuCaptionCreation”.
-Select
“Transformation Xsl” as the type of Transformation.
-Select
“FriendSchema” as the InputSchema.
-The
Output Schema for this Transformation has not yet been defined. Follow the steps given
below to create the “MenuDefinitionSchema”.
oClick
“Add Schema” button associated with Output Schema drop down list to open up the “Add
Schema” dialog box.
oIn
the Schema Properties tab, enter the name of the schema as “MenuDefinitionSchema”.
oSelect
the Type as “SchemaXsd”
oClick
the “
Add
Port
” button to supply the XML Schema definition.
oIn
the Port properties tab, name the port “MenuDefinitionPort” and select the port type
as “PortFileXml”.
oSelect
“Enter XML port data to save in the metadata” and paste the following block of code
in the input text box.
<xs:element name="ViewProperties" type="ViewPropertiesType"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType
name="ViewPropertiesType" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:sequence>
<xs:any
namespace="##any" processContents="lax" minOccurs="0" />
</xs:sequence>
<xs:attribute
name="Caption" type="xs:string" use="optional" default="" />
<xs:attribute
name="Description" type="xs:string" use="optional" default="" />
oGiven
below is what we have after following these steps
oClick
OK to complete the creation of this port and return to the “Add Schema” dialog box.
oGiven
below is what we have in the “Add Schema” dialog box
oClick
OK to complete the schema creation and return to the “Add Transformation” dialog box.
oGiven
below is what we have at the end of these steps.
-Follow
the steps given below to create a new port to supply the XSL transformation required
to transform FriendSchema to MenuDefinitionSchema.
oClick
the “
Add
Port
” button associated with Port drop down list
oEnter
the name as “MenuDefinitionProvider”.
oSelect
“Port File Xml” as the type of Port.
oSelect
the option “Enter XML port data to save in the metadata” and paste the following XSL
in the input text box.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:iwb="http://schemas.microsoft.com/InformationBridge/2004" xmlns:ab="urn-GreetingService-Data">
<xsl:template
match="/">
<iwb:ViewProperties
Description="Default Friend view" ShowAs="MenuItem">
<xsl:attribute
name="Caption">Greeting Message for <xsl:value-of select="//@Name"></xsl:value-of></xsl:attribute>
</iwb:ViewProperties>
</xsl:template>
</xsl:stylesheet>
oGiven
below is what we have after following the above steps
oClick
OK and return to the Add Transformation dialog box
-Given
below is what we have after defining the port for the transformation.
-Uncheck
the box “Apply Translations” and click the OK to complete the process of defining
the transformation.
To facilitate addition of a new operation, a button has
been provided adjacent to the Operation Name drop down list, as seen above. Click
this button to open up the Add Operation Dialog box.
-In
the Operation Properties tab, let us name the operation as “DefineMenuItemName”.
-Select
the entity “Friend” from the drop down.
-MenuDefinitionOperationInstance
requires the operation to be of type OperationTransformationAggregation or OperationCallComponent.
For simplicity, we select OperationTransformationAggregation
-We
will be associating the transformation “MenuCaptionCreation” created above with an
instance of this operation. The output of transformation “MenuCaptionCreation” will
serve as input to this operation. Hence the input to the operation instance DefineMenuItemName
must be an XML confirming to MenuDefinitionSchema.
oClick
the edit button associated with the “Input Schema” to open the “Select Schemas” Dialog
box.
oSelect
“MenuDefinitionSchema” and add it to the list of Selected schemas. Given below is
what we have at the end of these steps.
oClick
OK to complete the process of associating an Input Schema with the “DefineMenuItemName”
operation and return to the “Add Operation” dialog box.
oSelect
“MenuDefinitionSchema” from the Output Schema drop down list.
oSince
the Input & Output Schemas use the same XSD, keep the Transformation property
set to “None”.
oGiven
below is what we have after performing the above steps.
oClick
OK to return to the “Menu Item Definition” dialog box as shown below.
- Assign “Reference” as the value for the Input
Operation Name.
- Assign “(None)” as the value for the Input Operation
Output Argument.
- Select “MenuCaptionCreation” as the value for
Transformation Name.
Given below is what we have at the end of these
steps.
- Click OK to complete the Menu Item Definition.
j) Describe
how the view on an entity is to be located by
Information
Bridge
.
When IBF client receives an XML confirming to the
FriendSchema as input, we need to let it know, which operation has to be executed
for this reference so that we get the data associated with it. This is done by defining
a ViewLocator element as shown below.
1. In VS.NET, right click the child node of the
“View Locators” folder & select “Properties”. Assign the value “FriendSchema”
to the property ReferenceSchemaName.
Given below is what we have in the Metadata explorer
window.
2. The operation “GetGreetingMessage” is to be executed
when “FriendSchema” is received as input. Right click the immediate child node of
“FriendSchema” and select Properties. Assign the value “GetGreetingMessage” to the
property “OperationName”
3. Click the button labeled “…” associated with
the property “TransformationInstances” to open up the Transformation Instances Dialog
box. Assign the value “Reference” to the property “Input Operation Name”. Leave the
remaining properties unmodified. Given below is what we have at the end of these steps.
Click OK to complete the ViewLocator definition.
k) Describe
actions that can be performed on the view:
1.
Double click “[Add Action…]” node under the “Actions” folder to open up the Add Action
Dialog box. Fill the entries in the dialog box as shown below.
An action of the type “EnterContext” is executed when “Show Details”
item is selected from the smart tag menu. This action will be composed of multiple
operation instances, which will be executed sequentially. Hence we have selected the
check box labeled “Sequential execution”
2. Click OK to complete the Action definition.
Next we need to define the Operation Instances that compose an
Action. So far, It has been an exhaustive article, and in order to do justice to this important part of building an IBF application, I will elaborate it separately in the next article