2006/unicorn/src/org/w3c/unicorn/tasklist TaskListUnmarshallerBeans.java,1.1.2.3,1.1.2.4

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist
In directory hutz:/tmp/cvs-serv5324/src/org/w3c/unicorn/tasklist

Modified Files:
      Tag: dev2
	TaskListUnmarshallerBeans.java 
Log Message:
Removed ThenType from XML schema (then and else are now RoutineType)

Index: TaskListUnmarshallerBeans.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/Attic/TaskListUnmarshallerBeans.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -d -r1.1.2.3 -r1.1.2.4
--- TaskListUnmarshallerBeans.java	17 Aug 2009 17:32:58 -0000	1.1.2.3
+++ TaskListUnmarshallerBeans.java	17 Aug 2009 17:54:31 -0000	1.1.2.4
@@ -21,7 +21,7 @@
 import org.w3.unicorn.tasklist.TUi;
 import org.w3.unicorn.tasklist.TaskType;
 import org.w3.unicorn.tasklist.TasklistDocument;
-import org.w3.unicorn.tasklist.ThenType;
+import org.w3.unicorn.tasklist.RoutineType;
 import org.w3.unicorn.tasklist.ValueType;
 import org.w3c.unicorn.Framework;
 import org.w3c.unicorn.contract.CallMethod;
@@ -89,15 +89,13 @@
 		final Task aTaskCurrent = new Task();
 		// Create the execution level tree
 		aTaskCurrent.setID(aTask.getId());
-		aTaskCurrent.setTree(this.ExpandTree(aTask));
+		aTaskCurrent.setTree(this.expandTree(aTask, aTask.getRoutine()));
 
 		// parameters
 		final ParametersType aParameters = aTask.getParameters();
 		if (aParameters != null) {
-			final ParameterType[] listOfParameter;
-			listOfParameter = aParameters.getParameterArray();
 
-			for (final ParameterType aParameterBeans : listOfParameter) {
+			for (final ParameterType aParameterBeans : aParameters.getParameterList()) {
 
 				final TUi.Enum aTUi = aParameterBeans.getUi();
 				final String sObserver = aParameterBeans.getObserver();
@@ -117,8 +115,7 @@
 
 					// Values
 					final Map<String, Value> mapOfValue = new LinkedHashMap<String, Value>();
-					for (final ValueType aValue : aParameterBeans
-							.getValueArray()) {
+					for (final ValueType aValue : aParameterBeans.getValueList()) {
 
 						// name of the value
 						String sValueName = aValue.getName();
@@ -128,8 +125,7 @@
 
 						// Mappings of the value
 						final Map<String, List<Mapping>> mapOfMapping = new LinkedHashMap<String, List<Mapping>>();
-						for (final MappedType aMappedBeans : aValue
-								.getMappedArray()) {
+						for (final MappedType aMappedBeans : aValue.getMappedList()) {
 							final Mapping aMapping = this
 									.createMapping(aMappedBeans);
 							if (aMapping != null) {
@@ -360,50 +356,25 @@
 	 *            the task to transform into a tree
 	 * @throws UnknownObserverException 
 	 */
-	public TLTNode ExpandTree(TaskType myTask) throws UnknownObserverException {
+	public TLTNode expandTree(TaskType myTask, RoutineType subroutine) throws UnknownObserverException {
 		TaskListUnmarshallerBeans.logger
 				.trace("Creation of the tree based on the Task "
 						+ myTask.getId());
 		TLTNode root = new TLTNode();
 		root.setID(NodeID++);
-		for (ExecType exec : myTask.getRoutine().getExecArray()) {
+		for (ExecType exec : subroutine.getExecList()) {
 			final Observer obs = Framework.mapOfObserver.get(exec.getValue());
 			if (obs == null)
 				throw new UnknownObserverException("The observer " + exec.getValue() + " does not exist. Exec ID: " + exec.getId());
 			root.addExec(new TLTExec(exec.getId(), obs, exec.getValue(), exec
 					.getType(), exec.getParam()));
 		}
-		for (IfType iflist : myTask.getRoutine().getIfArray()) {
+		for (IfType iflist : subroutine.getIfList()) {
 			root.addIf(fillIfs(myTask, iflist));
 		}
 		return root;
 	}
-
-	/**
-	 * Recursion over the Then tag to fill the tree
-	 * 
-	 * @param myThen
-	 *            the ThenType node for the recursion
-	 * @return the node created
-	 * @throws UnknownObserverException 
-	 */
-	private TLTNode FillNode(TaskType myTask, ThenType myThen) throws UnknownObserverException {
-		TaskListUnmarshallerBeans.logger.trace("Creation of a then branch ");
-		TLTNode node = new TLTNode();
-		node.setID(NodeID++);
-		for (ExecType exec : myThen.getExecArray()) {
-			final Observer obs = Framework.mapOfObserver.get(exec.getValue());
-			if (obs==null)
-				throw new UnknownObserverException("The observer " + exec.getValue() + " does not exist. Exec ID: " + exec.getId());
-			node.addExec(new TLTExec(exec.getId(), obs, exec.getValue(), exec
-					.getType(), exec.getParam()));
-		}
-		for (IfType iflist : myThen.getIfArray()) {
-			node.addIf(fillIfs(myTask, iflist));
-		}
-		return node;
-	}
-
+	
 	/**
 	 * Created the Ifnode in the tree
 	 * 
@@ -422,7 +393,7 @@
 		for (String cond : conds) {
 			TLTCond myCond = new TLTCond();
 
-			for (CondType condlist : myTask.getConds().getCondArray()) {
+			for (CondType condlist : myTask.getConds().getCondList()) {
 				if (condlist.getId().equals(cond)) {
 					TaskListUnmarshallerBeans.logger
 							.trace("Creation of a condition " + cond);
@@ -447,12 +418,12 @@
 		if (ifs.getThen() != null) {
 			TaskListUnmarshallerBeans.logger
 					.trace("Call recursion for the Then ");
-			ifnode.setIfOk(FillNode(myTask, ifs.getThen()));
+			ifnode.setIfOk(expandTree(myTask, ifs.getThen()));
 			// Add recursively the inner if in the else part
 			if (ifs.getElse() != null) {
 				TaskListUnmarshallerBeans.logger
 						.trace("Call recursion for the else");
-				ifnode.setIfNotOk(FillNode(myTask, ifs.getElse()));
+				ifnode.setIfNotOk(expandTree(myTask, ifs.getElse()));
 			}
 		}
 		return ifnode;
@@ -529,7 +500,7 @@
 	public void unmarshal() {
 		TaskListUnmarshallerBeans.logger.trace("unmarshal tasklist");
 		// creates the tasklist without computing references
-		for (final TaskType aTask : this.aTaskList.getTasklist().getTaskArray()) {
+		for (final TaskType aTask : this.aTaskList.getTasklist().getTaskList()) {
 			if (this.mapOfTask.containsKey(aTask.getId())) {
 				TaskListUnmarshallerBeans.logger.warn("Task with id "
 						+ aTask.getId() + " already defined.");

Received on Monday, 17 August 2009 17:54:42 UTC