public class SetContentMetadataClientSideElement extends StaticClientSideRelation implements Component
ClientSideElement.Script, ClientSideElement.ScriptFile
Modifier and Type | Field and Description |
---|---|
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) |
protected List<? extends Content> |
_resolve(List<String> contentIds)
Resolve content by their ids
|
private Map<String,Object> |
_returnValue(List<I18nizableText> errorMessages,
List<String> errorIds) |
protected void |
_setContentMetatada(List<String> contentIdsToReference,
List<WorkflowAwareContent> 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,
List<String> 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
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, List<String> 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 list of content ids to edit and that will have a metadata of type content modifiedcontentsToEditToRemove
- 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, List<WorkflowAwareContent> 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 list of content to edit and that will have a metadata of type content modifiedcontentType
- 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 void _doAction(WorkflowAwareContent content, List<String> workflowActionIds, Map<String,Object> values, List<String> errorIds, List<I18nizableText> errorMessages)