Context messages

The highest level element in the context message type definitions is <ContextMessages>. It can have ContextMessage sub elements only.

Example:
<ContextMessages>
   <ContextMessage Id="org.company.map.message" name="Map">
	           <...>
   </ContextMessage>
   <ContextMessage Id="org.company.uom" name="Units">
	           <...>
   </ContextMessage>
</ContextMessages>
For each context message that is supported, a ContextMessage element must be present. A ContextMessage element has these attributes:
Attribute Description

Id

Identification of the message to make it unique during modeling. It is recommended to start it with your company’s namespace, for example “com.mycompany” or “ge.myfirma”.

Name

The description of this message type.

A ContextMessage element has these sub elements:

Element

Description

MessageIdentifier

The identification of the message during runtime. The web parts subscribe to this identifier.

MaxSelect

The maximum number of selected records that can be processed for this context message. The value to specify here depends on the data the web part can process and whether it makes sense to see the context of multiple selected records. Example: For a web part that shows linked documents of a selected object, it makes no sense to show documents of multiple selected objects. For a web part that shows a location on a map, it can be handy to show the locations of all selected objects.

Template

The template for the XML that forms the runtime context message. These template elements must be present:

  • The template for a filled message.
  • The template for an empty message. This message is sent to clear the web part.

For the content of the Template element, see below.

AppliesTo

This element describes for which tables, domains and/or table fields the message applies. This is used during the generation of the InContext Reference Model to link the context message types to tables. For the content of the AppliesTo element, see below.

Mappings

This element describes how the placeholders in the templates must be filled with real values when the context message is built up at runtime.

IncludeHook, DeclarationHook, FunctionHook, ConditionHook, BeforeMappingHook, AfterMappingHook

Those hooks contain the source code that must be included in the corresponding hooks of the context messages in the generated models.

Example:
<ContextMessage Id="org.company.map.message" name="Map">
   <MessageIdentifier>companyMapMessage</MessageIdentifier>
   <MaxSelect>1</MaxSelect>
   <Template condition=”gen:data”>
	 	  <...>
   </Template>
   <AppliesTo>
	    <...>
   </AppliesTo>
   <Mappings>
	    <...>
   </Mappings>
   <DeclarationHook>
table	ttcmcs080			|* Carriers/LSP
   </DeclarationHook>
   <ConditionHook>
select	tcmcs080.scac
from	  tcmcs080
where	 tcmcs080.cfrw = :#table#.carr
as set with 1 rows
selectdo
   	return(tcmcs080.scac = "UPSN")
endselect
return(false)
   </ConditionHook>
</ContextMessage>