/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Resolver } from "../../types/senselogic/sitevision/api/base/Resolver"; /** * Node resolver utility interface. * @author Magnus Lövgren * @since Sitevision 4.1 */ export interface NodeResolverUtil { /** * Gets the Calendar resolver for Collaboration-related nodes. * *
* This is a convenience resolver that uses the {@link #getCollaborationDateResolver()} to resolve a Date
* from a Node and then convert it to a Calendar.
*
* Note! Calendar implements Comparable so this resolver can be used
* to get a Comparator using {@link NodeComparatorUtil#getResolverComparator(Resolver)}.
*
* Types
* The Date value will be resolved differently for different node types.
* For some types it will potentially do multiple checks and return the first found of them
* (i.e. first check that has a non-null Date value).
*
sv:userIdentity
* sv:collaborationGroup
* sv:collaborationGroupPage of the group was last published.sv:collaborationGroupPage of the group was last modified.sv:collaborationGroupPage of the group was created.sv:collaborationGroupPage
* sv:collaborationGroup of the collaboration group page had it's last activity
* e.g. new entry or a modified file.
* sv:collaborationGroupTemplate
* sv:collaborationGroupFolder
* * This resolver also supports some non-collaboration node types: *
*sv:page, sv:article, sv:sitePage, sv:link, sv:template,
* sv:structurePage, sv:structureLink
* sv:image, sv:file, sv:folder, sv:structureFolder
*
* Unsupported node types will resolve to null.
*
* Example
*
This server-side Javascript code demonstrates how to get the "last updated" Date from av sv:collaborationGroup.
*
// Use NodeResolverUtil to get the Date resolver for Collaboration Nodes
* var nodeResolverUtil = require('NodeResolverUtil'),
* collaborationDateResolver = nodeResolverUtil.getCollaborationDateResolver(),
* collaborationGroup,
* lastUpdated;
*
* // Get the sv:collaborationGroup Node...
* collaborationGroup = ...
*
* // Use the resolver to get (i.e. resolve) the "last updated" Date of the Collaboration group
* lastUpdated = collaborationDateResolver.resolve(collaborationGroup);
*
*
* Sorting tip!
* Date implements Comparable so this resolver can be used
* to get a Comparator using {@link NodeComparatorUtil#getResolverComparator(Resolver)}.
* This resolver and the resolver comparator can be helpful when you want to sort a collection of
* sv:collaborationGroup nodes in "most active" order.
*
* This is a convenience resolver that uses the {@link #getVersionedDateResolver()} to resolve a Date
* from a Node and then convert it to a Calendar.
*
* Note! Calendar implements Comparable so this resolver can be used
* to get a Comparator using {@link NodeComparatorUtil#getResolverComparator(Resolver)}.
*
* Types and versions
* The Date value will be resolved differently for different node types in different versions.
* For some types it will potentially do multiple checks and return the first found of them
* (i.e. first check that has a non-null Date value).
*
* Date resolve in the {@link senselogic.sitevision.api.versioning.VersionUtil#ONLINE_VERSION}: *
*sv:page, sv:article, sv:sitePage, sv:link, sv:template,
* sv:collaborationGroupPage, sv:collaborationGroupTemplate,
* sv:structurePage, sv:structureLink
* sv:collaborationGroup
* sv:collaborationGroupPage of the group was last published.sv:collaborationGroupPage of the group was last modified.sv:collaborationGroupPage of the group was created.sv:file, sv:image, sv:folder, sv:structureFolder
* * Date resolve in the {@link senselogic.sitevision.api.versioning.VersionUtil#OFFLINE_VERSION}: *
*sv:page, sv:article, sv:sitePage, sv:link, sv:template,
* sv:file, sv:image, sv:folder,
* sv:collaborationGroupPage, sv:collaborationGroupTemplate,
* sv:structurePage, sv:structureLink, sv:structureFolder
* sv:collaborationGroup
* sv:collaborationGroupPage of the group was last modified.sv:collaborationGroupPage of the group was created.
* Unsupported node types will resolve to null.
*
* Sorting tip!
* Date implements Comparable so this resolver can be used
* to get a Comparator using {@link NodeComparatorUtil#getResolverComparator(Resolver)}.
* This resolver and the resolver comparator can be helpful when you want to sort nodes by time.
*
* The Locale value will be resolved differently for different node types: *
*sv:page, sv:article, sv:template, sv:sitePage,
* sv:structurePage, sv:collaborationGroupPage, sv:collaborationGroupTemplate,
* sv:link, sv:structureLink,
* sv:folder, sv:structureFolder, sv:collaborationGroupFolder
* sv:archive,
* sv:applicationIndex, sv:nodeIndex
* sv:collaborationGroup
* sv:collaborationGroupPage of the group.
* Unsupported node types will resolve to null.
*
* The list of tags can be resolved for different node types: *
*sv:page, sv:article, sv:file, sv:image,
* sv:sitePage, sv:collaborationGroupPage
* sv:timelineEntry, sv:timelineWallEntry, sv:timelineFileEntry,
* sv:timelineFileWallEntry, sv:timelineShareEntry, sv:timelineSharePageEntry
* sv:comment, sv:pageComment
* sv:tagGroup
* sv:tagGroupRepository
* * Unsupported node types will resolve to an empty list (unmodifiable), i.e. the resolver will never return null. *
** Note! The resolved list is not explicitly sorted. The tags will typically be in insertion order. *
* *
* Example
*
This server-side Javascript code demonstrates how to get all tags that belong to a sv:tagGroup, sorted by the tag name.
*
// Resolves and returns a List of sv:tag from a given Node
* function getAllTagsFrom(from) {
* var nodeResolverUtil = require('NodeResolverUtil'),
* tagResolver = nodeResolverUtil.getTagsResolver();
*
* return tagResolver.resolve(from);
* }
*
* // Sorts a List of sv:tag by the tag names in ascending order
* function sortTagList(tagList) {
* var nodeComparatorUtil = require('NodeComparatorUtil'),
* collectionsInstance = require('CollectionsInstance'),
* tagNameComparator;
*
* tagNameComparator = nodeComparatorUtil.getPropertyComparator('tagName');
* collectionsInstance.sort(tagList, tagNameComparator);
* }
*
* var resourceLocatorUtil = require('ResourceLocatorUtil'),
* tagGroupsRepository,
* tags;
*
* tagGroupsRepository = resourceLocatorUtil.getTagGroupRepository();
* tags = getAllTagsFrom(tagGroupsRepository);
*
* if (tags.size() > 1) {
* sortTagList(tags);
* }
* @return a resolver that can resolve a List of sv:tag from a Node
* @since Sitevision 5
*/
getTagsResolver(): Resolver;
/**
* Gets the sv:tagGroup resolver for nodes.
*
* * The list of tag groups can be resolved for different node types: *
*sv:tag
* sv:tagGroupRepository
* sv:sitePage, sv:page, sv:folder, sv:archive,
* sv:article, sv:file, sv:image, sv:collaborationGroupFolder,
* sv:collaborationGroupPage, sv:userField (of type TAGS),
* sv:metadataMultipleTagDefinition, sv:metadataSingleTagDefinition
* * Unsupported node types will resolve to an empty list (unmodifiable), i.e. the resolver will never return null. *
** Note! The resolved list is not explicitly sorted. The tag groups will typically be in insertion order. *
* @return a resolver that can resolve a List of sv:tagGroup from a Node * @since Sitevision 5 */ getTagGroupsResolver(): Resolver; /** * Gets the sv:targetAudience resolver for nodes. * ** The list of target audiences can be resolved for different node types: *
*sv:targetAudienceGroup
* sv:targetAudienceRepository
* * Unsupported node types will resolve to an empty list (unmodifiable), i.e. the resolver will never return null. *
* @return a resolver that can resolve a List of sv:targetAudience from a Node * @since Sitevision 2024.09.2 */ getTargetAudiencesResolver(): Resolver; } declare namespace NodeResolverUtil {} declare var nodeResolverUtil: NodeResolverUtil; export default nodeResolverUtil;