|
(→AHPSCRIPTS-111)
|
(→AHPSCRIPTS-9)
|
| Line 2227: | |||
| out.flush(); | out.flush(); | ||
| out.close();</pre> | out.close();</pre> | ||
| + | * Importing Dependencies: | ||
| + | <pre>import com.urbancode.anthill3.main.client.AnthillClient; | ||
| + | import com.urbancode.anthill3.persistence.UnitOfWork; | ||
| + | import org.w3c.dom.Document; | ||
| + | import com.urbancode.anthill3.domain.project.*; | ||
| + | import com.urbancode.anthill3.domain.profile.*; | ||
| + | import com.urbancode.anthill3.domain.workflow.*; | ||
| + | import com.urbancode.anthill3.domain.xml.*; | ||
| + | import com.urbancode.commons.xml.*; | ||
| + | import java.io.File; | ||
| + | import javax.xml.parsers.DocumentBuilderFactory; | ||
| + | import javax.xml.transform.*; | ||
| + | import javax.xml.transform.dom.DOMSource; | ||
| + | import javax.xml.*; | ||
| + | import javax.xml.transform.stream.StreamResult; | ||
| + | String PROJECT_NAME=PropertyLookup.getValue("ProjectName"); | ||
| + | Project project = ProjectFactory.getInstance().restoreForName(PROJECT_NAME); | ||
| + | DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance(); | ||
| + | |||
| + | //Hardcoded for now; could be modified to dynamically find the file from the bin directory | ||
| + | InputStream inputStream = new FileInputStream(new File("Iterations_Test_dependencies.xml")); | ||
| + | |||
| + | org.w3c.dom.Document doc = documentBuilderFactory.newDocumentBuilder().parse(inputStream); | ||
| + | StringWriter stw = new StringWriter(); | ||
| + | Transformer serializer = TransformerFactory.newInstance().newTransformer(); | ||
| + | serializer.transform(new DOMSource(doc), new StreamResult(stw)); | ||
| + | String xmlString = stw.toString(); | ||
| + | commandOutput.println(xmlString); | ||
| + | System.out.println(xmlString); | ||
| + | DependencyXml depXml = new DependencyXml(); | ||
| + | depXml.importDependencies(xmlString);</pre> | ||