RepoTemplateSource(NodeRef ref) throws IOException { this.nodeRef = ref; this.conn = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); }
/** utility function for parsing xml */ public static Document parse(final NodeRef nodeRef, final ContentService contentService) throws SAXException, IOException { final ContentReader contentReader = contentService.getReader(nodeRef, ContentModel.TYPE_CONTENT); final InputStream in = contentReader.getContentInputStream(); return XMLUtil.parse(in); }
@Override public InputStream openContentStream(NodeRef nodeRef) throws ActualEnvironmentException { ContentReader contentReader = apiFacet.getContentService().getReader(nodeRef, ContentModel.PROP_CONTENT); return contentReader.getContentInputStream(); }
public ContentReader makeContentReader() { QName srcContentProp = getParamWithDefault(PARAM_SOURCE_CONTENT_PROPERTY, DEFAULT_CONTENT_PROPERTY); ContentReader contentReader = contentService.getReader(sourceNode, srcContentProp); if (contentReader == null || !contentReader.exists()) { throw new UnimportantTransformException(CONTENT_READER_NOT_FOUND_MESSAGE); } return contentReader; }
@Override public ContentReader getReader(NodeRef nodeRef) { FileInfo fileInfo = toFileInfo(nodeRef, false); if (fileInfo.isFolder()) { throw new InvalidTypeException("Unable to get a content reader for a folder: " + fileInfo); } return contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); }
public String getContent() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(nodeRef, property); return (reader != null && reader.exists()) ? reader.getContentString() : ""; }
protected boolean sourceNodeIsXml(NodeRef sourceNode) { boolean result = false; // TODO: BJR 20100211: We can do better than this... ContentReader reader = serviceRegistry.getContentService().getReader(sourceNode, ContentModel.PROP_CONTENT); if ((reader != null) && reader.exists()) { result = (reader.getContentData().getMimetype().equals("text/xml")); } return result; }
public InputStream getInputStream() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(nodeRef, property); return (reader != null && reader.exists()) ? reader.getContentInputStream() : null; }
public String execute() throws Throwable { return CONTENT_SERVICE.getReader(testNode, ContentModel.PROP_CONTENT).getContentString(); } });
public InputStream readFile(NodeRef base, String path) { NodeRef fileRef = lookup(base, path).getFirst(); if (fileRef == null) { throw new AlfrescoRuntimeException("Not Found: " + path); } return fContentService.getReader(fileRef, ContentModel.PROP_CONTENT).getContentInputStream(); }
/** * @return the content stream to the specified maximum length in characters */ public String getContentMaxLength(int length) { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(getNodeRef(), property); return (reader != null && reader.exists()) ? reader.getContentString(length) : ""; }
/** * @return the content stream */ public String getContent() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(getNodeRef(), property); return (reader != null && reader.exists()) ? reader.getContentString() : ""; }
/** * @return the content stream */ public String getContent() { ContentService contentService = services.getContentService(); ContentReader reader = contentService.getReader(getNodeRef(), property); return (reader != null && reader.exists()) ? reader.getContentString() : ""; }
private void outputThumbnailTempContentLocation(NodeRef thumbnail, String ext, String message) throws IOException { File tempFile = TempFileProvider.createTempFile("thumbnailServiceImplTest", "." + ext); ContentReader reader = this.contentService.getReader(thumbnail, ContentModel.PROP_CONTENT); reader.getContent(tempFile); System.out.println(message + ": " + tempFile.getPath()); }
public boolean isDefinitionDeployed(NodeRef workflowDefinition) { if (!nodeService.getType(workflowDefinition).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + workflowDefinition + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService.getProperty(workflowDefinition, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(workflowDefinition, ContentModel.PROP_CONTENT); return isDefinitionDeployed(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }
public WorkflowDeployment deployDefinition(NodeRef definitionContent) { if (!nodeService.getType(definitionContent).equals(WorkflowModel.TYPE_WORKFLOW_DEF)) { throw new WorkflowException( "Node " + definitionContent + " is not of type 'bpm:workflowDefinition'"); } String engineId = (String) nodeService .getProperty(definitionContent, WorkflowModel.PROP_WORKFLOW_DEF_ENGINE_ID); ContentReader contentReader = contentService.getReader(definitionContent, ContentModel.PROP_CONTENT); return deployDefinition(engineId, contentReader.getContentInputStream(), contentReader.getMimetype()); }
public void testNullReaderForNullUrl() throws Exception { // set the property, but with a null URL ContentData contentData = new ContentData(null, null, 0L, null); nodeService.setProperty(contentNodeRef, ContentModel.PROP_CONTENT, contentData); // get the reader ContentReader reader = contentService.getReader(contentNodeRef, ContentModel.PROP_CONTENT); assertNull("Reader must be null if the content URL is null", reader); }
private String readTextContent(NodeRef nodeRef) { ContentReader reader = contentService.getReader(nodeRef, ContentModel.PROP_CONTENT); assertNotNull("reader was null", reader); reader.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); return reader.getContentString(); }
@Override public Void execute() throws Throwable { ContentReader reader = contentService.getReader(testContext.destNodeRef, ContentModel.PROP_CONTENT); assertNotNull("reader is null", reader); String contentStr = reader.getContentString(); assertEquals("Content is wrong", CONTENT_UPDATE_STRING, contentStr); return null; } };
@Override public Void execute() throws Throwable { NodeRef shuffledNodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME); assertTrue("node is not versionable", nodeService.hasAspect(shuffledNodeRef, ContentModel.ASPECT_VERSIONABLE)); assertEquals("shuffledNode ref is different", shuffledNodeRef, testContext.testNodeRef); assertEquals("Unexpected content size", contentService.getReader(shuffledNodeRef, ContentModel.PROP_CONTENT).getSize(), UPDATED_TEXT.length()); return null; } };