@sitevision/api 2.0.0-alpha.1 → 2023.2.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/client/requester/index.d.ts +10 -8
  2. package/client/toasts/index.d.ts +7 -5
  3. package/common/app/index.d.ts +45 -46
  4. package/common/events/index.d.ts +30 -31
  5. package/common/i18n/index.d.ts +7 -5
  6. package/common/router/index.d.ts +72 -77
  7. package/common/security/index.d.ts +27 -21
  8. package/index.d.ts +8 -0
  9. package/package.json +1 -1
  10. package/server/AliasUtil/index.d.ts +11 -9
  11. package/server/ArchiveUtil/index.d.ts +43 -41
  12. package/server/ArraysInstance/index.d.ts +1666 -1807
  13. package/server/ArticleUtil/index.d.ts +292 -224
  14. package/server/AuthenticationUtil/index.d.ts +72 -84
  15. package/server/BookmarkUtil/index.d.ts +74 -79
  16. package/server/BuddyIconRenderer/index.d.ts +123 -131
  17. package/server/BuddyIconRenderer.BuddyIconSize/index.d.ts +41 -0
  18. package/server/BuddyIconRenderer.BuddyIconSize/index.js +25 -0
  19. package/server/ClientUtil/index.d.ts +10 -8
  20. package/server/CollaborationFactory/index.d.ts +37 -40
  21. package/server/CollaborationGroupFolderUtil/index.d.ts +28 -26
  22. package/server/CollaborationGroupState/index.d.ts +27 -0
  23. package/server/CollaborationGroupState/index.js +11 -0
  24. package/server/CollaborationGroupTemplateUtil/index.d.ts +46 -48
  25. package/server/CollaborationGroupType/index.d.ts +28 -0
  26. package/server/CollaborationGroupType/index.js +12 -0
  27. package/server/CollaborationGroupUtil/index.d.ts +84 -80
  28. package/server/CollectionsInstance/index.d.ts +641 -704
  29. package/server/ColorUtil/index.d.ts +34 -35
  30. package/server/CompoundAndFilterBuilder/index.d.ts +28 -26
  31. package/server/CompoundComparatorBuilder/index.d.ts +33 -31
  32. package/server/CompoundOrFilterBuilder/index.d.ts +28 -26
  33. package/server/ContentNodeUtil/index.d.ts +34 -32
  34. package/server/CurrencyFactory/index.d.ts +70 -68
  35. package/server/DateUtil/index.d.ts +131 -141
  36. package/server/DecorationUtil/index.d.ts +11 -9
  37. package/server/DeviceUtil/index.d.ts +19 -17
  38. package/server/DimensionMode/index.d.ts +17 -0
  39. package/server/DimensionMode/index.js +12 -0
  40. package/server/DirectoryUtil/index.d.ts +87 -85
  41. package/server/DocType/index.d.ts +30 -0
  42. package/server/DocType/index.js +14 -0
  43. package/server/DocTypeUtil/index.d.ts +127 -133
  44. package/server/EndecUtil/index.d.ts +329 -346
  45. package/server/ExtendedDismaxParserBuilder/index.d.ts +153 -167
  46. package/server/FileIconRenderer/index.d.ts +152 -171
  47. package/server/FileUtil/index.d.ts +272 -298
  48. package/server/FilterBuilder/index.d.ts +39 -37
  49. package/server/FolderUtil/index.d.ts +91 -92
  50. package/server/FontUtil/index.d.ts +34 -35
  51. package/server/FormatterBuilderFactory/index.d.ts +73 -81
  52. package/server/HighlightBuilder/index.d.ts +76 -83
  53. package/server/IconUtil/index.d.ts +25 -23
  54. package/server/ImageLinkRenderer/index.d.ts +35 -33
  55. package/server/ImageRenderer/index.d.ts +340 -376
  56. package/server/ImageUtil/index.d.ts +245 -263
  57. package/server/IndexUtil/index.d.ts +38 -35
  58. package/server/IndexUtil.IndexType/index.d.ts +29 -0
  59. package/server/IndexUtil.IndexType/index.js +13 -0
  60. package/server/IndexingUtil/index.d.ts +67 -45
  61. package/server/InstanceCreatorUtil/index.d.ts +423 -459
  62. package/server/InstanceTypeUtil/index.d.ts +167 -188
  63. package/server/JwtUtil/index.d.ts +129 -127
  64. package/server/LandingPageUtil/index.d.ts +82 -85
  65. package/server/LandingPageUtil/index.js +1 -0
  66. package/server/LinkPageUtil/index.d.ts +294 -248
  67. package/server/LinkRenderer/index.d.ts +649 -713
  68. package/server/LinkTargetBuilder/index.d.ts +65 -73
  69. package/server/LinkValueBuilder/index.d.ts +66 -73
  70. package/server/ListWrapper/index.d.ts +80 -89
  71. package/server/LocaleUtil/index.d.ts +381 -393
  72. package/server/LogUtil/index.d.ts +118 -127
  73. package/server/MailBuilder/index.d.ts +106 -121
  74. package/server/MailUtil/index.d.ts +58 -63
  75. package/server/MathInstance/index.d.ts +624 -656
  76. package/server/MessageDigesterFactory/index.d.ts +28 -26
  77. package/server/MetadataDefinitionUtil/index.d.ts +77 -81
  78. package/server/MetadataUtil/index.d.ts +321 -345
  79. package/server/MimeTypeUtil/index.d.ts +208 -214
  80. package/server/MonitorBuilder/index.d.ts +17 -17
  81. package/server/NodeComparatorUtil/index.d.ts +214 -224
  82. package/server/NodeFactoryUtil/index.d.ts +19 -17
  83. package/server/NodeFilterUtil/index.d.ts +651 -738
  84. package/server/NodeIteratorUtil/index.d.ts +209 -224
  85. package/server/NodeResolverUtil/index.d.ts +398 -404
  86. package/server/NodeTreeUtil/index.d.ts +211 -226
  87. package/server/NodeTypeUtil/index.d.ts +1430 -546
  88. package/server/OfflineVersionPropertyUtil/index.d.ts +6 -4
  89. package/server/OnlineVersionPropertyUtil/index.d.ts +6 -4
  90. package/server/OutputUtil/index.d.ts +384 -379
  91. package/server/PageUtil/index.d.ts +264 -186
  92. package/server/PermissionUtil/index.d.ts +391 -428
  93. package/server/PermissionUtil.Permission/index.d.ts +54 -0
  94. package/server/PermissionUtil.Permission/index.js +38 -0
  95. package/server/PortletContextUtil/index.d.ts +111 -106
  96. package/server/PortletUtil/index.d.ts +30 -20
  97. package/server/PrincipalUtil/index.d.ts +33 -31
  98. package/server/Properties/index.d.ts +68 -75
  99. package/server/PropertyUtil/index.d.ts +1419 -1461
  100. package/server/PublishingUtil/index.d.ts +246 -247
  101. package/server/QueryStringUtil/index.d.ts +403 -414
  102. package/server/RedirectUtil/index.d.ts +62 -66
  103. package/server/RelatedValueBuilder/index.d.ts +40 -38
  104. package/server/Requester/index.d.ts +123 -123
  105. package/server/ResourceLocatorUtil/index.d.ts +434 -474
  106. package/server/RestApi/index.d.ts +156 -136
  107. package/server/RestAppInvokerFactory/index.d.ts +25 -23
  108. package/server/RoleAssignmentBuilder/index.d.ts +35 -33
  109. package/server/RoleMatcherBuilder/index.d.ts +35 -33
  110. package/server/RoleUtil/index.d.ts +35 -37
  111. package/server/ScriptUtil/index.d.ts +457 -494
  112. package/server/SearchFactory/index.d.ts +102 -117
  113. package/server/SearchUtil/index.d.ts +73 -71
  114. package/server/SearcherBuilder/index.d.ts +107 -114
  115. package/server/Session/index.d.ts +251 -1093
  116. package/server/Session/index.js +1 -20
  117. package/server/SimpleUserUtil/index.d.ts +26 -27
  118. package/server/SiteCookieUtil/index.d.ts +150 -173
  119. package/server/SortBuilder/index.d.ts +24 -22
  120. package/server/SourceSetMode/index.d.ts +12 -0
  121. package/server/SourceSetMode/index.js +12 -0
  122. package/server/SpellCheckBuilder/index.d.ts +27 -27
  123. package/server/StandardParserBuilder/index.d.ts +33 -31
  124. package/server/StructureUtil/index.d.ts +83 -81
  125. package/server/SubscriberUtil/index.d.ts +58 -65
  126. package/server/SubscriptionUtil/index.d.ts +121 -128
  127. package/server/SystemUserUtil/index.d.ts +146 -144
  128. package/server/TagUtil/index.d.ts +113 -118
  129. package/server/TemplateUtil/index.d.ts +113 -118
  130. package/server/TemporaryFileNodeBuilder/index.d.ts +29 -27
  131. package/server/TemporaryNodeBuilder/index.d.ts +136 -174
  132. package/server/TextModuleRendererBuilder/index.d.ts +18 -16
  133. package/server/TimestampUtil/index.d.ts +102 -116
  134. package/server/TranslationUtil/index.d.ts +96 -102
  135. package/server/TrashcanUtil/index.d.ts +112 -115
  136. package/server/UserDataUtil/index.d.ts +108 -109
  137. package/server/UserFactory/index.d.ts +49 -56
  138. package/server/UserFieldRenderer/index.d.ts +118 -126
  139. package/server/UserIdentityUtil/index.d.ts +36 -34
  140. package/server/UserUtil/index.d.ts +30 -28
  141. package/server/Utils/index.d.ts +702 -791
  142. package/server/VelocityRenderer/index.d.ts +94 -92
  143. package/server/VersionUtil/index.d.ts +24 -8
  144. package/server/WebContentUtil/index.d.ts +275 -282
  145. package/server/WebResourceFactory/index.d.ts +46 -51
  146. package/server/XSLTUtil/index.d.ts +33 -31
  147. package/server/XmlParserUtil/index.d.ts +47 -45
  148. package/server/appData/index.d.ts +8 -6
  149. package/server/appInfo/index.d.ts +6 -2
  150. package/server/appResource/index.d.ts +23 -21
  151. package/server/cache/index.d.ts +8 -6
  152. package/server/globalAppData/index.d.ts +8 -6
  153. package/server/headless/index.d.ts +28 -26
  154. package/server/hooks/index.d.ts +9 -9
  155. package/server/oauth2/index.d.ts +12 -10
  156. package/server/privileged/index.d.ts +24 -22
  157. package/server/storage/index.d.ts +22 -20
  158. package/types/javax/jcr/Binary/index.d.ts +0 -20
  159. package/types/javax/jcr/Binary/index.js +0 -1
  160. package/types/javax/jcr/ImportUUIDBehavior/index.d.ts +24 -0
  161. package/types/javax/jcr/Item/index.d.ts +1 -116
  162. package/types/javax/jcr/Item/index.js +0 -6
  163. package/types/javax/jcr/NamespaceRegistry/index.d.ts +66 -42
  164. package/types/javax/jcr/NamespaceRegistry/index.js +0 -2
  165. package/types/javax/jcr/Node/index.d.ts +24 -1495
  166. package/types/javax/jcr/Node/index.js +1 -34
  167. package/types/javax/jcr/NodeIterator/index.d.ts +1 -1
  168. package/types/javax/jcr/Property/index.d.ts +487 -489
  169. package/types/javax/jcr/Property/index.js +0 -5
  170. package/types/javax/jcr/PropertyIterator/index.d.ts +1 -1
  171. package/types/javax/jcr/RangeIterator/index.d.ts +1 -43
  172. package/types/javax/jcr/RangeIterator/index.js +1 -5
  173. package/types/javax/jcr/Repository/index.d.ts +460 -260
  174. package/types/javax/jcr/Repository/index.js +0 -4
  175. package/types/javax/jcr/Value/index.d.ts +0 -29
  176. package/types/javax/jcr/Value/index.js +0 -2
  177. package/types/javax/jcr/ValueFactory/index.d.ts +0 -70
  178. package/types/javax/jcr/ValueFactory/index.js +1 -2
  179. package/types/javax/jcr/Workspace/index.d.ts +93 -569
  180. package/types/javax/jcr/Workspace/index.js +1 -12
  181. package/types/javax/jcr/nodetype/ItemDefinition/index.d.ts +0 -103
  182. package/types/javax/jcr/nodetype/ItemDefinition/index.js +0 -5
  183. package/types/javax/jcr/nodetype/NodeDefinition/index.d.ts +1 -1
  184. package/types/javax/jcr/nodetype/NodeDefinitionTemplate/index.d.ts +1 -1
  185. package/types/javax/jcr/nodetype/NodeType/index.d.ts +255 -264
  186. package/types/javax/jcr/nodetype/NodeType/index.js +1 -12
  187. package/types/javax/jcr/nodetype/NodeTypeDefinition/index.d.ts +0 -104
  188. package/types/javax/jcr/nodetype/NodeTypeDefinition/index.js +1 -7
  189. package/types/javax/jcr/nodetype/NodeTypeIterator/index.d.ts +1 -1
  190. package/types/javax/jcr/nodetype/NodeTypeManager/index.d.ts +0 -123
  191. package/types/javax/jcr/nodetype/NodeTypeManager/index.js +1 -8
  192. package/types/javax/jcr/nodetype/NodeTypeTemplate/index.d.ts +1 -1
  193. package/types/javax/jcr/nodetype/PropertyDefinition/index.d.ts +1 -270
  194. package/types/javax/jcr/nodetype/PropertyDefinition/index.js +1 -7
  195. package/types/javax/jcr/nodetype/PropertyDefinitionTemplate/index.d.ts +1 -1
  196. package/types/javax/jcr/observation/Event/index.d.ts +82 -41
  197. package/types/javax/jcr/observation/EventIterator/index.d.ts +1 -1
  198. package/types/javax/jcr/observation/EventJournal/index.d.ts +1 -1
  199. package/types/javax/jcr/observation/EventListenerIterator/index.d.ts +1 -1
  200. package/types/javax/jcr/query/Query/index.d.ts +29 -8
  201. package/types/javax/jcr/query/RowIterator/index.d.ts +1 -1
  202. package/types/javax/jcr/query/qom/And/index.d.ts +1 -1
  203. package/types/javax/jcr/query/qom/BindVariableValue/index.d.ts +1 -1
  204. package/types/javax/jcr/query/qom/ChildNode/index.d.ts +1 -1
  205. package/types/javax/jcr/query/qom/ChildNodeJoinCondition/index.d.ts +1 -1
  206. package/types/javax/jcr/query/qom/Comparison/index.d.ts +1 -1
  207. package/types/javax/jcr/query/qom/DescendantNode/index.d.ts +1 -1
  208. package/types/javax/jcr/query/qom/DescendantNodeJoinCondition/index.d.ts +1 -1
  209. package/types/javax/jcr/query/qom/DynamicOperand/index.d.ts +1 -1
  210. package/types/javax/jcr/query/qom/EquiJoinCondition/index.d.ts +1 -1
  211. package/types/javax/jcr/query/qom/FullTextSearch/index.d.ts +1 -1
  212. package/types/javax/jcr/query/qom/FullTextSearchScore/index.d.ts +1 -1
  213. package/types/javax/jcr/query/qom/Join/index.d.ts +1 -1
  214. package/types/javax/jcr/query/qom/Length/index.d.ts +1 -1
  215. package/types/javax/jcr/query/qom/Literal/index.d.ts +1 -1
  216. package/types/javax/jcr/query/qom/LowerCase/index.d.ts +1 -1
  217. package/types/javax/jcr/query/qom/NodeLocalName/index.d.ts +1 -1
  218. package/types/javax/jcr/query/qom/NodeName/index.d.ts +1 -1
  219. package/types/javax/jcr/query/qom/Not/index.d.ts +1 -1
  220. package/types/javax/jcr/query/qom/Or/index.d.ts +1 -1
  221. package/types/javax/jcr/query/qom/PropertyExistence/index.d.ts +1 -1
  222. package/types/javax/jcr/query/qom/PropertyValue/index.d.ts +1 -1
  223. package/types/javax/jcr/query/qom/QueryObjectModel/index.d.ts +1 -1
  224. package/types/javax/jcr/query/qom/QueryObjectModelConstants/index.d.ts +73 -1
  225. package/types/javax/jcr/query/qom/QueryObjectModelFactory/index.d.ts +1 -1
  226. package/types/javax/jcr/query/qom/SameNode/index.d.ts +1 -1
  227. package/types/javax/jcr/query/qom/SameNodeJoinCondition/index.d.ts +1 -1
  228. package/types/javax/jcr/query/qom/Selector/index.d.ts +1 -1
  229. package/types/javax/jcr/query/qom/StaticOperand/index.d.ts +1 -1
  230. package/types/javax/jcr/query/qom/UpperCase/index.d.ts +1 -1
  231. package/types/javax/jcr/security/AccessControlList/index.d.ts +1 -1
  232. package/types/javax/jcr/security/AccessControlPolicyIterator/index.d.ts +1 -1
  233. package/types/javax/jcr/security/NamedAccessControlPolicy/index.d.ts +1 -1
  234. package/types/javax/jcr/security/Privilege/index.d.ts +127 -43
  235. package/types/javax/jcr/version/Version/index.d.ts +1 -1
  236. package/types/javax/jcr/version/VersionHistory/index.d.ts +1 -1
  237. package/types/javax/jcr/version/VersionIterator/index.d.ts +1 -1
  238. package/types/senselogic/sitevision/api/base/Requireable/ScriptEngine/index.d.ts +9 -0
  239. package/types/senselogic/sitevision/api/base/Requireable/ScriptEngine/index.js +11 -0
  240. package/types/senselogic/sitevision/api/collaboration/CollaborationGroupWrapper/index.d.ts +9 -5
  241. package/types/senselogic/sitevision/api/format/NumericFormatterBuilder/index.d.ts +1 -1
  242. package/types/senselogic/sitevision/api/link/CustomLinkProcessor/index.d.ts +1 -1
  243. package/types/senselogic/sitevision/api/render/BuddyIconRenderer.BuddyIconInfo/index.d.ts +49 -0
  244. package/types/senselogic/sitevision/api/render/BuddyIconRenderer.BuddyIconInfo/index.js +12 -0
  245. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.ArticleUtilConstants/index.d.ts +83 -0
  246. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.ArticleUtilConstants/index.js +21 -0
  247. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.ExceptionSuppressingProxyConstants/index.d.ts +29 -0
  248. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.ExceptionSuppressingProxyConstants/index.js +12 -0
  249. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.IndexingUtilConstants/index.d.ts +29 -0
  250. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.IndexingUtilConstants/index.js +12 -0
  251. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.LinkPageUtilConstants/index.d.ts +65 -0
  252. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.LinkPageUtilConstants/index.js +18 -0
  253. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.MathInstanceConstants/index.d.ts +23 -0
  254. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.MathInstanceConstants/index.js +11 -0
  255. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.MimeTypeUtilConstants/index.d.ts +17 -0
  256. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.MimeTypeUtilConstants/index.js +10 -0
  257. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.d.ts +1241 -0
  258. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.js +189 -0
  259. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.OutputUtilConstants/index.d.ts +29 -0
  260. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.OutputUtilConstants/index.js +12 -0
  261. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PageUtilConstants/index.d.ts +89 -0
  262. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PageUtilConstants/index.js +22 -0
  263. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PortletContextUtilConstants/index.d.ts +25 -0
  264. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PortletContextUtilConstants/index.js +11 -0
  265. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PortletUtilConstants/index.d.ts +17 -0
  266. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.PortletUtilConstants/index.js +10 -0
  267. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.QueryStringUtilConstants/index.d.ts +17 -0
  268. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.QueryStringUtilConstants/index.js +10 -0
  269. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.SearchHitConstants/index.d.ts +23 -0
  270. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.SearchHitConstants/index.js +11 -0
  271. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.SearchResultConstants/index.d.ts +35 -0
  272. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.SearchResultConstants/index.js +13 -0
  273. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.VersionUtilConstants/index.d.ts +23 -0
  274. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.VersionUtilConstants/index.js +11 -0
  275. package/types/senselogic/sitevision/api/script/RequesterChainable/index.d.ts +2 -2
  276. package/types/senselogic/sitevision/api/script/proxy/ExceptionSuppressingProxy/index.d.ts +22 -2
  277. package/types/senselogic/sitevision/api/search/SearchHit/index.d.ts +16 -2
  278. package/types/senselogic/sitevision/api/search/SearchResult/index.d.ts +28 -6
  279. package/types/senselogic/sitevision/api/security/jaas/filter/AuthenticationFilter/index.d.ts +31 -1
  280. package/types/senselogic/sitevision/api/user/UserIdentityWrapper/index.d.ts +1 -1
@@ -1,465 +1,3 @@
1
- /**
2
- * Gets the boolean true primitive.
3
- * @return <code>true</code>
4
- */
5
- export function getTrue(): boolean;
6
-
7
- /**
8
- * Gets the boolean false primitive.
9
- * @return <code>false</code>
10
- */
11
- export function getFalse(): boolean;
12
-
13
- /**
14
- * Gets the null reference.
15
- * @return <code>null</code>
16
- */
17
- export function getNull(): unknown;
18
-
19
- /**
20
- * Gets an object that is ensured not to be null.
21
- *
22
- * <p>
23
- * This is a convenience method that can be used to avoid unnecessary subsequent method invocations in Velocity.
24
- * </p>
25
- *
26
- * <p>
27
- * Velocity ignores <code>null</code> assignments and trying to assign a null reference will be logged as a WARNING message.
28
- * A common strategy to work around this is to use the the Velocity <code>#if</code> clause. It allows for easy non-null
29
- * checks - a <code>null</code> object is considered to be <code>false</code>. The downside with this strategy is that it
30
- * requires two subsequent method invocations. That can of course be a really bad thing if the method does costly things. This method
31
- * can be used to avoid such problems.
32
- * </p>
33
- *
34
- * <p>
35
- * <strong>An example</strong><br>
36
- * This Velocity code:
37
- * </p>
38
- * <pre><code> #if ($anObject.getPersonOrNull())
39
- * #set ($person = $anObject.getPersonOrNull())
40
- * $person.getName()
41
- * ...
42
- * #end</code></pre>
43
- * Can be better utilized as:
44
- * <pre><code> #set ($scriptUtil = ...)
45
- *
46
- * #set ($person = $scriptUtil.getNonNull(${anObject.getPersonOrNull()}))
47
- * #if ($person)
48
- * $person.getName()
49
- * ...
50
- * #end
51
- * </code></pre>
52
- * @param anObject the object that might be <code>null</code>
53
- * @return anObject if non-null, <code>Boolean.FALSE</code> otherwise
54
- * @see #getNonNull(Object, Object)
55
- * @see #getNonBlank(String)
56
- * @since Sitevision 2.6.2
57
- */
58
- export function getNonNull(anObject: unknown): unknown;
59
-
60
- /**
61
- * Gets an object that is ensured not to be null or a whitespace only string.
62
- *
63
- * <p>
64
- * This is a convenience method that can be used to avoid unnecessary subsequent method invocations in Velocity.
65
- * </p>
66
- *
67
- * <p>
68
- * Velocity ignores <code>null</code> assignments and trying to assign a null reference will be logged as a WARNING message.
69
- * A common strategy to work around this is to use the the Velocity <code>#if</code> clause. It allows for easy non-null
70
- * checks - a <code>null</code> object is considered to be <code>false</code>. The downside with this strategy is that it
71
- * requires two subsequent method invocations. That can of course be a really bad thing if the method does costly things. This method
72
- * can be used to avoid such problems.
73
- * </p>
74
- *
75
- * <p>
76
- * <strong>An example</strong><br>
77
- * This Velocity code:
78
- * </p>
79
- * <pre><code> #if ($anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly())
80
- * #set ($name = $anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly())
81
- * #if ($name.trim().length() &gt; 0)
82
- * &lt;p&gt;
83
- * $name
84
- * &lt;/p&gt;
85
- * #end
86
- * #end</code></pre>
87
- * Can be better utilized as:
88
- * <pre><code> #set ($scriptUtil = ...)
89
- *
90
- * #set ($name = $scriptUtil.getNonBlank(${anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly()}))
91
- * #if ($name)
92
- * &lt;p&gt;
93
- * $name
94
- * &lt;/p&gt;
95
- * #end
96
- * </code></pre>
97
- *
98
- * <p>
99
- * <strong>A typical example when using {@link senselogic.sitevision.api.property.PropertyUtil} and whitespace is an issue</strong><br>
100
- * This Velocity code:
101
- * </p>
102
- * <pre><code> #if ($propertyUtil.getString($theNode, 'thePropertyName'))
103
- * #set ($propertyValue = $propertyUtil.getString($theNode, 'thePropertyName'))
104
- * #if ($propertyValue.trim().length() &gt; 0)
105
- * &lt;p&gt;
106
- * $propertyValue
107
- * &lt;/p&gt;
108
- * #end
109
- * #end</code></pre>
110
- * Can be better utilized as:
111
- * <pre><code> #set ($scriptUtil = ...)
112
- *
113
- * #set ($propertyValue = $scriptUtil.getNonBlank(${propertyUtil.getString($theNode, 'thePropertyName')}))
114
- * #if ($propertyValue)
115
- * &lt;p&gt;
116
- * $propertyValue
117
- * &lt;/p&gt;
118
- * #end
119
- * </code></pre>
120
- * @param aString the string that might be <code>null</code> or whitespace only
121
- * @return aString if <code>aString</code> is non-null and not whitespace only, <code>Boolean.FALSE</code> otherwise
122
- * @see #getNonBlank(String, Object)
123
- * @since Sitevision 3.6
124
- */
125
- export function getNonBlank(aString: string): unknown;
126
-
127
- /**
128
- * Gets a default value if an object is null.
129
- * @param anObject the object that might be <code>null</code>
130
- * @param aDefaultValue the default value to return if <code>anObject</code> is <code>null</code>
131
- * @return anObject if non-null, <code>aDefaultValue</code> otherwise
132
- * @see #getNonNull(Object)
133
- * @since Sitevision 2.6.2
134
- */
135
- export function getNonNull(anObject: unknown, aDefaultValue: unknown): unknown;
136
-
137
- /**
138
- * Gets a default value if a string is null or whitespace only.
139
- * @param aString the string that might be <code>null</code> or whitespace only
140
- * @param aDefaultValue the default value to return if <code>aString</code> is <code>null</code> or whitespace only
141
- * @return aString if <code>aString</code> is non-null and not whitespace only, <code>aDefaultValue</code> otherwise
142
- * @see #getNonBlank(String)
143
- * @since Sitevision 3.6
144
- */
145
- export function getNonBlank(aString: string, aDefaultValue: unknown): unknown;
146
-
147
- /**
148
- * Checks if a string is not null and not empty.
149
- * @param aString the string to check
150
- * @return <code>true</code> if <code>aString</code> is not <code>null</code> and not empty, <code>false</code> otherwise
151
- * @see #isNotBlank(String)
152
- * @since Sitevision 2.6
153
- */
154
- export function isNotEmpty(aString: string): boolean;
155
-
156
- /**
157
- * Checks if a string is null or empty.
158
- * @param aString the string to check
159
- * @return <code>true</code> if <code>aString</code> is <code>null</code> or empty, <code>false</code> otherwise
160
- * @see #isBlank(String)
161
- * @since Sitevision 3.6.2
162
- */
163
- export function isEmpty(aString: string): boolean;
164
-
165
- /**
166
- * Checks if a string is not null, not empty and not whitespace only.
167
- * @param aString the string to check
168
- * @return <code>true</code> if <code>aString</code> is not <code>null</code>, not empty and not whitespace only - <code>false</code> otherwise
169
- * @see #isNotEmpty(String)
170
- * @since Sitevision 2.6
171
- */
172
- export function isNotBlank(aString: string): boolean;
173
-
174
- /**
175
- * Checks if a string is null, empty or whitespace only.
176
- * @param aString the string to check
177
- * @return <code>true</code> if <code>aString</code> is <code>null</code>, empty or whitespace only - <code>false</code> otherwise
178
- * @see #isEmpty(String)
179
- * @since Sitevision 3.6.2
180
- */
181
- export function isBlank(aString: string): boolean;
182
-
183
- /**
184
- * Gets a system property. This method invokes the getProperty method of the java.lang.System class, i.e <code>System.getProperty(String)</code>.
185
- *
186
- * <p>
187
- * <strong>Important note!</strong><br>
188
- * This method can be used to reveal potential sensitive information about the server.
189
- * </p>
190
- * <p>
191
- * Allowed properties:
192
- * </p>
193
- * <ul>
194
- * <li>"sitevision.version" (5.1)</li>
195
- * <li>"sitevision.build" (5.1)</li>
196
- * <li>"sitevision.environment.type" (5.2.1)</li>
197
- * </ul>
198
- * <p>
199
- * A legacy mode that enables the API to return all properties can be enabled using the following system property:<br>
200
- * <em>sitevision.api.scriptutil.legacy_system_properties=true</em>
201
- * </p>
202
- *
203
- * <p>
204
- * A tip if you need to do backward compatibility workarounds: The Sitevision version is accessible as a system property
205
- * named <em>sitevision.version</em>.
206
- * </p>
207
- * @param aName the name of the system property
208
- * @return the value of the system property, or <code>null</code> if indeterminable (e.g. no accessible property named <code>aName</code> exist)
209
- * @since Sitevision 2.6_02
210
- * @deprecated Exposes server information and will therefore be removed in future releases of Sitevision
211
- */
212
- export function getSystemProperty(aName: string): string;
213
-
214
- /**
215
- * Creates and returns an instance of a Java class.
216
- * @param aQualifiedClassName a fully qualified name of the class (i.e. including packages)
217
- * @return an instance of the class, or <code>null</code> if an instance can not be created
218
- * @deprecated Use {@link senselogic.sitevision.api.script.factory.InstanceCreatorUtil#getDefaultInstance(String)} instead
219
- */
220
- export function getInstance(aQualifiedClassName: string): unknown;
221
-
222
- /**
223
- * Methods that wraps an array in a <code>List</code>. Arrays are sub optimal in Velocity and JavaScript.
224
- * @param anArray an array that needs to be wrapped
225
- * @return a list containing the array elements. If the array is <code>null</code>, <code>null</code> is returned
226
- * @since Sitevision 2.6_06
227
- */
228
- export function getList(anArray: unknown): unknown;
229
-
230
- /**
231
- * Gets the date format pattern used in the Sitevision editor for a specific Locale.
232
- * @param aLocale the <code>Locale</code> that specifies the date format pattern
233
- * @return the date format pattern used in the Sitevision editor that corresponds to <code>aLocale</code>. If <code>aLocale</code> is <code>null</code> then the current locale (as of {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentLocale()}) is used to locate the format pattern. If no pattern exist for <code>aLocale</code> then the pattern that corresponds to <code>Locale.ENGLISH</code> will be returned.
234
- * @since Sitevision 2.6.1_02
235
- * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getEditorFormatPattern(java.util.Locale)} instead
236
- */
237
- export function getFormatPattern(aLocale: unknown): string;
238
-
239
- /**
240
- * Methods that formats a date according to a <code>SimpleDateFormat</code> pattern
241
- * @param aFormatPattern date to string pattern according to <code>SimpleDateFormat</code>. If <code>null</code> is specified the default format is used
242
- * @param aDate the <code>Date</code>
243
- * @return returns a <code>String</code> representation of <code>aDate</code> according to <code>aFormatPattern</code>. Returns <code>null</code> if <code>aDate</code> is <code>null</code>.
244
- * @since Sitevision 2.6_06
245
- * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getDateAsString(String, java.util.Date)} instead
246
- */
247
- export function getDateAsString(aFormatPattern: string, aDate: unknown): string;
248
-
249
- /**
250
- * Methods that formats the date of a calendar according to a <code>SimpleDateFormat</code> pattern
251
- * @param aFormatPattern date to string pattern according to <code>SimpleDateFormat</code>. If <code>null</code> is specified the default format is used
252
- * @param aCalendar the <code>Calendar</code>
253
- * @return returns a <code>String</code> representation of the date of <code>aCalendar</code> according to <code>aFormatPattern</code>. Returns <code>null</code> if <code>aDate</code> is <code>null</code>.
254
- * @since Sitevision 2.6.1_02
255
- * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getCalendarAsString(String, java.util.Calendar)} instead
256
- */
257
- export function getCalendarAsString(
258
- aFormatPattern: string,
259
- aCalendar: unknown
260
- ): string;
261
-
262
- /**
263
- * Methods that returns a human presentable size with an appropriate byte-suffix (bytes/kB/MB/GB/TB).
264
- * <p>
265
- * Note! This method uses two significant digits and 1024 as base. Some examples:<br>
266
- * &nbsp;&nbsp; <code>126</code> -&gt; "<code>130 bytes</code>"<br>
267
- * &nbsp;&nbsp; <code>126975</code> -&gt; "<code>120 kB</code>"<br>
268
- * &nbsp;&nbsp; <code>456456456</code> -&gt; "<code>440 MB</code>"
269
- * </p>
270
- * @param aSize a size that should be presented for humans
271
- * @return a human presentable byte-suffixed size with two significant digits. If <code>aSize</code> is less than 0 or larger than 1125899906842624 (1024 TB), an empty String will be returned.
272
- * @since Sitevision 2.6.1_04
273
- */
274
- export function getHumanPresentableSize(aSize: number): string;
275
-
276
- /**
277
- * Method that converts a string to an int.
278
- * @param aString the string to be converted
279
- * @return <code>aString</code> as <code>int</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1 is returned
280
- * @since Sitevision 2.6.1_04
281
- */
282
- export function stringToInt(aString: string): number;
283
-
284
- /**
285
- * Method that converts a string to a long.
286
- * @param aString the string to be converted
287
- * @return <code>aString</code> as <code>long</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1 is returned
288
- * @since Sitevision 2.6.1_04
289
- */
290
- export function stringToLong(aString: string): number;
291
-
292
- /**
293
- * Method that converts a string to a double.
294
- * @param aString the string to be converted
295
- * @return <code>aString</code> as <code>double</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1.0 is returned
296
- * @since Sitevision 2.6.1_04
297
- */
298
- export function stringToDouble(aString: string): number;
299
-
300
- /**
301
- * Method that converts a string to a float.
302
- * @param aString the string to be converted
303
- * @return <code>aString</code> as <code>float</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1.0 is returned
304
- * @since Sitevision 2.6.1_04
305
- */
306
- export function stringToFloat(aString: string): number;
307
-
308
- /**
309
- * Method that returns true for values that can be interpreted as the true value.
310
- * @param anObject an Object that might be interpreted as a true value
311
- * @return returns <code>true</code> if <code>anObject</code> is a <code>Boolean</code> with a <code>true</code> value or a <code>String</code> with a "<code>true</code>" value, <code>false</code> otherwise.
312
- * @since Sitevision 2.6.1_04
313
- */
314
- export function isTrue(anObject: unknown): boolean;
315
-
316
- /**
317
- * Method that returns true for values that can be interpreted as the false value.
318
- * @param anObject an Object that might be interpreted as a false value
319
- * @return returns <code>true</code> if <code>anObject</code> is a <code>Boolean</code> with a <code>false</code> value or a <code>String</code> with a "<code>false</code>" value, <code>false</code> otherwise.
320
- * @since Sitevision 2.6.1_04
321
- */
322
- export function isFalse(anObject: unknown): boolean;
323
-
324
- /**
325
- * Joins the elements of an array to a single String.
326
- *
327
- * <p>Some examples:</p>
328
- * <pre><code>
329
- * joinArray(["one", "two", "three"], ";") -&gt; "one;two;three"
330
- * joinArray(["a", myTwoInteger], "-") -&gt; "a-2"
331
- * joinArray(["", null, "three"], "-") -&gt; "--three"
332
- * joinArray([], "-") -&gt; ""
333
- * joinArray(null, "-") -&gt; null
334
- * </code></pre>
335
- * @param anArray the array that should be joined to a single string. <code>null</code> elements will be treated as empty (<code>""</code>) and for non-String elements <code>toString()</code> will be invoked on the element to get a string representation.
336
- * @param aSeparator the separator that should delimit the elements of <code>anArray</code> in the resulting joined string. <code>null</code> will be treated as empty (<code>""</code>)
337
- * @return the joined <code>String</code>. If <code>anArray</code> is <code>null</code>, <code>null</code> will be returned
338
- * @see #joinCollection(java.util.Collection, String)
339
- * @since Sitevision 2.6.1_04
340
- */
341
- export function joinArray(anArray: unknown, aSeparator: string): string;
342
-
343
- /**
344
- * Joins the items of a Collection to a single String.
345
- *
346
- * <p>
347
- * For examples, see {@link #joinArray(Object[], String)}
348
- * </p>
349
- * @param aCollection the collection that should be joined to a single string. <code>null</code> items will be treated as empty (<code>""</code>) and for non-String items <code>toString()</code> will be invoked on the item to get a string representation.
350
- * @param aSeparator the separator that should delimit the items of <code>aCollection</code> in the resulting joined string. <code>null</code> will be treated as empty (<code>""</code>)
351
- * @return the joined <code>String</code>. If <code>aCollection</code> is <code>null</code>, <code>null</code> will be returned
352
- * @see #joinArray(Object[], String)
353
- * @since Sitevision 2.6.1_04
354
- */
355
- export function joinCollection(
356
- aCollection: unknown,
357
- aSeparator: string
358
- ): string;
359
-
360
- /**
361
- * A utility method to get a formatted string based on a pattern and some pattern arguments.
362
- *
363
- * <p>
364
- * <strong>A Velocity example:</strong>
365
- * </p>
366
- * <pre><code>
367
- * #set ($instanceCreatorUtil = ...)
368
- * #set ($scriptUtil = ...)
369
- * #set ($searchPhrase = ...)
370
- *
371
- * <em>## Determine pattern</em>
372
- * #if ($language == 'sv')
373
- * #set ($pattern = 'Din sökning {0} gav inga träffar')
374
- * #else
375
- * #set ($pattern = 'No hits for your search {0}')
376
- * #end
377
- *
378
- * <em>## Set up pattern argument(s)</em>
379
- * #set ($argsList = $instanceCreatorUtil.list)
380
- * $scriptUtil.swallow(${argsList.add($searchPhrase)})
381
- *
382
- * <em>## Format and print result</em>
383
- * &lt;p&gt;$scriptUtil.messageFormat($pattern, $argsList)&lt;/p&gt;
384
- * </code></pre>
385
- * @param aMessageFormatPattern a pattern accepted by the Java <a href="http://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html">MessageFormat</a> class
386
- * @param anArguments arguments needed by the pattern
387
- * @return the result of the pattern evaluation or <code>null</code> if evaluation fails. Returns <code>null</code> if <code>aMessageFormatPattern</code> is <code>null</code> or if <code>anArguments</code> doesn't contain any arguments.
388
- * @since Sitevision 3.0
389
- */
390
- export function messageFormat(
391
- aMessageFormatPattern: string,
392
- anArguments: unknown
393
- ): string;
394
-
395
- /**
396
- * A utility method that can be used to prevent method invocation return values to be added to the Velocity output.
397
- *
398
- * <p>
399
- * <strong>An example:</strong><br>This Velocity code:
400
- * </p>
401
- * <pre><code>
402
- * #set ($myList = $instanceCreatorUtil.list)
403
- * $myList.add("Magnus Lövgren")
404
- * $myList.add("Mikael Wikblom")
405
- * </code></pre>
406
- * will result in the following Velocity output (the <code>add</code> method of <code>ArrayList</code> returns a <code>boolean</code>):
407
- * <pre><code>true true</code></pre>
408
- * <p>
409
- * If a non-void method is invoked and the return value isn't handled, it will be part of the Velocity output.
410
- * The <code>swallow</code> method can be used to prevent that (i.e. use it to "swallow" the result):
411
- * </p>
412
- * <pre><code>
413
- * #set ($myList = $instanceCreatorUtil.list)
414
- * $scriptUtil.swallow(${myList.add("Magnus Lövgren")})
415
- * $scriptUtil.swallow(${myList.add("Mikael Wikblom")})</code></pre>
416
- * <p>
417
- * <em>Note! The code above is just an example that illustrates a common problem. When creating and working with a
418
- * List from Velocity, you should probably use a {@link senselogic.sitevision.api.script.factory.ListWrapper} instead</em>
419
- * </p>
420
- * @param anObject the object that should be "swallowed"
421
- * @since Sitevision 3.0
422
- */
423
- export function swallow(anObject: unknown): void;
424
-
425
- /**
426
- * Removes leading and ending control characters (char &lt;= 32) from a String and returns the result (<code>null</code>
427
- * if the string is empty or <code>null</code>).
428
- *
429
- * <p>
430
- * The String is trimmed using <code>String.trim()</code>
431
- * </p>
432
- * @param aString the string that should be trimmed
433
- * @return the trimmed String. Returns <code>null</code> if <code>aString</code> is <code>null</code> or the trimmed String is empty.
434
- * @since Sitevision 2.6.1_04
435
- */
436
- export function trimToNull(aString: string): string;
437
-
438
- /**
439
- * Removes leading and ending control characters (char &lt;= 32) from a String and returns the result (empty String (<code>""</code>)
440
- * if the string is empty or <code>null</code>).
441
- *
442
- * <p>
443
- * The String is trimmed using <code>String.trim()</code>
444
- * </p>
445
- * @param aString the string that should be trimmed
446
- * @return the trimmed String. Returns empty (<code>""</code>) if <code>aString</code> is <code>null</code> or the trimmed String is empty.
447
- * @since Sitevision 2.6.1_04
448
- */
449
- export function trimToEmpty(aString: string): string;
450
-
451
- /**
452
- * Flattens a multi-lined string to a trimmed single-line string.
453
- *
454
- * <p>
455
- * This method replaces all whitespace (space, line break and such) with a space, but will never add multiple spaces.
456
- * </p>
457
- * @param aString the multi-lined string
458
- * @return a single-line trimmed string with sequential whitespace removed, or <code>null</code> if <code>aString</code> is <code>null</code>.
459
- * @since Sitevision 3.6
460
- */
461
- export function flatten(aString: string): string;
462
-
463
1
  /**
464
2
  * Scripting utility interface that might be needed when using a limited scripting or template language (such as Velocity).
465
3
  *
@@ -469,38 +7,463 @@ export function flatten(aString: string): string;
469
7
  * </p>
470
8
  * @author Magnus Lövgren
471
9
  */
472
- declare namespace scriptUtil {
473
- export {
474
- getTrue,
475
- getFalse,
476
- getNull,
477
- getNonNull,
478
- getNonBlank,
479
- isNotEmpty,
480
- isEmpty,
481
- isNotBlank,
482
- isBlank,
483
- getSystemProperty,
484
- getInstance,
485
- getList,
486
- getFormatPattern,
487
- getDateAsString,
488
- getCalendarAsString,
489
- getHumanPresentableSize,
490
- stringToInt,
491
- stringToLong,
492
- stringToDouble,
493
- stringToFloat,
494
- isTrue,
495
- isFalse,
496
- joinArray,
497
- joinCollection,
498
- messageFormat,
499
- swallow,
500
- trimToNull,
501
- trimToEmpty,
502
- flatten,
503
- };
10
+ export interface ScriptUtil {
11
+ /**
12
+ * Gets the boolean true primitive.
13
+ * @return <code>true</code>
14
+ */
15
+ getTrue(): boolean;
16
+
17
+ /**
18
+ * Gets the boolean false primitive.
19
+ * @return <code>false</code>
20
+ */
21
+ getFalse(): boolean;
22
+
23
+ /**
24
+ * Gets the null reference.
25
+ * @return <code>null</code>
26
+ */
27
+ getNull(): unknown;
28
+
29
+ /**
30
+ * Gets an object that is ensured not to be null.
31
+ *
32
+ * <p>
33
+ * This is a convenience method that can be used to avoid unnecessary subsequent method invocations in Velocity.
34
+ * </p>
35
+ *
36
+ * <p>
37
+ * Velocity ignores <code>null</code> assignments and trying to assign a null reference will be logged as a WARNING message.
38
+ * A common strategy to work around this is to use the the Velocity <code>#if</code> clause. It allows for easy non-null
39
+ * checks - a <code>null</code> object is considered to be <code>false</code>. The downside with this strategy is that it
40
+ * requires two subsequent method invocations. That can of course be a really bad thing if the method does costly things. This method
41
+ * can be used to avoid such problems.
42
+ * </p>
43
+ *
44
+ * <p>
45
+ * <strong>An example</strong><br>
46
+ * This Velocity code:
47
+ * </p>
48
+ * <pre><code> #if ($anObject.getPersonOrNull())
49
+ * #set ($person = $anObject.getPersonOrNull())
50
+ * $person.getName()
51
+ * ...
52
+ * #end</code></pre>
53
+ * Can be better utilized as:
54
+ * <pre><code> #set ($scriptUtil = ...)
55
+ *
56
+ * #set ($person = $scriptUtil.getNonNull(${anObject.getPersonOrNull()}))
57
+ * #if ($person)
58
+ * $person.getName()
59
+ * ...
60
+ * #end
61
+ * </code></pre>
62
+ * @param anObject the object that might be <code>null</code>
63
+ * @return anObject if non-null, <code>Boolean.FALSE</code> otherwise
64
+ * @see #getNonNull(Object, Object)
65
+ * @see #getNonBlank(String)
66
+ * @since Sitevision 2.6.2
67
+ */
68
+ getNonNull(anObject: unknown): unknown;
69
+
70
+ /**
71
+ * Gets an object that is ensured not to be null or a whitespace only string.
72
+ *
73
+ * <p>
74
+ * This is a convenience method that can be used to avoid unnecessary subsequent method invocations in Velocity.
75
+ * </p>
76
+ *
77
+ * <p>
78
+ * Velocity ignores <code>null</code> assignments and trying to assign a null reference will be logged as a WARNING message.
79
+ * A common strategy to work around this is to use the the Velocity <code>#if</code> clause. It allows for easy non-null
80
+ * checks - a <code>null</code> object is considered to be <code>false</code>. The downside with this strategy is that it
81
+ * requires two subsequent method invocations. That can of course be a really bad thing if the method does costly things. This method
82
+ * can be used to avoid such problems.
83
+ * </p>
84
+ *
85
+ * <p>
86
+ * <strong>An example</strong><br>
87
+ * This Velocity code:
88
+ * </p>
89
+ * <pre><code> #if ($anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly())
90
+ * #set ($name = $anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly())
91
+ * #if ($name.trim().length() &gt; 0)
92
+ * &lt;p&gt;
93
+ * $name
94
+ * &lt;/p&gt;
95
+ * #end
96
+ * #end</code></pre>
97
+ * Can be better utilized as:
98
+ * <pre><code> #set ($scriptUtil = ...)
99
+ *
100
+ * #set ($name = $scriptUtil.getNonBlank(${anObject.getPersonNameThatCanBeNullOrEmptyOrWhitespaceOnly()}))
101
+ * #if ($name)
102
+ * &lt;p&gt;
103
+ * $name
104
+ * &lt;/p&gt;
105
+ * #end
106
+ * </code></pre>
107
+ *
108
+ * <p>
109
+ * <strong>A typical example when using {@link senselogic.sitevision.api.property.PropertyUtil} and whitespace is an issue</strong><br>
110
+ * This Velocity code:
111
+ * </p>
112
+ * <pre><code> #if ($propertyUtil.getString($theNode, 'thePropertyName'))
113
+ * #set ($propertyValue = $propertyUtil.getString($theNode, 'thePropertyName'))
114
+ * #if ($propertyValue.trim().length() &gt; 0)
115
+ * &lt;p&gt;
116
+ * $propertyValue
117
+ * &lt;/p&gt;
118
+ * #end
119
+ * #end</code></pre>
120
+ * Can be better utilized as:
121
+ * <pre><code> #set ($scriptUtil = ...)
122
+ *
123
+ * #set ($propertyValue = $scriptUtil.getNonBlank(${propertyUtil.getString($theNode, 'thePropertyName')}))
124
+ * #if ($propertyValue)
125
+ * &lt;p&gt;
126
+ * $propertyValue
127
+ * &lt;/p&gt;
128
+ * #end
129
+ * </code></pre>
130
+ * @param aString the string that might be <code>null</code> or whitespace only
131
+ * @return aString if <code>aString</code> is non-null and not whitespace only, <code>Boolean.FALSE</code> otherwise
132
+ * @see #getNonBlank(String, Object)
133
+ * @since Sitevision 3.6
134
+ */
135
+ getNonBlank(aString: string): unknown;
136
+
137
+ /**
138
+ * Gets a default value if an object is null.
139
+ * @param anObject the object that might be <code>null</code>
140
+ * @param aDefaultValue the default value to return if <code>anObject</code> is <code>null</code>
141
+ * @return anObject if non-null, <code>aDefaultValue</code> otherwise
142
+ * @see #getNonNull(Object)
143
+ * @since Sitevision 2.6.2
144
+ */
145
+ getNonNull(anObject: unknown, aDefaultValue: unknown): unknown;
146
+
147
+ /**
148
+ * Gets a default value if a string is null or whitespace only.
149
+ * @param aString the string that might be <code>null</code> or whitespace only
150
+ * @param aDefaultValue the default value to return if <code>aString</code> is <code>null</code> or whitespace only
151
+ * @return aString if <code>aString</code> is non-null and not whitespace only, <code>aDefaultValue</code> otherwise
152
+ * @see #getNonBlank(String)
153
+ * @since Sitevision 3.6
154
+ */
155
+ getNonBlank(aString: string, aDefaultValue: unknown): unknown;
156
+
157
+ /**
158
+ * Checks if a string is not null and not empty.
159
+ * @param aString the string to check
160
+ * @return <code>true</code> if <code>aString</code> is not <code>null</code> and not empty, <code>false</code> otherwise
161
+ * @see #isNotBlank(String)
162
+ * @since Sitevision 2.6
163
+ */
164
+ isNotEmpty(aString: string): boolean;
165
+
166
+ /**
167
+ * Checks if a string is null or empty.
168
+ * @param aString the string to check
169
+ * @return <code>true</code> if <code>aString</code> is <code>null</code> or empty, <code>false</code> otherwise
170
+ * @see #isBlank(String)
171
+ * @since Sitevision 3.6.2
172
+ */
173
+ isEmpty(aString: string): boolean;
174
+
175
+ /**
176
+ * Checks if a string is not null, not empty and not whitespace only.
177
+ * @param aString the string to check
178
+ * @return <code>true</code> if <code>aString</code> is not <code>null</code>, not empty and not whitespace only - <code>false</code> otherwise
179
+ * @see #isNotEmpty(String)
180
+ * @since Sitevision 2.6
181
+ */
182
+ isNotBlank(aString: string): boolean;
183
+
184
+ /**
185
+ * Checks if a string is null, empty or whitespace only.
186
+ * @param aString the string to check
187
+ * @return <code>true</code> if <code>aString</code> is <code>null</code>, empty or whitespace only - <code>false</code> otherwise
188
+ * @see #isEmpty(String)
189
+ * @since Sitevision 3.6.2
190
+ */
191
+ isBlank(aString: string): boolean;
192
+
193
+ /**
194
+ * Gets a system property. This method invokes the getProperty method of the java.lang.System class, i.e <code>System.getProperty(String)</code>.
195
+ *
196
+ * <p>
197
+ * <strong>Important note!</strong><br>
198
+ * This method can be used to reveal potential sensitive information about the server.
199
+ * </p>
200
+ * <p>
201
+ * Allowed properties:
202
+ * </p>
203
+ * <ul>
204
+ * <li>"sitevision.version" (5.1)</li>
205
+ * <li>"sitevision.build" (5.1)</li>
206
+ * <li>"sitevision.environment.type" (5.2.1)</li>
207
+ * </ul>
208
+ * <p>
209
+ * A legacy mode that enables the API to return all properties can be enabled using the following system property:<br>
210
+ * <em>sitevision.api.scriptutil.legacy_system_properties=true</em>
211
+ * </p>
212
+ *
213
+ * <p>
214
+ * A tip if you need to do backward compatibility workarounds: The Sitevision version is accessible as a system property
215
+ * named <em>sitevision.version</em>.
216
+ * </p>
217
+ * @param aName the name of the system property
218
+ * @return the value of the system property, or <code>null</code> if indeterminable (e.g. no accessible property named <code>aName</code> exist)
219
+ * @since Sitevision 2.6_02
220
+ * @deprecated Exposes server information and will therefore be removed in future releases of Sitevision
221
+ */
222
+ getSystemProperty(aName: string): string;
223
+
224
+ /**
225
+ * Creates and returns an instance of a Java class.
226
+ * @param aQualifiedClassName a fully qualified name of the class (i.e. including packages)
227
+ * @return an instance of the class, or <code>null</code> if an instance can not be created
228
+ * @deprecated Use {@link senselogic.sitevision.api.script.factory.InstanceCreatorUtil#getDefaultInstance(String)} instead
229
+ */
230
+ getInstance(aQualifiedClassName: string): unknown;
231
+
232
+ /**
233
+ * Methods that wraps an array in a <code>List</code>. Arrays are sub optimal in Velocity and JavaScript.
234
+ * @param anArray an array that needs to be wrapped
235
+ * @return a list containing the array elements. If the array is <code>null</code>, <code>null</code> is returned
236
+ * @since Sitevision 2.6_06
237
+ */
238
+ getList(anArray: unknown): unknown;
239
+
240
+ /**
241
+ * Gets the date format pattern used in the Sitevision editor for a specific Locale.
242
+ * @param aLocale the <code>Locale</code> that specifies the date format pattern
243
+ * @return the date format pattern used in the Sitevision editor that corresponds to <code>aLocale</code>. If <code>aLocale</code> is <code>null</code> then the current locale (as of {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentLocale()}) is used to locate the format pattern. If no pattern exist for <code>aLocale</code> then the pattern that corresponds to <code>Locale.ENGLISH</code> will be returned.
244
+ * @since Sitevision 2.6.1_02
245
+ * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getEditorFormatPattern(java.util.Locale)} instead
246
+ */
247
+ getFormatPattern(aLocale: unknown): string;
248
+
249
+ /**
250
+ * Methods that formats a date according to a <code>SimpleDateFormat</code> pattern
251
+ * @param aFormatPattern date to string pattern according to <code>SimpleDateFormat</code>. If <code>null</code> is specified the default format is used
252
+ * @param aDate the <code>Date</code>
253
+ * @return returns a <code>String</code> representation of <code>aDate</code> according to <code>aFormatPattern</code>. Returns <code>null</code> if <code>aDate</code> is <code>null</code>.
254
+ * @since Sitevision 2.6_06
255
+ * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getDateAsString(String, java.util.Date)} instead
256
+ */
257
+ getDateAsString(aFormatPattern: string, aDate: unknown): string;
258
+
259
+ /**
260
+ * Methods that formats the date of a calendar according to a <code>SimpleDateFormat</code> pattern
261
+ * @param aFormatPattern date to string pattern according to <code>SimpleDateFormat</code>. If <code>null</code> is specified the default format is used
262
+ * @param aCalendar the <code>Calendar</code>
263
+ * @return returns a <code>String</code> representation of the date of <code>aCalendar</code> according to <code>aFormatPattern</code>. Returns <code>null</code> if <code>aDate</code> is <code>null</code>.
264
+ * @since Sitevision 2.6.1_02
265
+ * @deprecated use {@link senselogic.sitevision.api.date.DateUtil#getCalendarAsString(String, java.util.Calendar)} instead
266
+ */
267
+ getCalendarAsString(aFormatPattern: string, aCalendar: unknown): string;
268
+
269
+ /**
270
+ * Methods that returns a human presentable size with an appropriate byte-suffix (bytes/kB/MB/GB/TB).
271
+ * <p>
272
+ * Note! This method uses two significant digits and 1024 as base. Some examples:<br>
273
+ * &nbsp;&nbsp; <code>126</code> -&gt; "<code>130 bytes</code>"<br>
274
+ * &nbsp;&nbsp; <code>126975</code> -&gt; "<code>120 kB</code>"<br>
275
+ * &nbsp;&nbsp; <code>456456456</code> -&gt; "<code>440 MB</code>"
276
+ * </p>
277
+ * @param aSize a size that should be presented for humans
278
+ * @return a human presentable byte-suffixed size with two significant digits. If <code>aSize</code> is less than 0 or larger than 1125899906842624 (1024 TB), an empty String will be returned.
279
+ * @since Sitevision 2.6.1_04
280
+ */
281
+ getHumanPresentableSize(aSize: number): string;
282
+
283
+ /**
284
+ * Method that converts a string to an int.
285
+ * @param aString the string to be converted
286
+ * @return <code>aString</code> as <code>int</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1 is returned
287
+ * @since Sitevision 2.6.1_04
288
+ */
289
+ stringToInt(aString: string): number;
290
+
291
+ /**
292
+ * Method that converts a string to a long.
293
+ * @param aString the string to be converted
294
+ * @return <code>aString</code> as <code>long</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1 is returned
295
+ * @since Sitevision 2.6.1_04
296
+ */
297
+ stringToLong(aString: string): number;
298
+
299
+ /**
300
+ * Method that converts a string to a double.
301
+ * @param aString the string to be converted
302
+ * @return <code>aString</code> as <code>double</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1.0 is returned
303
+ * @since Sitevision 2.6.1_04
304
+ */
305
+ stringToDouble(aString: string): number;
306
+
307
+ /**
308
+ * Method that converts a string to a float.
309
+ * @param aString the string to be converted
310
+ * @return <code>aString</code> as <code>float</code>. If <code>aString</code> is <code>null</code> or can't be converted, -1.0 is returned
311
+ * @since Sitevision 2.6.1_04
312
+ */
313
+ stringToFloat(aString: string): number;
314
+
315
+ /**
316
+ * Method that returns true for values that can be interpreted as the true value.
317
+ * @param anObject an Object that might be interpreted as a true value
318
+ * @return returns <code>true</code> if <code>anObject</code> is a <code>Boolean</code> with a <code>true</code> value or a <code>String</code> with a "<code>true</code>" value, <code>false</code> otherwise.
319
+ * @since Sitevision 2.6.1_04
320
+ */
321
+ isTrue(anObject: unknown): boolean;
322
+
323
+ /**
324
+ * Method that returns true for values that can be interpreted as the false value.
325
+ * @param anObject an Object that might be interpreted as a false value
326
+ * @return returns <code>true</code> if <code>anObject</code> is a <code>Boolean</code> with a <code>false</code> value or a <code>String</code> with a "<code>false</code>" value, <code>false</code> otherwise.
327
+ * @since Sitevision 2.6.1_04
328
+ */
329
+ isFalse(anObject: unknown): boolean;
330
+
331
+ /**
332
+ * Joins the elements of an array to a single String.
333
+ *
334
+ * <p>Some examples:</p>
335
+ * <pre><code>
336
+ * joinArray(["one", "two", "three"], ";") -&gt; "one;two;three"
337
+ * joinArray(["a", myTwoInteger], "-") -&gt; "a-2"
338
+ * joinArray(["", null, "three"], "-") -&gt; "--three"
339
+ * joinArray([], "-") -&gt; ""
340
+ * joinArray(null, "-") -&gt; null
341
+ * </code></pre>
342
+ * @param anArray the array that should be joined to a single string. <code>null</code> elements will be treated as empty (<code>""</code>) and for non-String elements <code>toString()</code> will be invoked on the element to get a string representation.
343
+ * @param aSeparator the separator that should delimit the elements of <code>anArray</code> in the resulting joined string. <code>null</code> will be treated as empty (<code>""</code>)
344
+ * @return the joined <code>String</code>. If <code>anArray</code> is <code>null</code>, <code>null</code> will be returned
345
+ * @see #joinCollection(java.util.Collection, String)
346
+ * @since Sitevision 2.6.1_04
347
+ */
348
+ joinArray(anArray: unknown, aSeparator: string): string;
349
+
350
+ /**
351
+ * Joins the items of a Collection to a single String.
352
+ *
353
+ * <p>
354
+ * For examples, see {@link #joinArray(Object[], String)}
355
+ * </p>
356
+ * @param aCollection the collection that should be joined to a single string. <code>null</code> items will be treated as empty (<code>""</code>) and for non-String items <code>toString()</code> will be invoked on the item to get a string representation.
357
+ * @param aSeparator the separator that should delimit the items of <code>aCollection</code> in the resulting joined string. <code>null</code> will be treated as empty (<code>""</code>)
358
+ * @return the joined <code>String</code>. If <code>aCollection</code> is <code>null</code>, <code>null</code> will be returned
359
+ * @see #joinArray(Object[], String)
360
+ * @since Sitevision 2.6.1_04
361
+ */
362
+ joinCollection(aCollection: unknown, aSeparator: string): string;
363
+
364
+ /**
365
+ * A utility method to get a formatted string based on a pattern and some pattern arguments.
366
+ *
367
+ * <p>
368
+ * <strong>A Velocity example:</strong>
369
+ * </p>
370
+ * <pre><code>
371
+ * #set ($instanceCreatorUtil = ...)
372
+ * #set ($scriptUtil = ...)
373
+ * #set ($searchPhrase = ...)
374
+ *
375
+ * <em>## Determine pattern</em>
376
+ * #if ($language == 'sv')
377
+ * #set ($pattern = 'Din sökning {0} gav inga träffar')
378
+ * #else
379
+ * #set ($pattern = 'No hits for your search {0}')
380
+ * #end
381
+ *
382
+ * <em>## Set up pattern argument(s)</em>
383
+ * #set ($argsList = $instanceCreatorUtil.list)
384
+ * $scriptUtil.swallow(${argsList.add($searchPhrase)})
385
+ *
386
+ * <em>## Format and print result</em>
387
+ * &lt;p&gt;$scriptUtil.messageFormat($pattern, $argsList)&lt;/p&gt;
388
+ * </code></pre>
389
+ * @param aMessageFormatPattern a pattern accepted by the Java <a href="http://docs.oracle.com/javase/8/docs/api/java/text/MessageFormat.html">MessageFormat</a> class
390
+ * @param anArguments arguments needed by the pattern
391
+ * @return the result of the pattern evaluation or <code>null</code> if evaluation fails. Returns <code>null</code> if <code>aMessageFormatPattern</code> is <code>null</code> or if <code>anArguments</code> doesn't contain any arguments.
392
+ * @since Sitevision 3.0
393
+ */
394
+ messageFormat(aMessageFormatPattern: string, anArguments: unknown): string;
395
+
396
+ /**
397
+ * A utility method that can be used to prevent method invocation return values to be added to the Velocity output.
398
+ *
399
+ * <p>
400
+ * <strong>An example:</strong><br>This Velocity code:
401
+ * </p>
402
+ * <pre><code>
403
+ * #set ($myList = $instanceCreatorUtil.list)
404
+ * $myList.add("Magnus Lövgren")
405
+ * $myList.add("Mikael Wikblom")
406
+ * </code></pre>
407
+ * will result in the following Velocity output (the <code>add</code> method of <code>ArrayList</code> returns a <code>boolean</code>):
408
+ * <pre><code>true true</code></pre>
409
+ * <p>
410
+ * If a non-void method is invoked and the return value isn't handled, it will be part of the Velocity output.
411
+ * The <code>swallow</code> method can be used to prevent that (i.e. use it to "swallow" the result):
412
+ * </p>
413
+ * <pre><code>
414
+ * #set ($myList = $instanceCreatorUtil.list)
415
+ * $scriptUtil.swallow(${myList.add("Magnus Lövgren")})
416
+ * $scriptUtil.swallow(${myList.add("Mikael Wikblom")})</code></pre>
417
+ * <p>
418
+ * <em>Note! The code above is just an example that illustrates a common problem. When creating and working with a
419
+ * List from Velocity, you should probably use a {@link senselogic.sitevision.api.script.factory.ListWrapper} instead</em>
420
+ * </p>
421
+ * @param anObject the object that should be "swallowed"
422
+ * @since Sitevision 3.0
423
+ */
424
+ swallow(anObject: unknown): void;
425
+
426
+ /**
427
+ * Removes leading and ending control characters (char &lt;= 32) from a String and returns the result (<code>null</code>
428
+ * if the string is empty or <code>null</code>).
429
+ *
430
+ * <p>
431
+ * The String is trimmed using <code>String.trim()</code>
432
+ * </p>
433
+ * @param aString the string that should be trimmed
434
+ * @return the trimmed String. Returns <code>null</code> if <code>aString</code> is <code>null</code> or the trimmed String is empty.
435
+ * @since Sitevision 2.6.1_04
436
+ */
437
+ trimToNull(aString: string): string;
438
+
439
+ /**
440
+ * Removes leading and ending control characters (char &lt;= 32) from a String and returns the result (empty String (<code>""</code>)
441
+ * if the string is empty or <code>null</code>).
442
+ *
443
+ * <p>
444
+ * The String is trimmed using <code>String.trim()</code>
445
+ * </p>
446
+ * @param aString the string that should be trimmed
447
+ * @return the trimmed String. Returns empty (<code>""</code>) if <code>aString</code> is <code>null</code> or the trimmed String is empty.
448
+ * @since Sitevision 2.6.1_04
449
+ */
450
+ trimToEmpty(aString: string): string;
451
+
452
+ /**
453
+ * Flattens a multi-lined string to a trimmed single-line string.
454
+ *
455
+ * <p>
456
+ * This method replaces all whitespace (space, line break and such) with a space, but will never add multiple spaces.
457
+ * </p>
458
+ * @param aString the multi-lined string
459
+ * @return a single-line trimmed string with sequential whitespace removed, or <code>null</code> if <code>aString</code> is <code>null</code>.
460
+ * @since Sitevision 3.6
461
+ */
462
+ flatten(aString: string): string;
504
463
  }
505
464
 
465
+ declare namespace ScriptUtil {}
466
+
467
+ declare var scriptUtil: ScriptUtil;
468
+
506
469
  export default scriptUtil;