Package org.exoplatform.news.storage.jcr
Class JcrNewsAttachmentsStorage
- java.lang.Object
-
- org.exoplatform.news.storage.jcr.JcrNewsAttachmentsStorage
-
- All Implemented Interfaces:
NewsAttachmentsStorage
public class JcrNewsAttachmentsStorage extends Object implements NewsAttachmentsStorage
-
-
Field Summary
Fields Modifier and Type Field Description static StringNEWS_ATTACHMENTS_NODES_FOLDER
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAttachmentFromExistingResource(javax.jcr.Node newsNode, String resourceId)Add an existing resource with the given id to the given news nodeStringaddAttachmentFromUploadedResource(javax.jcr.Node newsNode, String uploadId)Add the resource with the given upload id to the given news nodeprotected NewsAttachmentconvertNodeToNewsAttachment(javax.jcr.Node attachmentNode)NewsAttachmentgetNewsAttachment(String attachmentId)Get the attachment with the given idStringgetNewsAttachmentOpenUrl(String attachmentId)Get the URL to open the attachment with the given idList<NewsAttachment>getNewsAttachments(javax.jcr.Node newsNode)Get the list of attachments of the given news nodeInputStreamgetNewsAttachmentStream(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)List<NewsAttachment>updateNewsAttachments(News updatedNews, javax.jcr.Node newsNode)Adds new attachments to the News and remove the attachments to remove.
-
-
-
Field Detail
-
NEWS_ATTACHMENTS_NODES_FOLDER
public static final String NEWS_ATTACHMENTS_NODES_FOLDER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
getNewsAttachments
public List<NewsAttachment> getNewsAttachments(javax.jcr.Node newsNode) throws Exception
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
public NewsAttachment getNewsAttachment(String attachmentId) throws Exception
Get the attachment with the given id- Specified by:
getNewsAttachmentin interfaceNewsAttachmentsStorage- Parameters:
attachmentId- The attachment id- Returns:
- The attachment
- Throws:
Exception- when error
-
getNewsAttachmentStream
public InputStream getNewsAttachmentStream(String attachmentId) throws Exception
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
public String getNewsAttachmentOpenUrl(String attachmentId) throws Exception
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
-
shareAttachmentFromOtherSpace
public void shareAttachmentFromOtherSpace(javax.jcr.Node newsNode, String attachmentId) throws javax.jcr.RepositoryException- Throws:
javax.jcr.RepositoryException
-
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 ExceptionAdd 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
public void makeAttachmentsPublic(javax.jcr.Node newsNode) throws Exception- Specified by:
makeAttachmentsPublicin interfaceNewsAttachmentsStorage- Throws:
Exception
-
unmakeAttachmentsPublic
public void unmakeAttachmentsPublic(javax.jcr.Node newsNode) throws Exception- Specified by:
unmakeAttachmentsPublicin interfaceNewsAttachmentsStorage- Throws:
Exception
-
removeAttachment
public void removeAttachment(javax.jcr.Node newsNode, String attachmentId)Remove the attachment with the given id from the given news node- Specified by:
removeAttachmentin interfaceNewsAttachmentsStorage- Parameters:
newsNode- The news nodeattachmentId- The attachment id
-
shareAttachments
public void shareAttachments(javax.jcr.Node newsNode, org.exoplatform.social.core.space.model.Space space)- Specified by:
shareAttachmentsin interfaceNewsAttachmentsStorage
-
convertNodeToNewsAttachment
protected NewsAttachment convertNodeToNewsAttachment(javax.jcr.Node attachmentNode) throws Exception
- Throws:
Exception
-
-