public String getMimetype() { return contentData.getMimetype(); }
public String getMimetype() { return contentData.getMimetype(); }
public Serializable getValueInternal(CMISNodeInfo nodeInfo) { ContentData contentData = getContentData(nodeInfo); if (contentData != null) { return contentData.getMimetype(); } return null; }
private ContentData sanitizeMimetype(ContentData contentData) { String mimetype = contentData.getMimetype(); if (mimetype != null) { mimetype = mimetype.toLowerCase(); contentData = ContentData.setMimetype(contentData, mimetype); } return contentData; }
/** * ContentDataPart * @param contentService content service * @param partName String * @param data data */ public ContentDataPart(ContentService contentService, String partName, ContentData data) { super(partName, data.getMimetype(), data.getEncoding(), null); this.contentService = contentService; this.data = data; this.filename = partName; }
private ContentData sanitizeMimetype(ContentData contentData) { String mimetype = contentData.getMimetype(); if (mimetype != null) { mimetype = mimetype.toLowerCase(); contentData = ContentData.setMimetype(contentData, mimetype); } return contentData; }
public Serializable getValueInternal(CMISNodeInfo nodeInfo) { ContentData contentData = getContentData(nodeInfo); if (contentData != null) { return contentData.getMimetype(); } return null; }
/** * ContentDataPart * @param contentService content service * @param partName String * @param data data */ public ContentDataPart(ContentService contentService, String partName, ContentData data) { super(partName, data.getMimetype(), data.getEncoding(), null); this.contentService = contentService; this.data = data; this.filename = partName; }
@Override protected Map<String, Object> getTransientValues(NodeRef item) { Map<String, Object> values = new HashMap<String, Object>(3); ContentData contentData = getContentData(item); if (contentData != null) { values.put(EncodingFieldProcessor.KEY, contentData.getEncoding()); values.put(MimetypeFieldProcessor.KEY, contentData.getMimetype()); values.put(SizeFieldProcessor.KEY, contentData.getSize()); } return values; }
@Override protected Map<String, Object> getTransientValues(NodeRef item) { Map<String, Object> values = new HashMap<String, Object>(3); ContentData contentData = getContentData(item); if (contentData != null) { values.put(EncodingFieldProcessor.KEY, contentData.getEncoding()); values.put(MimetypeFieldProcessor.KEY, contentData.getMimetype()); values.put(SizeFieldProcessor.KEY, contentData.getSize()); } return values; }
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; }
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; }
/** * Construct */ public NodeContentData(NodeRef nodeRef, ContentData contentData) { super(contentData.getContentUrl(), contentData.getMimetype(), contentData.getSize(), contentData.getEncoding(), contentData.getLocale()); this.nodeRef = nodeRef; }
/** * Construct */ public NodeContentData(NodeRef nodeRef, ContentData contentData) { super(contentData.getContentUrl(), contentData.getMimetype(), contentData.getSize(), contentData.getEncoding(), contentData.getLocale()); this.nodeRef = nodeRef; }
@Override public Void doWork() throws Exception { NodeRef file1NodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME); Map<QName, Serializable> props = nodeService.getProperties(file1NodeRef); ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT); testContext.mimetype = data.getMimetype(); driver.renameFile(testSession, testConnection, TEST_DIR + "\\" + FILE_NAME, TEST_DIR + "\\" + FILE_OLD_TEMP); return null; } };
@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);
@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);
@Override public Void execute() throws Throwable { NodeRef shuffledNodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME); Map<QName, Serializable> props = nodeService.getProperties(shuffledNodeRef); ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT); assertNotNull("data is null", data); assertEquals("size is wrong", 26112, data.getSize()); assertEquals("mimeType is wrong", "application/msword",data.getMimetype()); return null; } };
@Override public Void execute() throws Throwable { NodeRef shuffledNodeRef = getNodeForPath(testConnection, TEST_DIR + "\\" + FILE_NAME); Map<QName, Serializable> props = nodeService.getProperties(shuffledNodeRef); ContentData data = (ContentData)props.get(ContentModel.PROP_CONTENT); assertNotNull("data is null", data); assertEquals("size is wrong", 26112, data.getSize()); assertEquals("mimeType is wrong", "application/msword",data.getMimetype()); return null; } };
protected void checkContent(FileInfo file, String name, String mimeType) { assertEquals("", name, file.getName()); assertEquals("", mimeType, file.getContentData().getMimetype()); }