public abstract class LocalizableItem extends ExtensibleItem
| Modifier and Type | Class and Description |
|---|---|
static interface |
LocalizableItem.LocalizableItemImpl
interface to persistence layer
|
ExtensibleItem.ExtensibleItemImplItem.AttributeFilter, Item.AttributeMode, Item.CachedGetter, Item.CachedSetter, Item.ItemAttributeMap, Item.ItemConstraint, Item.ItemImpl, Item.JaloCachedComputationException| Modifier and Type | Field and Description |
|---|---|
static String |
LANGUAGE_FALLBACK_ENABLED
Session context parameter which enables language fallback for for all localized property read operations.
|
_CREATION_TIME_INTERNAL, _MODIFIED_TIME_INTERNAL, accessorLog, CREATION_TIME, DISABLE_ATTRIBUTE_CHECK, DISABLE_ITEMCHECK_BEFORE_REMOVABLE, EVEN, FEATURE_ACCESSMAP_QUALIFIER, INITIAL_CREATION_FLAG, isJaloOnly, MODIFIED_TIME, NEGATIVE, NOT_FOUND, OWNER, PK, POSITIVE, SAVE_FROM_SERVICE_LAYER, staticTransientObjects, TYPEimpl, tenant| Constructor and Description |
|---|
LocalizableItem() |
| Modifier and Type | Method and Description |
|---|---|
Map |
getAllLocalizedProperties()
Returns all localized properties in the current session language as as Map of key/value mappings.
|
Map |
getAllLocalizedProperties(SessionContext ctx)
Returns all localized properties in given SessionContext language as as Map of key/value mappings.
|
Map<Language,?> |
getAllLocalizedProperties(SessionContext ctx,
String name,
Set<Language> languages)
Returns all values of a localized property according to a specified set of languages.
|
Map<Language,?> |
getAllLocalizedProperties(String name,
Set<Language> languages)
Returns all values of a localized property according to a specified set of languages.
|
protected SessionContext |
getAllValuesSessionContext(SessionContext ctx)
creates a session context instance for getting all localized property values using
getLocalizedProperty(SessionContext, String). |
Object |
getLocalizedProperty(SessionContext ctx,
String name)
Returns the value of a localized property.
|
Object |
getLocalizedProperty(String name)
Returns the value of a localized property.
|
protected Object |
getLocalizedPropertyInternal(SessionContext ctx,
String name)
Non-language-fallback implementation for
getLocalizedProperty(SessionContext, String). |
Set |
getLocalizedPropertyNames()
Returns the qualifiers of all localized properties of this item.
|
Set |
getLocalizedPropertyNames(SessionContext ctx)
Returns the qualifiers of all localized properties of this item.
|
protected boolean |
hasLanguage(SessionContext ctx) |
protected boolean |
isEmptyValue(SessionContext ctx,
String name,
Object value)
Override this method to implement different language fallback behaviour.
|
protected boolean |
isFallbackEnabled(SessionContext ctx) |
Object |
removeLocalizedProperty(SessionContext ctx,
String name)
Removes a localized property from this item.
|
Object |
removeLocalizedProperty(String name)
Removes a localized property from this item.
|
Map<Language,?> |
setAllLocalizedProperties(SessionContext ctx,
String name,
Map<Language,?> values)
Changes multiple localized values of one property at once.
|
Map<Language,?> |
setAllLocalizedProperties(String name,
Map<Language,?> values)
Changes multiple localized values of one property at once.
|
Object |
setLocalizedProperty(SessionContext ctx,
String name,
Object value)
Sets the value of a localized property.
|
Object |
setLocalizedProperty(String name,
Object value)
Sets the value of a localized property.
|
createNonClassAccessor, getAllProperties, getAllProperties, getProperty, getProperty, getPropertyNames, getPropertyNames, removeProperty, removeProperty, setAllProperties, setAllProperties, setProperty, setPropertyaddLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addLinkedItems, addNegativePermission, addPermission, addPositivePermission, assureExtensionsLoaded, changeTypeAfterCreation, checkConstraint, checkItemPermission, checkMandatoryAttribute, checkMandatoryAttribute, checkPermission, checkPermission, checkRemovable, clearPermission, compareTo, createItem, ctx, doAfterRemove, doBeforeRemove, equals, getAccessorFor, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributes, getAllAttributesInternal, getAllLinkedItems, getAndCheckCacheBoundItem, getAttribute, getAttribute, getCacheBoundItem, getComposedType, getComposedTypePK, getCreationTime, getCurrentlyRemovingCount, getDefaultAttributeModes, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItems, getLinkedItemsCount, getLinkedItemsCount, getLinkedItemsCount, getModificationTime, getNegativePermissions, getNonInitialAttributes, getOwner, getPermissionMap, getPermissions, getPersistenceVersion, getPK, getPositivePermissions, getRestrictedPrincipals, getSession, getSyncObject, getTenant, getTransientObject, getTransientObjectMap, hashCode, hasRegisteredClassAccessorFor, internal_registerClassAccessorFor, internal_registerNonClassAccessorFor, invalidateLocalCaches, isAlive, isCacheBound, isCurrentlyRemoving, isCurrentlyRemoving, isEmptyRelationValue, isInCreate, isInstanceOf, isItemCheckBeforeRemoveableDisabled, isRelationLocalizationFallbackEnabled, newInstance, notifyExtensionsAfterItemCreation, notifyExtensionsBeforeItemCreation, notifyItemRemoval, readResolve, refreshRemote, registerAccessFor, registerAccessFor, registerJaloInvalidationListeners, remove, remove, removeItemCollection, removeItemCollection, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinkedItems, removeLinks, removePartOfItems, removePartOfItems, setAllAttributes, setAllAttributes, setAllAttributesInternal, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAllLinkedItems, setAttribute, setAttribute, setAttributeFromString, setAttributeFromString, setCacheBound, setComposedType, setCreationTime, setImplementation, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setLinkedItems, setModificationTime, setNonInitialAttributes, setOwner, setPermissionsByMap, setTransientObject, setUseTA, toString, useTA, writeReplacegetImplementation, setTenantpublic static final String LANGUAGE_FALLBACK_ENABLED
protected SessionContext getAllValuesSessionContext(SessionContext ctx)
getLocalizedProperty(SessionContext, String). the return value will be a map the created session context simply doesnt have a language.
use it as follows:
public Map myMethod(SessionContext ctx)
{
return (Map) getLocalizedProperty(getAllValuesSessionContext(ctx), "theKey");
}
ctx - the original session contexprotected boolean hasLanguage(SessionContext ctx)
protected boolean isFallbackEnabled(SessionContext ctx)
public Map getAllLocalizedProperties()
This method calls getAllLocalizedProperties(SessionContext) with the current session's SessionContext
object. See this method for more details.
public Map getAllLocalizedProperties(SessionContext ctx)
This method is using the following attributes of the given SessionContext:
| CacheUsage | Language | StagingMethod | ||
|---|---|---|---|---|
| yes | yes | yes if called on a StageableItem, no otherwise |
ctx - A SessionContext objectpublic Set getLocalizedPropertyNames()
This method calls getLocalizedPropertyNames(SessionContext) with the current session's SessionContext
object. See this method for more details.
public Set getLocalizedPropertyNames(SessionContext ctx)
This method is using the following attributes of the given SessionContext:
| CacheUsage | Language | StagingMethod | ||
|---|---|---|---|---|
| yes | yes | yes if called on a StageableItem, no otherwise |
ctx - a SessionContext objectpublic Object getLocalizedProperty(String name)
This method calls getLocalizedProperty(SessionContext,String) with the current session's SessionContext
object. See this method for more details.
name - the name of the propertypublic Object getLocalizedProperty(SessionContext ctx, String name)
This method is using the following attributes of the given SessionContext:
| CacheUsage | Language | StagingMethod | ||
|---|---|---|---|---|
| yes | yes | yes if called on a StageableItem, no otherwise |
ctx - a SessionContext objectname - the name of the propertyprotected boolean isEmptyValue(SessionContext ctx, String name, Object value)
null values
are considered as empty. Example:
@Override
protected boolean isEmptyValue(SessionContext ctx, String name, Object value)
{
return super.isEmptyValue(ctx, name, value) || ("myAttr".equals(name) && ((String) value).trim().length() == 0);
}
ctx - the session context while getting the propertyname - the property namevalue - the actual stored valueprotected Object getLocalizedPropertyInternal(SessionContext ctx, String name)
getLocalizedProperty(SessionContext, String).public Object setLocalizedProperty(String name, Object value)
jaloSession.getSessionContext().setLanguage(jaloSession.getC2LManager().getLanguageByIsoCode("DE"));
myLocItem.setLocalizedProperty("de-value");
name - the name of the propertyvalue - the new value of this propertypublic Object setLocalizedProperty(SessionContext ctx, String name, Object value)
SessionContext ctx = jaloSession.createSessionContext();
ctx.setLanguage(jaloSession.getC2LManager().getLanguageByIsoCode("DE"));
myLocItem.setLocalizedProperty(ctx, "de-value");
if the session context doesnt hold a language it is expected that all values are meant to be set at once - the
given value has to be a map { Language -> Serializable } in that case !
Map allValues = new HashMap();
allValues.put(jaloSession.getC2LManager().getLanguageByIsoCode("DE"), "de-value");
allValues.put(jaloSession.getC2LManager().getLanguageByIsoCode("EN"), "en-value");
SessionContext ctx = jaloSession.createSessionContext();
ctx.setLanguage(null);
myLocItem.setLocalizedProperty(ctx, allValues);
name - the name of the propertyvalue - the new value of this propertyctx - the session context defining the language to set the value forpublic Map<Language,?> setAllLocalizedProperties(SessionContext ctx, String name, Map<Language,?> values)
Please note that this method will not clear any existing value for languages which are missing in the values map!
ctx - the session contextname - the property namevalues - public Map<Language,?> setAllLocalizedProperties(String name, Map<Language,?> values)
Please note that this method will not clear any existing value for languages which are missing in the values map!
name - the property namevalues - public Map<Language,?> getAllLocalizedProperties(SessionContext ctx, String name, Set<Language> languages)
ctx - the session contextname - the property namelanguages - the languages to get values forpublic Map<Language,?> getAllLocalizedProperties(String name, Set<Language> languages)
name - the property namelanguages - the languages to get values forpublic Object removeLocalizedProperty(String name)
This method calls removeLocalizedProperty(SessionContext,String) with the current session's
SessionContext object. See this method for more details.
name - the name of the propertyremoveLocalizedProperty(SessionContext, String)public Object removeLocalizedProperty(SessionContext ctx, String name)
Please note that only the property in the SessionContext language is removed. Its other values will remain unchanged.
name - the name of the propertyctx - a SessionContext object defining the language to remove value forCopyright © 2017 SAP SE. All Rights Reserved.