org.silverpeas.attachment.mock
Class AttachmentServiceMockWrapper

java.lang.Object
  extended by org.silverpeas.attachment.mock.AttachmentServiceMockWrapper
All Implemented Interfaces:
AttachmentService

public class AttachmentServiceMockWrapper
extends Object
implements AttachmentService

A wrapper of a mock of an AttachmentService instance dedicated to the tests. This wrapper decorates the mock and it is used to be managed by an IoC container as an AttachmentService instance.

Author:
mmoquillon

Field Summary
 
Fields inherited from interface org.silverpeas.attachment.AttachmentService
NO_UPDATE_MODE, UPDATE_DIRECT_MODE, UPDATE_SHORTCUT_MODE, VERSION_MODE
 
Constructor Summary
AttachmentServiceMockWrapper()
           
 
Method Summary
 void addXmlForm(SimpleDocumentPK pk, String language, String xmlFormName)
           
 SimpleDocumentPK changeVersionState(SimpleDocumentPK pk, String comment)
           
 SimpleDocumentPK cloneDocument(SimpleDocument original, String foreignCloneId)
           
 List<SimpleDocumentPK> copyAllDocuments(WAPrimaryKey resourceSourcePk, WAPrimaryKey targetDestinationPk)
           
 SimpleDocumentPK copyDocument(SimpleDocument original, ForeignPK targetPk)
           
 SimpleDocument createAttachment(SimpleDocument document, File content)
           
 SimpleDocument createAttachment(SimpleDocument document, File content, boolean indexIt)
           
 SimpleDocument createAttachment(SimpleDocument document, File content, boolean indexIt, boolean invokeCallback)
           
 SimpleDocument createAttachment(SimpleDocument document, InputStream content)
           
 SimpleDocument createAttachment(SimpleDocument document, InputStream content, boolean indexIt)
           
 SimpleDocument createAttachment(SimpleDocument document, InputStream content, boolean indexIt, boolean invokeCallback)
           
 void createIndex(SimpleDocument document)
           
 void createIndex(SimpleDocument document, Date startOfVisibilityPeriod, Date endOfVisibilityPeriod)
           
 void deleteAllAttachments(String componentInstanceId)
           
 void deleteAllAttachments(String resourceId, String componentInstanceId)
           
 void deleteAttachment(SimpleDocument document)
           
 void deleteAttachment(SimpleDocument document, boolean invokeCallback)
           
 void deleteIndex(SimpleDocument document)
           
 SimpleDocument findExistingDocument(SimpleDocumentPK pk, String fileName, ForeignPK foreign, String lang)
           
 AttachmentService getAttachmentServiceMock()
           
 void getBinaryContent(File file, SimpleDocumentPK pk, String lang)
           
 void getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang)
           
 void getBinaryContent(OutputStream output, SimpleDocumentPK pk, String lang, long contentOffset, long contentLength)
           
 void indexAllDocuments(WAPrimaryKey fk, Date startOfVisibilityPeriod, Date endOfVisibilityPeriod)
           
 SimpleDocumentList<SimpleDocument> listAllDocumentsByForeignKey(WAPrimaryKey foreignKey, String lang)
           
 SimpleDocumentList<SimpleDocument> listDocumentsByForeignKey(WAPrimaryKey foreignKey, String lang)
           
 SimpleDocumentList<SimpleDocument> listDocumentsByForeignKeyAndType(WAPrimaryKey foreignKey, DocumentType type, String lang)
           
 List<SimpleDocument> listDocumentsLockedByUser(String usedId, String language)
           
 List<SimpleDocument> listDocumentsRequiringWarning(Date alertDate, String language)
           
 List<SimpleDocument> listDocumentsToUnlock(Date expiryDate, String language)
           
 List<SimpleDocument> listExpiringDocuments(Date alertDate, String language)
           
 boolean lock(String attachmentId, String userId, String language)
           
 Map<String,String> mergeDocuments(ForeignPK originalForeignKey, ForeignPK cloneForeignKey, DocumentType type)
           
 List<SimpleDocumentPK> moveAllDocuments(WAPrimaryKey resourceSourcePk, WAPrimaryKey targetDestinationPk)
           
 SimpleDocumentPK moveDocument(SimpleDocument document, ForeignPK destination)
           
 void removeContent(SimpleDocument document, String lang, boolean invokeCallback)
           
 void reorderAttachments(List<SimpleDocumentPK> pks)
           
 void reorderDocuments(List<SimpleDocument> documents)
           
 SimpleDocument searchDocumentById(SimpleDocumentPK primaryKey, String lang)
           
 void switchAllowingDownloadForReaders(SimpleDocumentPK pk, boolean allowing)
           
 void switchComponentBehaviour(String componentId, boolean toVersionning)
           
 void unindexAttachmentsOfExternalObject(WAPrimaryKey foreignKey)
           
 boolean unlock(UnlockContext context)
           
 void updateAttachment(SimpleDocument document, boolean indexIt, boolean invokeCallback)
           
 void updateAttachment(SimpleDocument document, File content, boolean indexIt, boolean invokeCallback)
           
 void updateAttachment(SimpleDocument document, InputStream content, boolean indexIt, boolean invokeCallback)
           
 void updateIndexEntryWithDocuments(FullIndexEntry indexEntry)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttachmentServiceMockWrapper

public AttachmentServiceMockWrapper()
Method Detail

getAttachmentServiceMock

public AttachmentService getAttachmentServiceMock()

deleteAllAttachments

public void deleteAllAttachments(String componentInstanceId)
                          throws AttachmentException
Specified by:
deleteAllAttachments in interface AttachmentService
Throws:
AttachmentException

getBinaryContent

public void getBinaryContent(File file,
                             SimpleDocumentPK pk,
                             String lang)
Specified by:
getBinaryContent in interface AttachmentService

getBinaryContent

public void getBinaryContent(OutputStream output,
                             SimpleDocumentPK pk,
                             String lang)
Specified by:
getBinaryContent in interface AttachmentService

getBinaryContent

public void getBinaryContent(OutputStream output,
                             SimpleDocumentPK pk,
                             String lang,
                             long contentOffset,
                             long contentLength)
Specified by:
getBinaryContent in interface AttachmentService

addXmlForm

public void addXmlForm(SimpleDocumentPK pk,
                       String language,
                       String xmlFormName)
Specified by:
addXmlForm in interface AttachmentService

cloneDocument

public SimpleDocumentPK cloneDocument(SimpleDocument original,
                                      String foreignCloneId)
Specified by:
cloneDocument in interface AttachmentService

mergeDocuments

public Map<String,String> mergeDocuments(ForeignPK originalForeignKey,
                                         ForeignPK cloneForeignKey,
                                         DocumentType type)
Specified by:
mergeDocuments in interface AttachmentService

copyDocument

public SimpleDocumentPK copyDocument(SimpleDocument original,
                                     ForeignPK targetPk)
Specified by:
copyDocument in interface AttachmentService

copyAllDocuments

public List<SimpleDocumentPK> copyAllDocuments(WAPrimaryKey resourceSourcePk,
                                               WAPrimaryKey targetDestinationPk)
Specified by:
copyAllDocuments in interface AttachmentService

moveDocument

public SimpleDocumentPK moveDocument(SimpleDocument document,
                                     ForeignPK destination)
Specified by:
moveDocument in interface AttachmentService

moveAllDocuments

public List<SimpleDocumentPK> moveAllDocuments(WAPrimaryKey resourceSourcePk,
                                               WAPrimaryKey targetDestinationPk)
Specified by:
moveAllDocuments in interface AttachmentService

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       InputStream content)
                                throws AttachmentException
Specified by:
createAttachment in interface AttachmentService
Throws:
AttachmentException

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       InputStream content,
                                       boolean indexIt)
Specified by:
createAttachment in interface AttachmentService

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       InputStream content,
                                       boolean indexIt,
                                       boolean invokeCallback)
Specified by:
createAttachment in interface AttachmentService

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       File content)
                                throws AttachmentException
Specified by:
createAttachment in interface AttachmentService
Throws:
AttachmentException

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       File content,
                                       boolean indexIt)
Specified by:
createAttachment in interface AttachmentService

createAttachment

public SimpleDocument createAttachment(SimpleDocument document,
                                       File content,
                                       boolean indexIt,
                                       boolean invokeCallback)
Specified by:
createAttachment in interface AttachmentService

createIndex

public void createIndex(SimpleDocument document)
Specified by:
createIndex in interface AttachmentService

deleteIndex

public void deleteIndex(SimpleDocument document)
Specified by:
deleteIndex in interface AttachmentService

createIndex

public void createIndex(SimpleDocument document,
                        Date startOfVisibilityPeriod,
                        Date endOfVisibilityPeriod)
Specified by:
createIndex in interface AttachmentService

deleteAttachment

public void deleteAttachment(SimpleDocument document)
Specified by:
deleteAttachment in interface AttachmentService

deleteAllAttachments

public void deleteAllAttachments(String resourceId,
                                 String componentInstanceId)
Specified by:
deleteAllAttachments in interface AttachmentService

deleteAttachment

public void deleteAttachment(SimpleDocument document,
                             boolean invokeCallback)
Specified by:
deleteAttachment in interface AttachmentService

removeContent

public void removeContent(SimpleDocument document,
                          String lang,
                          boolean invokeCallback)
Specified by:
removeContent in interface AttachmentService

reorderAttachments

public void reorderAttachments(List<SimpleDocumentPK> pks)
                        throws AttachmentException
Specified by:
reorderAttachments in interface AttachmentService
Throws:
AttachmentException

reorderDocuments

public void reorderDocuments(List<SimpleDocument> documents)
                      throws AttachmentException
Specified by:
reorderDocuments in interface AttachmentService
Throws:
AttachmentException

searchDocumentById

public SimpleDocument searchDocumentById(SimpleDocumentPK primaryKey,
                                         String lang)
Specified by:
searchDocumentById in interface AttachmentService

listDocumentsByForeignKey

public SimpleDocumentList<SimpleDocument> listDocumentsByForeignKey(WAPrimaryKey foreignKey,
                                                                    String lang)
Specified by:
listDocumentsByForeignKey in interface AttachmentService

listAllDocumentsByForeignKey

public SimpleDocumentList<SimpleDocument> listAllDocumentsByForeignKey(WAPrimaryKey foreignKey,
                                                                       String lang)
Specified by:
listAllDocumentsByForeignKey in interface AttachmentService

listDocumentsByForeignKeyAndType

public SimpleDocumentList<SimpleDocument> listDocumentsByForeignKeyAndType(WAPrimaryKey foreignKey,
                                                                           DocumentType type,
                                                                           String lang)
Specified by:
listDocumentsByForeignKeyAndType in interface AttachmentService

unindexAttachmentsOfExternalObject

public void unindexAttachmentsOfExternalObject(WAPrimaryKey foreignKey)
Specified by:
unindexAttachmentsOfExternalObject in interface AttachmentService

updateAttachment

public void updateAttachment(SimpleDocument document,
                             boolean indexIt,
                             boolean invokeCallback)
Specified by:
updateAttachment in interface AttachmentService

updateAttachment

public void updateAttachment(SimpleDocument document,
                             File content,
                             boolean indexIt,
                             boolean invokeCallback)
Specified by:
updateAttachment in interface AttachmentService

updateAttachment

public void updateAttachment(SimpleDocument document,
                             InputStream content,
                             boolean indexIt,
                             boolean invokeCallback)
Specified by:
updateAttachment in interface AttachmentService

listDocumentsRequiringWarning

public List<SimpleDocument> listDocumentsRequiringWarning(Date alertDate,
                                                          String language)
Specified by:
listDocumentsRequiringWarning in interface AttachmentService

listExpiringDocuments

public List<SimpleDocument> listExpiringDocuments(Date alertDate,
                                                  String language)
Specified by:
listExpiringDocuments in interface AttachmentService

listDocumentsToUnlock

public List<SimpleDocument> listDocumentsToUnlock(Date expiryDate,
                                                  String language)
Specified by:
listDocumentsToUnlock in interface AttachmentService

lock

public boolean lock(String attachmentId,
                    String userId,
                    String language)
Specified by:
lock in interface AttachmentService

unlock

public boolean unlock(UnlockContext context)
Specified by:
unlock in interface AttachmentService

changeVersionState

public SimpleDocumentPK changeVersionState(SimpleDocumentPK pk,
                                           String comment)
Specified by:
changeVersionState in interface AttachmentService

findExistingDocument

public SimpleDocument findExistingDocument(SimpleDocumentPK pk,
                                           String fileName,
                                           ForeignPK foreign,
                                           String lang)
Specified by:
findExistingDocument in interface AttachmentService

listDocumentsLockedByUser

public List<SimpleDocument> listDocumentsLockedByUser(String usedId,
                                                      String language)
Specified by:
listDocumentsLockedByUser in interface AttachmentService

updateIndexEntryWithDocuments

public void updateIndexEntryWithDocuments(FullIndexEntry indexEntry)
Specified by:
updateIndexEntryWithDocuments in interface AttachmentService

indexAllDocuments

public void indexAllDocuments(WAPrimaryKey fk,
                              Date startOfVisibilityPeriod,
                              Date endOfVisibilityPeriod)
Specified by:
indexAllDocuments in interface AttachmentService

switchComponentBehaviour

public void switchComponentBehaviour(String componentId,
                                     boolean toVersionning)
Specified by:
switchComponentBehaviour in interface AttachmentService

switchAllowingDownloadForReaders

public void switchAllowingDownloadForReaders(SimpleDocumentPK pk,
                                             boolean allowing)
Specified by:
switchAllowingDownloadForReaders in interface AttachmentService


Copyright © 2016 Silverpeas. All Rights Reserved.