Placeholders Example

From GreenVulcano Wiki
Jump to: navigation, search

The following table shows how to use some metadata using specific examples:

Metadata Example Returns
SQL sql{{ds.test_gv::select ‘OK’ from dual}} the String ‘OK’
SQLLIST [sqllist{{ds.test_gv::,::select name from city order by 1}}] a list of City, separated by "," ordered alfabetically and enclosed into “[“ and “]”
TIMESTAMP timestamp{{yyyyMMdd HH:mm:ss}} the current timestamp with the indicated format
OGNL Service: ognl{{#object.getService()}} the service field of the input GVBuffer
JAVASCRIPT System: js{{gvesb::object.getSystem()}} the system field of the input GVBuffer
SYSTEM Server Name: ${{jboss.server.name}} the indicated system property value
CLASS %{{fqclass}} the FQN (Fully Qualified Name) of the input GVBuffer: it.greenvulcano.gvesb.buffer.GVBuffer
DECODE decode{{ognl{{#object.getProperty(‘SQL’)}}::OK::Sql OK::Sql KO}} 'Sql OK' if ognl evaluates to 'OK'. 'Sql KO' otherwise
MINUTE Minute decode{{js{{gvesb::timestamp{{mm}} % 2 == 0}}::true::EVEN::ODD}} 'EVEN' if js evaluates to 'true'. 'ODD' otherwise.
timestamp: returns the current minute and js: verifies if the current minute is even or odd.
NOW_PLUS_30s js{{gvesb::DateUtils.dateToString(DateUtils.addTime(DateUtils.createCalendar().getTime(), Calendar.SECOND, 30), DateUtils.FORMAT_ISO_DATETIME_L)}} the current time plus 30 seconds in Long ISO date/time format.

See TestProperty example for seeing how configure some of it using VulCon®.