Package org.exoplatform.news
Class NewsAttachmentsServiceImpl
- java.lang.Object
-
- org.exoplatform.news.NewsAttachmentsServiceImpl
-
- All Implemented Interfaces:
NewsAttachmentsService
public class NewsAttachmentsServiceImpl extends Object implements NewsAttachmentsService
-
-
Field Summary
Fields Modifier and Type Field Description static StringNEWS_ATTACHMENTS_NODES_FOLDER
-
Constructor Summary
Constructors Constructor Description NewsAttachmentsServiceImpl(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 nodevoidunmakeAttachmentsPublic(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
-
NewsAttachmentsServiceImpl
public NewsAttachmentsServiceImpl(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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- Throws:
Exception
-
unmakeAttachmentsPublic
public void unmakeAttachmentsPublic(javax.jcr.Node newsNode) throws Exception- Specified by:
unmakeAttachmentsPublicin interfaceNewsAttachmentsService- 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 interfaceNewsAttachmentsService- Parameters:
newsNode- The news nodeattachmentId- The attachment id
-
convertNodeToNewsAttachment
protected NewsAttachment convertNodeToNewsAttachment(javax.jcr.Node attachmentNode) throws Exception
- Throws:
Exception
-
-