private List getAttachments(Node resourceNode, Document descriptor, String archiveBasePath) throws IOException { List rv = new ArrayList(); List fileNodes = XPathHelper.selectNodes("//FILEREF", descriptor); for (Iterator i = fileNodes.iterator(); i.hasNext();) { Node fileNode = (Node)i.next(); String relFile = XPathHelper.getNodeValue("./RELFILE/@value", fileNode); String filePath = archiveBasePath + "/" + XPathHelper.getNodeValue("./CONTENTID/@value", fileNode) + "/" + relFile; FileResource attachment = new FileResource(); attachment.setInputStream(new FileInputStream(filePath)); attachment.setFileName(relFile.substring(relFile.lastIndexOf("/") + 1)); rv.add(attachment); } return rv; }
FileResource file = new FileResource(); try { String fileName = fileHelper.getFilenameForNode(node); file.setFileName(fileName); file.setDescription(""); } else file.setDescription(resourceHelper.getDescription(node.getParentNode())); file.setInputStream(fileHelper.getInputStreamForNode(node,contextPath)); file.setDestinationResourcePath(fileHelper.getFilePathForNode(node, contextPath)); file.setContentType(this.mimeTypes.getContentType(fileName)); file.setTitle(fileHelper.getTitle(node)); if(parent != null) { file.setParent(parent); file.setLegacyGroup(parent.getLegacyGroup()); } else file.setLegacyGroup(""); } catch (IOException e) { resourceMap.remove(resourceHelper.getId(node.getParentNode()));
if ("sakai-file-resource".equals(thing.getTypeName())) { description = ((FileResource)thing).getDescription(); String fileName = ((FileResource)thing).getFileName(); id = contentHostingService.getSiteCollection(siteId); String contextPath = ((FileResource)thing).getDestinationResourcePath(); if (contextPath != null && (contextPath.length() + id.length()) > 255) { contents = ((FileResource)thing).getInputStream();
FileResource file = new FileResource(); try { String fileName = fileHelper.getFilenameForNode(node); file.setFileName(fileName); file.setDescription(""); } else file.setDescription(resourceHelper.getDescription(node.getParentNode())); file.setInputStream(fileHelper.getInputStreamForNode(node,contextPath)); file.setDestinationResourcePath(fileHelper.getFilePathForNode(node, contextPath)); file.setContentType(this.mimeTypes.getContentType(fileName)); file.setTitle(fileHelper.getTitle(node)); if(parent != null) { file.setParent(parent); file.setLegacyGroup(parent.getLegacyGroup()); } else file.setLegacyGroup(""); } catch (IOException e) { resourceMap.remove(resourceHelper.getId(node.getParentNode()));
if ("sakai-file-resource".equals(thing.getTypeName())) { description = ((FileResource)thing).getDescription(); String fileName = ((FileResource)thing).getFileName(); id = contentHostingService.getSiteCollection(siteId); String contextPath = ((FileResource)thing).getDestinationResourcePath(); if (contextPath != null && (contextPath.length() + id.length()) > 255) { contents = ((FileResource)thing).getInputStream();