示例#1
0
文件: main.go 项目: unikk/cuto
func realMain() int {
	if len(os.Args) != 2 {
		fmt.Println(usage)
		return rc_PARAM_ERROR
	}

	path := os.Args[1]
	elm, err := converter.ParseFile(path)
	if err != nil {
		fmt.Println(err)
		return rc_SYNTAX_ERROR
	}

	definitions := converter.GenerateDefinitions(elm)
	err = converter.ExportFile(convertExtension(path, ".bpmn"), definitions)
	if err != nil {
		fmt.Println(err)
		return rc_OUTPUT_ERROR
	}

	return rc_OK
}
示例#2
0
文件: network.go 项目: unikk/cuto
func (n *Network) Export(name, nwkDir string) error {
	flowPath := filepath.Join(nwkDir, name+".bpmn")
	jobexPath := filepath.Join(nwkDir, name+".csv")

	flowHead, err := converter.ParseString(n.Flow)
	if err != nil {
		return err
	}
	definition := converter.GenerateDefinitions(flowHead)
	if err := converter.ExportFile(flowPath, definition); err != nil {
		return err
	}

	file, err := os.Create(jobexPath)
	if err != nil {
		return err
	}
	defer file.Close()
	if err := n.exportJob(file); err != nil {
		return nil
	}

	return nil
}