Package org.ametys.cms.content
Class CopyReport
- java.lang.Object
-
- org.ametys.cms.content.CopyReport
-
public final class CopyReport extends Object
The report object, used internally to provide useful informations once the whole duplication process has ended.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CopyReport.CopyMode
Available copy modestatic class
CopyReport.CopyState
The possible state of the copy
-
Field Summary
Fields Modifier and Type Field Description protected String
_baseContentId
Identifier of the base content associated to this reportprotected Boolean
_baseContentIsReferenceTable
Indicates if the base content associated to this report is a a entry of a reference table (can be null if unavailable)protected String
_baseContentTitle
Title of the base content associated to this report (can be null if unavailable)protected Map<String,Object>
_contentReferenceValues
List of values (content id or list of content ids) to be set into metadata of type content.protected List<String>
_copiedAttachments
List of paths (relative to the root attachment node of the target content) of the copied attachments during the duplicationprotected Map<ModifiableRichText,MetadataDefinition>
_copiedRichTexts
List of copied rich text metadata during the duplication processprotected String
_fallbackMetadataSetName
Name of the metadata set associated to this reportprotected List<CopyReport>
_innerReports
Child reports associated to this report.protected List<I18nizableText>
_metadataCopyErrors
List of metadata labels.protected String
_metadataSetName
Name of the metadata set associated to this reportprotected String
_metadataSetType
Type of the metadata set associated to this reportprotected CopyReport.CopyMode
_mode
The copy mode used during the copy (creation or edition)protected Map<String,Integer>
_repeatersInfo
List of info about repeaters to be used to perform the edition of content metadataprotected CopyReport.CopyState
_state
The state of the copyprotected String
_targetContentId
Identifier of the target content associated to this reportprotected boolean
_targetContentIsReferenceTable
Indicates if the target content associated to this report is a entry of a reference tableprotected String
_targetContentTitle
title of the target content associated to this report
-
Constructor Summary
Constructors Constructor Description CopyReport(String baseContentId, Boolean baseContentIsRefTable, String metadataSetName, String fallbackMetadataSetName, String metadataSetType, CopyReport.CopyMode copyMode)
Constructor.CopyReport(String baseContentId, String baseContentTitle, Boolean baseContentIsRefTable, String metadataSetName, String fallbackMetadataSetName, String metadataSetType, CopyReport.CopyMode copyMode)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttachment(String relPath)
Add an attachments to the copied attachments report listvoid
addContentReferenceValues(String metadataPath, Object values)
Should be used to store the values of a content metadata.void
addRepeaterInfo(String metadataPath, int entryCount)
Add repeater info to be able to perform an edition at the of the copy for content metadatavoid
addReport(CopyReport report)
Add a child report to the report.void
addRichText(ModifiableRichText richText, MetadataDefinition definition)
Add a rich text to the list of copied rich texts.String
getBaseContentId()
Get the base content identifierBoolean
getBaseContentIsReferenceTable()
Is the base content a reference table entry ?String
getBaseContentTitle()
Get the base content title.List<CopyReport>
getChildReports()
Get the list of child copy reports.Map<String,Object>
getContentReferenceValuesMap()
Get the list content reference valuesList<String>
getCopiedAttachments()
Get the list of the copied attachments.Map<ModifiableRichText,MetadataDefinition>
getCopiedRichTexts()
Get the list of copied rich text metadata.String
getFallbackMetadataSetName()
Get the name of the fallback metadataset used for the copy.List<I18nizableText>
getMetadataErrors()
Get the list of metadata errors during the copy.String
getMetadataSetName()
Get the name of the metadataset used for the copy.String
getMetadataSetType()
Get the type of the metadataset used for the copy.CopyReport.CopyMode
getMode()
Get the mode of the copyMap<String,Integer>
getRepeatersInfo()
Get the map of info about copied repeatersCopyReport.CopyState
getStatus()
Get the status of the copyString
getTargetContentId()
Get the target content identifierboolean
getTargetContentIsReferenceTable()
Is the target content a reference table entry?String
getTargetContentTitle()
Get the target content titlevoid
notifyContentCopyError()
Notify that the copy ended with an error (except for metadata copy error, wherenotifyMetadataCopyError(I18nizableText)
must be used).void
notifyContentCopySuccess()
Notify a copy successvoid
notifyContentCreation(String id, String title, boolean isRefTable)
Notify information about the target content to the report.void
notifyMetadataCopyError(I18nizableText label)
Notify a metadata copy error.void
setReferenceTable(boolean isRefTable)
Set whether the base content is a reference table's entry.void
setTargetContentTitle(String title)
Set the target content title.
-
-
-
Field Detail
-
_metadataSetName
protected final String _metadataSetName
Name of the metadata set associated to this report
-
_fallbackMetadataSetName
protected final String _fallbackMetadataSetName
Name of the metadata set associated to this report
-
_metadataSetType
protected final String _metadataSetType
Type of the metadata set associated to this report
-
_baseContentId
protected final String _baseContentId
Identifier of the base content associated to this report
-
_baseContentTitle
protected final String _baseContentTitle
Title of the base content associated to this report (can be null if unavailable)
-
_baseContentIsReferenceTable
protected Boolean _baseContentIsReferenceTable
Indicates if the base content associated to this report is a a entry of a reference table (can be null if unavailable)
-
_mode
protected final CopyReport.CopyMode _mode
The copy mode used during the copy (creation or edition)
-
_targetContentId
protected String _targetContentId
Identifier of the target content associated to this report
-
_targetContentTitle
protected String _targetContentTitle
title of the target content associated to this report
-
_targetContentIsReferenceTable
protected boolean _targetContentIsReferenceTable
Indicates if the target content associated to this report is a entry of a reference table
-
_innerReports
protected List<CopyReport> _innerReports
Child reports associated to this report. Each child report denotes an inner copy
-
_copiedRichTexts
protected Map<ModifiableRichText,MetadataDefinition> _copiedRichTexts
List of copied rich text metadata during the duplication process
-
_copiedAttachments
protected List<String> _copiedAttachments
List of paths (relative to the root attachment node of the target content) of the copied attachments during the duplication
-
_contentReferenceValues
protected Map<String,Object> _contentReferenceValues
List of values (content id or list of content ids) to be set into metadata of type content. Keys are the metadata path
-
_repeatersInfo
protected Map<String,Integer> _repeatersInfo
List of info about repeaters to be used to perform the edition of content metadata
-
_metadataCopyErrors
protected List<I18nizableText> _metadataCopyErrors
List of metadata labels. Each entry in the list denote an error during the copy of this metadata
-
_state
protected CopyReport.CopyState _state
The state of the copy
-
-
Constructor Detail
-
CopyReport
public CopyReport(String baseContentId, Boolean baseContentIsRefTable, String metadataSetName, String fallbackMetadataSetName, String metadataSetType, CopyReport.CopyMode copyMode)
Constructor. If the title of the base content if available, should be used.- Parameters:
baseContentId
- The content id of the base contentbaseContentIsRefTable
- Indicates if the base content is a reference table's entry (can be null if unavailable)metadataSetName
- The metadata set namefallbackMetadataSetName
- The fallback metadata set name. Use for legacy purpose.metadataSetType
- The metadata set type (edit or view)copyMode
- The mode of copy
-
CopyReport
public CopyReport(String baseContentId, String baseContentTitle, Boolean baseContentIsRefTable, String metadataSetName, String fallbackMetadataSetName, String metadataSetType, CopyReport.CopyMode copyMode)
Constructor.- Parameters:
baseContentId
- The content id of the base contentbaseContentTitle
- The title of the base contentbaseContentIsRefTable
- Indicates if the base content is a reference table's entrymetadataSetName
- The metadata set namefallbackMetadataSetName
- The fallback metadata set name. Use for legacy purpose.metadataSetType
- The metadata set type (edit or view)copyMode
- The mode of copy
-
-
Method Detail
-
setReferenceTable
public void setReferenceTable(boolean isRefTable)
Set whether the base content is a reference table's entry.- Parameters:
isRefTable
- true for reference table's entry.
-
setTargetContentTitle
public void setTargetContentTitle(String title)
Set the target content title.- Parameters:
title
- The target content title.
-
notifyContentCreation
public void notifyContentCreation(String id, String title, boolean isRefTable)
Notify information about the target content to the report.- Parameters:
id
- The content idtitle
- The content titleisRefTable
- Indicates if the target content is a reference table's entry.
-
notifyContentCopySuccess
public void notifyContentCopySuccess()
Notify a copy success
-
notifyContentCopyError
public void notifyContentCopyError()
Notify that the copy ended with an error (except for metadata copy error, wherenotifyMetadataCopyError(I18nizableText)
must be used).
-
notifyMetadataCopyError
public void notifyMetadataCopyError(I18nizableText label)
Notify a metadata copy error.- Parameters:
label
- The label of the metadata
-
addRichText
public void addRichText(ModifiableRichText richText, MetadataDefinition definition)
Add a rich text to the list of copied rich texts.- Parameters:
richText
- the rich textdefinition
- the metadata definition
-
getCopiedRichTexts
public Map<ModifiableRichText,MetadataDefinition> getCopiedRichTexts()
Get the list of copied rich text metadata.- Returns:
- List of
ModifiableRichText
-
addAttachment
public void addAttachment(String relPath)
Add an attachments to the copied attachments report list- Parameters:
relPath
- The relative path where to copy
-
addContentReferenceValues
public void addContentReferenceValues(String metadataPath, Object values)
Should be used to store the values of a content metadata. These values will be used later in the copy process to properly edit content metadata- Parameters:
metadataPath
- The path of the metadata to copyvalues
- The values
-
getContentReferenceValuesMap
public Map<String,Object> getContentReferenceValuesMap()
Get the list content reference values- Returns:
- Map representing the content reference values
-
addRepeaterInfo
public void addRepeaterInfo(String metadataPath, int entryCount)
Add repeater info to be able to perform an edition at the of the copy for content metadata- Parameters:
metadataPath
- The path of the metadata concernedentryCount
- the entry count
-
getRepeatersInfo
public Map<String,Integer> getRepeatersInfo()
Get the map of info about copied repeaters- Returns:
- Map holding repeaters info. Each values is the size of a repeater
-
getStatus
public CopyReport.CopyState getStatus()
Get the status of the copy- Returns:
- A copy state enum value
-
getMode
public CopyReport.CopyMode getMode()
Get the mode of the copy- Returns:
- A cope mode enum value
-
getMetadataSetName
public String getMetadataSetName()
Get the name of the metadataset used for the copy.- Returns:
- the metadataset name
-
getFallbackMetadataSetName
public String getFallbackMetadataSetName()
Get the name of the fallback metadataset used for the copy.- Returns:
- the fallback metadataset name
-
getMetadataSetType
public String getMetadataSetType()
Get the type of the metadataset used for the copy.- Returns:
- the metadataset name
-
getBaseContentId
public String getBaseContentId()
Get the base content identifier- Returns:
- The identifier
-
getBaseContentTitle
public String getBaseContentTitle()
Get the base content title.- Returns:
- The title or null (if unavailable)
-
getBaseContentIsReferenceTable
public Boolean getBaseContentIsReferenceTable()
Is the base content a reference table entry ?- Returns:
- true if it is, null if unknown.
-
getTargetContentId
public String getTargetContentId()
Get the target content identifier- Returns:
- The identifier
-
getTargetContentTitle
public String getTargetContentTitle()
Get the target content title- Returns:
- The title
-
getTargetContentIsReferenceTable
public boolean getTargetContentIsReferenceTable()
Is the target content a reference table entry?- Returns:
- true if it is.
-
getChildReports
public List<CopyReport> getChildReports()
Get the list of child copy reports. Each child report denotes an inner copy- Returns:
- The list of copy reports.
-
getMetadataErrors
public List<I18nizableText> getMetadataErrors()
Get the list of metadata errors during the copy.- Returns:
- List of the label of each metadata in error.
-
getCopiedAttachments
public List<String> getCopiedAttachments()
Get the list of the copied attachments.- Returns:
- List of paths (relative to the root attachment node of the target content)
-
addReport
public void addReport(CopyReport report)
Add a child report to the report. This must be done when an copy is requested- Parameters:
report
- The report of the copy to add
-
-