public class DamLanguageUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ATTRIBUTE_ASSET_LINKS_RELATION |
static java.lang.String |
ATTRIBUTE_ASSET_SOURCE_RELATION |
static java.lang.String |
ATTRIBUTE_ASSET_UPDATE_REQUIRED |
static java.lang.String |
ATTRIBUTE_COLLECTION_SOURCE_LANGUAGE_COPY |
static java.lang.String |
ATTRIBUTE_CQ_TRANSLATION_LAST_UPDATE |
static java.lang.String |
CQ_LASTMODIFIED |
Constructor and Description |
---|
DamLanguageUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addSmartAssetUpdateFlag(Asset destinationAsset)
Deprecated.
|
static void |
addSmartAssetUpdateSource(Asset destinationAsset,
java.lang.String sourcePath) |
static void |
afterReplacingUpdatedAsset(java.lang.String destinationPath,
Session userSession,
java.lang.String prefixPath,
ResourceResolver resourceResolver) |
static java.util.List<java.lang.String> |
createLanguageCopy(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String sourcePath,
java.lang.String[] targetLanguageCodes)
This method creates language copy of an asset/folder
|
static java.util.List<java.lang.String> |
createLanguageCopyWithAssetRelations(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String sourcePath,
java.lang.String[] targetLanguageCodes)
This method creates language copy of an asset/folder and its source(for example psd for jpeg).
|
static java.util.List<java.lang.String> |
createLanguageCopyWithAssetRelationsForAsset(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String sourcePath,
java.lang.String[] targetLanguageCodes) |
static java.util.List<java.lang.String> |
createLanguageCopyWithAssetRelationsForNTFolder(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String sourcePath,
java.lang.String[] targetLanguageCodes) |
static java.lang.String |
createUpdateLanguageCopy(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String sourcePath,
java.lang.String targetLanguageCode,
java.lang.String prefixPath)
This method creates update language copy of an asset/folder
|
static java.lang.String |
createUpdateLanguageCopyWithAssetRelations(ResourceResolver resourceResolver,
PageManagerFactory pageManagerFactory,
java.lang.String destinationPath,
java.lang.String targetLanguageCode,
java.lang.String prefixPath)
This method creates temporary language copy of an asset/folder and its source(for example psd for jpeg) in case
temporary asset translation is required.
|
static java.lang.String |
findLanguageCopyPathWithAutoCreatedRoots(java.lang.String assetPath,
java.lang.String languageCode,
ResourceResolver resolver) |
static Asset |
findLanguageCopyWithAutoCreatedRoots(java.lang.String assetPath,
java.lang.String languageCode,
ResourceResolver resolver) |
static Resource |
findLanguageCopyWithAutoCreatedRootsForAssetOrNTFolder(Resource resource,
java.lang.String languageCode,
ResourceResolver resolver) |
static java.util.ArrayList<Asset> |
getAssetsFromAssociatedContent(Node contentFragmentNode,
java.lang.String destinationLanguage,
ResourceResolver resourceResolver) |
static Language |
getLanguage(java.lang.String path)
Deprecated.
since 6.2, use
com.day.cq.commons.LanguageUtil instead |
static Asset |
getLanguageCopy(java.lang.String assetPath,
java.lang.String languageCode,
ResourceResolver resolver)
This method returns the Language copy asset if language copy exists, for
the asked locale
|
static java.lang.String |
getLanguageRoot(java.lang.String path)
Deprecated.
since 6.2, use
com.day.cq.commons.LanguageUtil instead |
static java.lang.String |
getLanguageRootLocale(java.lang.String path)
Returns the locale for the given path.
|
static java.util.Collection<Resource> |
getLanguageRoots(ResourceResolver resolver,
java.lang.String path)
Modified version of com.day.cq.wcm.core.impl.LanguageManagerImpl for Resources
Returns a collection of language root pages for the given asset.
|
static java.util.List<Asset> |
getRelatedAssets(Resource resource,
java.lang.String relationName) |
static ResourceResolver |
getUserResourceResolverFromUserId(SlingRepository slingRepository,
ResourceResolverFactory resolverFactory,
java.lang.String userId,
java.lang.String serviceUser) |
static boolean |
hasLanguageCopy(java.lang.String assetPath,
java.lang.String languageCode,
ResourceResolver resolver)
This method returns true if language copy of an asset exists, for the
asked locale
|
static boolean |
isSmartAssetUpdateRequired(Asset sourceAsset,
Asset destinationAsset) |
static void |
moveUpdatedAsset(java.lang.String sourcePath,
java.lang.String destinationPath,
Session userSession,
PageManagerFactory pageManagerFactory,
ResourceResolver resourceResolver) |
static void |
moveUpdatedAsset(java.lang.String sourcePath,
java.lang.String destinationPath,
Session userSession,
PageManagerFactory pageManagerFactory,
ResourceResolverFactory resolverFactory)
Deprecated.
since 6.2, use
moveUpdatedAsset(String, String, Session, PageManagerFactory, ResourceResolver) instead |
static void |
replaceUpdatedAsset(java.lang.String sourcePath,
java.lang.String destinationPath,
Session userSession,
PageManagerFactory pageManagerFactory,
ResourceResolver resourceResolver) |
static java.util.List<java.lang.String> |
replaceWithExistingLanguageCopiesIfPossible(java.util.List<java.lang.String> paths,
java.lang.String destinationLanguageCode,
ResourceResolver resourceResolver)
Returns a list after replacing paths with their existing language copies.
|
public static final java.lang.String ATTRIBUTE_ASSET_LINKS_RELATION
public static final java.lang.String ATTRIBUTE_ASSET_SOURCE_RELATION
public static final java.lang.String ATTRIBUTE_ASSET_UPDATE_REQUIRED
public static final java.lang.String ATTRIBUTE_COLLECTION_SOURCE_LANGUAGE_COPY
public static final java.lang.String CQ_LASTMODIFIED
public static final java.lang.String ATTRIBUTE_CQ_TRANSLATION_LAST_UPDATE
public static boolean hasLanguageCopy(java.lang.String assetPath, java.lang.String languageCode, ResourceResolver resolver)
assetPath
- The path of an asset for which language copy is askedlanguageCode
- Language for which language copy is askedresolver
- ResourceResolverpublic static Asset getLanguageCopy(java.lang.String assetPath, java.lang.String languageCode, ResourceResolver resolver)
assetPath
- The path of an asset for which language copy is askedlanguageCode
- Language for which language copy is askedresolver
- ResourceResolverpublic static java.util.List<java.lang.String> createLanguageCopy(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String sourcePath, java.lang.String[] targetLanguageCodes)
resourceResolver
- pageManagerFactory
- sourcePath
- - source for creating language copytargetLanguageCodes
- - array of language codes@Deprecated public static java.lang.String getLanguageRoot(java.lang.String path)
com.day.cq.commons.LanguageUtil
insteadpath
- pathnull
if not found@Deprecated public static Language getLanguage(java.lang.String path)
com.day.cq.commons.LanguageUtil
insteadpath
- pathnull
if not foundpublic static java.util.Collection<Resource> getLanguageRoots(ResourceResolver resolver, java.lang.String path)
resolver
- resource resolverpath
- path of the current pagepublic static java.lang.String createUpdateLanguageCopy(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String sourcePath, java.lang.String targetLanguageCode, java.lang.String prefixPath)
resourceResolver
- pageManagerFactory
- sourcePath
- - source for creating language copytargetLanguageCode
- - destination language codeprefixPath
- - Root path where language copies are created@Deprecated public static void moveUpdatedAsset(java.lang.String sourcePath, java.lang.String destinationPath, Session userSession, PageManagerFactory pageManagerFactory, ResourceResolverFactory resolverFactory)
moveUpdatedAsset(String, String, Session, PageManagerFactory, ResourceResolver)
insteadsourcePath
- destinationPath
- userSession
- pageManagerFactory
- resolverFactory
- public static void moveUpdatedAsset(java.lang.String sourcePath, java.lang.String destinationPath, Session userSession, PageManagerFactory pageManagerFactory, ResourceResolver resourceResolver)
public static void replaceUpdatedAsset(java.lang.String sourcePath, java.lang.String destinationPath, Session userSession, PageManagerFactory pageManagerFactory, ResourceResolver resourceResolver)
public static boolean isSmartAssetUpdateRequired(Asset sourceAsset, Asset destinationAsset)
@Deprecated public static void addSmartAssetUpdateFlag(Asset destinationAsset) throws RepositoryException
RepositoryException
public static void addSmartAssetUpdateSource(Asset destinationAsset, java.lang.String sourcePath) throws RepositoryException
RepositoryException
public static java.util.List<java.lang.String> createLanguageCopyWithAssetRelations(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String sourcePath, java.lang.String[] targetLanguageCodes) throws RepositoryException
resourceResolver
- pageManagerFactory
- sourcePath
- - source for creating language copytargetLanguageCodes
- - array of language codesRepositoryException
public static java.util.List<java.lang.String> createLanguageCopyWithAssetRelationsForAsset(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String sourcePath, java.lang.String[] targetLanguageCodes) throws RepositoryException
RepositoryException
public static java.util.List<java.lang.String> createLanguageCopyWithAssetRelationsForNTFolder(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String sourcePath, java.lang.String[] targetLanguageCodes) throws RepositoryException
RepositoryException
public static java.util.List<Asset> getRelatedAssets(Resource resource, java.lang.String relationName)
public static java.lang.String createUpdateLanguageCopyWithAssetRelations(ResourceResolver resourceResolver, PageManagerFactory pageManagerFactory, java.lang.String destinationPath, java.lang.String targetLanguageCode, java.lang.String prefixPath) throws RepositoryException
resourceResolver
- pageManagerFactory
- destinationPath
- - source for creating language copytargetLanguageCode
- - destination language codeprefixPath
- - Root path where language copies are createdRepositoryException
public static java.lang.String findLanguageCopyPathWithAutoCreatedRoots(java.lang.String assetPath, java.lang.String languageCode, ResourceResolver resolver)
public static Resource findLanguageCopyWithAutoCreatedRootsForAssetOrNTFolder(Resource resource, java.lang.String languageCode, ResourceResolver resolver) throws RepositoryException
RepositoryException
public static Asset findLanguageCopyWithAutoCreatedRoots(java.lang.String assetPath, java.lang.String languageCode, ResourceResolver resolver)
public static void afterReplacingUpdatedAsset(java.lang.String destinationPath, Session userSession, java.lang.String prefixPath, ResourceResolver resourceResolver) throws RepositoryException
RepositoryException
public static java.lang.String getLanguageRootLocale(java.lang.String path)
path
- public static java.util.List<java.lang.String> replaceWithExistingLanguageCopiesIfPossible(java.util.List<java.lang.String> paths, java.lang.String destinationLanguageCode, ResourceResolver resourceResolver)
paths
- The list of paths whose language copy has to be replaceddestinationLanguageCode
- language code of destination language copyresourceResolver
- public static java.util.ArrayList<Asset> getAssetsFromAssociatedContent(Node contentFragmentNode, java.lang.String destinationLanguage, ResourceResolver resourceResolver) throws RepositoryException
RepositoryException
public static ResourceResolver getUserResourceResolverFromUserId(SlingRepository slingRepository, ResourceResolverFactory resolverFactory, java.lang.String userId, java.lang.String serviceUser) throws LoginException, RepositoryException
LoginException
RepositoryException
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"