public class ReferenceSearch extends Object
ReferenceSearch
provides methods that search references to
resources (e.g. a path in a property to an image)Modifier and Type | Class and Description |
---|---|
static class |
ReferenceSearch.Info
Holds information about the search results
|
Constructor and Description |
---|
ReferenceSearch() |
Modifier and Type | Method and Description |
---|---|
Collection<String> |
adjustReferences(Node node,
String path,
String destination)
Adjusts all references to
path to destination
in the properties below the specified node . |
Collection<String> |
adjustReferences(Node node,
String path,
String destination,
boolean shallow,
Set<String> excludedProperties)
Adjusts all references to
path to destination
in the properties below the specified node . |
Collection<String> |
adjustReferences(ResourceResolver resolver,
String path,
String destination,
String[] refPaths)
Adjusts all references to
path to destination
in the pages specified by refPaths . |
static String |
escapeIllegalXpathSearchChars(String s)
Escapes illegal XPath search characters.
|
String |
getSearchRoot()
Returns the search root.
|
boolean |
isExact()
Returns the shallow flag.
|
Map<String,ReferenceSearch.Info> |
search(ResourceResolver resolver,
String path)
Searches for references to the given path.
|
ReferenceSearch |
setExact(boolean exact)
Sets the
exact flag. |
ReferenceSearch |
setPredicate(AbstractResourcePredicate resourcePredicate)
Set the
resourcePredicate , this predicate is evaluated for
each search result and can be used to filter results. |
ReferenceSearch |
setRepository(SlingRepository repository) |
ReferenceSearch |
setSearchRoot(String searchRoot)
Sets the search root
|
public ReferenceSearch setRepository(SlingRepository repository)
public String getSearchRoot()
public ReferenceSearch setSearchRoot(String searchRoot)
searchRoot
- the search rootpublic boolean isExact()
setExact(boolean)
public ReferenceSearch setExact(boolean exact)
exact
flag. If true
only exact
references are searched (and replaced). otherwise also references to
child resources are included.exact
- true
if perform an exact searchpublic ReferenceSearch setPredicate(AbstractResourcePredicate resourcePredicate)
resourcePredicate
, this predicate is evaluated for
each search result and can be used to filter results.resourcePredicate
- an instance of AbstractResourcePredicate
public Map<String,ReferenceSearch.Info> search(ResourceResolver resolver, String path)
resolver
- the resource resolverpath
- the path to search forpublic Collection<String> adjustReferences(ResourceResolver resolver, String path, String destination, String[] refPaths)
path
to destination
in the pages specified by refPaths
. If isExact()
is true
only exact references to path
are
adjusted, otherwise all references to child resources are adjusted, too.resolver
- resolver to operate on.path
- source pathdestination
- destination pathrefPaths
- paths of pages to be adjustedpublic Collection<String> adjustReferences(Node node, String path, String destination) throws RepositoryException
path
to destination
in the properties below the specified node
. If isExact()
is true
only exact references to path
are
adjusted, otherwise all references to child resources are adjusted, too.node
- (content) node to traversepath
- source pathdestination
- destination pathRepositoryException
- if an error during repository access occurspublic Collection<String> adjustReferences(Node node, String path, String destination, boolean shallow, Set<String> excludedProperties) throws RepositoryException
path
to destination
in the properties below the specified node
. If isExact()
is true
only exact references to path
are
adjusted, otherwise all references to child resources are adjusted, too.node
- (content) node to adjustpath
- source pathdestination
- destination pathshallow
- if true
child nodes are not traversedexcludedProperties
- a set of excluded property namesRepositoryException
- if an error during repository access occurs"Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"