www.pudn.com > sxg.rar > GwComplexType.java


/*
 * Copyright (c) 2003 Jens Mueller
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/**
 	Instances of this class represent xsd-types defined by the
 	<xsd:ComplexType> statement.

 	@author Jens Mueller
 */

import java.util.Vector;
import java.util.List;
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.XPath;


public  class GwComplexType
{
	private String _name;
	private GwOID _oid;
	private String _type;
	private boolean _isTable;	
	private String _schemaLocation;
	private String _namespacePrefix;
	private String _maxAccess;
	private String _status;	
	private String _xpath;
	public Vector _typeElements;
	public Vector _typeAttributes;
	private Document _tempDocument;

	public GwComplexType( 	String type, 
										String name, 
										GwOID oid , 
										boolean isTable, 
										String location, 
										String namespacePrefix )
	{
		_type = type;
		_name = name;
		_oid = oid;
		_isTable = isTable;
		_schemaLocation = location;
		_namespacePrefix = namespacePrefix;
		_typeElements = new Vector();
		_typeAttributes = new Vector();
		_tempDocument = DocumentHelper.createDocument();
	}
	
	public String getType()
	{
		return _type;
	}

	public GwOID getOid()
	{
		return _oid;
	}

	public String getName()
	{
		return _name;
	}
	
	public String getSchemaLocation()
	{
		return _schemaLocation;
	}
	
	public String getNamespacePrefix()
	{
		return _namespacePrefix;
	}

	public String getMaxAccess()
	{
		return _maxAccess;
	}

	public String getStatus()
	{
		return _status;
	}
	
	public boolean isTable()
	{
		return _isTable;
	}
	
	public void setMaxAccess( String maxAccess )
	{
		_maxAccess = maxAccess;
	}

	public void setStatus( String status )
	{
		_status = status;
	}
	
	public void setXPath( String xpath )
	{
		_xpath = xpath;
	}

	public String getXPath()
	{
		return _xpath;
	}
	
	public Document getTempDocument()
	{
		return _tempDocument;
	}
	
	public boolean allTypeOidsPrefixed()
	{
		boolean allOidsPrefixed = true;
		//check elements
		for ( Iterator iterator = _typeElements.iterator(); iterator.hasNext(); )
			if ( !_oid.isPrefixOf( (( GwElement )iterator.next()).getOid() ) )
			{
				allOidsPrefixed = false;
				break;
			}
		if ( allOidsPrefixed )
		//check attributes if necessary
			for ( Iterator iterator = _typeAttributes.iterator(); iterator.hasNext(); )
				if ( !_oid.isPrefixOf( (( GwElement )iterator.next()).getOid() ) )
				{
					allOidsPrefixed = false;
					break;
				}
		return allOidsPrefixed;
	}
	
	/*
	public GatewayGetRequest getGatewayGetRequest()
	{
		return gatewayGetRequest;
	}

	public void setGatewayGetRequest(GatewayGetRequest gatewayGetRequest)
	{
		this.gatewayGetRequest = gatewayGetRequest;
	}
*/
}