Package org.exoplatform.news.storage.jcr
Class JcrNewsAttachmentsStorage
java.lang.Object
org.exoplatform.news.storage.jcr.JcrNewsAttachmentsStorage
- All Implemented Interfaces:
NewsAttachmentsStorage
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJcrNewsAttachmentsStorage(org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService, org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.services.jcr.ext.distribution.DataDistributionManager dataDistributionManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.upload.UploadService uploadService, org.exoplatform.services.cms.documents.DocumentService documentService) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachmentFromExistingResource(javax.jcr.Node newsNode, String resourceId) Add an existing resource with the given id to the given news nodeaddAttachmentFromUploadedResource(javax.jcr.Node newsNode, String uploadId) Add the resource with the given upload id to the given news nodeprotected NewsAttachmentconvertNodeToNewsAttachment(javax.jcr.Node attachmentNode) getNewsAttachment(String attachmentId) Get the attachment with the given idgetNewsAttachmentOpenUrl(String attachmentId) Get the URL to open the attachment with the given idgetNewsAttachments(javax.jcr.Node newsNode) Get the list of attachments of the given news nodegetNewsAttachmentStream(String attachmentId) Get data stream of the attachment with the given idvoidmakeAttachmentsPublic(javax.jcr.Node newsNode) voidremoveAttachment(javax.jcr.Node newsNode, String attachmentId) Remove the attachment with the given id from the given news nodevoidshareAttachmentFromOtherSpace(javax.jcr.Node newsNode, String attachmentId) voidshareAttachments(javax.jcr.Node newsNode, org.exoplatform.social.core.space.model.Space space) voidunmakeAttachmentsPublic(javax.jcr.Node newsNode) updateNewsAttachments(News updatedNews, javax.jcr.Node newsNode) Adds new attachments to the News and remove the attachments to remove.
-
Field Details
-
NEWS_ATTACHMENTS_NODES_FOLDER
- See Also:
-
-
Constructor Details
-
JcrNewsAttachmentsStorage
public JcrNewsAttachmentsStorage(org.exoplatform.services.jcr.ext.app.SessionProviderService sessionProviderService, org.exoplatform.services.jcr.RepositoryService repositoryService, org.exoplatform.services.jcr.ext.hierarchy.NodeHierarchyCreator nodeHierarchyCreator, org.exoplatform.services.jcr.ext.distribution.DataDistributionManager dataDistributionManager, org.exoplatform.social.core.space.spi.SpaceService spaceService, org.exoplatform.upload.UploadService uploadService, org.exoplatform.services.cms.documents.DocumentService documentService)
-
-
Method Details
-
getNewsAttachments
Get the list of attachments of the given news node- Specified by:
getNewsAttachmentsin interfaceNewsAttachmentsStorage- Parameters:
newsNode- The news node- Returns:
- The list of attachments
- Throws:
Exception- when error
-
getNewsAttachment
Get the attachment with the given id- Specified by:
getNewsAttachmentin interfaceNewsAttachmentsStorage- Parameters:
attachmentId- The attachment id- Returns:
- The attachment
- Throws:
Exception- when error
-
getNewsAttachmentStream
Get data stream of the attachment with the given id- Specified by:
getNewsAttachmentStreamin interfaceNewsAttachmentsStorage- Parameters:
attachmentId- The attachment id- Returns:
- The attachment data stream
- Throws:
Exception- when error
-
getNewsAttachmentOpenUrl
Get the URL to open the attachment with the given id- Specified by:
getNewsAttachmentOpenUrlin interfaceNewsAttachmentsStorage- Parameters:
attachmentId- The attachment id- Returns:
- The URl to open the attachment
- Throws:
Exception- when error
-
updateNewsAttachments
public List<NewsAttachment> updateNewsAttachments(News updatedNews, javax.jcr.Node newsNode) throws Exception Adds new attachments to the News and remove the attachments to remove. New attachments have only an uploadId, no id, so all attachments of the updatedNews with an uploadId are considered as new attachments.- Specified by:
updateNewsAttachmentsin interfaceNewsAttachmentsStorage- Parameters:
updatedNews- The updated NewsnewsNode- The existing News node- Throws:
javax.jcr.RepositoryException- when errorException
-
addAttachmentFromUploadedResource
public String addAttachmentFromUploadedResource(javax.jcr.Node newsNode, String uploadId) throws Exception Add the resource with the given upload id to the given news node- Specified by:
addAttachmentFromUploadedResourcein interfaceNewsAttachmentsStorage- Parameters:
newsNode- The news nodeuploadId- The id of the uploaded resource- Returns:
- The id of the added attachment
- Throws:
Exception- when error
-
addAttachmentFromExistingResource
public void addAttachmentFromExistingResource(javax.jcr.Node newsNode, String resourceId) throws Exception Add an existing resource with the given id to the given news node- Specified by:
addAttachmentFromExistingResourcein interfaceNewsAttachmentsStorage- Parameters:
newsNode- The news noderesourceId- The id of the existing resource- Throws:
Exception- when error
-
makeAttachmentsPublic
- Specified by:
makeAttachmentsPublicin interfaceNewsAttachmentsStorage- Throws:
Exception
-
unmakeAttachmentsPublic
- Specified by:
unmakeAttachmentsPublicin interfaceNewsAttachmentsStorage- Throws:
Exception
-
removeAttachment
Remove the attachment with the given id from the given news node- Specified by:
removeAttachmentin interfaceNewsAttachmentsStorage- Parameters:
newsNode- The news nodeattachmentId- The attachment id
-
convertNodeToNewsAttachment
protected NewsAttachment convertNodeToNewsAttachment(javax.jcr.Node attachmentNode) throws Exception - Throws:
Exception
-