Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When

...

defining

...

a

...

data

...

service,

...

a

...

user

...

may

...

have

...

an

...

requirement,

...

that

...

even

...

if

...

a

...

user

...

has

...

not

...

entered

...

a

...

specific

...

parameter

...

value

...

in

...

a

...

request,

...

a

...

default

...

value

...

should

...

be

...

automatically

...

added

...

to

...

the

...

query.

...

This

...

can

...

be

...

done

...

in

...

WSO2

...

Data

...

Services

...

Server

...

using

...

the

...

default

...

values

...

feature

...

that

...

is

...

found

...

when

...

defining

...

a

...

query.

...

The WSO2 Data Services Server adds default values when defining queries. Therefore, even if a user has not entered a specific parameter value in a request, a default value gets automatically added to the query. For example, shown below is how a default value is set for an Input Mapping in a query:

Image Added

Referring to Internal Property Values using Default Values

The Data Services Server defines special system variables that can be used as default values. At the moment, it only provides a variable for retreiving the username of the current user authenticated in a secured data service. This variable can be accessed using the following syntax:

Code Block

#{USERNAME}: This value replaces the current  input mapping value dynamically with the current user's username, when a  data service request is processed in the server.{color}
*
*\#{NULL}{*}{color:#000000}: This value sets the current input mapping  value to null. It's the same as providing "xsi:nil" in the incoming  message's input parameter element.{color}
*
*\#{TENANT_ID}{*}{color:#000000}: This value represents the current  tenant ID, which is meaningful when having a Stratos deployment where  multiple tenants live in the same server.{color}
*
*\#{USER_ROLES}{*}{color:#000000}: This value contains the list of  user roles that the current calling user has. If the parameter mapped  is of type ARRAY, it will have the full list of user roles. If  it's a SCALAR, it will only contain the first user role of the user.{color}

{color:#000000}For a demonstration of the usage of default values, refer to the{color} {color:#000000}[DSS263:Default Values Demo]{color} {color:#000000}in the Data Services Server examples section.{color}

For a demonstration of the usage of default values, refer to the Default Values Demo in the Data Services Server examples section.