Class SimpleDocumentService
- java.lang.Object
-
- org.silverpeas.core.contribution.attachment.SimpleDocumentService
-
- All Implemented Interfaces:
ComponentInstanceDeletion
,VolatileResourceCleaner
,AttachmentService
,DocumentIndexing
@Service public class SimpleDocumentService extends Object implements AttachmentService, ComponentInstanceDeletion, VolatileResourceCleaner
- Author:
- ehugonnet
-
-
Field Summary
-
Fields inherited from interface org.silverpeas.core.contribution.attachment.AttachmentService
VERSION_MODE
-
-
Constructor Summary
Constructors Constructor Description SimpleDocumentService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addXmlForm(SimpleDocumentPK pk, String language, String xmlFormName)
SimpleDocumentPK
changeVersionState(SimpleDocumentPK pk, String comment)
Change the management of versions of the document.void
cleanVolatileResources(String volatileResourceId, String componentInstanceIdentifier)
Cleans the resources referenced with the given resource identifier and linked to the component instance represented by the given identifier.SimpleDocumentPK
cloneDocument(SimpleDocument original, String foreignCloneId)
Clone the attachment.List<Pair<SimpleDocumentPK,SimpleDocumentPK>>
copyAllDocuments(ResourceReference resourceSourcePk, ResourceReference targetDestinationPk)
Copies all the attachment linked to a resource to another one.SimpleDocumentPK
copyDocument(SimpleDocument original, ResourceReference targetPk)
Clone the attachment.SimpleDocument
createAttachment(SimpleDocument document, File content)
Create file attached to an object who is identified by the foreignId.SimpleDocument
createAttachment(SimpleDocument document, File content, boolean indexIt)
Create file attached to an object who is identified by the foreignId.SimpleDocument
createAttachment(SimpleDocument document, File content, boolean indexIt, boolean notify)
Create file attached to an object who is identified by the foreignId.SimpleDocument
createAttachment(SimpleDocument document, InputStream content)
Create file attached to an object who is identified by the foreignId.SimpleDocument
createAttachment(SimpleDocument document, InputStream content, boolean indexIt)
Create file attached to an object who is identified by the foreignId.SimpleDocument
createAttachment(SimpleDocument document, InputStream content, boolean indexIt, boolean notify)
Create file attached to an object who is identified by the foreignId.void
createIndex(SimpleDocument document)
void
createIndex(SimpleDocument document, Date startOfVisibility, Date endOfVisibility)
void
delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance.void
deleteAllAttachments(String componentInstanceId)
Deletes all the documents related to the component instance identified by the specified identifier.void
deleteAllAttachments(String resourceId, String componentInstanceId)
Deletes all the document attached to a component resource.void
deleteAttachment(SimpleDocument document)
Delete a given attachment.void
deleteAttachment(SimpleDocument document, boolean notify)
Delete a given attachment.void
deleteIndex(SimpleDocument document)
SimpleDocument
findExistingDocument(SimpleDocumentPK pk, String fileName, ResourceReference foreign, String lang)
Find documents with the same name attached to the specified foreign id.void
getBinaryContent(File file, SimpleDocumentPK pk, String lang)
Writes the binary content into the specified File.void
getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang)
Writes the binary content into the specified OutputStream.void
getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang, long contentOffset, long contentLength)
Writes the binary content contained between begin and end indexes into the specified OutputStream.void
indexAllDocuments(ResourceReference fk, Date startOfVisibilityPeriod, Date endOfVisibilityPeriod)
Indexes all the documents (whatever their type) of a container.SimpleDocumentList<SimpleDocument>
listAllDocumentsByForeignKey(ResourceReference foreignKey, String lang)
Search all documents (files, xmlform content, wysiwyg) attached to a foreign object.SimpleDocumentList<SimpleDocument>
listDocumentsByForeignKey(ResourceReference foreignKey, String lang)
Search all files attached to a foreign object.SimpleDocumentList<SimpleDocument>
listDocumentsByForeignKeyAndType(ResourceReference foreignKey, DocumentType type, String lang)
Search all file attached to a foreign object.List<SimpleDocument>
listDocumentsLockedByUser(String usedId, String language)
Search all the documents locked by a specific user.List<SimpleDocument>
listDocumentsRequiringWarning(Date alertDate, String language)
Search all the documents in an instance which are locked at the alert date.List<SimpleDocument>
listDocumentsToUnlock(Date expiryDate, String language)
Search all the documents in an instance requiring to be unlocked at the specified date.List<SimpleDocument>
listExpiringDocuments(Date expiryDate, String language)
Search all the documents in an instance which require an alert at the specified date.boolean
lock(String attachmentId, String userId, String language)
Lock a file so it can be edited by an user.Map<String,String>
mergeDocuments(ResourceReference originalForeignKey, ResourceReference cloneForeignKey, DocumentType type)
Merges the documents of cloned container with the original documents.List<SimpleDocumentPK>
moveAllDocuments(ResourceReference resourceSourcePk, ResourceReference targetDestinationPk)
SimpleDocumentPK
moveDocument(SimpleDocument document, ResourceReference destination)
Moves the attachment.void
removeContent(SimpleDocument document, String lang, boolean notify)
To remove the content of the document in the specified language.void
reorderAttachments(List<SimpleDocumentPK> pks)
Reorder the attachments according to the order in the list.void
reorderDocuments(List<SimpleDocument> documents)
Reorder the attachments according to the order in the list.SimpleDocument
searchDocumentById(SimpleDocumentPK primaryKey, String lang)
Search the document.void
switchAllowingDownloadForReaders(SimpleDocumentPK pk, boolean allowing)
Allows or forbids the download for readers.void
switchComponentBehaviour(String componentId, boolean toVersionning)
Change the management of versions of the documents of a whole component (only attachments are taken into account).void
switchEnableDisplayAsContent(SimpleDocumentPK pk, boolean enable)
Enables or not the display of the content of an attachment.void
switchEnableEditSimultaneously(SimpleDocumentPK pk, boolean enable)
Enables or not the simultaneous edition of the content of an attachment.void
unindexAttachmentsOfExternalObject(ResourceReference foreignKey)
boolean
unlock(UnlockContext context)
Release a locked file.void
updateAttachment(SimpleDocument document, boolean indexIt, boolean notify)
To update the document : status, metadata but not its content.void
updateAttachment(SimpleDocument document, File content, boolean indexIt, boolean notify)
To update a document content by updating or adding some content.void
updateAttachment(SimpleDocument document, InputStream in, boolean indexIt, boolean notify)
To update a document content by updating or adding some content.void
updateIndexEntryWithDocuments(FullIndexEntry indexEntry)
Add the documents to the index.
-
-
-
Method Detail
-
deleteAllAttachments
public void deleteAllAttachments(String componentInstanceId)
Description copied from interface:AttachmentService
Deletes all the documents related to the component instance identified by the specified identifier.- Specified by:
deleteAllAttachments
in interfaceAttachmentService
- Parameters:
componentInstanceId
- the component instance identifier.
-
cleanVolatileResources
public void cleanVolatileResources(String volatileResourceId, String componentInstanceIdentifier)
Description copied from interface:VolatileResourceCleaner
Cleans the resources referenced with the given resource identifier and linked to the component instance represented by the given identifier.- Specified by:
cleanVolatileResources
in interfaceVolatileResourceCleaner
- Parameters:
volatileResourceId
- a resource identifier.componentInstanceIdentifier
- a component instance identifier.
-
createIndex
public void createIndex(SimpleDocument document)
- Specified by:
createIndex
in interfaceAttachmentService
-
deleteIndex
public void deleteIndex(SimpleDocument document)
- Specified by:
deleteIndex
in interfaceAttachmentService
-
createIndex
public void createIndex(SimpleDocument document, Date startOfVisibility, Date endOfVisibility)
- Specified by:
createIndex
in interfaceAttachmentService
-
unindexAttachmentsOfExternalObject
public void unindexAttachmentsOfExternalObject(ResourceReference foreignKey)
- Specified by:
unindexAttachmentsOfExternalObject
in interfaceAttachmentService
-
addXmlForm
public void addXmlForm(SimpleDocumentPK pk, String language, String xmlFormName)
- Specified by:
addXmlForm
in interfaceAttachmentService
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, InputStream content)
Create file attached to an object who is identified by the foreignId.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.- Returns:
- the stored document.
- Throws:
AttachmentException
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, InputStream content, boolean indexIt)
Create file attached to an object who is identified by the foreignId.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.indexIt
-true
if the document is to be indexed,false
otherwhise.- Returns:
- the stored document.
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, InputStream content, boolean indexIt, boolean notify)
Create file attached to an object who is identified by the foreignId.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.indexIt
-true
if the document is to be indexed,false
otherwhise.notify
-true
to notify about the creation of an attachment,false
otherwise.- Returns:
- the stored document.
-
deleteAttachment
public void deleteAttachment(SimpleDocument document)
Delete a given attachment.- Specified by:
deleteAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to deleted.
-
deleteAllAttachments
public void deleteAllAttachments(String resourceId, String componentInstanceId)
Description copied from interface:AttachmentService
Deletes all the document attached to a component resource.- Specified by:
deleteAllAttachments
in interfaceAttachmentService
- Parameters:
resourceId
- the identifier of the resource.componentInstanceId
- the identifier of the component instance into which the resource is referenced.
-
deleteAttachment
public void deleteAttachment(SimpleDocument document, boolean notify)
Delete a given attachment.- Specified by:
deleteAttachment
in interfaceAttachmentService
- Parameters:
document
- the attachmentDetail object to deleted.notify
-true
to notify about the deletion of an attachment,false
otherwise.
-
searchDocumentById
public SimpleDocument searchDocumentById(SimpleDocumentPK primaryKey, String lang)
Description copied from interface:AttachmentService
Search the document.- Specified by:
searchDocumentById
in interfaceAttachmentService
- Parameters:
primaryKey
- the primary key of document.lang
- the lang of the document.- Returns:
- java.util.Vector: a collection of AttachmentDetail
-
listAllDocumentsByForeignKey
public SimpleDocumentList<SimpleDocument> listAllDocumentsByForeignKey(ResourceReference foreignKey, String lang)
Description copied from interface:AttachmentService
Search all documents (files, xmlform content, wysiwyg) attached to a foreign object.- Specified by:
listAllDocumentsByForeignKey
in interfaceAttachmentService
- Parameters:
foreignKey
- : the primary key of foreign object.lang
- the language of the documents.- Returns:
- the list of attached documents.
-
listDocumentsByForeignKey
public SimpleDocumentList<SimpleDocument> listDocumentsByForeignKey(ResourceReference foreignKey, String lang)
Description copied from interface:AttachmentService
Search all files attached to a foreign object.- Specified by:
listDocumentsByForeignKey
in interfaceAttachmentService
- Parameters:
foreignKey
- : the primary key of foreign object.lang
- the language of the documents.- Returns:
- the list of attached documents.
-
updateAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(UPDATE) public void updateAttachment(@SourceObject @TargetPK SimpleDocument document, boolean indexIt, boolean notify)
Description copied from interface:AttachmentService
To update the document : status, metadata but not its content.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
updateAttachment
in interfaceAttachmentService
-
updateAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(UPDATE) public void updateAttachment(@SourceObject @TargetPK SimpleDocument document, InputStream in, boolean indexIt, boolean notify)
Description copied from interface:AttachmentService
To update a document content by updating or adding some content.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
updateAttachment
in interfaceAttachmentService
-
removeContent
public void removeContent(SimpleDocument document, String lang, boolean notify)
Description copied from interface:AttachmentService
To remove the content of the document in the specified language.- Specified by:
removeContent
in interfaceAttachmentService
-
cloneDocument
public SimpleDocumentPK cloneDocument(SimpleDocument original, String foreignCloneId)
Clone the attachment.- Specified by:
cloneDocument
in interfaceAttachmentService
- Parameters:
original
-foreignCloneId
-- Returns:
-
copyDocument
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(COPY) public SimpleDocumentPK copyDocument(@SourceObject SimpleDocument original, @TargetPK ResourceReference targetPk)
Clone the attachment.- Specified by:
copyDocument
in interfaceAttachmentService
- Parameters:
original
-targetPk
-- Returns:
-
copyAllDocuments
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(COPY) public List<Pair<SimpleDocumentPK,SimpleDocumentPK>> copyAllDocuments(@SourcePK ResourceReference resourceSourcePk, @TargetPK ResourceReference targetDestinationPk)
Description copied from interface:AttachmentService
Copies all the attachment linked to a resource to another one.- Specified by:
copyAllDocuments
in interfaceAttachmentService
- Parameters:
resourceSourcePk
- the identifier of the resource and its location (component instance) which linked attachments must be copied.targetDestinationPk
- the identifier of the resource and its location (component instance) that will get the copied attachments.- Returns:
- le list of copied attachments, empty if nothing is copied.
-
reorderAttachments
public void reorderAttachments(List<SimpleDocumentPK> pks)
Reorder the attachments according to the order in the list.- Specified by:
reorderAttachments
in interfaceAttachmentService
- Parameters:
pks
-- Throws:
AttachmentException
-
reorderDocuments
public void reorderDocuments(List<SimpleDocument> documents)
Reorder the attachments according to the order in the list.- Specified by:
reorderDocuments
in interfaceAttachmentService
- Parameters:
documents
-- Throws:
AttachmentException
-
getBinaryContent
public void getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang)
Description copied from interface:AttachmentService
Writes the binary content into the specified OutputStream.- Specified by:
getBinaryContent
in interfaceAttachmentService
- Parameters:
output
- the stream where the content is to be written.pk
- the id of the document.lang
- the language of the content.
-
getBinaryContent
public void getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang, long contentOffset, long contentLength)
Description copied from interface:AttachmentService
Writes the binary content contained between begin and end indexes into the specified OutputStream.- Specified by:
getBinaryContent
in interfaceAttachmentService
- Parameters:
output
- the stream where the content is to be written.pk
- the id of the document.lang
- the language of the content.contentOffset
- number of bytes to skip from input content before copying into output.contentLength
- number of bytes to copy.
-
listDocumentsRequiringWarning
public List<SimpleDocument> listDocumentsRequiringWarning(Date alertDate, String language)
Description copied from interface:AttachmentService
Search all the documents in an instance which are locked at the alert date.- Specified by:
listDocumentsRequiringWarning
in interfaceAttachmentService
- Parameters:
alertDate
- the date when a warning is required.language
- the language in which the documents are required.- Returns:
- an ordered list of the documents.
-
listExpiringDocuments
public List<SimpleDocument> listExpiringDocuments(Date expiryDate, String language)
Description copied from interface:AttachmentService
Search all the documents in an instance which require an alert at the specified date.- Specified by:
listExpiringDocuments
in interfaceAttachmentService
- Parameters:
expiryDate
- the date when the document reservation should alter.language
- the language in which the documents are required.- Returns:
- an ordered list of the documents.
-
listDocumentsToUnlock
public List<SimpleDocument> listDocumentsToUnlock(Date expiryDate, String language)
Description copied from interface:AttachmentService
Search all the documents in an instance requiring to be unlocked at the specified date.- Specified by:
listDocumentsToUnlock
in interfaceAttachmentService
- Parameters:
expiryDate
- the date when the document reservation should expire.language
- the language in which the documents are required.- Returns:
- an ordered list of the documents.
-
updateAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(UPDATE) public void updateAttachment(@SourceObject @TargetPK SimpleDocument document, File content, boolean indexIt, boolean notify)
Description copied from interface:AttachmentService
To update a document content by updating or adding some content.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
updateAttachment
in interfaceAttachmentService
-
getBinaryContent
public void getBinaryContent(File file, SimpleDocumentPK pk, String lang)
Description copied from interface:AttachmentService
Writes the binary content into the specified File.- Specified by:
getBinaryContent
in interfaceAttachmentService
- Parameters:
file
- the file where the content is to be written.pk
- the id of the document.lang
- the language of the content.
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, File content)
Description copied from interface:AttachmentService
Create file attached to an object who is identified by the foreignId.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.- Returns:
- the stored document.
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, File content, boolean indexIt)
Description copied from interface:AttachmentService
Create file attached to an object who is identified by the foreignId.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.indexIt
- true if the document is to be indexed, false otherwhise.- Returns:
- the stored document.
-
createAttachment
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(CREATE) public SimpleDocument createAttachment(@SourceObject @TargetPK SimpleDocument document, File content, boolean indexIt, boolean notify)
Description copied from interface:AttachmentService
Create file attached to an object who is identified by the foreignId.The filename returned by
SimpleDocument.getFilename()
is normalized in order to get only single character encoding and no more combined characters. The normalized filename is set to given document.- Specified by:
createAttachment
in interfaceAttachmentService
- Parameters:
document
- the document to be created.content
- the binary content of the document.indexIt
- true if the document is to be indexed, false otherwhise.notify
- true if the callback methods of the components must be called, false for ignoring thoose callbacks.- Returns:
- the stored document.
-
unlock
public boolean unlock(UnlockContext context)
Release a locked file.- Specified by:
unlock
in interfaceAttachmentService
- Parameters:
context
- : the unlock parameters.- Returns:
- false if the file is locked - true if the unlock succeeded.
- Throws:
AttachmentException
-
lock
public boolean lock(String attachmentId, String userId, String language)
Lock a file so it can be edited by an user.- Specified by:
lock
in interfaceAttachmentService
- Parameters:
attachmentId
-userId
-language
-- Returns:
- false if the attachment is already checkout - true if the attachment was successfully checked out.
-
changeVersionState
public SimpleDocumentPK changeVersionState(SimpleDocumentPK pk, String comment)
Description copied from interface:AttachmentService
Change the management of versions of the document. If the document is currently with version management, then all history is removed and the document becomes a simple document with no more version management. If the document has no version management then a new public version is created and the document becomes a document with a version history management. F- Specified by:
changeVersionState
in interfaceAttachmentService
- Parameters:
pk
- the id of the document.comment
- the comment of the versioned documetn if we are switching from simple to versioned.- Returns:
- the pk to the document after is state change.
-
findExistingDocument
public SimpleDocument findExistingDocument(SimpleDocumentPK pk, String fileName, ResourceReference foreign, String lang)
Description copied from interface:AttachmentService
Find documents with the same name attached to the specified foreign id.- Specified by:
findExistingDocument
in interfaceAttachmentService
- Parameters:
pk
- the id of the document.fileName
- the name of the file.foreign
- the id of the container of the document.lang
- the language of the document.- Returns:
- a document with the same filename - null if none is found.
-
listDocumentsByForeignKeyAndType
public SimpleDocumentList<SimpleDocument> listDocumentsByForeignKeyAndType(ResourceReference foreignKey, DocumentType type, String lang)
Description copied from interface:AttachmentService
Search all file attached to a foreign object.- Specified by:
listDocumentsByForeignKeyAndType
in interfaceAttachmentService
- Parameters:
foreignKey
- : the primary key of foreign object.type
- : the type of documentlang
- the lang for the documents.- Returns:
- the list of attached documents.
-
listDocumentsLockedByUser
public List<SimpleDocument> listDocumentsLockedByUser(String usedId, String language)
Description copied from interface:AttachmentService
Search all the documents locked by a specific user.- Specified by:
listDocumentsLockedByUser
in interfaceAttachmentService
- Parameters:
usedId
- the id of the user.language
- the language in which the documents are required.- Returns:
- an ordered list of the documents.
-
moveDocument
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(MOVE) public SimpleDocumentPK moveDocument(@SourceObject SimpleDocument document, @TargetPK ResourceReference destination)
Description copied from interface:AttachmentService
Moves the attachment.- Specified by:
moveDocument
in interfaceAttachmentService
- Parameters:
document
- to be moved.destination
- the foreign id to be moved to.- Returns:
- the new document id.
-
moveAllDocuments
@SimulationActionProcess(elementLister=AttachmentSimulationElementLister.class) @Action(MOVE) public List<SimpleDocumentPK> moveAllDocuments(@SourcePK ResourceReference resourceSourcePk, @TargetPK ResourceReference targetDestinationPk)
- Specified by:
moveAllDocuments
in interfaceAttachmentService
-
updateIndexEntryWithDocuments
public void updateIndexEntryWithDocuments(FullIndexEntry indexEntry)
Description copied from interface:AttachmentService
Add the documents to the index.- Specified by:
updateIndexEntryWithDocuments
in interfaceAttachmentService
- Specified by:
updateIndexEntryWithDocuments
in interfaceDocumentIndexing
- Parameters:
indexEntry
- the entry to be updated with the document indexes.
-
indexAllDocuments
public void indexAllDocuments(ResourceReference fk, Date startOfVisibilityPeriod, Date endOfVisibilityPeriod)
Description copied from interface:AttachmentService
Indexes all the documents (whatever their type) of a container.- Specified by:
indexAllDocuments
in interfaceAttachmentService
- Parameters:
fk
- the id of the container of the document.startOfVisibilityPeriod
- can be null.endOfVisibilityPeriod
- can be null.
-
mergeDocuments
public Map<String,String> mergeDocuments(ResourceReference originalForeignKey, ResourceReference cloneForeignKey, DocumentType type)
Description copied from interface:AttachmentService
Merges the documents of cloned container with the original documents.- Specified by:
mergeDocuments
in interfaceAttachmentService
- Returns:
- a map with the cloned document id as key and the original document id as value.
-
switchComponentBehaviour
public void switchComponentBehaviour(String componentId, boolean toVersionning)
Description copied from interface:AttachmentService
Change the management of versions of the documents of a whole component (only attachments are taken into account). If the document is currently with version management, then all history is removed and the document becomes a simple document with no more version management. If the document has no version management then a new public version is created and the document becomes a document with a version history management.- Specified by:
switchComponentBehaviour
in interfaceAttachmentService
- Parameters:
componentId
- : the id of the component switching its behaviour.toVersionning
- : if set to true all simple attachments become versioned, if false all versioned attachments become simple attachments.
-
switchAllowingDownloadForReaders
public void switchAllowingDownloadForReaders(SimpleDocumentPK pk, boolean allowing)
Description copied from interface:AttachmentService
Allows or forbids the download for readers.- Specified by:
switchAllowingDownloadForReaders
in interfaceAttachmentService
- Parameters:
pk
- the id of the document.allowing
- : allowing the download for readers if true versioned attachments become simple attachments.
-
switchEnableDisplayAsContent
public void switchEnableDisplayAsContent(SimpleDocumentPK pk, boolean enable)
Description copied from interface:AttachmentService
Enables or not the display of the content of an attachment.- Specified by:
switchEnableDisplayAsContent
in interfaceAttachmentService
- Parameters:
pk
- the id of the document.enable
- enable the display if true
-
switchEnableEditSimultaneously
public void switchEnableEditSimultaneously(SimpleDocumentPK pk, boolean enable)
Description copied from interface:AttachmentService
Enables or not the simultaneous edition of the content of an attachment.- Specified by:
switchEnableEditSimultaneously
in interfaceAttachmentService
- Parameters:
pk
- the id of the document.enable
- enable edition simultaneously if true
-
delete
public void delete(String componentInstanceId)
Deletes the resources belonging to the specified component instance. This method is invoked by Silverpeas when a component instance is being deleted.- Specified by:
delete
in interfaceComponentInstanceDeletion
- Parameters:
componentInstanceId
- the unique identifier of a component instance.
-
-