public class SetContentMetadataClientSideElement extends StaticClientSideRelation implements Component
ClientSideElement.Script, ClientSideElement.ScriptFile
Modifier and Type | Field and Description |
---|---|
protected ContentHelper |
_contentHelper
The content helper
|
protected ContentWorkflowHelper |
_contentWorkflowHelper
The content workflow helper
|
protected ContentTypeExtensionPoint |
_ctypesEP
The content types extension point
|
protected ContentTypesHelper |
_ctypesHelper
The content type helper
|
protected FilterCompatibleContentMetadataExtensionPoint |
_filterCompatibleContentMetadataExtensionPoint
The EP to filter meta
|
protected AmetysObjectResolver |
_resolver
The Ametys object resolver
|
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
Constructor and Description |
---|
SetContentMetadataClientSideElement() |
Modifier and Type | Method and Description |
---|---|
private void |
_clean(List<Map<String,String>> contentsToEditToRemove,
List<String> workflowActionIds,
List<I18nizableText> errorMessages,
List<String> errorIds) |
protected Map<String,Object> |
_convert(MetadataDefinition metadatadef)
Convert a metadata definition to JSON
|
protected List<Map<String,Object>> |
_convert(Set<MetadataDefinition> metadatadefs)
Convert metadata definitions to JSON object
|
private void |
_doAction(WorkflowAwareContent content,
List<String> workflowActionIds,
Map<String,Object> values,
List<String> errorIds,
List<I18nizableText> errorMessages) |
protected Set<MetadataDefinition> |
_findCompatibleMetadata(List<Content> contentToReference,
List<Content> contentToEdit)
Find the list of compatible metadata definition
|
private Set<MetadataDefinition> |
_findCompatibleMetadata(List<Content> contentToReference,
List<Content> contentToEdit,
String targetContentTypeName,
MetadataDefinition metaDef,
boolean anyParentIsMultiple,
Collection<String> compatibleContentTypes,
boolean requiresMultiple) |
private boolean |
_hasRight(List<Content> contentToEdit,
MetadataDefinition metaDef) |
private List<String> |
_reorder(List<String> currentElements,
List<String> elementsToReorder,
int newPosition) |
protected List<? extends Content> |
_resolve(List<String> contentIds)
Resolve content by their ids
|
protected Map<? extends Content,Integer> |
_resolve(Map<String,Integer> contentIds)
Resolve content by their ids
|
private Map<String,Object> |
_returnValue(List<I18nizableText> errorMessages,
List<String> errorIds) |
protected void |
_setContentMetatada(List<String> contentIdsToReference,
Map<WorkflowAwareContent,Integer> contentToEdit,
ContentType contentType,
String metadataPath,
List<String> workflowActionIds,
List<I18nizableText> errorMessages,
List<String> errorIds)
Set the metadata 'metadatapath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'
|
Map<String,Object> |
getCompatibleMetadata(List<String> contentIdsToReference,
List<String> contentIdsToEdit)
Find a metadata of type content in definition of 'contentIdsToReference' and set the metadata of contents 'contentIdsToEdit' with value 'contentIdsToReference'
|
void |
service(ServiceManager manager) |
Map<String,Object> |
setContentMetatada(List<String> contentIdsToReference,
Map<String,Integer> contentIdsToEdit,
List<Map<String,String>> contentsToEditToRemove,
String metadatapath,
List<String> workflowActionIds)
Set the metadata 'metadatapath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'
|
configure, getSourceRelationType, getTargetRelationType
_configureClass, _configureParameters, _configureScript, configureInitialParameters
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
getLogger, setLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getDependencies, getId, getPluginName, getRights, getScripts, getScripts
protected AmetysObjectResolver _resolver
protected ContentTypesHelper _ctypesHelper
protected ContentTypeExtensionPoint _ctypesEP
protected ContentWorkflowHelper _contentWorkflowHelper
protected FilterCompatibleContentMetadataExtensionPoint _filterCompatibleContentMetadataExtensionPoint
protected ContentHelper _contentHelper
public SetContentMetadataClientSideElement()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
service
in class StaticFileImportsClientSideElement
ServiceException
public Map<String,Object> getCompatibleMetadata(List<String> contentIdsToReference, List<String> contentIdsToEdit)
contentIdsToReference
- The list of content ids that will be added as values in the content fieldcontentIdsToEdit
- The list of content ids to edit and that will have a metadata of type content modifiedprotected List<Map<String,Object>> _convert(Set<MetadataDefinition> metadatadefs)
metadatadefs
- The metadata definitionsprotected Map<String,Object> _convert(MetadataDefinition metadatadef)
metadatadef
- the metadata definitionprotected Set<MetadataDefinition> _findCompatibleMetadata(List<Content> contentToReference, List<Content> contentToEdit)
contentToReference
- the contents to referencecontentToEdit
- the contents to editprivate Set<MetadataDefinition> _findCompatibleMetadata(List<Content> contentToReference, List<Content> contentToEdit, String targetContentTypeName, MetadataDefinition metaDef, boolean anyParentIsMultiple, Collection<String> compatibleContentTypes, boolean requiresMultiple)
private boolean _hasRight(List<Content> contentToEdit, MetadataDefinition metaDef)
public Map<String,Object> setContentMetatada(List<String> contentIdsToReference, Map<String,Integer> contentIdsToEdit, List<Map<String,String>> contentsToEditToRemove, String metadatapath, List<String> workflowActionIds)
contentIdsToReference
- The list of content ids that will be added as values in the content fieldcontentIdsToEdit
- The map {key: content ids to edit and that will have a metadata of type content modified; value: the new position if metadata is multiple and it is a reorder of values. May be null or equals to -1 if it is not a reorder}contentsToEditToRemove
- The list of content to edit to remove currently referenced content. Keys are "contentId" and "valueToRemove"metadatapath
- The metadata path selected to do modification in the contentIdsToEdit contentsworkflowActionIds
- The ids of workflow actions to use to edit the metadata. Actions will be tested in this order and first available action will be usedprivate Map<String,Object> _returnValue(List<I18nizableText> errorMessages, List<String> errorIds)
private void _clean(List<Map<String,String>> contentsToEditToRemove, List<String> workflowActionIds, List<I18nizableText> errorMessages, List<String> errorIds)
protected void _setContentMetatada(List<String> contentIdsToReference, Map<WorkflowAwareContent,Integer> contentToEdit, ContentType contentType, String metadataPath, List<String> workflowActionIds, List<I18nizableText> errorMessages, List<String> errorIds)
contentIdsToReference
- The list of content ids that will be added as values in the content fieldcontentToEdit
- The map {key: contents to edit and that will have a metadata of type content modified; value: the new position if metadata is multiple and it is a reorder of values. May be null or equals to -1 if it is not a reorder}contentType
- The content typemetadataPath
- The metadata selected to do modification in the contentIdsToEdit contentsworkflowActionIds
- The ids of workflow actions to use to edit the metadata. Actions will be tested in this order and first available action will be usederrorMessages
- The list that will be felt with error messages of content that had an issue during the operationerrorIds
- The list that will be felt with ids of content that had an issue during the operationprivate List<String> _reorder(List<String> currentElements, List<String> elementsToReorder, int newPosition)
private void _doAction(WorkflowAwareContent content, List<String> workflowActionIds, Map<String,Object> values, List<String> errorIds, List<I18nizableText> errorMessages)
protected List<? extends Content> _resolve(List<String> contentIds)
contentIds
- The id of contents to resolve