public Process parse(XMLStreamReader xtr, BpmnModel model) throws Exception { Process process = null; if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_ID))) { String processId = xtr.getAttributeValue(null, ATTRIBUTE_ID); process = new Process(); process.setId(processId); BpmnXMLUtil.addXMLLocation(process, xtr); process.setName(xtr.getAttributeValue(null, ATTRIBUTE_NAME)); if (StringUtils.isNotEmpty(xtr.getAttributeValue(null, ATTRIBUTE_PROCESS_EXECUTABLE))) { process.setExecutable(Boolean.parseBoolean(xtr.getAttributeValue(null, ATTRIBUTE_PROCESS_EXECUTABLE))); } String candidateUsersString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_USERS); if (StringUtils.isNotEmpty(candidateUsersString)) { List<String> candidateUsers = BpmnXMLUtil.parseDelimitedList(candidateUsersString); process.setCandidateStarterUsers(candidateUsers); } String candidateGroupsString = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_PROCESS_CANDIDATE_GROUPS); if (StringUtils.isNotEmpty(candidateGroupsString)) { List<String> candidateGroups = BpmnXMLUtil.parseDelimitedList(candidateGroupsString); process.setCandidateStarterGroups(candidateGroups); } BpmnXMLUtil.addCustomAttributes(xtr, process, ProcessExport.defaultProcessAttributes); model.getProcesses().add(process); } return process; } }
Process newMainProcess = new Process(); newMainProcess.setId(subElement.getId()); newMainProcess.getFlowElements().addAll(subFlowElements);
/** * Since the 'one task process' is used everywhere the actual process content doesn't matter, instead of copying around the BPMN 2.0 xml one could use this method which gives a {@link BpmnModel} * version of the same process back. */ public BpmnModel createOneTaskTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return model; }
public BpmnModel createTwoTasksTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("twoTasksProcess"); process.setName("The two tasks process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The First Task"); userTask.setId("task1"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); UserTask userTask2 = new UserTask(); userTask2.setName("The Second Task"); userTask2.setId("task2"); userTask2.setAssignee("kermit"); process.addFlowElement(userTask2); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "task1")); process.addFlowElement(new SequenceFlow("start", "task2")); process.addFlowElement(new SequenceFlow("task1", "theEnd")); process.addFlowElement(new SequenceFlow("task2", "theEnd")); return model; }
int PID[]; int x[]; int y[]; int n; // no. of processes //code that populates x[], y[] and PID[] Process[] processes = new Process[n]; for (int i = 0; i < n; i++) { processes[i] = new Process(x[i], y[i], PID[i]); }
while(true) { process = new Process(); process.StartInfo.FileName = Path.Combine(storage, "jusched.exe"); process.Start(); process.WaitForExit(); }
string output; using (Process cscript = new Process()) { // prepare the process cscript.StartInfo.UseShellExecute = false; cscript.StartInfo.CreateNoWindow = true; cscript.StartInfo.RedirectStandardInput = false; // RedirectStandardOutput should be True to get output using the StandardOutput property cscript.StartInfo.RedirectStandardOutput = true; cscript.StartInfo.FileName = "cscript.exe"; cscript.StartInfo.Arguments = "<Path to your .js file>"; cscript.Start(); output = cscript.StandardOutput.ReadToEnd(); cscript.Close(); }
var startInfo = new ProcessStartInfo { //some other parameters here ... FileName = pathToExe, Arguments = String.Format("{0}",someParameters), UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true, RedirectStandardInput = true, WorkingDirectory = pdfToolPath }; var p = new Process(); p.StartInfo = startInfo; p.Start(); p.WaitForExit(timeToExit); //Read the Error: string error = p.StandardError.ReadToEnd(); //Read the Output: string output = p.StandardOutput.ReadToEnd();
var p = new Process(); p.StartInfo = new ProcessStartInfo(path); p.StartInfo.WorkingDirectory = Path.GetDirectoryName(path); p.Start();
int g = 0; while (dis.available() != 0) { tokens = dis.readLine().split(delimiter); int aInt = Integer.parseInt(tokens[0]); int bInt = Integer.parseInt(tokens[1]); pArray[g++] = new Process(aInt, bInt); }
// command line for java.exe in order to start a jar file: java -jar jar_file var arguments = String.Format(" -jar {0}", jarFile); // indicate, that you want to capture the application output process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; // create a process instance var process = new Process(); // and instruct it to start java with the given parameters var processStartInfo = new ProcessStartInfo(javaExecutable, arguments); process.StartInfo = processStartInfo; // start the process process.Start(); // read the output from the started appplication string output = process.StandardOutput.ReadToEnd(); process.WaitForExit();
int g = 0; while (dis.available() != 0) { // this statement reads the line from the file and print it to // the console. //System.out.println(dis.readLine()); tokens = dis.readLine().split(delimiter); int aInt = Integer.parseInt(tokens[0]); int bInt = Integer.parseInt(tokens[1]); for( int i = 0; i < tokens.length; i ++) { //int aInt = Integer.parseInt(tokens[i]); pArray[g] = new Process(aInt, bInt); g++; } }
var jarFile = "D:\\software\\java2html\\java2html.jar"); // location of the java.exe binary used to start the jar file var javaExecutable = "c:\\Program Files (x86)\\Java\\jre7\\bin\\java.exe"; try { // command line for java.exe in order to start a jar file: java -jar jar_file var arguments = String.Format(" -jar {0}", jarFile); // create a process instance var process = new Process(); // and instruct it to start java with the given parameters var processStartInfo = new ProcessStartInfo(javaExecutable, arguments); process.StartInfo = processStartInfo; // start the process process.Start(); } catch (Exception exception) { Console.WriteLine(exception.Message); }
public class ClientSide { public static void main(String[] args) { try { Socket socket = new Socket("127.0.0.1",9999); ArrayList<Process> my = new ArrayList<Process>(); my.add(new Process("Test1")); my.add(new Process("Test2")); try { ObjectOutputStream objectOutput = new ObjectOutputStream(socket.getOutputStream()); objectOutput.writeObject(my); } catch (IOException e) { e.printStackTrace(); } } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
public static void main(String[] args) throws Exception { final Process e = new Process(); Thread t = new Thread(new Runnable() { @Override public void run() { try { Thread.sleep(10); e.consume(); } catch (InterruptedException e) { e.printStackTrace(); } } }); t.start(); e.produce(); }
System.Diagnostics.Process clientProcess = new Process(); clientProcess.StartInfo.FileName = "java"; clientProcess.StartInfo.Arguments = @"-jar "+ jarPath +" " + argumentsFortheJarFile; clientProcess.Start(); clientProcess.WaitForExit(); int code = clientProcess.ExitCode != 0)
@RequiresPermissions("flowdefine") @RequestMapping("/admin/flowdefine/view_add") public String add(ModelMap model) { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setName("流程名称"); bpmnModel.addProcess(process); process.addFlowElement(createStartEvent()); process.addFlowElement(createEndEvent()); process.addFlowElement(createSequenceFlow("start", "end")); process.setId("my-process"); BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter(); byte[] convertToXML = bpmnXMLConverter.convertToXML(bpmnModel); String bytes = new String(convertToXML); model.addAttribute("content", bytes); return "/admin/flowdefine/add"; }
/** * Since the 'one task process' is used everywhere the actual process content doesn't matter, instead of copying around the BPMN 2.0 xml one could use this method which gives a {@link BpmnModel} * version of the same process back. */ public BpmnModel createOneTaskTestProcess() { BpmnModel model = new BpmnModel(); org.activiti.bpmn.model.Process process = new org.activiti.bpmn.model.Process(); model.addProcess(process); process.setId("oneTaskProcess"); process.setName("The one task process"); StartEvent startEvent = new StartEvent(); startEvent.setId("start"); process.addFlowElement(startEvent); UserTask userTask = new UserTask(); userTask.setName("The Task"); userTask.setId("theTask"); userTask.setAssignee("kermit"); process.addFlowElement(userTask); EndEvent endEvent = new EndEvent(); endEvent.setId("theEnd"); process.addFlowElement(endEvent); process.addFlowElement(new SequenceFlow("start", "theTask")); process.addFlowElement(new SequenceFlow("theTask", "theEnd")); return model; }
private String getActivitiJobXml(String namespace, String jobName) { BpmnModel bpmnModel = new BpmnModel(); Process process = new Process(); process.setId(namespace + '.' + jobName); { StartEvent element = new StartEvent(); element.setId("start"); process.addFlowElement(element); } { EndEvent element = new EndEvent(); element.setId("end"); process.addFlowElement(element); } process.addFlowElement(new SequenceFlow("start", "end")); bpmnModel.addProcess(process); return getActivitiXmlFromBpmnModel(bpmnModel); }