@sitevision/api 1.0.19 → 1.1.0-alpha.1
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.
- package/common/router/index.d.ts +1 -1
- package/hidden/javax/jcr/Binary/index.d.ts +86 -0
- package/hidden/javax/jcr/Credentials/index.d.ts +11 -0
- package/hidden/javax/jcr/ImportUUIDBehavior/index.d.ts +11 -0
- package/hidden/javax/jcr/Item/index.d.ts +353 -0
- package/hidden/javax/jcr/ItemVisitor/index.d.ts +41 -0
- package/hidden/javax/jcr/NamespaceRegistry/index.d.ts +100 -0
- package/hidden/javax/jcr/Node/index.d.ts +2808 -0
- package/hidden/javax/jcr/NodeIterator/index.d.ts +18 -0
- package/hidden/javax/jcr/Property/index.d.ts +801 -0
- package/hidden/javax/jcr/PropertyIterator/index.d.ts +17 -0
- package/hidden/javax/jcr/RangeIterator/index.d.ts +75 -0
- package/hidden/javax/jcr/Repository/index.d.ts +318 -0
- package/hidden/javax/jcr/RepositoryFactory/index.d.ts +90 -0
- package/hidden/javax/jcr/Value/index.d.ts +190 -0
- package/hidden/javax/jcr/ValueFactory/index.d.ts +179 -0
- package/hidden/javax/jcr/Workspace/index.d.ts +1061 -0
- package/hidden/javax/jcr/lock/Lock/index.d.ts +142 -0
- package/hidden/javax/jcr/lock/LockManager/index.d.ts +217 -0
- package/hidden/javax/jcr/nodetype/ItemDefinition/index.d.ts +219 -0
- package/hidden/javax/jcr/nodetype/NodeDefinition/index.d.ts +158 -0
- package/hidden/javax/jcr/nodetype/NodeDefinitionTemplate/index.d.ts +74 -0
- package/hidden/javax/jcr/nodetype/NodeType/index.d.ts +349 -0
- package/hidden/javax/jcr/nodetype/NodeTypeDefinition/index.d.ts +248 -0
- package/hidden/javax/jcr/nodetype/NodeTypeIterator/index.d.ts +16 -0
- package/hidden/javax/jcr/nodetype/NodeTypeManager/index.d.ts +218 -0
- package/hidden/javax/jcr/nodetype/NodeTypeTemplate/index.d.ts +98 -0
- package/hidden/javax/jcr/nodetype/PropertyDefinition/index.d.ts +536 -0
- package/hidden/javax/jcr/nodetype/PropertyDefinitionTemplate/index.d.ts +97 -0
- package/hidden/javax/jcr/observation/Event/index.d.ts +133 -0
- package/hidden/javax/jcr/observation/EventIterator/index.d.ts +20 -0
- package/hidden/javax/jcr/observation/EventJournal/index.d.ts +22 -0
- package/hidden/javax/jcr/observation/EventListener/index.d.ts +23 -0
- package/hidden/javax/jcr/observation/EventListenerIterator/index.d.ts +20 -0
- package/hidden/javax/jcr/observation/ObservationManager/index.d.ts +227 -0
- package/hidden/javax/jcr/query/Query/index.d.ts +201 -0
- package/hidden/javax/jcr/query/QueryManager/index.d.ts +73 -0
- package/hidden/javax/jcr/query/QueryResult/index.d.ts +51 -0
- package/hidden/javax/jcr/query/Row/index.d.ts +159 -0
- package/hidden/javax/jcr/query/RowIterator/index.d.ts +20 -0
- package/hidden/javax/jcr/query/qom/And/index.d.ts +26 -0
- package/hidden/javax/jcr/query/qom/BindVariableValue/index.d.ts +15 -0
- package/hidden/javax/jcr/query/qom/ChildNode/index.d.ts +27 -0
- package/hidden/javax/jcr/query/qom/ChildNodeJoinCondition/index.d.ts +27 -0
- package/hidden/javax/jcr/query/qom/Column/index.d.ts +39 -0
- package/hidden/javax/jcr/query/qom/Comparison/index.d.ts +82 -0
- package/hidden/javax/jcr/query/qom/Constraint/index.d.ts +13 -0
- package/hidden/javax/jcr/query/qom/DescendantNode/index.d.ts +31 -0
- package/hidden/javax/jcr/query/qom/DescendantNodeJoinCondition/index.d.ts +29 -0
- package/hidden/javax/jcr/query/qom/DynamicOperand/index.d.ts +9 -0
- package/hidden/javax/jcr/query/qom/EquiJoinCondition/index.d.ts +41 -0
- package/hidden/javax/jcr/query/qom/FullTextSearch/index.d.ts +89 -0
- package/hidden/javax/jcr/query/qom/FullTextSearchScore/index.d.ts +24 -0
- package/hidden/javax/jcr/query/qom/Join/index.d.ts +36 -0
- package/hidden/javax/jcr/query/qom/JoinCondition/index.d.ts +9 -0
- package/hidden/javax/jcr/query/qom/Length/index.d.ts +24 -0
- package/hidden/javax/jcr/query/qom/Literal/index.d.ts +18 -0
- package/hidden/javax/jcr/query/qom/LowerCase/index.d.ts +26 -0
- package/hidden/javax/jcr/query/qom/NodeLocalName/index.d.ts +16 -0
- package/hidden/javax/jcr/query/qom/NodeName/index.d.ts +16 -0
- package/hidden/javax/jcr/query/qom/Not/index.d.ts +20 -0
- package/hidden/javax/jcr/query/qom/Operand/index.d.ts +9 -0
- package/hidden/javax/jcr/query/qom/Or/index.d.ts +30 -0
- package/hidden/javax/jcr/query/qom/Ordering/index.d.ts +53 -0
- package/hidden/javax/jcr/query/qom/PropertyExistence/index.d.ts +24 -0
- package/hidden/javax/jcr/query/qom/PropertyValue/index.d.ts +25 -0
- package/hidden/javax/jcr/query/qom/QueryObjectModel/index.d.ts +64 -0
- package/hidden/javax/jcr/query/qom/QueryObjectModelConstants/index.d.ts +9 -0
- package/hidden/javax/jcr/query/qom/QueryObjectModelFactory/index.d.ts +638 -0
- package/hidden/javax/jcr/query/qom/SameNode/index.d.ts +27 -0
- package/hidden/javax/jcr/query/qom/SameNodeJoinCondition/index.d.ts +36 -0
- package/hidden/javax/jcr/query/qom/Selector/index.d.ts +35 -0
- package/hidden/javax/jcr/query/qom/Source/index.d.ts +9 -0
- package/hidden/javax/jcr/query/qom/StaticOperand/index.d.ts +10 -0
- package/hidden/javax/jcr/query/qom/UpperCase/index.d.ts +26 -0
- package/hidden/javax/jcr/retention/Hold/index.d.ts +34 -0
- package/hidden/javax/jcr/retention/RetentionManager/index.d.ts +189 -0
- package/hidden/javax/jcr/retention/RetentionPolicy/index.d.ts +21 -0
- package/hidden/javax/jcr/security/AccessControlEntry/index.d.ts +24 -0
- package/hidden/javax/jcr/security/AccessControlList/index.d.ts +91 -0
- package/hidden/javax/jcr/security/AccessControlManager/index.d.ts +297 -0
- package/hidden/javax/jcr/security/AccessControlPolicy/index.d.ts +11 -0
- package/hidden/javax/jcr/security/AccessControlPolicyIterator/index.d.ts +20 -0
- package/hidden/javax/jcr/security/NamedAccessControlPolicy/index.d.ts +22 -0
- package/hidden/javax/jcr/security/Privilege/index.d.ts +117 -0
- package/hidden/javax/jcr/version/Version/index.d.ts +121 -0
- package/hidden/javax/jcr/version/VersionHistory/index.d.ts +307 -0
- package/hidden/javax/jcr/version/VersionIterator/index.d.ts +20 -0
- package/hidden/javax/jcr/version/VersionManager/index.d.ts +1082 -0
- package/hidden/senselogic/sitevision/api/base/Builder/index.d.ts +102 -0
- package/hidden/senselogic/sitevision/api/base/Filter/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/base/FilterSplit/index.d.ts +50 -0
- package/hidden/senselogic/sitevision/api/base/Loadable/index.d.ts +15 -0
- package/hidden/senselogic/sitevision/api/base/Resolver/index.d.ts +31 -0
- package/hidden/senselogic/sitevision/api/base/Wrapper/index.d.ts +24 -0
- package/hidden/senselogic/sitevision/api/collaboration/CollaborationGroupWrapper/index.d.ts +417 -0
- package/hidden/senselogic/sitevision/api/format/NumericFormatter/index.d.ts +80 -0
- package/hidden/senselogic/sitevision/api/format/NumericFormatterBuilder/index.d.ts +100 -0
- package/hidden/senselogic/sitevision/api/i18n/Currency/index.d.ts +120 -0
- package/hidden/senselogic/sitevision/api/link/CustomLinkProcessor/index.d.ts +45 -0
- package/hidden/senselogic/sitevision/api/link/CustomLinkRenderData/index.d.ts +65 -0
- package/hidden/senselogic/sitevision/api/mail/Mail/index.d.ts +32 -0
- package/hidden/senselogic/sitevision/api/message/MessageTextLinker/index.d.ts +15 -0
- package/hidden/senselogic/sitevision/api/metadata/value/LinkValue/index.d.ts +23 -0
- package/hidden/senselogic/sitevision/api/metadata/value/RelatedValue/index.d.ts +23 -0
- package/hidden/senselogic/sitevision/api/property/VersionedPropertyUtil/index.d.ts +642 -0
- package/hidden/senselogic/sitevision/api/render/BuddyIconRenderer/BuddyIconInfo/index.d.ts +51 -0
- package/hidden/senselogic/sitevision/api/render/ImageScaler/index.d.ts +58 -0
- package/hidden/senselogic/sitevision/api/render/TextModuleRenderer/index.d.ts +301 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/ArticleUtilConstants/index.d.ts +85 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/ExceptionSuppressingProxyConstants/index.d.ts +31 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/IndexingUtilConstants/index.d.ts +31 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/LinkPageUtilConstants/index.d.ts +67 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/MathInstanceConstants/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/MimeTypeUtilConstants/index.d.ts +19 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/NodeTypeUtilConstants/index.d.ts +1243 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/OutputUtilConstants/index.d.ts +31 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/PageUtilConstants/index.d.ts +91 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/PortletContextUtilConstants/index.d.ts +27 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/PortletUtilConstants/index.d.ts +19 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/QueryStringUtilConstants/index.d.ts +19 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/SearchHitConstants/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/SearchResultConstants/index.d.ts +37 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/VersionUtilConstants/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityAccess/index.d.ts +8 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityContext/index.d.ts +50 -0
- package/hidden/senselogic/sitevision/api/render/velocity/VelocityEvaluator/index.d.ts +89 -0
- package/hidden/senselogic/sitevision/api/script/RequesterChainable/index.d.ts +119 -0
- package/hidden/senselogic/sitevision/api/script/app/RestAppInvoker/index.d.ts +272 -0
- package/hidden/senselogic/sitevision/api/script/factory/TypedArgument/index.d.ts +43 -0
- package/hidden/senselogic/sitevision/api/script/proxy/ExceptionSuppressingCollection/index.d.ts +94 -0
- package/hidden/senselogic/sitevision/api/script/proxy/ExceptionSuppressingIterator/index.d.ts +117 -0
- package/hidden/senselogic/sitevision/api/script/proxy/ExceptionSuppressingProxy/index.d.ts +90 -0
- package/hidden/senselogic/sitevision/api/search/SearchFieldUtil/index.d.ts +89 -0
- package/hidden/senselogic/sitevision/api/search/SearchHighlighter/index.d.ts +45 -0
- package/hidden/senselogic/sitevision/api/search/SearchHit/index.d.ts +1176 -0
- package/hidden/senselogic/sitevision/api/search/SearchResult/index.d.ts +414 -0
- package/hidden/senselogic/sitevision/api/search/facet/SearchFacetField/index.d.ts +27 -0
- package/hidden/senselogic/sitevision/api/search/facet/SearchFacetValue/index.d.ts +61 -0
- package/hidden/senselogic/sitevision/api/search/searcher/Searcher/index.d.ts +277 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/Filter/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/Highlight/index.d.ts +29 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/Monitor/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/Parser/index.d.ts +35 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/Sort/index.d.ts +25 -0
- package/hidden/senselogic/sitevision/api/search/searcher/component/SpellCheck/index.d.ts +29 -0
- package/hidden/senselogic/sitevision/api/search/sort/CustomSort/index.d.ts +82 -0
- package/hidden/senselogic/sitevision/api/search/suggestion/SearchSuggestion/index.d.ts +21 -0
- package/hidden/senselogic/sitevision/api/security/DirectoryAttributes/index.d.ts +70 -0
- package/hidden/senselogic/sitevision/api/security/MessageDigester/index.d.ts +50 -0
- package/hidden/senselogic/sitevision/api/security/RoleAssignment/index.d.ts +72 -0
- package/hidden/senselogic/sitevision/api/security/RoleMatcher/index.d.ts +29 -0
- package/hidden/senselogic/sitevision/api/security/SecretStore/index.d.ts +55 -0
- package/hidden/senselogic/sitevision/api/security/UserUtil/index.d.ts +80 -0
- package/hidden/senselogic/sitevision/api/security/jaas/filter/AuthenticationFilter/index.d.ts +36 -0
- package/hidden/senselogic/sitevision/api/security/jaas/filter/AuthenticationFilterChain/index.d.ts +32 -0
- package/hidden/senselogic/sitevision/api/user/UserIdentityWrapper/index.d.ts +599 -0
- package/hidden/senselogic/sitevision/api/webresource/LinkTarget/index.d.ts +20 -0
- package/hidden/senselogic/sitevision/api/xml/XmlElement/index.d.ts +55 -0
- package/hidden/senselogic/sitevision/api/xml/XmlElementHandler/index.d.ts +17 -0
- package/package.json +2 -4
- package/server/AliasUtil/index.d.ts +25 -0
- package/server/AliasUtil/index.js +10 -0
- package/server/ArchiveUtil/index.d.ts +65 -11
- package/server/ArraysInstance/index.d.ts +1846 -0
- package/server/ArticleUtil/index.d.ts +381 -69
- package/server/AuthenticationUtil/index.d.ts +106 -0
- package/server/BookmarkUtil/index.d.ts +36 -28
- package/server/BuddyIconRenderer/index.d.ts +240 -0
- package/server/ClientUtil/index.d.ts +18 -4
- package/server/CollaborationFactory/index.d.ts +42 -25
- package/server/CollaborationGroupFolderUtil/index.d.ts +40 -29
- package/server/CollaborationGroupTemplateUtil/index.d.ts +71 -39
- package/server/CollaborationGroupUtil/index.d.ts +128 -55
- package/server/CollectionsInstance/index.d.ts +738 -0
- package/server/ColorUtil/index.d.ts +22 -17
- package/server/CompoundAndFilterBuilder/index.d.ts +60 -0
- package/server/CompoundComparatorBuilder/index.d.ts +63 -0
- package/server/CompoundOrFilterBuilder/index.d.ts +59 -0
- package/server/ContentNodeUtil/index.d.ts +76 -0
- package/server/CurrencyFactory/index.d.ts +135 -0
- package/server/DateUtil/index.d.ts +154 -77
- package/server/DecorationUtil/index.d.ts +23 -0
- package/server/DeviceUtil/index.d.ts +36 -0
- package/server/DirectoryUtil/index.d.ts +107 -47
- package/server/DocTypeUtil/index.d.ts +149 -0
- package/server/EndecUtil/index.d.ts +537 -91
- package/server/ExtendedDismaxParserBuilder/index.d.ts +311 -0
- package/server/FileIconRenderer/index.d.ts +346 -0
- package/server/FileUtil/index.d.ts +462 -0
- package/server/FilterBuilder/index.d.ts +120 -0
- package/server/FolderUtil/index.d.ts +161 -0
- package/server/FontUtil/index.d.ts +49 -0
- package/server/FormatterBuilderFactory/index.d.ts +129 -0
- package/server/HighlightBuilder/index.d.ts +194 -0
- package/server/IconUtil/index.d.ts +37 -0
- package/server/ImageLinkRenderer/index.d.ts +134 -0
- package/server/ImageRenderer/index.d.ts +613 -231
- package/server/ImageUtil/index.d.ts +430 -0
- package/server/IndexUtil/index.d.ts +71 -0
- package/server/IndexingUtil/index.d.ts +92 -0
- package/server/InstanceCreatorUtil/index.d.ts +661 -0
- package/server/InstanceTypeUtil/index.d.ts +202 -0
- package/server/JwtUtil/index.d.ts +217 -0
- package/server/LandingPageUtil/index.d.ts +67 -50
- package/server/LinkPageUtil/index.d.ts +468 -0
- package/server/LinkRenderer/index.d.ts +1157 -0
- package/server/LinkTargetBuilder/index.d.ts +146 -0
- package/server/LinkValueBuilder/index.d.ts +129 -52
- package/server/ListWrapper/index.d.ts +172 -0
- package/server/LocaleUtil/index.d.ts +695 -61
- package/server/LogUtil/index.d.ts +118 -77
- package/server/MailBuilder/index.d.ts +238 -0
- package/server/MailUtil/index.d.ts +98 -0
- package/server/MathInstance/index.d.ts +681 -0
- package/server/MessageDigesterFactory/index.d.ts +49 -0
- package/server/MetadataDefinitionUtil/index.d.ts +118 -0
- package/server/MetadataUtil/index.d.ts +524 -79
- package/server/MimeTypeUtil/index.d.ts +316 -0
- package/server/MonitorBuilder/index.d.ts +51 -0
- package/server/NodeComparatorUtil/index.d.ts +397 -0
- package/server/NodeFactoryUtil/index.d.ts +32 -0
- package/server/NodeFilterUtil/index.d.ts +924 -0
- package/server/NodeIteratorUtil/index.d.ts +322 -72
- package/server/NodeResolverUtil/index.d.ts +767 -0
- package/server/NodeTreeUtil/index.d.ts +339 -63
- package/server/NodeTypeUtil/index.d.ts +391 -197
- package/server/OfflineVersionPropertyUtil/index.d.ts +30 -0
- package/server/OnlineVersionPropertyUtil/index.d.ts +30 -0
- package/server/OutputUtil/index.d.ts +641 -0
- package/server/PageUtil/index.d.ts +330 -0
- package/server/PermissionUtil/index.d.ts +650 -0
- package/server/PortletContextUtil/index.d.ts +118 -37
- package/server/PortletContextUtil/index.js +1 -0
- package/server/PortletUtil/index.d.ts +40 -0
- package/server/PrincipalUtil/index.d.ts +51 -0
- package/server/Properties/index.d.ts +185 -38
- package/server/PropertyUtil/index.d.ts +2330 -406
- package/server/PublishingUtil/index.d.ts +385 -49
- package/server/QueryStringUtil/index.d.ts +737 -0
- package/server/RedirectUtil/index.d.ts +98 -0
- package/server/RelatedValueBuilder/index.d.ts +81 -39
- package/server/Requester/index.d.ts +441 -65
- package/server/ResourceLocatorUtil/index.d.ts +483 -227
- package/server/RestApi/index.d.ts +208 -23
- package/server/RestAppInvokerFactory/index.d.ts +73 -0
- package/server/RoleAssignmentBuilder/index.d.ts +60 -0
- package/server/RoleMatcherBuilder/index.d.ts +59 -0
- package/server/RoleUtil/index.d.ts +57 -0
- package/server/ScriptUtil/index.d.ts +625 -143
- package/server/SearchFactory/index.d.ts +133 -0
- package/server/SearchUtil/index.d.ts +164 -0
- package/server/SearcherBuilder/index.d.ts +260 -0
- package/server/Session/index.d.ts +1758 -0
- package/server/SimpleUserUtil/index.d.ts +39 -30
- package/server/SiteCookieUtil/index.d.ts +78 -53
- package/server/SortBuilder/index.d.ts +111 -0
- package/server/SpellCheckBuilder/index.d.ts +68 -0
- package/server/StandardParserBuilder/index.d.ts +112 -0
- package/server/StructureUtil/index.d.ts +167 -0
- package/server/SubscriberUtil/index.d.ts +122 -0
- package/server/SubscriptionUtil/index.d.ts +197 -0
- package/server/SystemUserUtil/index.d.ts +201 -98
- package/server/TagUtil/index.d.ts +193 -0
- package/server/TemplateUtil/index.d.ts +217 -0
- package/server/TemporaryFileNodeBuilder/index.d.ts +63 -0
- package/server/TemporaryNodeBuilder/index.d.ts +241 -0
- package/server/TextModuleRendererBuilder/index.d.ts +68 -0
- package/server/TimestampUtil/index.d.ts +98 -82
- package/server/TranslationUtil/index.d.ts +175 -0
- package/server/TrashcanUtil/index.d.ts +193 -24
- package/server/UserDataUtil/index.d.ts +167 -85
- package/server/UserFactory/index.d.ts +45 -30
- package/server/UserFieldRenderer/index.d.ts +258 -0
- package/server/UserIdentityUtil/index.d.ts +61 -29
- package/server/UserUtil/index.d.ts +69 -28
- package/server/Utils/index.d.ts +870 -12
- package/server/VelocityRenderer/index.d.ts +248 -0
- package/server/VersionUtil/index.d.ts +15 -12
- package/server/WebContentUtil/index.d.ts +644 -0
- package/server/WebResourceFactory/index.d.ts +66 -0
- package/server/XSLTUtil/index.d.ts +49 -10
- package/server/XmlParserUtil/index.d.ts +82 -81
- package/builtins/Binary/index.d.ts +0 -3
- package/builtins/Calendar/index.d.ts +0 -3
- package/builtins/Collection/index.d.ts +0 -3
- package/builtins/Date/index.d.ts +0 -3
- package/builtins/InputStream/index.d.ts +0 -3
- package/builtins/Instant/index.d.ts +0 -3
- package/builtins/List/index.d.ts +0 -3
- package/builtins/LocalDateTime/index.d.ts +0 -3
- package/builtins/Locale/index.d.ts +0 -3
- package/builtins/Node/index.d.ts +0 -3
- package/builtins/NodeIterator/index.d.ts +0 -27
- package/builtins/Property/index.d.ts +0 -3
- package/builtins/Serializable/index.d.ts +0 -3
- package/builtins/Set/index.d.ts +0 -3
- package/builtins/Throwable/index.d.ts +0 -3
- package/builtins/byte/index.d.ts +0 -3
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script utility for server-side invoke of a local RESTApp.
|
|
3
|
+
*
|
|
4
|
+
* <p>
|
|
5
|
+
* This is a local, server-side, inbound utility to invoke a specific
|
|
6
|
+
* <a href="https://developer.sitevision.se/restapps" target="_blank">RESTApp</a>
|
|
7
|
+
* of the local site without any outgoing http connections.
|
|
8
|
+
* This utility can be used regardless of the RESTApp allows requests or not!
|
|
9
|
+
* Verb/method restrictions (GET/POST/PUT/DELETE) specified for the RESTApp will be respected.
|
|
10
|
+
* </p>
|
|
11
|
+
*
|
|
12
|
+
* <div id="options">
|
|
13
|
+
* <h3>RESTApp invocation</h3>
|
|
14
|
+
* <p>
|
|
15
|
+
* This utility has methods to server-side invoke a specific RESTApp that resides on the same site as this code is executed.
|
|
16
|
+
* Each method requires that a <em>route</em> is specified. Each method also allows for <em>options</em> to be passed to the RESTApp
|
|
17
|
+
* so it can do its job properly. Each method returns an object with the result of the RESTApp invocation.
|
|
18
|
+
* </p>
|
|
19
|
+
* <h4>Options</h4>
|
|
20
|
+
* <ul>
|
|
21
|
+
* <li>
|
|
22
|
+
* <strong>headers</strong> <em>(key/value object)</em> [optional]
|
|
23
|
+
* - request headers to pass to the invoking RESTApp.
|
|
24
|
+
* </li>
|
|
25
|
+
* <li>
|
|
26
|
+
* <strong><em><name></em></strong> <em>(key/value object)</em> [optional, RESTApp dependant]
|
|
27
|
+
* - named parameters/data/files to pass to the invoking RESTApp.
|
|
28
|
+
* </li>
|
|
29
|
+
* </ul>
|
|
30
|
+
* <h4>Result</h4>
|
|
31
|
+
* <ul>
|
|
32
|
+
* <li>
|
|
33
|
+
* <strong>statusCode</strong> <em>(integer)</em>
|
|
34
|
+
* - the http status code.
|
|
35
|
+
* </li>
|
|
36
|
+
* <li>
|
|
37
|
+
* <strong>statusMessage</strong> <em>(string)</em>
|
|
38
|
+
* - the status code message or error message.
|
|
39
|
+
* </li>
|
|
40
|
+
* <li>
|
|
41
|
+
* <strong>headers</strong> <em>(key/value object)</em> [optional, RESTApp dependant]
|
|
42
|
+
* - potential response headers set by the invoked RESTApp.
|
|
43
|
+
* </li>
|
|
44
|
+
* <li>
|
|
45
|
+
* <strong>body</strong> - [optional, RESTApp dependant]
|
|
46
|
+
* - potential result set by the invoked RESTApp:
|
|
47
|
+
* <ul>
|
|
48
|
+
* <li>
|
|
49
|
+
* {@link javax.jcr.Node} (of type sv:file, sv:image or sv:temporaryFileNode) if the RESTApp executes
|
|
50
|
+
* <code>
|
|
51
|
+
* <a href="https://developer.sitevision.se/docs/rest-api/restapps/index.js#h-ressendFilefile" target="_blank">res.sendFile</a>
|
|
52
|
+
* </code>
|
|
53
|
+
* </li>
|
|
54
|
+
* <li>
|
|
55
|
+
* <code>object</code> if the RESTApp executes
|
|
56
|
+
* <code>
|
|
57
|
+
* <a href="https://developer.sitevision.se/docs/rest-api/restapps/index.js#h-resjsonresponse" target="_blank">res.json</a>
|
|
58
|
+
* </code>
|
|
59
|
+
* </li>
|
|
60
|
+
* <li>
|
|
61
|
+
* <code>string</code> if the RESTApp executes
|
|
62
|
+
* <code>
|
|
63
|
+
* <a href="https://developer.sitevision.se/docs/rest-api/restapps/index.js#h-ressendresponse" target="_blank">res.send</a>
|
|
64
|
+
* </code>
|
|
65
|
+
* </li>
|
|
66
|
+
* </ul>
|
|
67
|
+
* </li>
|
|
68
|
+
* </ul>
|
|
69
|
+
* </div>
|
|
70
|
+
*
|
|
71
|
+
* <h3>Basic GET example</h3>
|
|
72
|
+
* <p>
|
|
73
|
+
* Below is an example of how to use the RestAppInvoker utility to execute a GET on the items route of a RESTApp.
|
|
74
|
+
* </p><pre><code> var restAppInvokerFactory = require('RestAppInvokerFactory'),
|
|
75
|
+
* restApp = restAppInvokerFactory.fromPath('/rest-api/my-rest-app'),
|
|
76
|
+
* result;
|
|
77
|
+
*
|
|
78
|
+
* if (restApp) {
|
|
79
|
+
* result = restApp.get('/items', {count:5});
|
|
80
|
+
* if (result.statusCode === 200) {
|
|
81
|
+
* <em>// Handle valid result ...</em>
|
|
82
|
+
* result.body ...
|
|
83
|
+
* } else {
|
|
84
|
+
* <em>// Handle other/error result ...</em>
|
|
85
|
+
* }
|
|
86
|
+
* }</code></pre>
|
|
87
|
+
*
|
|
88
|
+
* <h3>Basic POST example</h3>
|
|
89
|
+
* <p>
|
|
90
|
+
* Below is an example of how to use the RestAppInvoker utility to execute a POST on the addfile route of a RESTApp.
|
|
91
|
+
* </p><pre><code> var restAppInvokerFactory = require('RestAppInvokerFactory'),
|
|
92
|
+
* restApp = restAppInvokerFactory.fromPath('/rest-api/my-rest-app'),
|
|
93
|
+
* fileNode,
|
|
94
|
+
* options,
|
|
95
|
+
* result;
|
|
96
|
+
*
|
|
97
|
+
* if (restApp) {
|
|
98
|
+
* fileNode = ... <em>// Get the JCR file Node (sv:file, sv:image) to pass to the RESTApp</em>
|
|
99
|
+
*
|
|
100
|
+
* options = {
|
|
101
|
+
* headers: {
|
|
102
|
+
* 'X-custom-header': 'Custom value'
|
|
103
|
+
* },
|
|
104
|
+
* spreadsheet: fileNode,
|
|
105
|
+
* sendMail: true,
|
|
106
|
+
* customerId: 'abc123'
|
|
107
|
+
* };
|
|
108
|
+
*
|
|
109
|
+
* result = restApp.post('/addfile', options);
|
|
110
|
+
* if (result.statusCode === 200) {
|
|
111
|
+
* <em>// Handle valid result ...</em>
|
|
112
|
+
* result.body ...
|
|
113
|
+
* } else {
|
|
114
|
+
* <em>// Handle other/error result ...</em>
|
|
115
|
+
* }
|
|
116
|
+
* }</code></pre>
|
|
117
|
+
*
|
|
118
|
+
* <p>
|
|
119
|
+
* <strong>REST siblings note!</strong>
|
|
120
|
+
* </p>
|
|
121
|
+
* <ul>
|
|
122
|
+
* <li>
|
|
123
|
+
* Server-side invoke of the <em>local Sitevision REST API</em> should typically be handled via
|
|
124
|
+
* {@link senselogic.sitevision.api.script.RestApi}.
|
|
125
|
+
* </li>
|
|
126
|
+
* <li>
|
|
127
|
+
* Invoking <em>external REST API:s</em> should typically be handled via
|
|
128
|
+
* {@link senselogic.sitevision.api.script.Requester}.
|
|
129
|
+
* </li>
|
|
130
|
+
* </ul>
|
|
131
|
+
*
|
|
132
|
+
* <p>
|
|
133
|
+
* An instance of the Sitevision class implementing this interface can be obtained via a method in
|
|
134
|
+
* {@link RestAppInvokerFactory}.
|
|
135
|
+
* </p>Executes GET for a route of the RESTApp.
|
|
136
|
+
*
|
|
137
|
+
* <p>
|
|
138
|
+
* <em>REST hint!</em> A <em>get</em> typically indicates a <em>read</em> of something.
|
|
139
|
+
* </p>Executes GET with options for a route of the RESTApp.
|
|
140
|
+
*
|
|
141
|
+
* <p>
|
|
142
|
+
* <em>REST hint!</em> A <em>get</em> typically indicates a <em>read</em> of something.
|
|
143
|
+
* </p>Executes POST for a route of the RESTApp.
|
|
144
|
+
*
|
|
145
|
+
* <p>
|
|
146
|
+
* <em>REST hint!</em> A <em>post</em> typically indicates the <em>creation</em> of something.
|
|
147
|
+
* </p>Executes POST with options for a route of the RESTApp.
|
|
148
|
+
*
|
|
149
|
+
* <p>
|
|
150
|
+
* <em>REST hint!</em> A <em>post</em> typically indicates the <em>creation</em> of something.
|
|
151
|
+
* </p>Executes PUT for a route of the RESTApp.
|
|
152
|
+
*
|
|
153
|
+
* <p>
|
|
154
|
+
* <em>REST hint!</em> A <em>put</em> typically indicates an <em>update</em> of something.
|
|
155
|
+
* </p>Executes PUT with options for a route of the RESTApp.
|
|
156
|
+
*
|
|
157
|
+
* <p>
|
|
158
|
+
* <em>REST hint!</em> A <em>put</em> typically indicates an <em>update</em> of something.
|
|
159
|
+
* </p>Executes DELETE for a route of the RESTApp.
|
|
160
|
+
*
|
|
161
|
+
* <p>
|
|
162
|
+
* <em>REST hint!</em> A <em>delete</em> typically indicates a <em>removal</em> of something.
|
|
163
|
+
* </p>Executes DELETE with options for a route of the RESTApp.
|
|
164
|
+
*
|
|
165
|
+
* <p>
|
|
166
|
+
* <em>REST hint!</em> A <em>delete</em> typically indicates a <em>removal</em> of something.
|
|
167
|
+
* </p>
|
|
168
|
+
* @param <O> script object
|
|
169
|
+
* @author Magnus Lövgren
|
|
170
|
+
* @since Sitevision 7
|
|
171
|
+
* @see senselogic.sitevision.api.script.RestApi
|
|
172
|
+
* @see senselogic.sitevision.api.script.Requester
|
|
173
|
+
*/
|
|
174
|
+
interface RestAppInvoker {
|
|
175
|
+
/**
|
|
176
|
+
* Executes GET for a route of the RESTApp.
|
|
177
|
+
*
|
|
178
|
+
* <p>
|
|
179
|
+
* <em>REST hint!</em> A <em>get</em> typically indicates a <em>read</em> of something.
|
|
180
|
+
* </p>
|
|
181
|
+
* @param aRoute a route
|
|
182
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
183
|
+
* @see #get(String, Object)
|
|
184
|
+
*/
|
|
185
|
+
get(aRoute: string): unknown;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Executes GET with options for a route of the RESTApp.
|
|
189
|
+
*
|
|
190
|
+
* <p>
|
|
191
|
+
* <em>REST hint!</em> A <em>get</em> typically indicates a <em>read</em> of something.
|
|
192
|
+
* </p>
|
|
193
|
+
* @param aRoute a route
|
|
194
|
+
* @param aOptions a options
|
|
195
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
196
|
+
*/
|
|
197
|
+
get(aRoute: string, aOptions: unknown): unknown;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Executes POST for a route of the RESTApp.
|
|
201
|
+
*
|
|
202
|
+
* <p>
|
|
203
|
+
* <em>REST hint!</em> A <em>post</em> typically indicates the <em>creation</em> of something.
|
|
204
|
+
* </p>
|
|
205
|
+
* @param aRoute a route
|
|
206
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
207
|
+
* @see #post(String, Object)
|
|
208
|
+
*/
|
|
209
|
+
post(aRoute: string): unknown;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Executes POST with options for a route of the RESTApp.
|
|
213
|
+
*
|
|
214
|
+
* <p>
|
|
215
|
+
* <em>REST hint!</em> A <em>post</em> typically indicates the <em>creation</em> of something.
|
|
216
|
+
* </p>
|
|
217
|
+
* @param aRoute a route
|
|
218
|
+
* @param aOptions a options
|
|
219
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
220
|
+
*/
|
|
221
|
+
post(aRoute: string, aOptions: unknown): unknown;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Executes PUT for a route of the RESTApp.
|
|
225
|
+
*
|
|
226
|
+
* <p>
|
|
227
|
+
* <em>REST hint!</em> A <em>put</em> typically indicates an <em>update</em> of something.
|
|
228
|
+
* </p>
|
|
229
|
+
* @param aRoute a route
|
|
230
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
231
|
+
* @see #put(String, Object)
|
|
232
|
+
*/
|
|
233
|
+
put(aRoute: string): unknown;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Executes PUT with options for a route of the RESTApp.
|
|
237
|
+
*
|
|
238
|
+
* <p>
|
|
239
|
+
* <em>REST hint!</em> A <em>put</em> typically indicates an <em>update</em> of something.
|
|
240
|
+
* </p>
|
|
241
|
+
* @param aRoute a route
|
|
242
|
+
* @param aOptions a options
|
|
243
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
244
|
+
*/
|
|
245
|
+
put(aRoute: string, aOptions: unknown): unknown;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Executes DELETE for a route of the RESTApp.
|
|
249
|
+
*
|
|
250
|
+
* <p>
|
|
251
|
+
* <em>REST hint!</em> A <em>delete</em> typically indicates a <em>removal</em> of something.
|
|
252
|
+
* </p>
|
|
253
|
+
* @param aRoute a route
|
|
254
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
255
|
+
* @see #delete(String, Object)
|
|
256
|
+
*/
|
|
257
|
+
delete(aRoute: string): unknown;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Executes DELETE with options for a route of the RESTApp.
|
|
261
|
+
*
|
|
262
|
+
* <p>
|
|
263
|
+
* <em>REST hint!</em> A <em>delete</em> typically indicates a <em>removal</em> of something.
|
|
264
|
+
* </p>
|
|
265
|
+
* @param aRoute a route
|
|
266
|
+
* @param aOptions a options
|
|
267
|
+
* @return a script object representing the response (properties: headers, statusCode, statusMessage, body)
|
|
268
|
+
*/
|
|
269
|
+
delete(aRoute: string, aOptions: unknown): unknown;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
export default RestAppInvoker;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This interface is a representation of a constructor argument (it's value and type) that can be used to
|
|
3
|
+
* create Java object instances via {@link InstanceCreatorUtil}.
|
|
4
|
+
*
|
|
5
|
+
* <p>
|
|
6
|
+
* An instance of the Sitevision class implementing this interface can be obtained via any of these methods:
|
|
7
|
+
* </p>
|
|
8
|
+
* <ul>
|
|
9
|
+
* <li>{@link InstanceCreatorUtil#getBooleanArgument(boolean)}</li>
|
|
10
|
+
* <li>{@link InstanceCreatorUtil#getByteArgument(byte)}</li>
|
|
11
|
+
* <li>{@link InstanceCreatorUtil#getCharArgument(char)}</li>
|
|
12
|
+
* <li>{@link InstanceCreatorUtil#getCustomArgument(String, Object)}</li>
|
|
13
|
+
* <li>{@link InstanceCreatorUtil#getDoubleArgument(double)}</li>
|
|
14
|
+
* <li>{@link InstanceCreatorUtil#getEnumArgument(String, Object)}</li>
|
|
15
|
+
* <li>{@link InstanceCreatorUtil#getFloatArgument(float)}</li>
|
|
16
|
+
* <li>{@link InstanceCreatorUtil#getIntArgument(int)}</li>
|
|
17
|
+
* <li>{@link InstanceCreatorUtil#getLongArgument(long)}</li>
|
|
18
|
+
* <li>{@link InstanceCreatorUtil#getNullArgument(String)}</li>
|
|
19
|
+
* <li>{@link InstanceCreatorUtil#getObjectArgument(Object)}</li>
|
|
20
|
+
* <li>{@link InstanceCreatorUtil#getShortArgument(short)}</li>
|
|
21
|
+
* </ul>
|
|
22
|
+
*
|
|
23
|
+
* <p>
|
|
24
|
+
* See {@link InstanceCreatorUtil} for how to obtain an instance of the <code>InstanceCreatorUtil</code> interface.
|
|
25
|
+
* </p>Gets the argument class.Gets the argument value.
|
|
26
|
+
* @author Magnus Lövgren
|
|
27
|
+
* @since Sitevision 3.1
|
|
28
|
+
*/
|
|
29
|
+
interface TypedArgument {
|
|
30
|
+
/**
|
|
31
|
+
* Gets the argument class.
|
|
32
|
+
* @return the class of the argument
|
|
33
|
+
*/
|
|
34
|
+
getType(): unknown;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Gets the argument value.
|
|
38
|
+
* @return the value of the argument
|
|
39
|
+
*/
|
|
40
|
+
getValue(): unknown;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default TypedArgument;
|
package/hidden/senselogic/sitevision/api/script/proxy/ExceptionSuppressingCollection/index.d.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decorates the iterator of a collection with a {@link ExceptionSuppressingIterator} to ensure exceptions are suppressed for all
|
|
3
|
+
* iterator invocations.
|
|
4
|
+
*
|
|
5
|
+
* <p>
|
|
6
|
+
* The sole purpose of the <code>ExceptionSuppressingCollection</code> is to provide easy access to a decorated iterator
|
|
7
|
+
* (i.e. an {@link ExceptionSuppressingIterator}). You should <em>not</em> create a collection of exception suppressing proxys
|
|
8
|
+
* (i.e. <code>Collection<ExceptionSuppressingProxy></code>) yourself. You should use <code>ExceptionSuppressingCollection</code>
|
|
9
|
+
* with your "regular" collection since the actual proxying is done by the iterator itself.
|
|
10
|
+
* </p>
|
|
11
|
+
* <p>
|
|
12
|
+
* Note that the <code>next</code> method of the interator returns an instance of a <em>Dynamic proxy</em> so not all methods can be invoked
|
|
13
|
+
* directly on the returned object. To invoke a method that is not proxied (i.e. a method not declared in an interface the object implements),
|
|
14
|
+
* you must extract the "real" object from the proxy and use that reference when invoking the method. See {@link ExceptionSuppressingIterator}
|
|
15
|
+
* for more information about the iterator and {@link ExceptionSuppressingProxy} for more information about dynamic proxies and how to extract
|
|
16
|
+
* "real" object.
|
|
17
|
+
* </p>
|
|
18
|
+
*
|
|
19
|
+
* <p>
|
|
20
|
+
* <strong>Important note! </strong>This interface is intended to be used <em>only</em> in contexts where exceptions when iterating a
|
|
21
|
+
* collection will cause <em>serious</em> trouble if they arise and the context doesn't provide proper exception handling
|
|
22
|
+
* (e.g. when rendering a Velocity template). Suppressing exceptions is generally a bad idea and using this decorator will affect performance.
|
|
23
|
+
* Hence, this interface should only be used where the upsides with suppressing exceptions outweighs the downsides.
|
|
24
|
+
* This interface should be used only as a temporary patch/solution until the "real" problem causing the exception has been solved.
|
|
25
|
+
* </p>
|
|
26
|
+
*
|
|
27
|
+
* <p>
|
|
28
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
29
|
+
* {@link senselogic.sitevision.api.Utils#getExceptionSuppressingCollection(java.util.Collection)}.
|
|
30
|
+
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
|
|
31
|
+
* </p>
|
|
32
|
+
*
|
|
33
|
+
* <p>
|
|
34
|
+
* ----------------------------------------------------------------------------------------------------
|
|
35
|
+
* </p>
|
|
36
|
+
*
|
|
37
|
+
* <p>
|
|
38
|
+
* <strong>Example of how <code>ExceptionSuppressingCollection</code> could be used in Velocity:</strong>
|
|
39
|
+
* </p>
|
|
40
|
+
*
|
|
41
|
+
* <p>Case description:</p>
|
|
42
|
+
* <p>
|
|
43
|
+
* <em>You have a Velocity template where you iterate a collection. Sometimes a certain method throws an exception.
|
|
44
|
+
* The rendered output of the template gets corrupt whenever an exception is thrown and you have not yet tracked down the root
|
|
45
|
+
* cause of the exception. Until the root cause is found and the problem is fixed, you need a temporary solution that ignores
|
|
46
|
+
* exceptions to keep template output acceptable. Since the method is declared in an interface and implemented in the instance
|
|
47
|
+
* you're invoking, you're in sheer luck. You can decorate your collection with a <code>ExceptionSuppressingCollection</code>
|
|
48
|
+
* to get a decorated iterator. When interating, all returned elements are proxied by an <code>ExceptionSuppressingProxy</code>.
|
|
49
|
+
* Invoking the method through the proxy will suppress exceptions and you can diminish the output problems.
|
|
50
|
+
* Note that you should invoke the real object for all non-problematic methods and methods that can't be proxied
|
|
51
|
+
* (i.e. methods not declared in an interface). To get a reference to the real object,
|
|
52
|
+
* use {@link ExceptionSuppressingProxy#getProxiedObject()}.</em>
|
|
53
|
+
* </p>
|
|
54
|
+
* <p>
|
|
55
|
+
* This is what the code looks like before your temporary fix:
|
|
56
|
+
* </p>
|
|
57
|
+
* <pre><code>
|
|
58
|
+
* #foreach ($item in $myCollection)
|
|
59
|
+
* <p>
|
|
60
|
+
* $item.thisNeverThrowsExceptions()
|
|
61
|
+
* $item.thisMethodSometimesThrowsExceptions()
|
|
62
|
+
* </p>
|
|
63
|
+
* #end
|
|
64
|
+
* </code></pre>
|
|
65
|
+
* <p>
|
|
66
|
+
* This is how you could use an <code>ExceptionSuppressingCollection</code> to apply a temporary fix:
|
|
67
|
+
* </p>
|
|
68
|
+
* <pre><code>
|
|
69
|
+
* <em>## Decorate collection</em>
|
|
70
|
+
* #set ($decoratedCollection = $sitevisionUtils.getExceptionSuppressingCollection($myCollection))
|
|
71
|
+
*
|
|
72
|
+
* #foreach ($item in $decoratedCollection)
|
|
73
|
+
* <p>
|
|
74
|
+
* <em>## Get the real object and invoke non-problematic method as usual</em>
|
|
75
|
+
* #set ($realObject = $item.getProxiedObject())
|
|
76
|
+
*
|
|
77
|
+
* $realObject.thisNeverThrowsExceptions()
|
|
78
|
+
* $!item.thisMethodSometimesThrowsExceptions() <em>## Executed through a proxy, might return null</em>
|
|
79
|
+
* </p>
|
|
80
|
+
* #end
|
|
81
|
+
* </p>
|
|
82
|
+
* </code></pre>Returns an exception suppressing iterator that ensures no exceptions will be thrown during iteration.
|
|
83
|
+
* @author Magnus Lövgren
|
|
84
|
+
* @since Sitevision 2.6.1_09
|
|
85
|
+
*/
|
|
86
|
+
interface ExceptionSuppressingCollection {
|
|
87
|
+
/**
|
|
88
|
+
* Returns an exception suppressing iterator that ensures no exceptions will be thrown during iteration.
|
|
89
|
+
* @return a {@link ExceptionSuppressingIterator} that suppresses exceptions and returns proxied items
|
|
90
|
+
*/
|
|
91
|
+
iterator(): unknown;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export default ExceptionSuppressingCollection;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import ExceptionSuppressingProxy from "../ExceptionSuppressingProxy";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decorates an iterator with exception suppressing behaviour and returns {@link ExceptionSuppressingProxy}s in order to ensure that no
|
|
5
|
+
* invocation will throw an exception.
|
|
6
|
+
*
|
|
7
|
+
* <p>
|
|
8
|
+
* This iterator is of type <code>ExceptionSuppressingProxy</code> that is an implementation of a <em>Dynamic proxy</em> so not all
|
|
9
|
+
* methods can be directly invoked on objects retrieved by the <code>next</code> method. See {@link ExceptionSuppressingCollection}
|
|
10
|
+
* for an example of how this iterator can be used easily from Velocity and how to invoke methods not declared in an interface.
|
|
11
|
+
* See {@link ExceptionSuppressingProxy} for more information about dynamic proxies.
|
|
12
|
+
* </p>
|
|
13
|
+
* <p>
|
|
14
|
+
* <strong>Important note! </strong>This interface is intended to be used <em>only</em> in contexts where exceptions thrown during iteration will
|
|
15
|
+
* cause <em>serious</em> trouble if they arise and the context doesn't provide proper exception handling (e.g. when executing a Velocity template).
|
|
16
|
+
* Suppressing exceptions is generally a bad idea and using this iterator will affect performance.
|
|
17
|
+
* Hence, this interface should only be used where the upsides with suppressing exceptions far outweighs the downsides.
|
|
18
|
+
* This interface should be used only as a temporary patch/solution until the "real" problem causing the exception has been solved.
|
|
19
|
+
* </p>
|
|
20
|
+
*
|
|
21
|
+
* <p>
|
|
22
|
+
* An instance of the Sitevision class implementing this interface can be obtained directly via
|
|
23
|
+
* {@link senselogic.sitevision.api.Utils#getExceptionSuppressingIterator(java.util.Iterator)}
|
|
24
|
+
* or indirectly via {@link senselogic.sitevision.api.Utils#getExceptionSuppressingCollection(java.util.Collection)}.
|
|
25
|
+
* You would typically use the latter if you should iterate a collection with the Velocity #foreach loop.
|
|
26
|
+
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
|
|
27
|
+
* </p>Returns <code>true</code> if decorated iterator has more elements. (In other words, returns <code>true</code>
|
|
28
|
+
* if <code>next</code> would return an element rather than throwing an exception.)
|
|
29
|
+
*
|
|
30
|
+
* <p>
|
|
31
|
+
* This method will never throw an exception
|
|
32
|
+
* </p>Returns a proxy for the next element of the decorated iterator. Calling this method repeatedly until the {@link #hasNext()} method
|
|
33
|
+
* returns <code>false</code> will return each element in the underlying collection exactly once.
|
|
34
|
+
*
|
|
35
|
+
* <p>
|
|
36
|
+
* <strong>Note!</strong> The returned element will be embedded in an <code>ExceptionSuppressingProxy</code> that will be reused for
|
|
37
|
+
* <em>all</em> next() invocations on this iterator. In other words, the proxied item of the returned element will change,
|
|
38
|
+
* but never the returned element itself. This implies that you shouldn't keep references to an item retrieved from a next()
|
|
39
|
+
* invocation during iteration. If you do, don't be surprised if the element contains something else than it did when you set the reference...
|
|
40
|
+
* </p>
|
|
41
|
+
*
|
|
42
|
+
* <p>
|
|
43
|
+
* This method will never throw an exception.
|
|
44
|
+
* </p>
|
|
45
|
+
* <p>
|
|
46
|
+
* <strong>Note! </strong>Be aware of <code>null</code> items since they're never proxied. If the underlying collection contains a
|
|
47
|
+
* <code>null</code> item, this iterator will just return <code>null</code>, not a proxy. In other words: even though this method
|
|
48
|
+
* won't throw any exceptions, invoking a method on the returned object might throw a <code>NullPointerException</code>.
|
|
49
|
+
* </p>Tries to remove from the underlying collection the last element returned by decorated iterator (optional operation).
|
|
50
|
+
* This method can be called only once per call to <code>next</code>. The behavior of an iterator is unspecified if
|
|
51
|
+
* the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
|
|
52
|
+
*
|
|
53
|
+
* <p>
|
|
54
|
+
* This method will never throw an exception.
|
|
55
|
+
* </p>
|
|
56
|
+
* <p>
|
|
57
|
+
* <strong>Note!</strong> Since exceptions are suppressed, you can never tell if the remove operation actually succeeded
|
|
58
|
+
* or if the underlying collection doesn't support removal (i.e. <code>UnsupportedOperationException</code> thrown by the
|
|
59
|
+
* decorated iterator is catched by this iterator).
|
|
60
|
+
* </p>
|
|
61
|
+
* @author Magnus Lövgren
|
|
62
|
+
* @since Sitevision 2.6.1_09
|
|
63
|
+
*/
|
|
64
|
+
interface ExceptionSuppressingIterator {
|
|
65
|
+
/**
|
|
66
|
+
* Returns <code>true</code> if decorated iterator has more elements. (In other words, returns <code>true</code>
|
|
67
|
+
* if <code>next</code> would return an element rather than throwing an exception.)
|
|
68
|
+
*
|
|
69
|
+
* <p>
|
|
70
|
+
* This method will never throw an exception
|
|
71
|
+
* </p>
|
|
72
|
+
* @return <code>true</code> if the decorated iterator has more elements, <code>false</code> if not or if an exception is thrown by the decorated iterator
|
|
73
|
+
*/
|
|
74
|
+
hasNext(): boolean;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Returns a proxy for the next element of the decorated iterator. Calling this method repeatedly until the {@link #hasNext()} method
|
|
78
|
+
* returns <code>false</code> will return each element in the underlying collection exactly once.
|
|
79
|
+
*
|
|
80
|
+
* <p>
|
|
81
|
+
* <strong>Note!</strong> The returned element will be embedded in an <code>ExceptionSuppressingProxy</code> that will be reused for
|
|
82
|
+
* <em>all</em> next() invocations on this iterator. In other words, the proxied item of the returned element will change,
|
|
83
|
+
* but never the returned element itself. This implies that you shouldn't keep references to an item retrieved from a next()
|
|
84
|
+
* invocation during iteration. If you do, don't be surprised if the element contains something else than it did when you set the reference...
|
|
85
|
+
* </p>
|
|
86
|
+
*
|
|
87
|
+
* <p>
|
|
88
|
+
* This method will never throw an exception.
|
|
89
|
+
* </p>
|
|
90
|
+
* <p>
|
|
91
|
+
* <strong>Note! </strong>Be aware of <code>null</code> items since they're never proxied. If the underlying collection contains a
|
|
92
|
+
* <code>null</code> item, this iterator will just return <code>null</code>, not a proxy. In other words: even though this method
|
|
93
|
+
* won't throw any exceptions, invoking a method on the returned object might throw a <code>NullPointerException</code>.
|
|
94
|
+
* </p>
|
|
95
|
+
* @return the next element, or <code>null</code> if an exception is thrown.
|
|
96
|
+
*/
|
|
97
|
+
next(): ExceptionSuppressingProxy;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Tries to remove from the underlying collection the last element returned by decorated iterator (optional operation).
|
|
101
|
+
* This method can be called only once per call to <code>next</code>. The behavior of an iterator is unspecified if
|
|
102
|
+
* the underlying collection is modified while the iteration is in progress in any way other than by calling this method.
|
|
103
|
+
*
|
|
104
|
+
* <p>
|
|
105
|
+
* This method will never throw an exception.
|
|
106
|
+
* </p>
|
|
107
|
+
* <p>
|
|
108
|
+
* <strong>Note!</strong> Since exceptions are suppressed, you can never tell if the remove operation actually succeeded
|
|
109
|
+
* or if the underlying collection doesn't support removal (i.e. <code>UnsupportedOperationException</code> thrown by the
|
|
110
|
+
* decorated iterator is catched by this iterator).
|
|
111
|
+
* </p>
|
|
112
|
+
|
|
113
|
+
*/
|
|
114
|
+
remove(): void;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export default ExceptionSuppressingIterator;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Proxies an object and delegates all interface method invocations to the proxied object in order to ensure that no invocation
|
|
3
|
+
* will throw an exception.
|
|
4
|
+
*
|
|
5
|
+
* <p>
|
|
6
|
+
* This interface is an exception suppressing implementation of a so called
|
|
7
|
+
* <em><a href="http://docs.oracle.com/javase/8/docs/technotes/guides/reflection/proxy.html">Dynamic proxy</a></em>.
|
|
8
|
+
* This means it will proxy all methods of an object that are declared in an interface implemented by the object.
|
|
9
|
+
* If a method invocation through this proxy throws an <code>Exception</code>, it will be catched and the default value will be returned
|
|
10
|
+
* (e.g. <code>null</code>, <code>0</code>, <code>false</code> etc).
|
|
11
|
+
* </p>
|
|
12
|
+
*
|
|
13
|
+
* <p>
|
|
14
|
+
* <strong>Important note! </strong>This interface is intended to be used <em>only</em> in contexts where exceptions will cause <em>serious</em>
|
|
15
|
+
* trouble if they arise and the context doesn't provide proper exception handling (e.g. when executing a Velocity template).
|
|
16
|
+
* Suppressing exceptions is generally a <em>really</em> bad idea and using this proxy will affect performance.
|
|
17
|
+
* Hence, this interface should only be used where the upsides with suppressing exceptions far outweighs the downsides.
|
|
18
|
+
* This interface should be used only as a temporary patch/solution until the "real" problem causing the exception has been solved.
|
|
19
|
+
* </p>
|
|
20
|
+
*
|
|
21
|
+
* <p>
|
|
22
|
+
* The state of an ExceptionSuppressingProxy is available at all times and updated for each method invocation
|
|
23
|
+
* (except for invocations of methods declared in this interface).
|
|
24
|
+
* If last method invocation resulted in a thrown exception the proxy status will be {@link #EXCEPTION_THROWN_STATUS}
|
|
25
|
+
* and the exception will be available via {@link #getCurrentException()}.
|
|
26
|
+
* </p>
|
|
27
|
+
*
|
|
28
|
+
* <p>
|
|
29
|
+
* An instance of the Sitevision class implementing this interface can be obtained via
|
|
30
|
+
* {@link senselogic.sitevision.api.Utils#getExceptionSuppressingProxy(Object)}.
|
|
31
|
+
* See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
|
|
32
|
+
* </p>
|
|
33
|
+
*
|
|
34
|
+
* <p>
|
|
35
|
+
* ----------------------------------------------------------------------------------------------------
|
|
36
|
+
* </p>
|
|
37
|
+
*
|
|
38
|
+
* <p>
|
|
39
|
+
* <strong>Example of how <code>ExceptionSuppressingProxy</code> could be used in Velocity:</strong>
|
|
40
|
+
* </p>
|
|
41
|
+
*
|
|
42
|
+
* <p>Case description:</p>
|
|
43
|
+
* <p>
|
|
44
|
+
* <em>You have a Velocity template where a certain method invocation sometimes throws an exception.
|
|
45
|
+
* The rendered output of the template gets corrupt whenever an exception is thrown and you have not yet tracked down the root cause
|
|
46
|
+
* of the exception. Until the root cause is found and the problem is fixed, you need a temporary solution that ignores exceptions
|
|
47
|
+
* to keep template output acceptable. Since the method is declared in an interface and implemented in the instance you're invoking,
|
|
48
|
+
* you're in sheer luck. You can use an <code>ExceptionSuppressingProxy</code> to suppress exceptions in order to diminish output
|
|
49
|
+
* problems.</em><p>This is what the code looks like before your temporary fix:
|
|
50
|
+
* </p>
|
|
51
|
+
* <pre><code>
|
|
52
|
+
* <p>
|
|
53
|
+
* $myObject.thisNeverThrowsExceptions()
|
|
54
|
+
* $myObject.thisMethodSometimesThrowsExceptions() <em>## This method is declared in an interface, hence can be proxied</em>
|
|
55
|
+
* </p>
|
|
56
|
+
* </code></pre>
|
|
57
|
+
* This is how you could use an <code>ExceptionSuppressingProxy</code> to apply a temporary fix:<pre><code>
|
|
58
|
+
* <p>
|
|
59
|
+
* $myObject.thisNeverThrowsExceptions()
|
|
60
|
+
*
|
|
61
|
+
* <em>## Get an ExceptionSuppressingProxy instance for myObject</em>
|
|
62
|
+
* #set ($proxy = $sitevisionUtils.getExceptionSuppressingProxy($myObject))
|
|
63
|
+
*
|
|
64
|
+
* $!proxy.thisMethodSometimesThrowsExceptions() <em>## Method invoked through a proxy, might return null</em>
|
|
65
|
+
* </p>
|
|
66
|
+
* </code></pre>Returns current statusReturns the exception that was thrown during last method invocation of the proxied object.Returns the proxied objectThe status indicating that this proxy has no object set, nothing to proxy.The status indicating that last method invocation did not throw an exception.The status indicating that last method invocation did throw an exception
|
|
67
|
+
* @author Magnus Lövgren
|
|
68
|
+
* @since Sitevision 2.6.1_09
|
|
69
|
+
*/
|
|
70
|
+
interface ExceptionSuppressingProxy {
|
|
71
|
+
/**
|
|
72
|
+
* Returns current status
|
|
73
|
+
* @return {@link #NO_OBJECT_PROXIED_STATUS} or {@link #NO_EXCEPTION_THROWN_STATUS} or {@link #EXCEPTION_THROWN_STATUS}
|
|
74
|
+
*/
|
|
75
|
+
getCurrentStatus(): number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Returns the exception that was thrown during last method invocation of the proxied object.
|
|
79
|
+
* @return the exception thrown during last method invocation, or <code>null</code> if no exeption was thrown
|
|
80
|
+
*/
|
|
81
|
+
getCurrentException(): unknown;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Returns the proxied object
|
|
85
|
+
* @return the object that is proxied by an instance of this interface, or <code>null</code> if no proxied object is set
|
|
86
|
+
*/
|
|
87
|
+
getProxiedObject(): unknown;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default ExceptionSuppressingProxy;
|