From 254ee6f47eebfc00462c10756a92066e82cc1a96 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Tue, 21 Jun 2011 15:46:02 +0200 Subject: Initial commit --- .../com/c2kernel/lifecycle/instance/ParserWF.java | 357 +++++++++++++++++++++ 1 file changed, 357 insertions(+) create mode 100755 source/com/c2kernel/lifecycle/instance/ParserWF.java (limited to 'source/com/c2kernel/lifecycle/instance/ParserWF.java') diff --git a/source/com/c2kernel/lifecycle/instance/ParserWF.java b/source/com/c2kernel/lifecycle/instance/ParserWF.java new file mode 100755 index 0000000..c3d718d --- /dev/null +++ b/source/com/c2kernel/lifecycle/instance/ParserWF.java @@ -0,0 +1,357 @@ +package com.c2kernel.lifecycle.instance; + +import java.awt.Point; +import java.io.IOException; +import java.util.Vector; + +import com.c2kernel.lookup.AgentPath; +import com.c2kernel.utils.CastorHashMap; +import com.c2kernel.utils.Logger; + +/** + * @version $Revision: 1.26 $ $Date: 2006/03/03 13:52:21 $ + * @author $Author: abranson $ + */ +public class ParserWF +{ + static Vector nexts; + static String file = ""; + static int i; + static CastorHashMap mInfo = new CastorHashMap(); + + /** + * Method addStep. + * @param act + * @param xmlfile + * @return CompositeActivity + * @throws IOException + */ + /** + * @associates <{com.c2kernel.lifecycle.instance.Workflow}> + * @label creates + */ + public static CompositeActivity addStep(CompositeActivity act, String xmlfile, AgentPath agent) throws IOException + { + nexts = new Vector(1, 1); + i = 0; + file = xmlfile; + int c; + while (i < file.length() - 5) + { + if (file.substring(i, i + 5).equals("")) + { + if (file.substring(i, i + 5).equals("")) + { + Logger.msg(7, ""); + i += 13; + int j = 0; + ; + while (file.charAt(i + j) != '<') + { + j++; + } + step[9] = file.substring(i, i + j); + i += (j + 14); + } + else if (file.substring(i, i + 6).equals("")) + { + Logger.msg(7, ""); + i += 6; + int j = 0; + ; + String[] tmp = new String[2]; + while (file.charAt(i + j) != '<') + { + j++; + } + tmp[0] = step[0]; + tmp[0] = parent.getPath() + "/" + tmp[0]; + tmp[1] = file.substring(i, i + j); + tmp[1] = parent.getPath() + "/" + tmp[1]; + nexts.addElement(tmp); + i += (j + 8); + Logger.msg(7, ""); + } + else if (file.substring(i, i + 5).equals("Path=")) + { + Logger.msg(7, "Path="); + i += 6; + int j = 0; + ; + step[11] = file.substring(i, i + j); + while (file.charAt(i + j) != '"') + { + j++; + } + i += (j + 1); + } + else + { + i++; + } + } + i += 7; + if (!step[14].equals("done")) + act = parent.newAtomChild(step[0], step[12].startsWith("true"), new Point(0, 0)); + Logger.msg(7, "Step Created"); + + try + { + Logger.msg(7, "Starting to create info"); + if (!step[1].equals("")) + act.getProperties().put("Agent ID", step[1]); + if (!step[2].equals("")) + act.getProperties().put("Lc", step[2]); + if (!step[3].equals("")) + act.getProperties().put("Wc", step[3]); + if (!step[4].equals("")) + act.getProperties().put("Posts", step[4]); + if (!step[5].equals("")) + act.getProperties().put("PreparationTime", step[5]); + if (!step[6].equals("")) + act.getProperties().put("ActiveTime", step[6]); + if (!step[7].equals("")) + act.getProperties().put("OpStartdate", step[7]); + if (!step[8].equals("")) + act.getProperties().put("OpEnddate", step[8]); + if (!step[9].equals("")) + act.getProperties().put("Description", step[9]); + Logger.msg(7, "create info for " + act.getID()); + Logger.msg(7, "Finished to create info"); + } + catch (Exception e) + { + Logger.error(e); + } + file = file.substring(i); + i = 0; + } +} -- cgit v1.2.3