Class FormsFoundationUtils
- java.lang.Object
-
- com.adobe.forms.foundation.service.util.FormsFoundationUtils
-
@Service(FormsFoundationUtils.class) @Property(name="connectors.jsoninvoker",boolValue=true) @Property(name="connectors.jsoninvoker.alias",value="ff.FormsFoundationUtils") public class FormsFoundationUtils extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CM_MIXIN
static java.lang.String
FORM_PAGE_ROOT_PATH
static java.lang.String
FORM_ROOT_PATH
static java.lang.String
STR_NT_FOLDER
static java.lang.String
STR_SLING_ORDERED_FOLDER
-
Constructor Summary
Constructors Constructor Description FormsFoundationUtils()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<java.lang.String,CopiedAssetInfo>
generateCopiedAssetNames(java.lang.String[] selectedItemsPath, java.lang.String destinationFolderPath)
Generating default name for multiple assets.java.lang.String
getAssetTitle(java.lang.String path)
This function returns the title of the given asset path.FormsAssetType
getAssetType(java.lang.String assetId)
FormsAssetType
getAssetType(javax.jcr.Node node)
java.util.List<java.lang.String>
getChildAssetsPath(java.lang.String folderPath, int depth, boolean includeChildFolderPath)
This function returns list of node path of all child nodes present at folderpath.java.lang.String
getContainingAssetPagePath(Page page)
Given a page path under /content/forms/af, return the top level asset cq page path e.g.java.lang.String
getCorrespondingShadowNodePath(java.lang.String assetPagePath)
returns corresponding shadow node path under /content/dam/formsanddocuments.java.lang.String
getCQPagePath(java.lang.String assetPath)
javax.jcr.Session
getCurrentSession()
java.lang.String[]
getResolvedAssetTags(java.lang.String assetId)
java.lang.String[]
getResolvedAssetTags(javax.jcr.Node node)
java.lang.String
getRootPath(java.lang.String assetPath)
This method returns the root path of given asset.boolean
isCoreComponentTheme(java.lang.String themePath)
boolean
nodeExists(java.lang.String assetName, java.lang.String destinationPath)
Check whether assetName is present at destinationPath.void
propagatePropertyToShadowNode(Page page, java.lang.String propName, java.lang.Object propValue, ResourceResolver resolver, boolean commit)
Tries to set the property change specified bypropName
andpropValue
on shadow node i.e.java.lang.String[]
resolveTags(java.lang.String[] tagNames)
void
updateReferences(java.lang.String sourcePath, java.lang.String destinationPath, java.lang.String[] referencesPath)
update source path to destination path in all references path
-
-
-
Field Detail
-
STR_SLING_ORDERED_FOLDER
public static final java.lang.String STR_SLING_ORDERED_FOLDER
- See Also:
- Constant Field Values
-
STR_NT_FOLDER
public static final java.lang.String STR_NT_FOLDER
- See Also:
- Constant Field Values
-
CM_MIXIN
public static final java.lang.String CM_MIXIN
- See Also:
- Constant Field Values
-
FORM_ROOT_PATH
public static final java.lang.String FORM_ROOT_PATH
- See Also:
- Constant Field Values
-
FORM_PAGE_ROOT_PATH
public static final java.lang.String FORM_PAGE_ROOT_PATH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAssetType
public FormsAssetType getAssetType(java.lang.String assetId) throws FormsFoundationException
- Throws:
FormsFoundationException
-
getAssetType
public FormsAssetType getAssetType(javax.jcr.Node node) throws FormsFoundationException
- Throws:
FormsFoundationException
-
getResolvedAssetTags
public java.lang.String[] getResolvedAssetTags(javax.jcr.Node node) throws FormsFoundationException
- Throws:
FormsFoundationException
-
getResolvedAssetTags
public java.lang.String[] getResolvedAssetTags(java.lang.String assetId) throws FormsFoundationException
- Throws:
FormsFoundationException
-
resolveTags
public java.lang.String[] resolveTags(java.lang.String[] tagNames) throws FormsFoundationException
- Throws:
FormsFoundationException
-
getCurrentSession
public javax.jcr.Session getCurrentSession() throws FormsFoundationException
- Throws:
FormsFoundationException
-
getAssetTitle
public java.lang.String getAssetTitle(java.lang.String path) throws FormsFoundationException
This function returns the title of the given asset path.- Parameters:
path
-- Returns:
- a string value
- Throws:
FormsFoundationException
-
nodeExists
public boolean nodeExists(java.lang.String assetName, java.lang.String destinationPath)
Check whether assetName is present at destinationPath.- Parameters:
assetName
-destinationPath
-- Returns:
- a boolean value
-
generateCopiedAssetNames
public java.util.Map<java.lang.String,CopiedAssetInfo> generateCopiedAssetNames(java.lang.String[] selectedItemsPath, java.lang.String destinationFolderPath) throws FormsFoundationException
Generating default name for multiple assets. This function uses generateCopiedAssetName function for each asset.- Parameters:
selectedItemsPath
-destinationFolderPath
-- Returns:
- a map of CopiedAssetInfo with key as sourceAssetPath
- Throws:
FormsFoundationException
-
getChildAssetsPath
public java.util.List<java.lang.String> getChildAssetsPath(java.lang.String folderPath, int depth, boolean includeChildFolderPath) throws FormsFoundationException
This function returns list of node path of all child nodes present at folderpath. If depth is greater than zero, then the child nodes path up to the depth passed will be included. If depth is zero or negative then all child nodes path will be included. Folder details will be included depending on includeFolderDetails flag.- Parameters:
folderPath
-depth
-includeFolderPath
-- Returns:
- a list of all nodes path present at folderpath
- Throws:
FormsFoundationException
-
updateReferences
public void updateReferences(java.lang.String sourcePath, java.lang.String destinationPath, java.lang.String[] referencesPath) throws FormsFoundationException
update source path to destination path in all references path- Parameters:
sourcePath
-destinationPath
-referencesPath
-- Throws:
FormsFoundationException
-
getCQPagePath
public java.lang.String getCQPagePath(java.lang.String assetPath)
-
getRootPath
public java.lang.String getRootPath(java.lang.String assetPath) throws FormsFoundationException
This method returns the root path of given asset.- Parameters:
assetPath
-- Returns:
- String
- Throws:
FormsFoundationException
-
getCorrespondingShadowNodePath
public java.lang.String getCorrespondingShadowNodePath(java.lang.String assetPagePath)
returns corresponding shadow node path under /content/dam/formsanddocuments. This method doesn't check path's existence- Parameters:
assetPagePath
-- Returns:
- corresponding shadow node path under /content/dam/formsanddocuments.
-
getContainingAssetPagePath
public java.lang.String getContainingAssetPagePath(Page page)
Given a page path under /content/forms/af, return the top level asset cq page path e.g. a page representive of /content/forms/af/ic1/channels/web would return /content/forms/af/ic1 where both /content/forms/af/ic1 and /content/forms/af/ic1/channels/web are cq pages This method assumes that the top level asset is also a cq page and resides under /content/forms/af- Parameters:
page
- a page path under /content/forms/af- Returns:
- the top level asset cq page path
-
propagatePropertyToShadowNode
public void propagatePropertyToShadowNode(Page page, java.lang.String propName, java.lang.Object propValue, ResourceResolver resolver, boolean commit) throws FormsFoundationException
Tries to set the property change specified bypropName
andpropValue
on shadow node i.e. the node under /content/dam/formsanddocuments This method should be used to propagate changes to any property to the shadow node e.g. when lastModifiedTime changes under /content/forms/af/ic1/channels/web, then /content/dam/formsanddocuments/ic1 can be notified of the same change- Parameters:
page
- a page in the hierarchy of a forms and documents asset representation under /content/forms/afpropName
- e.g. jcr:lastModifiedTimepropValue
- e.g. a Calendar instanceresolver
-commit
- true if commit should be done, false otherwise- Throws:
FormsFoundationException
- ifcommit
is true and commit fails
-
isCoreComponentTheme
public boolean isCoreComponentTheme(java.lang.String themePath)
-
-