/*
 * Copyright 2006 Mask@ Project.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.maskat.framework.eventdef;

import java.util.Iterator;

import org.maskat.framework.BasicDef;

public class Result extends BasicDef {
	private Event event;

	private String rootNode;

	private String onErrorTele;

	// public boolean equals(Object obj) {
	// if (obj == this)
	// return true;
	// if (!(obj instanceof Result))
	// return false;
	//
	// Result o = (Result) obj;
	// if (!CUtil.isStrEqual(rootNode, o.rootNode))
	// return false;
	// if (!CUtil.isStrEqual(onErrorTele, o.onErrorTele))
	// return false;
	//
	// return super.contentEquals(obj);
	// }

	public void setFromEvent(Event event) {
		this.event = event;
	}

	public String getEventType() {
		if (event == null)
			return null;
		return event.getType();
	}

	public Iterator getTargetsIt() {
		return getTypedChildren(Target.class);
	}

	public void clearTargets() {
		removeAllByType(Target.class);
	}

	public String getOnErrorTele() {
		return onErrorTele;
	}

	public void setOnErrorTele(String onErrorTele) {
		this.onErrorTele = onErrorTele;
	}

	public String getRootNode() {
		return rootNode;
	}

	public void setRootNode(String rootNode) {
		this.rootNode = rootNode;
	}

}
