Interface AssetReferenceResolver


@ProviderType public interface AssetReferenceResolver
The AssetReferenceResolver provides api to resolve the references of a composite assets (for e.g. InDesign assets) to an existing DAM's asset. Further it provides api for creation/cleanup of references and getting list of contained composite Assets. Implementation of this interface should be exposed as a component. Default implementation of this interface is available at com.day.cq.dam.core.impl.AssetReferenceResolverImpl
  • Method Details

    • resolve

      Iterator<? extends AssetRelation> resolve(Asset asset)
      This method would resolve asset references. Maps all the sub assets to DAM's existing asset
      Parameters:
      asset - - asset for which references are to be resolved
      Returns:
      - Iterator for relations created
    • getResolvedPath

      String getResolvedPath(String property, ResourceResolver resolver)
      This method would take the property of an referenced asset through which it can be mapped/associated with DAM's existing asset. It returns path of existing asset in DAM on success, otherwise returns NULL in case of not able to resolve.
      Parameters:
      property - referenced asset's property through which it can be mapped to DAM's existing asset.
      resolver - ResourceResolver instance
      Returns:
      Path of the resolved asset on success, Null otherwise.
    • getReferences

      Map<String,String> getReferences(String assetPath, ResourceResolver resolver)
      This method would take the asset path as input and return the assets being referred by the input asset with actual link nodes.
      Parameters:
      assetPath - referenced asset's path
      resolver - ResourceResolver instance
      Returns:
      Method returns Map in which key would be the composite asset refers input referenced asset and value would be the actual link node created by #AssetReferenceResolver.createReference
    • createReference

      String createReference(String assetPath, boolean doSave, String resolvedPath, List<Object> data, ResourceResolver resolver) throws RepositoryException
      This method would create the references which can be associated with the resolved asset as well can be stored as property/node by Composite Asset
      Parameters:
      assetPath - composite asset's path
      doSave - Whether the repository changes are saved or not.
      resolvedPath - resolved path of the referenced asset in DAM
      data - Pass the additional data needed for reference creation
      resolver - ResourceResolver instance
      Returns:
      path of the created link on success otherwise NULL
      Throws:
      RepositoryException - thrown if an error occurs while accessing the asset
    • resolveLink

      @Deprecated boolean resolveLink(String linkPath, String resolvedPath, ResourceResolver resolver)
      Deprecated.
      since 1.2
      This method will resolve the missing link. If the links are missing at the time of Composite Asset upload, they can be resolved through following method after wards.
      Parameters:
      linkPath - link's node path
      resolvedPath - path of an existing asset in the DAM to resolved with
      resolver - ResourceResolver instance
      Returns:
      returns true flag if able to resolve the link otherwise false
    • deleteLink

      @Deprecated boolean deleteLink(String linkPath, ResourceResolver resolver)
      Deprecated.
      since 1.2
      This method will be called at the time of referenced asset deletion and provides the cleanup of the associated links.
      Parameters:
      linkPath - link's node path
      resolver - ResourceResolver instance
      Returns:
      returns true flag on successful link deletion otherwise false
    • cleanup

      @Deprecated boolean cleanup(String assetPath, ResourceResolver resolver)
      Deprecated.
      since 1.2
      This method will clean all the links node created for referenced asset. It calls #AssetReferenceResolver.deleteLink internally to delete individual links
      Parameters:
      assetPath - referenced asset's path
      resolver - ResourceResolver instance
      Returns:
      returns true flag on successful cleanup otherwise false