Hide last authors
Pierre Dubois 3.1 1 This object provide a few utility functions to access the inners of the Requea platform.
Pierre Dubois 1.1 2
Pierre Dubois 3.1 3 == Properties ==
4 === User ===
Pierre Dubois 1.1 5
Pierre Dubois 3.1 6 ReadOnly
Pierre Dubois 1.1 7
Pierre Dubois 3.1 8 return: The current logged user object
9 example:
10 {{code language="javascript"}}
11 var login = System.User.Login;
12 {{/code}}
Pierre Dubois 1.1 13
Pierre Dubois 3.1 14 === UserName ===
Pierre Dubois 1.1 15
Pierre Dubois 3.1 16 ReadOnly
Pierre Dubois 1.1 17
Pierre Dubois 3.1 18 return: The currently logged user name
19 === UserLogin ===
Pierre Dubois 1.1 20
Pierre Dubois 3.1 21 ReadOnly
Pierre Dubois 1.1 22
Pierre Dubois 3.1 23 return: The currently logged user login
24 === SessionId ===
Pierre Dubois 1.1 25
Pierre Dubois 3.1 26 ReadOnly
Pierre Dubois 1.1 27
Pierre Dubois 3.1 28 eturn: The current HttpSession ID
29 === IPAddress ===
Pierre Dubois 1.1 30
Pierre Dubois 3.1 31 ReadOnly
Pierre Dubois 1.1 32
Pierre Dubois 3.1 33 return: The IP address of the current user
34 === UserId ===
Pierre Dubois 1.1 35
Pierre Dubois 3.1 36 ReadOnly
Pierre Dubois 1.1 37
Pierre Dubois 3.1 38 return: the logged user id (sysId of the sysPerson)
39 example:
40 {{code language="javascript"}}
41 data.rqBeneficiary = System.UserId;
42 {{/code}}
Pierre Dubois 1.1 43
Pierre Dubois 3.1 44 === Client ===
Pierre Dubois 1.1 45
Pierre Dubois 3.1 46 ReadOnly
Pierre Dubois 1.1 47
Pierre Dubois 3.1 48 return: the client type (browser)
49 === ClientVersion ===
Pierre Dubois 1.1 50
Pierre Dubois 3.1 51 ReadOnly
Pierre Dubois 1.1 52
Pierre Dubois 3.1 53 return: The client version (browser version)
54 === DefaultTimeZoneID ===
Pierre Dubois 1.1 55
Pierre Dubois 3.1 56 ReadOnly
Pierre Dubois 1.1 57
Pierre Dubois 3.1 58 return: the default timezone for the platform.
59 This parameter may be changed in TimeZone system setting
60 === DefaultLanguage ===
Pierre Dubois 1.1 61
Pierre Dubois 3.1 62 ReadOnly
Pierre Dubois 1.1 63
Pierre Dubois 3.1 64 return: The default language for the platform.
65 This parameter may be changed in Language system setting
66 === Registry ===
Pierre Dubois 1.1 67
Pierre Dubois 3.1 68 ReadOnly
Pierre Dubois 1.1 69
Pierre Dubois 3.1 70 return: The Registry Object
71 The Registry object. The Registry object is used to access to the entity metadata and provides a few utility functions.
72 example:
73 {{code language="javascript"}}
74 var reg = System.Registry;
75 var app = reg.getApplication("rqRequest");
76 {{/code}}
Pierre Dubois 1.1 77
Pierre Dubois 3.1 78 example:
79 {{code language="javascript"}}
80 var values=System.Registry.getOptionValues("2c9e849412dd022b0112f5ed01c8656e");
81 var first=values[0].sysValue;
82 {{/code}}
Pierre Dubois 1.1 83
Pierre Dubois 3.1 84 === NewGuid ===
85 Generates a new Guid
86 ReadOnly
Pierre Dubois 1.1 87
Pierre Dubois 3.1 88 return: The generated guid as a string
Pierre Dubois 1.1 89
90
Pierre Dubois 3.1 91 == Functions ==
92 === parseDate(str) ===
93 Parse a date from a string
Pierre Dubois 1.1 94
Pierre Dubois 3.1 95 return: the parsed date
96 === formatDate(dt, style) ===
97 Format a date. The string representation is based on the locale of the user
98 * dt. The date to format
99 * style. The style parameter can be: "long", "short", "medium", "full" or "ISO8601". By default, the style is "medium"
Pierre Dubois 1.1 100
Pierre Dubois 3.1 101 return: The formated date as a string
102 === formatNumber(obj, pattern) ===
103 Format a number as a string. The string representation is based on the locale of the user
Pierre Dubois 1.1 104
Pierre Dubois 3.1 105 return: The formated number.
106 === formatDateTime(dt, style) ===
107 Format a date time
108 * dt. The date to format
109 * style. The style parameter can be: "long", "short", "medium", "full" or "ISO8601". By default, the style is "medium"
Pierre Dubois 1.1 110
Pierre Dubois 3.1 111 return: The formated date as a string
112 === formatTime(dt, style) ===
113 Format the time portion of a date time.
114 * dt. The date to format
115 * style. The style parameter can be: "long", "short", "medium", "full" or "ISO8601". By default, the style is "medium"
Pierre Dubois 1.1 116
Pierre Dubois 3.1 117 return: The formated time as a string.
118 === parseDateTime(str, format) ===
119 Parse a date time
120 * str. The string to parse
121 * format. The java SimpleDateFormat used for the parsing
Pierre Dubois 1.1 122
Pierre Dubois 3.1 123 return.: The parsed date
124 === getDayOfDate(obj) ===
125 Extract the date portion of a time stamp. The date is rounded at 0:00:00, based on the timezone of the user.
126 * the date and time (timestamp)
Pierre Dubois 1.1 127
Pierre Dubois 3.1 128 return: the date
129 === getTimeOfDate(obj) ===
130 Extract the time portion of a date time
131 * the time stamp
Pierre Dubois 1.1 132
Pierre Dubois 3.1 133 return: the time as a number of milliseconds since 0:00:00
134 === isMemberOfGroup(objusr, grpname) ===
135 Check if a user is a member of a group
136 * user: The user
137 * grpname: the group name
Pierre Dubois 1.1 138
Pierre Dubois 3.1 139 return: true if the user belongs to this group
Pierre Dubois 1.1 140 === hasBundleAccess(bid) ===
Pierre Dubois 3.1 141 Checks if the current user may edit a bundle given its id.
142 * bundle Id
Pierre Dubois 1.1 143
Pierre Dubois 3.1 144 return: true if the user has edit access
Pierre Dubois 1.1 145 === EvalScript(jsScript, jsContext) ===
Pierre Dubois 3.1 146 Eval a script
Pierre Dubois 1.1 147
Pierre Dubois 3.1 148 return: the return value of the script evaluation
Pierre Dubois 1.1 149 === executeSQL(strCommand) ===
Pierre Dubois 3.1 150 Execute a row SQL command.
151 Note that some updates made by hibernate may not yet have been flushed to the database
Pierre Dubois 1.1 152
153 === Encrypt(cipher, value, type) ===
Pierre Dubois 3.1 154 Encrypt a string
155 * cipher. only 3DES is supported for now
Pierre Dubois 1.1 156
Pierre Dubois 3.1 157 return: the encrypted value as a string
Pierre Dubois 1.1 158 === Decrypt(cipher, value, type) ===
Pierre Dubois 3.1 159 Decrypt a string
Pierre Dubois 1.1 160
Pierre Dubois 3.1 161 return: the decrypted value as a string
162 === getLineCount(code) ===
163 Count the number of lines in a script
Pierre Dubois 1.1 164
Pierre Dubois 3.1 165 return: the number of lines as an integer.
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 9.11.5 - Documentation