MashZone NextGen Development and APIs : Map MashZone NextGen Attributes to Artifact Input Parameters : MashZone NextGen Attribute Mapping Expressions
MashZone NextGen Attribute Mapping Expressions
Scope
Mapping Expressions for URLs
Variable or Parameter Declarations in EMML
MashZone NextGen global attributes: custom attributes with simple values used for:
*All users.
*Default values for MashZone NextGen user attributes. If a value is not available at runtime for the current user, the MashZone NextGen global attribute value is used.
parameter=$global/attribute-name
<variable name="global.attribute-name" type="simple-type"/>
MashZone NextGen user attributes: custom attributes with simple values for each specific user.
In addition to the custom attributes that you define, MashZone NextGen user attributes can also refer to user attributes defined in your User Repository.
Global attributes can provide default values for user attributes with the same name.
parameter=$user/attribute-name
<variable name="user.attribute-name" type="simple-type"/>
MashZone NextGen session attributes: simple values or complex objects with multiple properties.
They are data saved from a previous response during the user's current session.
To use session attributes, your app or other client must first define them with the MashZone NextGen Server. See Define MashZone NextGen Session Attributes for instructions.
Important:  
Effective in this release, the user's MashZone NextGen credentials are no longer available as session attributes.
parameter=$session/attribute-name[/Xpath-expression-to-a-specific-node]
The XPath expression is optional and is only relevant for session attributess that are complex objects.
For session attributes with simple values:
<variable name="session.attribute-name" type="simple-type"/>
For complex objects:
<variable name="session.attribute-name" type="document"/>
MashZone NextGen request attributes: refers to HTTP headers or cookies for the current request.
parameter=$request.http-header/cookie-name
MashZone NextGen request attributes are not supported in EMML.
The following example shows a MashZone NextGen attribute for an app using PC4JS that maps a video service key to a global attribute:
Global Attribute Mapping
Presto.namespace("MyOrg");

var MyOrg.MyVideosApp = function(app){
var root = jQuery( app.rootElement ).find( '#content' );
var connection = app.getConnection();
var requestBody = "";

connection.request({
url: "/presto/edge/api/rest/VideoSvc/getAll?x-presto-resultFormat=json&videoKey=$global.VideoKey",
type: "get",
contentType: "application/x-www-form-urlencoded",
data: requestBody
},
{ onSuccess: function(response, responseHeaders) {
//handle response data
},
onFailure: function(e) {
//handle error message
}
});
This next example show an app that maps an input parameter for the user’s email to a MashZone NextGen user attribute.
User Attribute Mapping
...
connection.request({
url: "/presto/edge/api/rest/myMashup/Invoke?x-presto-resultFormat=json&email=$user.email",
type: "get",
contentType: "application/x-www-form-urlencoded",
data: requestBody
},
{ onSuccess: function(response, responseHeaders) {
//handle response data
},
onFailure: function(e) {
//handle error message
}
});
The next example shows an app that maps an input parameter to a cookie in the current request:
Request Attribute Mapping
...
connection.request({
url: "/presto/edge/api/rest/myMashup/Invoke?x-presto-resultFormat=json&ssocookie=$request.Cookie.mySSOCookie",
type: "get",
contentType: "application/x-www-form-urlencoded",
data: requestBody
},
{ onSuccess: function(response, responseHeaders) {
//handle response data
},
onFailure: function(e) {
//handle error message
}
});
See Define MashZone NextGen Session Attributes for examples of defining and mapping MashZone NextGen session attributes.
Copyright © 2013-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback