Package org.ametys.odf.clientsideelement
Class SetContentAttributeClientSideElement
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.core.ui.StaticFileImportsClientSideElement
org.ametys.core.ui.StaticClientSideElement
org.ametys.core.ui.StaticClientSideRelation
org.ametys.cms.clientsideelement.relations.SetContentAttributeClientSideElement
org.ametys.odf.clientsideelement.SetContentAttributeClientSideElement
- All Implemented Interfaces:
ClientSideElement,ClientSideRelation,LogEnabled,PluginAware,Component,Configurable,Serviceable
Set the attribute of type 'content' of a content, with another content.
If content is a
ProgramItem, additional check will be done on catalog and content language-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected EducationalPathHelperThe educational path helperprotected ObservationManagerThe observation managerprotected ODFHelperThe ODF helperFields inherited from class org.ametys.cms.clientsideelement.relations.SetContentAttributeClientSideElement
_contentHelper, _contentTypeExtensionPoint, _contentTypesHelper, _contentWorkflowHelper, _resolverFields inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Map<WorkflowAwareContent,Integer> _filterContentsToEdit(Map<WorkflowAwareContent, Integer> contentsToEdit, List<String> contentIdsToReference, List<I18nizableText> errorMessages, List<String> errorIds, Map<String, Object> additionalParams) Filter the list of contents to editprotected void_notifyObserverIfHierarchyChanged(List<String> contentIdsToReference, Map<String, Integer> contentIdsToEdit, List<Map<String, String>> contentsToEditToRemove, List<String> contentsInError) Notify observers if the hierarchy of program item has been changedgetEducationalPathReferences(List<String> contentIdsToReference, List<Map<String, String>> contentsToEditToRemove) Get the educational paths that reference the program items to removedvoidservice(ServiceManager manager) setContentAttribute(List<String> contentIdsToReference, Map<String, Integer> contentIdsToEdit, List<Map<String, String>> contentsToEditToRemove, String attributePath, List<String> workflowActionIds, Map<String, Object> additionalParams) Set the attribute at path 'attributePath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'Methods inherited from class org.ametys.cms.clientsideelement.relations.SetContentAttributeClientSideElement
_convert, _convert, _findCompatibleAttributes, _resolve, _resolve, _setContentAttribute, getCompatibleAttributes, setContentAttributeMethods inherited from class org.ametys.core.ui.StaticClientSideRelation
configure, getSourceRelationType, getTargetRelationTypeMethods inherited from class org.ametys.core.ui.StaticClientSideElement
_configureClass, _configureParameters, _configureScript, configureInitialParametersMethods inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toStringMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.ametys.core.ui.ClientSideElement
getDependencies, getId, getPluginName, getRights, getScripts, getScripts
-
Field Details
-
_odfHelper
The ODF helper -
_educationalHelper
The educational path helper -
_observationManager
The observation manager
-
-
Constructor Details
-
SetContentAttributeClientSideElement
public SetContentAttributeClientSideElement()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Overrides:
servicein classSetContentAttributeClientSideElement- Throws:
ServiceException
-
setContentAttribute
public Map<String,Object> setContentAttribute(List<String> contentIdsToReference, Map<String, Integer> contentIdsToEdit, List<Map<String, String>> contentsToEditToRemove, String attributePath, List<String> workflowActionIds, Map<String, Object> additionalParams) Description copied from class:SetContentAttributeClientSideElementSet the attribute at path 'attributePath' of contents 'contentIdsToEdit' with value 'contentIdsToReference'- Overrides:
setContentAttributein classSetContentAttributeClientSideElement- Parameters:
contentIdsToReference- The list of content identifiers that will be added as values in the content fieldcontentIdsToEdit- The map {key: content identifiers to edit and that will have an attribute of type content modified; value: the new position if attribute 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"attributePath- The attribute path selected to do modification in the contents to editworkflowActionIds- The identifiers of workflow actions to use to edit the attribute. Actions will be tested in this order and first available action will be usedadditionalParams- the map of additional parameters- Returns:
- A map with key success: true or false. if false, it can be due to errors (list of error messages)
-
_notifyObserverIfHierarchyChanged
protected void _notifyObserverIfHierarchyChanged(List<String> contentIdsToReference, Map<String, Integer> contentIdsToEdit, List<Map<String, String>> contentsToEditToRemove, List<String> contentsInError) Notify observers if the hierarchy of program item has been changed- Parameters:
contentIdsToReference- The list of content identifiers that will be added as values in the content fieldcontentIdsToEdit- The map {key: content identifiers to edit and that will have an attribute of type content modified; value: the new position if attribute 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"contentsInError- the ids of contents in error
-
getEducationalPathReferences
public Map<String,Object> getEducationalPathReferences(List<String> contentIdsToReference, List<Map<String, String>> contentsToEditToRemove) Get the educational paths that reference the program items to removed- Parameters:
contentIdsToReference- The list of content identifiers that will be added as values in the content fieldcontentsToEditToRemove- The list of content to edit to remove currently referenced content. Keys are "contentId" and "valueToRemove"- Returns:
- a Map with program items referencing the given program items in a educational path attribute as key and the list of educational path references as value
-
_filterContentsToEdit
protected Map<WorkflowAwareContent,Integer> _filterContentsToEdit(Map<WorkflowAwareContent, Integer> contentsToEdit, List<String> contentIdsToReference, List<I18nizableText> errorMessages, List<String> errorIds, Map<String, Object> additionalParams) Description copied from class:SetContentAttributeClientSideElementFilter the list of contents to edit- Overrides:
_filterContentsToEditin classSetContentAttributeClientSideElement- Parameters:
contentsToEdit- the map of contents to editcontentIdsToReference- The list of content ids that will be added as values in the content fielderrorMessages- the error messageserrorIds- the error content idsadditionalParams- the map of additional parameters- Returns:
- the list of filtered contents
-