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