private void writeFlowXml(File scxmlFile, File flowXml) throws Exception
{
getLog().info("writing " + flowXml + " from file " + scxmlFile);
UseCaseStructure useCaseStructure = new UseCaseStructureByScxml(scxmlFile);
//SCXML scxml = SCXMLParser.parse(new InputSource(new FileInputStream(scxmlFile)), new DefaultHandler());
StringBuilder result = new StringBuilder();
result.append("<?xml version='1.0' encoding='"+ENCODING+"'?>\n");
result.append("<flow xmlns='http://www.springframework.org/schema/webflow'\n" +
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'\n" +
" xsi:schemaLocation='http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd'>\n" +
"\n");
for (Map.Entry<String, String> variable: useCaseStructure.getVariables().entrySet()){
result.append(" <var name='" + variable.getKey()+ "' class='" + variable.getValue() + "' />\n");
}
for (String state: useCaseStructure.getStatenames()){
result.append("\n <view-state id='" + state+ "' >\n");
for (Map.Entry<String, String> transition: useCaseStructure.getTransitions(state).entrySet()){
result.append(" <transition on='" + transition.getKey()+ "' to='" + transition.getValue() + "' />\n");
}
result.append(" </view-state>\n");