public Element getT2flowWorkflow()

in taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Workflow.java [191:219]


	public Element getT2flowWorkflow() throws IOException {
		try {
			if (content != null)
				return content;
			ByteArrayOutputStream baos = new ByteArrayOutputStream();
			io.writeBundle(bundle, baos, T2FLOW);
			Document doc;
			try {
				DocumentBuilderFactory dbf = DocumentBuilderFactory
						.newInstance();
				dbf.setNamespaceAware(true);
				doc = dbf.newDocumentBuilder().parse(
						new ByteArrayInputStream(baos.toByteArray()));
			} catch (SAXException e) {
				throw new IOException("failed to convert to DOM tree", e);
			}
			Element e = doc.getDocumentElement();
			if (e.getNamespaceURI().equals(T2FLOW_NS)
					&& e.getNodeName().equals(T2FLOW_ROOTNAME))
				return content = e;
			throw new IOException(
					"unexpected element when converting to T2Flow: {"
							+ e.getNamespaceURI() + "}" + e.getNodeName());
		} catch (IOException e) {
			throw e;
		} catch (Exception e) {
			throw new IOException("problem when converting to SCUFL2", e);
		}
	}