FileDocCategorySizeDatePackage
Validation.javaAPI DocGlassfish v2 API11514Fri May 04 22:35:00 BST 2007com.sun.enterprise.tools.common.validation.data

Validation

public class Validation extends org.netbeans.modules.schema2beans.BaseBean
This generated bean class Validation matches the schema element validation Generated on Wed Aug 20 17:21:25 PDT 2003 This class matches the root element of the DTD, and is the root of the following bean graph: validation : Validation [attr: validate ENUM ( true false ) true] element : Element[0,n] name : String check : Check[0,n] name : String parameters : Parameters? parameter : Parameter[1,n] name : String value : String[1,n]

Fields Summary
static Vector
comparators
public static final String
VALIDATE
public static final String
ELEMENT
Constructors Summary
public Validation()

	// NOI18N

	    
		this(null, Common.USE_DEFAULT_VALUES);
	
public Validation(Node doc, int options)

		this(Common.NO_DEFAULT_VALUES);
		initFromNode(doc, options);
	
public Validation(int options)

		super(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
		initOptions(options);
	
Methods Summary
public static voidaddComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.add(c);
	
public intaddElement(com.sun.enterprise.tools.common.validation.data.Element value)

		return this.addValue(ELEMENT, value);
	
public static com.sun.enterprise.tools.common.validation.data.ValidationcreateGraph(org.w3c.dom.Node doc)

		return new Validation(doc, Common.NO_DEFAULT_VALUES);
	
public static com.sun.enterprise.tools.common.validation.data.ValidationcreateGraph(java.io.InputStream in)

		return createGraph(in, false);
	
public static com.sun.enterprise.tools.common.validation.data.ValidationcreateGraph(java.io.InputStream in, boolean validate)

		Document doc = GraphManager.createXmlDocument(in, validate);
		return createGraph(doc);
	
public static com.sun.enterprise.tools.common.validation.data.ValidationcreateGraph()

		try {
			return new Validation();
		}
		catch (Schema2BeansException e) {
			throw new RuntimeException(e.getMessage());
		}
	
public voiddump(java.lang.StringBuffer str, java.lang.String indent)

		String s;
		Object o;
		org.netbeans.modules.schema2beans.BaseBean n;
		str.append(indent);
		str.append("Element["+this.sizeElement()+"]");	// NOI18N
		for(int i=0; i<this.sizeElement(); i++)
		{
			str.append(indent+"\t");
			str.append("#"+i+":");
			n = (org.netbeans.modules.schema2beans.BaseBean) this.getElement(i);
			if (n != null)
				n.dump(str, indent + "\t");	// NOI18N
			else
				str.append(indent+"\tnull");	// NOI18N
			this.dumpAttributes(ELEMENT, i, str, indent);
		}

	
public java.lang.StringdumpBeanNode()

		StringBuffer str = new StringBuffer();
		str.append("Validation\n");	// NOI18N
		this.dump(str, "\n  ");	// NOI18N
		return str.toString();
	
public com.sun.enterprise.tools.common.validation.data.ElementgetElement(int index)

		return (Element)this.getValue(ELEMENT, index);
	
public com.sun.enterprise.tools.common.validation.data.Element[]getElement()

		return (Element[])this.getValues(ELEMENT);
	
public java.lang.StringgetValidate()

		return getAttributeValue(VALIDATE);
	
protected voidinitFromNode(org.w3c.dom.Node doc, int options)

		if (doc == null)
		{
			doc = GraphManager.createRootElementNode("validation");	// NOI18N
			if (doc == null)
				throw new Schema2BeansException(Common.getMessage(
					"CantCreateDOMRoot_msg", "validation"));
		}
		Node n = GraphManager.getElementNode("validation", doc);	// NOI18N
		if (n == null)
			throw new Schema2BeansException(Common.getMessage(
				"DocRootNotInDOMGraph_msg", "validation", doc.getFirstChild().getNodeName()));

		this.graphManager.setXmlDocument(doc);

		// Entry point of the createBeans() recursive calls
		this.createBean(n, this.graphManager());
		this.initialize(options);
	
protected voidinitOptions(int options)

		// The graph manager is allocated in the bean root
		this.graphManager = new GraphManager(this);
		this.createRoot("validation", "Validation",	// NOI18N
			Common.TYPE_1 | Common.TYPE_BEAN, Validation.class);

		// Properties (see root bean comments for the bean graph)
		this.createProperty("element", 	// NOI18N
			ELEMENT, 
			Common.TYPE_0_N | Common.TYPE_BEAN | Common.TYPE_KEY, 
			Element.class);
		this.createAttribute("validate", "Validate", 
						AttrProp.ENUM,
						new String[] {
							"true",
							"false"
						}, "true");
		this.initialize(options);
	
voidinitialize(int options)


	
private voidreadObject(java.io.ObjectInputStream in)

		try{
			init(comparators, new org.netbeans.modules.schema2beans.Version(1, 2, 0));
			String strDocument = in.readUTF();
			// System.out.println("strDocument='"+strDocument+"'");
			ByteArrayInputStream bais = new ByteArrayInputStream(strDocument.getBytes());
			Document doc = GraphManager.createXmlDocument(bais, false);
			initOptions(Common.NO_DEFAULT_VALUES);
			initFromNode(doc, Common.NO_DEFAULT_VALUES);
		}
		catch (Schema2BeansException e) {
			e.printStackTrace();
			throw new RuntimeException(e.getMessage());
		}
	
public static voidremoveComparator(org.netbeans.modules.schema2beans.BeanComparator c)

		comparators.remove(c);
	
public intremoveElement(com.sun.enterprise.tools.common.validation.data.Element value)

		return this.removeValue(ELEMENT, value);
	
public voidsetElement(com.sun.enterprise.tools.common.validation.data.Element[] value)

		this.setValue(ELEMENT, value);
	
public voidsetElement(int index, com.sun.enterprise.tools.common.validation.data.Element value)

		this.setValue(ELEMENT, index, value);
	
public voidsetValidate(java.lang.String value)

		setAttributeValue(VALIDATE, value);
	
public intsizeElement()

		return this.size(ELEMENT);
	
public voidvalidate()

		boolean restrictionFailure = false;
		// Validating property validate
		if (getValidate() == null) {
			throw new org.netbeans.modules.schema2beans.ValidateException("getValidate() == null", "validate", this);	// NOI18N
		}
		// Validating property element
		for (int _index = 0; _index < sizeElement(); ++_index) {
			com.sun.enterprise.tools.common.validation.data.Element element = getElement(_index);
			if (element != null) {
				element.validate();
			}
		}
	
private voidwriteObject(java.io.ObjectOutputStream out)

		ByteArrayOutputStream baos = new ByteArrayOutputStream();
		write(baos);
		String str = baos.toString();;
		// System.out.println("str='"+str+"'");
		out.writeUTF(str);