descriptor.getMetaAttributes().put("generator", "OSWOrkflow Designer");
descriptor.getMetaAttributes().put("generator", "OSWorkflow Designer");
  public boolean saveWorkflow(String name, WorkflowDescriptor descriptor, WorkflowGraph graph, boolean replace) throws Exception  {    String layoutBuffer = "";    String workflowBuffer;        Object obj = layouts.get(name);    if(obj instanceof Layout)    {      Layout layout = (Layout)obj;      try      {        HTTPWorkflowConfig config = (HTTPWorkflowConfig)workflows.get(name);                StringWriter sw = new StringWriter();        PrintWriter out = new PrintWriter(new BufferedWriter(sw));				//PrintWriter out = new PrintWriter(new ByteArrayOutputStream());        layout.writeXML(out, 0, graph);        out.flush();        out.close();        layoutBuffer = sw.getBuffer().toString();        	//layoutBuffer = out.toString();       }      catch(Exception e)      {        e.printStackTrace();        return false;      }    }    if(descriptor!=null)    {      HTTPWorkflowConfig config = (HTTPWorkflowConfig)workflows.get(name);      descriptor.getMetaAttributes().put("generator", "OSWOrkflow Designer");      descriptor.getMetaAttributes().put("lastModified", (new Date()).toString());      StringWriter sw = new StringWriter();      PrintWriter writer = new PrintWriter(new BufferedWriter(sw));      writer.println(WorkflowDescriptor.XML_HEADER);      writer.println(WorkflowDescriptor.DOCTYPE_DECL);      descriptor.writeXML(writer, 0);      writer.flush();      writer.close();      //workflowBuffer = writer.toString();      workflowBuffer = sw.getBuffer().toString();      String ret = writeWorkflowDescriptor(service.getRemoteAddress(), config.docId, name, workflowBuffer);      System.out.println("workflow ret = " + ret);      if (ret.length() == 0)        return false;      ret = writeWorkflowLayout(service.getRemoteAddress(), config.docId, name, layoutBuffer);      System.out.println("layout ret = " + ret);      if (ret.length() == 0)        return false;      config.docId = ret;		// set the new document ID      return true;		}    return false;  }