public class CopyContentMetadataComponent extends AbstractLogEnabled implements Serviceable, Component
This component is used to copy a content (either totally or partially).
In this whole file a Map named copyMap is regularly used. This map provide the name of the metadata to copy as well as some optional parameters. It has the following form (JSON) :
{ "$param1": value, "metadataA": null, "metadataB": { "subMetadataB1": null, "subMetadataB2": { "$param1": value, "$param2": value, "subSubMetadataB21": {...} }, ... } }
Each metadata that should be copied must be present as a key in the map. Composite metadata can contains child metadata but as seen on the example the map must be well structured, it is not a flat map. Parameters in the map must always start with the reserved character '$', in order to be differentiated from metadata name.
There are two main entry points for this helper component:
Modifier and Type | Class and Description |
---|---|
protected static class |
CopyContentMetadataComponent.CopyAttachmentsHandler
A copy attachments content handler.
|
Modifier and Type | Field and Description |
---|---|
protected ContentHelper |
_contentHelper
The content helper
|
protected ContentTypeExtensionPoint |
_contentTypeExtensionPoint
Content type extension point.
|
protected ContentTypesHelper |
_contentTypesHelper
Helper for content types
|
protected OutgoingReferencesExtractor |
_outgoingReferencesExtractor
The outgoing references extractor
|
protected AmetysObjectResolver |
_resolver
Ametys object resolver available to subclasses.
|
protected SAXParser |
_saxParser
The Excalibur SAX parser
|
protected WorkflowProvider |
_workflowProvider
Workflow provider.
|
static String |
ROLE
Avalon ROLE.
|
Constructor and Description |
---|
CopyContentMetadataComponent() |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Object> |
_buildCopyMap(AbstractMetadataSetElement metadataSetElement,
Map<String,Object> copyMap)
Recursive auxiliary function used to build the copy map.
|
protected Map<String,Object> |
_buildCopyMap(Content baseContent,
String metadataSetName,
String metadataSetType,
Map<String,Object> baseCopyMap)
Build the copy map from a metadata set.
|
protected Map<String,Object> |
_buildCopyMap(Content baseContent,
String metadataSetName,
String metadataSetType,
String targetContentType,
Map<String,Object> baseCopyMap)
Build the copy map from a metadata set.
|
protected void |
_copyFile(File baseFile,
ModifiableFolder targetFolder)
File copy during the copy of a folder.
|
protected void |
_copyFolder(Folder baseFolder,
ModifiableFolder targetFolder)
Folder copy during the copy of a rich text metadata.
|
protected void |
_copyMetadataMap(Content baseContent,
CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metaPrefix,
MetadataDefinition parentMetadataDefinition,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Copy the specified set of metadata from a base composite metadata to a target composite metadata by iterating over the copyMap.
|
protected String[] |
_copyReferencedContents(String[] baseContentIds,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Duplicate base contents by creating new contents.
|
protected void |
_copyRepeater(Content baseContent,
CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataPath,
MetadataDefinition metadataDefinition,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Copy a repeater
|
protected void |
_extractOutgoingReferences(ModifiableContent content)
Analyse the content to find outgoing references and store them
|
protected Map<String,Object> |
_getInputsForContentReferencesEdition(Content baseContent,
WorkflowAwareContent targetContent,
Map<String,Object> editionValues,
CopyReport copyReport)
Retrieve the inputs for the content references edition workflow function.
|
protected Map<String,Object> |
_getInputsForCopy(Content baseContent,
String title,
Map<String,Object> copyMap,
String targetContentType,
String parentContentId,
String parentMetadataPath,
CopyReport copyReport)
Retrieve the inputs for the copy workflow function.
|
protected Map<String,Object> |
_getInputsForEdition(Content baseContent,
WorkflowAwareContent targetContent,
Map<String,Object> copyMap,
CopyReport copyReport)
Retrieve the inputs for the edition workflow function.
|
protected MetadataDefinition |
_getMetadataDefinition(Content content,
MetadataDefinition metadataDefinition,
String metadataName)
Retrieves a
MetadataDefinition through its
parent definition or the ContentType of the
current content if at the root level of the metadataset. |
protected String |
_getWorklowName(Content content,
Map<String,Object> inputs)
Retrieve the workflow name of a content.
|
protected Map<String,Object> |
_handleInnerCopyMap(Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs)
Handle the creation of the inner copy map given the current context.
|
protected void |
_reportMetadataException(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
MetadataDefinition metadataDefinition,
CopyReport copyReport,
Exception e)
Add a metadata exception to the report.
|
protected WorkflowAwareContent |
_retrieveTargetContent(String targetContentId)
Retrieve the target content from its id.
|
protected void |
_runContentReferencesEdition(Content baseContent,
WorkflowProvider.AmetysObjectWorkflow targetContentWorkflow,
int editActionId,
boolean forceEdition,
CopyReport copyReport)
Run the edition of the content references that has been stored during the copy of the metadata.
|
protected void |
_setBooleanMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
Boolean isMultiple)
Set a metadata of type boolean from a base composite metadata to a target composite metadata.
|
protected void |
_setDateMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
Boolean isMultiple)
Set a metadata of type date/datetime from a base composite metadata to a target composite metadata.
|
protected void |
_setDoubleMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
Boolean isMultiple)
Set a metadata of type double from a base composite metadata to a target composite metadata.
|
protected void |
_setLongMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
Boolean isMultiple)
Set a metadata of type long from a base composite metadata to a target composite metadata.
|
protected void |
_setStringMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
Boolean isMultiple)
Set a metadata of type string from a base composite metadata to a target composite metadata.
|
protected void |
_updateRichTextMetadata(Content baseContent,
ModifiableContent targetContent,
CopyReport copyReport)
This method analyzes content rich texts and update their content to
ensure consistency.
|
Map<String,Object> |
buildCopyMap(Content baseContent,
String metadataSetName,
String metadataSetType)
Build the copy map from given content and metadata set.
|
void |
copyBasicMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDef,
String metadataName)
Copy a 'basic' metadata.
|
void |
copyBinaryMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName)
Duplicate a metadata of type
MetadataType.BINARY . |
void |
copyCompositeMetadata(Content baseContent,
CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataPath,
MetadataDefinition metadataDefinition,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Copy composite metadata
|
CopyReport |
copyContent(Content baseContent,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(Content baseContent,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
int initActionId,
int editRefActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(Content baseContent,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
int initActionId,
int editRefActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(Content baseContent,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
String targetContentType,
int initActionId,
int editRefActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(Content baseContent,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
String parentContentId,
String parentMetadataPath,
int initActionId,
int editActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(Content baseContent,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
String targetContentType,
String parentContentId,
String parentMetadataPath,
int initActionId,
int editRefActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(String baseContentId,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
int initActionId,
int editActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(String baseContentId,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
int initActionId,
int editActionId)
Copy a content by creating a new content and copying the value of the
metadata of a source content into the new one.
|
CopyReport |
copyContent(String baseContentId,
String title,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
String targetContentType,
int initActionId,
int editActionId)
Create a new content by copy of another.
|
void |
copyContentReferenceMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDefinition,
String metadataPath,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Duplicate a metadata of type
MetadataType.CONTENT . |
void |
copyFileMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDef,
String metadataName)
Copy a file metadata
|
void |
copyGeocodeMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName)
Duplicate a metadata of type
MetadataType.GEOCODE . |
void |
copyMetadata(Content baseContent,
CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDefinition,
String metaPrefix,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Copy the specified metadata from a base composite metadata to a target composite metadata.
|
void |
copyMetadataMap(Content baseContent,
ModifiableContent targetContent,
Map<String,Object> copyMap,
CopyReport copyReport)
Copy the specified set of metadata from a base content to a target content by iterating over the copyMap.
|
void |
copyMultilingualStringMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName)
Duplicate a metadata of type
MetadataType.MULTILINGUAL_STRING . |
void |
copyReferenceMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDefinition,
String metadataName)
Duplicate a metadata of type
MetadataType.REFERENCE . |
protected void |
copyRichTextMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
MetadataDefinition metadataDef,
String metadataName,
CopyReport copyReport)
Copy a rich-text metadata
|
void |
copySubContentMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName,
String metadataPath,
Map<String,Object> copyMap,
Map<String,Object> innerCopyMapInputs,
CopyReport copyReport)
Duplicate a metadata of type
MetadataType.SUB_CONTENT . |
void |
copyUserMetadata(CompositeMetadata baseMetaHolder,
ModifiableCompositeMetadata targetMetaHolder,
String metadataName)
Duplicate a metadata of type
MetadataType.USER . |
CopyReport |
editContent(String baseContentId,
String targetContentId,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType)
Edit a content by copying the value of the
metadata of a source content into a target content.
|
CopyReport |
editContent(String baseContentId,
String targetContentId,
Map<String,Object> copyMap,
String metadataSetName,
String metadataSetType,
int actionId,
int editRefActionId)
Edit a content by copying the value of the
metadata of a source content into a target content.
|
int |
getActionIdForCopy2()
Retrieve the action id to execute for the content copy.
|
int |
getDefaultActionIdForContentEdition()
Get the default workflow action id for editing content by copy
|
int |
getDefaultActionIdForEditingContentReferences()
Get the default workflow action id for editing content metadata of main content
|
int |
getDefaultInitActionId()
Get the default workflow action id for initialization of main content
|
void |
service(ServiceManager manager) |
getLogger, setLogger
protected WorkflowProvider _workflowProvider
protected AmetysObjectResolver _resolver
protected SAXParser _saxParser
protected ContentTypeExtensionPoint _contentTypeExtensionPoint
protected ContentTypesHelper _contentTypesHelper
protected OutgoingReferencesExtractor _outgoingReferencesExtractor
protected ContentHelper _contentHelper
public CopyContentMetadataComponent()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public CopyReport copyContent(String baseContentId, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, int initActionId, int editActionId)
baseContentId
- The identifier of the base contentcopyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.initActionId
- The workflow action id to use to create the new contenteditActionId
- The workflow action id to use to edit the newly created contentpublic CopyReport copyContent(String baseContentId, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, int initActionId, int editActionId)
baseContentId
- The identifier of the base contenttitle
- Desired title for the new content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.initActionId
- The init workflow action id for main content onlyeditActionId
- The workflow action for editing main content onlypublic CopyReport copyContent(String baseContentId, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, String targetContentType, int initActionId, int editActionId)
baseContentId
- The id of content to copytitle
- The title of the new created contentcopyMap
- The map of metadata to copy. Can be null to copy the whole metadata set.metadataSetName
- The name of metadata set to copymetadataSetType
- The type of metadata set to copytargetContentType
- The type of content to create. If null the type(s) of created content will be those of base content.initActionId
- The init workflow action id for main content onlyeditActionId
- The workflow action for editing main content onlypublic CopyReport copyContent(Content baseContent, Map<String,Object> copyMap, String metadataSetName, String metadataSetType)
baseContent
- The base content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.public CopyReport copyContent(Content baseContent, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, int initActionId, int editRefActionId)
baseContent
- The base content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.initActionId
- The init workflow action id for main content onlyeditRefActionId
- The workflow action for editing referencespublic CopyReport copyContent(Content baseContent, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, int initActionId, int editRefActionId)
baseContent
- The base content.title
- Desired title for the new content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.initActionId
- The init workflow action id for main content onlyeditRefActionId
- The workflow action for editing referencespublic CopyReport copyContent(Content baseContent, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, String targetContentType, int initActionId, int editRefActionId)
baseContent
- The base content.title
- Desired title for the new content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.targetContentType
- The type of content to create. If null the type(s) of created content will be those of base content.initActionId
- The init workflow action id for main content onlyeditRefActionId
- The workflow action for editing referencespublic CopyReport copyContent(Content baseContent, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, String parentContentId, String parentMetadataPath, int initActionId, int editActionId)
baseContent
- The base content.title
- Desired title for the new content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.parentContentId
- The target content ID.parentMetadataPath
- the parent metadata path, if a sub-content is being created.initActionId
- The init workflow action id for main content onlyeditActionId
- The workflow action for editing main content onlypublic CopyReport copyContent(Content baseContent, String title, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, String targetContentType, String parentContentId, String parentMetadataPath, int initActionId, int editRefActionId)
baseContent
- The base content.title
- Desired title for the new content.copyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.targetContentType
- The type of content to create. If null the type(s) of created content will be those of base content.parentContentId
- The target content ID.parentMetadataPath
- the parent metadata path, if a sub-content is being created.initActionId
- The init workflow action id for main content onlyeditRefActionId
- The workflow action for editing referencesprotected Map<String,Object> _getInputsForCopy(Content baseContent, String title, Map<String,Object> copyMap, String targetContentType, String parentContentId, String parentMetadataPath, CopyReport copyReport)
baseContent
- The content to copytitle
- The title to setcopyMap
- The map with properties to copytargetContentType
- The type of content to create. If null the type(s) of created content will be those of base content.parentContentId
- The parent content ID, when copying a sub-content.parentMetadataPath
- The parent metadata path, when copying a sub-content.copyReport
- The report of the copyprotected String _getWorklowName(Content content, Map<String,Object> inputs) throws IllegalArgumentException
content
- The content to considerinputs
- The inputs that will be provided to the workflow functionIllegalArgumentException
- if the content is not workflow aware.public Map<String,Object> buildCopyMap(Content baseContent, String metadataSetName, String metadataSetType)
baseContent
- the content to copymetadataSetName
- Name of the metadata set.metadataSetType
- Type of the metadata set.protected Map<String,Object> _buildCopyMap(Content baseContent, String metadataSetName, String metadataSetType, Map<String,Object> baseCopyMap)
baseContent
- the content to copymetadataSetName
- Name of the metadata set.metadataSetType
- Type of the metadata set.baseCopyMap
- The copy map being constructedprotected Map<String,Object> _buildCopyMap(Content baseContent, String metadataSetName, String metadataSetType, String targetContentType, Map<String,Object> baseCopyMap)
baseContent
- The content to be copiedmetadataSetName
- Name of the metadata set to be copied.metadataSetType
- Type of the metadata set to be copied (view or edition).targetContentType
- The content type of content to create. Can be null.baseCopyMap
- The copy map being constructedprotected Map<String,Object> _buildCopyMap(AbstractMetadataSetElement metadataSetElement, Map<String,Object> copyMap)
metadataSetElement
- The current metadata set elementcopyMap
- The copy map being constructed or nullpublic CopyReport editContent(String baseContentId, String targetContentId, Map<String,Object> copyMap, String metadataSetName, String metadataSetType)
baseContentId
- The identifier of the base contenttargetContentId
- The identifier of the target contentcopyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.public CopyReport editContent(String baseContentId, String targetContentId, Map<String,Object> copyMap, String metadataSetName, String metadataSetType, int actionId, int editRefActionId)
baseContentId
- The identifier of the base contenttargetContentId
- The identifier of the target contentcopyMap
- The map of properties as described in
CopyContentMetadataComponent
. Can be null in which
case the map will be constructed from a metadataSet.metadataSetName
- The name of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default name for possible inner copies (if not provided as a
copyMap parameter).metadataSetType
- The type of the metadata set to be used to
construct to copyMap if not provided. This will also be the
default type for possible inner copies.actionId
- the edit workflow action ideditRefActionId
- the workflow action id for editing referencesprotected WorkflowAwareContent _retrieveTargetContent(String targetContentId) throws IllegalArgumentException
targetContentId
- The target content identifer.IllegalArgumentException
- if the content is not workflow aware.protected Map<String,Object> _getInputsForEdition(Content baseContent, WorkflowAwareContent targetContent, Map<String,Object> copyMap, CopyReport copyReport)
baseContent
- The content to copytargetContent
- The target of the copycopyMap
- The properties to copycopyReport
- The report of the copypublic void copyMetadataMap(Content baseContent, ModifiableContent targetContent, Map<String,Object> copyMap, CopyReport copyReport)
baseContent
- The original contenttargetContent
- The copy contentcopyMap
- The properties to copycopyReport
- The copy report being populated during the copy.protected void _copyMetadataMap(Content baseContent, CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metaPrefix, MetadataDefinition parentMetadataDefinition, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
baseContent
- The original contentbaseMetaHolder
- The metadata holder of the baseContenttargetMetaHolder
- The metadata holder of the target contentmetaPrefix
- The metadata prefix.parentMetadataDefinition
- The parent metadata definition. Can be nullcopyMap
- The properties to copyinnerCopyMapInputs
- The properties to copy for sub objectscopyReport
- The copy report being populated during the copy.protected MetadataDefinition _getMetadataDefinition(Content content, MetadataDefinition metadataDefinition, String metadataName)
MetadataDefinition
through its
parent definition or the ContentType
of the
current content if at the root level of the metadataset.content
- The contentmetadataDefinition
- The parent metadata definition. Can be null.metadataName
- The metadata nameprotected void _reportMetadataException(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, MetadataDefinition metadataDefinition, CopyReport copyReport, Exception e)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to copymetadataDefinition
- The associated definitioncopyReport
- The report of the copye
- The raised exception.public void copyMetadata(Content baseContent, CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDefinition, String metaPrefix, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
baseContent
- The original contentbaseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataDefinition
- The associated definitionmetaPrefix
- The metadata prefix.copyMap
- The properties to copyinnerCopyMapInputs
- The properties to copy for sub objectscopyReport
- The report of the copypublic void copyBasicMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDef, String metadataName)
MetadataType.STRING
, MetadataType.DATE
, MetadataType.DATETIME
,
MetadataType.DOUBLE
, MetadataType.LONG
, MetadataType.BOOLEAN
,
MetadataType.USER
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataDef
- The metadata definitionmetadataName
- The metadata nameprotected void _setStringMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, Boolean isMultiple)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerisMultiple
- Is the metadata multipleprotected void _setDateMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, Boolean isMultiple)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerisMultiple
- Is the metadata multipleprotected void _setDoubleMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, Boolean isMultiple)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerisMultiple
- Is the metadata multipleprotected void _setLongMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, Boolean isMultiple)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerisMultiple
- Is the metadata multipleprotected void _setBooleanMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, Boolean isMultiple)
baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerisMultiple
- Is the metadata multiplepublic void copyGeocodeMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName)
MetadataType.GEOCODE
.baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerpublic void copyMultilingualStringMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName)
MetadataType.MULTILINGUAL_STRING
.baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerpublic void copyUserMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName)
MetadataType.USER
.baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerpublic void copyReferenceMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDefinition, String metadataName)
MetadataType.REFERENCE
.baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considermetadataDefinition
- The associated definitionpublic void copyBinaryMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName)
MetadataType.BINARY
.baseMetaHolder
- The metadata holder to copytargetMetaHolder
- The metadata holder where to copymetadataName
- The metadata to considerpublic void copyFileMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDef, String metadataName)
baseMetaHolder
- The copied composite metadatatargetMetaHolder
- The target composite metadatametadataDef
- The metadata definitionmetadataName
- The metadata nameprotected void copyRichTextMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDef, String metadataName, CopyReport copyReport)
baseMetaHolder
- The copied composite metadatatargetMetaHolder
- The target composite metadatametadataName
- The metadata namemetadataDef
- The metadata definitioncopyReport
- The copy reportprotected void _copyFolder(Folder baseFolder, ModifiableFolder targetFolder)
baseFolder
- The folder to copytargetFolder
- The folder where to copyprotected void _copyFile(File baseFile, ModifiableFolder targetFolder)
baseFile
- The file to copytargetFolder
- The folder where to copypublic void copyContentReferenceMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, MetadataDefinition metadataDefinition, String metadataPath, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
MetadataType.CONTENT
.
If the copy map has a '$mode' parameter set to 'create', a new content will be created for each referenced content in the base metadata.
The referenced contents are created if needed but content references are not set here.
It should be done manually as done in _runContentReferencesEdition(org.ametys.cms.repository.Content, org.ametys.plugins.workflow.support.WorkflowProvider.AmetysObjectWorkflow, int, boolean, org.ametys.cms.content.CopyReport)
baseMetaHolder
- The metadata holder of the content to copytargetMetaHolder
- The metadata holder of the target contentmetadataDefinition
- The definition of the metadatametadataPath
- The content metadata path.copyMap
- The properties to copyinnerCopyMapInputs
- The properties of sub objectscopyReport
- The report of the copyprotected String[] _copyReferencedContents(String[] baseContentIds, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
baseContentIds
- The ids of contents to copycopyMap
- The properties to copyinnerCopyMapInputs
- The properties of sub objectscopyReport
- The report of the copyprotected Map<String,Object> _handleInnerCopyMap(Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs)
copyMap
- The properties to copyinnerCopyMapInputs
- The properties of sub objectspublic void copySubContentMetadata(CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataName, String metadataPath, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
MetadataType.SUB_CONTENT
.
If the copy map has a '$mode' parameter set to 'create', a new content will be created for each referenced content in the base metadata.baseMetaHolder
- The metadata holder of the content to copytargetMetaHolder
- The metadata holder of the target contentmetadataName
- The name of the metadatametadataPath
- The content metadata path.copyMap
- The properties to copyinnerCopyMapInputs
- The properties of sub objectscopyReport
- The report of the copypublic void copyCompositeMetadata(Content baseContent, CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataPath, MetadataDefinition metadataDefinition, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
baseContent
- The copied contentbaseMetaHolder
- The original composite metadatatargetMetaHolder
- The target composite metadatametadataPath
- The metadata pathmetadataDefinition
- The metadata definitioncopyMap
- The map for copyinnerCopyMapInputs
- The properties of sub objectscopyReport
- The copy reportprotected void _copyRepeater(Content baseContent, CompositeMetadata baseMetaHolder, ModifiableCompositeMetadata targetMetaHolder, String metadataPath, MetadataDefinition metadataDefinition, Map<String,Object> copyMap, Map<String,Object> innerCopyMapInputs, CopyReport copyReport)
baseContent
- The copied contentbaseMetaHolder
- The original composite metadatatargetMetaHolder
- The target composite metadatametadataPath
- The metadata pathmetadataDefinition
- The metadata definitioncopyMap
- The map for copyinnerCopyMapInputs
- The properties of sub objectscopyReport
- The copy reportprotected void _extractOutgoingReferences(ModifiableContent content)
content
- The content to analyzeprotected void _updateRichTextMetadata(Content baseContent, ModifiableContent targetContent, CopyReport copyReport)
baseContent
- The copied contenttargetContent
- The target contentcopyReport
- The copy reportprotected void _runContentReferencesEdition(Content baseContent, WorkflowProvider.AmetysObjectWorkflow targetContentWorkflow, int editActionId, boolean forceEdition, CopyReport copyReport) throws Exception
baseContent
- The base content to copytargetContentWorkflow
- the target content local workfloweditActionId
- The edit action id to edit referencesforceEdition
- true to force edition regardless user's rightscopyReport
- the copy reportException
- If an error occuredprotected Map<String,Object> _getInputsForContentReferencesEdition(Content baseContent, WorkflowAwareContent targetContent, Map<String,Object> editionValues, CopyReport copyReport)
baseContent
- The content to copytargetContent
- The content where to copyeditionValues
- The values representing the content references to be edited (also contains special repeater size values)copyReport
- The report of the copypublic int getDefaultInitActionId()
public int getDefaultActionIdForEditingContentReferences()
public int getDefaultActionIdForContentEdition()
public int getActionIdForCopy2()