@Override public ContentData getContentData() { return delegatee.getContentData(); }
@Override public ContentData getContentData() { return delegatee.getContentData(); }
@Override public ContentData getContentData() { if (!this.cacheWriter.getReader().exists()) { return this.bsWriter.getContentData(); } return this.cacheWriter.getContentData(); }
@Override public ContentData getContentData() { if (!this.cacheWriter.getReader().exists()) { return this.bsWriter.getContentData(); } return this.cacheWriter.getContentData(); }
ContentData contentData = writer.getContentData(); nodeService.setProperty(nodeRef, propertyQName, contentData);
ContentData contentData = writer.getContentData(); nodeService.setProperty(nodeRef, propertyQName, contentData);
writer.putContent("INITIAL CONTENT"); contentData = writer.getContentData();
@Override public ContentData doWork() throws Exception { InputStream contentStream = handler.importStream(sourceContentUrl); ContentWriter writer = contentService.getWriter(null, null, false); writer.setEncoding(sourceContentData.getEncoding()); writer.setMimetype(sourceContentData.getMimetype()); writer.putContent(contentStream); return writer.getContentData(); } }, TenantService.DEFAULT_DOMAIN);
writer.putContent("INITIAL CONTENT"); contentData = writer.getContentData();
@Override public ContentData doWork() throws Exception { InputStream contentStream = handler.importStream(sourceContentUrl); ContentWriter writer = contentService.getWriter(null, null, false); writer.setEncoding(sourceContentData.getEncoding()); writer.setMimetype(sourceContentData.getMimetype()); writer.putContent(contentStream); return writer.getContentData(); } }, TenantService.DEFAULT_DOMAIN);
assertEquals(TestCenteraLikeContentWriter.UNKNOWN_ID, writer1.getContentData().getContentUrl()); writer1.putContent(content1); assertNotSame(TestCenteraLikeContentWriter.UNKNOWN_ID, writer1.getContentData().getContentUrl()); assertEquals(TestCenteraLikeContentWriter.UNKNOWN_ID, writer2.getContentData().getContentUrl()); writer2.putContent(content2); assertNotSame(TestCenteraLikeContentWriter.UNKNOWN_ID, writer2.getContentData().getContentUrl()); assertNotSame(writer1.getContentData().getContentUrl(), writer2.getContentData().getContentUrl()); ContentReader reader = store.getReader(writer1.getContentData().getContentUrl());
public ContentData execute() throws Throwable { // Create some content NodeRef rootNodeRef = nodeService.getRootNode(storeRef); Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13); properties.put(ContentModel.PROP_NAME, (Serializable)"test.txt"); NodeRef contentNodeRef = nodeService.createNode( rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTENT, properties).getChildRef(); ContentWriter writer = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.putContent("INITIAL CONTENT"); ContentData contentData = writer.getContentData(); // Delete the first node, bypassing archive nodeService.addAspect(contentNodeRef, ContentModel.ASPECT_TEMPORARY, null); nodeService.deleteNode(contentNodeRef); // Done return contentData; } };
public ContentData execute() throws Throwable { // Create some content NodeRef rootNodeRef = nodeService.getRootNode(storeRef); Map<QName, Serializable> properties = new HashMap<QName, Serializable>(13); properties.put(ContentModel.PROP_NAME, (Serializable)"test.txt"); NodeRef contentNodeRef = nodeService.createNode( rootNodeRef, ContentModel.ASSOC_CHILDREN, ContentModel.ASSOC_CHILDREN, ContentModel.TYPE_CONTENT, properties).getChildRef(); ContentWriter writer = contentService.getWriter(contentNodeRef, ContentModel.PROP_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.putContent("INITIAL CONTENT"); ContentData contentData = writer.getContentData(); // Delete the first node, bypassing archive nodeService.addAspect(contentNodeRef, ContentModel.ASPECT_TEMPORARY, null); nodeService.deleteNode(contentNodeRef); // Done return contentData; } };
assertEquals("Cache writer should still return actual size", overLimitSize, writer.getContentData().getSize());
ContentData contentData = writer.getContentData(); nodeService.setProperty(contentNodeRef, ContentModel.PROP_CONTENT, contentData);
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.putContent("INITIAL CONTENT"); ContentData contentData = writer.getContentData();
assertEquals("metadata didn't get onto node", writer.getContentData(), contentData); assertEquals("Metadata didn't get set on reader", writer.getContentData(), reader.getContentData());
assertNotNull(readerFromWriter); assertTrue(readerFromWriter.exists()); assertEquals(writer.getContentData(), readerFromWriter.getContentData()); assertEquals(content, readerFromWriter.getContentString()); assertNotNull(readerFromReader); assertTrue(readerFromReader.exists()); assertEquals(writer.getContentData(), readerFromReader.getContentData()); assertEquals(content, readerFromReader.getContentString());
writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.putContent("Some content"); ContentData writerContentData = writer.getContentData(); ContentData nodeContentData = (ContentData) nodeService.getProperty(contentNodeRef, ContentModel.PROP_CONTENT); assertNotNull(nodeContentData);
/** * Check that a valid writer into the content store can be retrieved and used. */ public void testSimpleNonTempWriter() throws Exception { ContentWriter writer = contentService.getWriter(null, null, false); assertNotNull("Writer should not be null", writer); assertNotNull("Content URL should not be null", writer.getContentUrl()); // write some content writer.putContent(SOME_CONTENT); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setEncoding("UTF-16"); writer.setLocale(Locale.CHINESE); // set the content property manually nodeService.setProperty(contentNodeRef, ContentModel.PROP_CONTENT, writer.getContentData()); // get the reader ContentReader reader = contentService.getReader(contentNodeRef, ContentModel.PROP_CONTENT); assertNotNull("Reader should not be null", reader); assertNotNull("Content URL should not be null", reader.getContentUrl()); assertEquals("Content Encoding was not set", "UTF-16", reader.getEncoding()); assertEquals("Content Locale was not set", Locale.CHINESE, reader.getLocale()); }