public class TranslationUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static com.fasterxml.jackson.databind.ObjectMapper |
mapper |
static String |
PN_TRANSLATION_IDS |
static String |
TRANSLATION_TOKEN |
| Modifier and Type | Method and Description |
|---|---|
static void |
addPropertyToTranslationIds(org.apache.sling.api.resource.Resource resource,
String propertyName,
String dictKeyForPropertyName)
Adds the given dictionary key to the resource value map
|
static String |
get(String path,
String propertyOrObjectKey,
Integer index,
boolean isProperty)
Returns unique dictionary key based on path and property provided.
|
static String |
get(String path,
String propertyOrObjectKey,
Integer index,
boolean isProperty,
String originalKey)
Returns unique dictionary key based on path and property provided.
|
static String |
getDictionaryPath(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String guideContainerPath)
Returns path to the old or new dictionary based on the container path provided
|
static javax.jcr.Node |
getOrAddDictionaryNode(org.apache.sling.api.resource.ResourceResolver resolver,
String containerPath)
Returns or adds dictionary node based on the adaptive form container path provided
|
static String |
getTranslationId(org.apache.sling.api.resource.Resource resource,
String propertyName,
String propertyValue)
Returns translation id for the property name and property value
|
static String |
getTranslationId(org.apache.sling.api.resource.Resource resource,
String propertyName,
String propertyValue,
boolean checkArray)
Returns translation id for the property name and property value
|
static String |
getTranslationId(org.apache.sling.api.resource.ValueMap properties,
String propertyName,
String propertyValue)
Returns translation id for the property name and property value
|
static String |
getTranslationId(org.apache.sling.api.resource.ValueMap properties,
String propertyName,
String propertyValue,
boolean checkArray)
Returns translation id for the property name and property value
|
static boolean |
isNewTranslation(org.apache.sling.api.resource.Resource resource)
Checks if the given resource use's new translation technique (unique keys for each property)
|
static boolean |
isNewTranslation(org.apache.sling.api.resource.ValueMap properties)
Checks if the given resource use's new translation technique (unique keys for each property)
|
static void |
removePropertyFromTranslationIds(org.apache.sling.api.resource.Resource resource,
String propertyName)
Deletes the given dictionary key from the resource value map
|
public static final String TRANSLATION_TOKEN
public static final String PN_TRANSLATION_IDS
public static final com.fasterxml.jackson.databind.ObjectMapper mapper
public static String get(String path, String propertyOrObjectKey, Integer index, boolean isProperty, String originalKey)
path - path of the current object from its parentpropertyOrObjectKey - property or name of the objectindex - index, if property value is of type arrayisProperty - isProperty, true if the key is a propertyoriginalKey - existing dictionary key, if a random id is not providedpublic static String get(String path, String propertyOrObjectKey, Integer index, boolean isProperty)
path - path of the current object from its parentpropertyOrObjectKey - property or name of the objectindex - index, if property value is of type arrayisProperty - isProperty, true if the key is a propertypublic static String getDictionaryPath(org.apache.sling.api.resource.ResourceResolver resourceResolver, String guideContainerPath)
resourceResolver - reference to the ResourceResolverguideContainerPath - path to the form containerpublic static javax.jcr.Node getOrAddDictionaryNode(org.apache.sling.api.resource.ResourceResolver resolver,
String containerPath)
throws javax.jcr.RepositoryException
resolver - reference to the ResourceResolvercontainerPath - path to the form containerjavax.jcr.RepositoryExceptionpublic static String getTranslationId(org.apache.sling.api.resource.ValueMap properties, String propertyName, String propertyValue, boolean checkArray) throws IOException
properties - reference to the properties ValueMappropertyName - name of the propertypropertyValue - property valuecheckArray - if property value is of array type, this should be trueIOExceptionpublic static String getTranslationId(org.apache.sling.api.resource.ValueMap properties, String propertyName, String propertyValue) throws IOException
properties - reference to the properties ValueMappropertyName - name of the propertypropertyValue - property valueIOExceptionpublic static boolean isNewTranslation(org.apache.sling.api.resource.ValueMap properties)
properties - reference to the ValueMappublic static boolean isNewTranslation(org.apache.sling.api.resource.Resource resource)
resource - reference to the Resourcepublic static String getTranslationId(org.apache.sling.api.resource.Resource resource, String propertyName, String propertyValue) throws IOException
resource - reference to the resource ResourcepropertyName - name of the propertypropertyValue - property valueIOExceptionpublic static String getTranslationId(org.apache.sling.api.resource.Resource resource, String propertyName, String propertyValue, boolean checkArray) throws IOException
resource - reference to the resource ResourcepropertyName - name of the propertypropertyValue - property valuecheckArray - if property value is of array type, this should be trueIOExceptionpublic static void addPropertyToTranslationIds(org.apache.sling.api.resource.Resource resource,
String propertyName,
String dictKeyForPropertyName)
throws IOException,
javax.jcr.RepositoryException
resource - reference to the ResourcepropertyName - name of the propertydictKeyForPropertyName - dictionary key for the propertyIOExceptionjavax.jcr.RepositoryExceptionpublic static void removePropertyFromTranslationIds(org.apache.sling.api.resource.Resource resource,
String propertyName)
throws IOException,
javax.jcr.RepositoryException
resource - reference to the ResourcepropertyName - name of the propertyIOExceptionjavax.jcr.RepositoryExceptionCopyright © 1982–2023 Adobe Systems Incorporated. All rights reserved.