Package org.opencms.gwt
Class CmsPropertyEditorHelper
- java.lang.Object
-
- org.opencms.gwt.CmsPropertyEditorHelper
-
- Direct Known Subclasses:
CmsNewResourceBuilder.PropertyEditorHelper
public class CmsPropertyEditorHelper extends java.lang.Object
Helper class responsible for loading / saving properties when using the property dialog.
-
-
Constructor Summary
Constructors Constructor Description CmsPropertyEditorHelper(CmsObject cms)
Creates a new instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,CmsClientProperty>
convertProperties(java.util.List<CmsProperty> properties)
Converts CmsProperty objects to CmsClientProperty objects.java.util.Map<CmsUUID,java.util.Map<java.lang.String,CmsXmlContentProperty>>
getDefaultProperties(java.util.List<CmsUUID> structureIds)
Internal method for computing the default property configurations for a list of structure ids.protected java.util.Map<java.lang.String,CmsXmlContentProperty>
getDefaultPropertiesForType(java.lang.String typeName)
Helper method to get the default property configuration for the given resource type.protected java.util.Map<java.lang.String,CmsProperty>
getPropertiesByName(java.util.List<CmsProperty> properties)
Converts a list of properties to a map.protected boolean
isWritable(CmsObject cms, CmsResource resource)
Returns whether the current user has write permissions, the resource is lockable or already locked by the current user and is in the current project.CmsPropertiesBean
loadPropertyData(CmsUUID id)
Loads the data needed for editing the properties of a resource.void
overrideStructureId(CmsUUID structureId)
Sets a structure id that overrides the one stored in a property change set.void
saveProperties(CmsPropertyChangeSet changes)
Saves a set of property changes.void
setUpdateIndex(boolean updateIndex)
Sets the 'update index' flag to control whether the index should be updated after saving.static void
updateWysiwygConfig(java.util.Map<java.lang.String,CmsXmlContentProperty> propertyConfig, CmsObject cms, CmsResource resource)
Updates the property configuration for properties using WYSIWYG widgets.
-
-
-
Constructor Detail
-
CmsPropertyEditorHelper
public CmsPropertyEditorHelper(CmsObject cms)
Creates a new instance.- Parameters:
cms
- the CMS context
-
-
Method Detail
-
updateWysiwygConfig
public static void updateWysiwygConfig(java.util.Map<java.lang.String,CmsXmlContentProperty> propertyConfig, CmsObject cms, CmsResource resource)
Updates the property configuration for properties using WYSIWYG widgets.- Parameters:
propertyConfig
- the property configurationcms
- the CMS contextresource
- the current resource (may be null)
-
getDefaultProperties
public java.util.Map<CmsUUID,java.util.Map<java.lang.String,CmsXmlContentProperty>> getDefaultProperties(java.util.List<CmsUUID> structureIds) throws CmsException
Internal method for computing the default property configurations for a list of structure ids.- Parameters:
structureIds
- the structure ids for which we want the default property configurations- Returns:
- a map from the given structure ids to their default property configurations
- Throws:
CmsException
- if something goes wrong
-
loadPropertyData
public CmsPropertiesBean loadPropertyData(CmsUUID id) throws CmsException
Loads the data needed for editing the properties of a resource.- Parameters:
id
- the structure id of the resource- Returns:
- the data needed for editing the properties
- Throws:
CmsException
- if something goes wrong
-
overrideStructureId
public void overrideStructureId(CmsUUID structureId)
Sets a structure id that overrides the one stored in a property change set.- Parameters:
structureId
- the new structure id
-
saveProperties
public void saveProperties(CmsPropertyChangeSet changes) throws CmsException
Saves a set of property changes.- Parameters:
changes
- the set of property changes- Throws:
CmsException
- if something goes wrong
-
setUpdateIndex
public void setUpdateIndex(boolean updateIndex)
Sets the 'update index' flag to control whether the index should be updated after saving.- Parameters:
updateIndex
- true if the index should be updated after saving
-
convertProperties
protected java.util.Map<java.lang.String,CmsClientProperty> convertProperties(java.util.List<CmsProperty> properties)
Converts CmsProperty objects to CmsClientProperty objects.- Parameters:
properties
- a list of server-side properties- Returns:
- a map of client-side properties
-
getDefaultPropertiesForType
protected java.util.Map<java.lang.String,CmsXmlContentProperty> getDefaultPropertiesForType(java.lang.String typeName)
Helper method to get the default property configuration for the given resource type.- Parameters:
typeName
- the name of the resource type- Returns:
- the default property configuration for the given type
-
getPropertiesByName
protected java.util.Map<java.lang.String,CmsProperty> getPropertiesByName(java.util.List<CmsProperty> properties)
Converts a list of properties to a map.- Parameters:
properties
- the list of properties- Returns:
- a map from property names to properties
-
isWritable
protected boolean isWritable(CmsObject cms, CmsResource resource) throws CmsException
Returns whether the current user has write permissions, the resource is lockable or already locked by the current user and is in the current project.- Parameters:
cms
- the cms contextresource
- the resource- Returns:
true
if the resource is writable- Throws:
CmsException
- in case checking the permissions fails
-
-