Class 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
    • 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 by propName and propValue 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
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FormsFoundationUtils

        public FormsFoundationUtils()
    • Method Detail

      • 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)
      • 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 by propName and propValue 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/af
        propName - e.g. jcr:lastModifiedTime
        propValue - e.g. a Calendar instance
        resolver -
        commit - true if commit should be done, false otherwise
        Throws:
        FormsFoundationException - if commit is true and commit fails
      • isCoreComponentTheme

        public boolean isCoreComponentTheme​(java.lang.String themePath)