FileDocCategorySizeDatePackage
ValidateeImpl.javaAPI DocGlassfish v2 API9704Fri May 04 22:35:00 BST 2007com.sun.enterprise.tools.common.validation.impl

ValidateeImpl

public class ValidateeImpl extends Object implements com.sun.enterprise.tools.common.validation.Validatee
author
Rajeshwar Patil
version
%I%, %G%

Fields Summary
private org.netbeans.modules.schema2beans.BaseBean
baseBean
private com.sun.enterprise.tools.common.validation.util.Utils
utils
Constructors Summary
public ValidateeImpl(Object baseBean)
Creates a new instance of ValidateeImpl

    
           
      
        this.baseBean = (BaseBean)baseBean;
        utils = new Utils();
    
Methods Summary
public intgetCardinal()

        String name = baseBean.name();
        BaseBean parent = baseBean.parent();
        BaseProperty baseProperty = parent.getProperty(name);
        return baseProperty.getInstanceType();
    
public java.lang.ObjectgetElement(java.lang.String elementName, int index)

            return utils.getElement(elementName, index, baseBean);
    
public java.lang.ObjectgetElement(java.lang.String elementName)

        return utils.getElement(elementName, baseBean);
    
public intgetElementCardinal(java.lang.String elementName)

        BaseProperty baseProperty = baseBean.getProperty(elementName);
        int returnValue = -1;
        if(null != baseProperty) {
            returnValue =  baseProperty.getInstanceType();
        } else {
            String format = 
                BundleReader.getValue("Error_does_not_exists");         //NOI18N
            Object[] arguments =    
                new Object[]{"Property", elementName};                  //NOI18N
            String message = MessageFormat.format(format, arguments);
            assert false : message;
        }
        return returnValue;
    
public java.util.ArrayListgetElementDtdNames()

        ArrayList elements = new ArrayList();
        BaseProperty[] baseProperty = baseBean.listProperties();
        int size = baseProperty.length;
        for(int i=0; i<size; i++){
            elements.add(baseProperty[i].getDtdName());
            ///String format = 
            ///    BundleReader.getValue("Name_Value_Pair_Format");     //NOI18N
            ///Object[] arguments = new Object[]{"Dtd Name",            //NOI18N
            ///    baseProperty[i].getDtdName()};
            ///System.out.println(MessageFormat.format(format, arguments));         
        }
        return elements;
    
public java.util.ArrayListgetElementNames()

        ArrayList elements = new ArrayList();
        BaseProperty[] baseProperty = baseBean.listProperties();
        int size = baseProperty.length;
        for(int i=0; i<size; i++){
            elements.add(baseProperty[i].getName());
            ///String format = 
            ///    BundleReader.getValue("Name_Value_Pair_Format");     //NOI18N
            ///Object[] arguments = new Object[]{"Name",                //NOI18N
            ///    baseProperty[i].getName()};
            ///System.out.println(MessageFormat.format(format, arguments));
            ///arguments = 
            ///    new Object[]{"FullName", baseProperty[i].getFullName()};//NOI18N
            ///System.out.println(MessageFormat.format(format, arguments));
         }
        return elements;
    
public java.lang.Object[]getElements(java.lang.String elementName)

        return utils.getElements(elementName, baseBean);
    
intgetIndex(org.netbeans.modules.schema2beans.BaseBean baseBean)

        int index = -1;
        boolean root = isRootElement(baseBean);
        if(!root){
            String name = baseBean.name();
            BaseBean parent = baseBean.parent();
            if(parent != null) {
                index = parent.indexOf(name, baseBean);
            }
        }
        return index;
    
public java.lang.StringgetIndexedXPath()

        BaseBean bean =  baseBean;
        BaseBean parentBean = null;
        String xpath = bean.dtdName();
        int index = getIndex(baseBean);
        if(index != -1){
            xpath = utils.getIndexedName(xpath,  index);
        }

        boolean root = isRootElement(bean);
        parentBean = bean.parent();

        String name = null;
        while(!root){
            name = parentBean.dtdName();
            index = getIndex(parentBean);
            if(index != -1) {
                name = utils.getIndexedName(name, index);
            }
            xpath = name + Constants.XPATH_DELIMITER + xpath;
            bean = parentBean;
            parentBean = bean.parent();
            root = isRootElement(bean);
        }
        xpath = Constants.XPATH_DELIMITER + xpath;
        return xpath;
    
public java.lang.reflect.MethodgetMethod(java.lang.String methodName)

        return utils.getMethod(utils.getClass(baseBean), methodName);
    
public java.lang.StringgetXPath()

        ///String format = BundleReader.getValue("Name_Value_Pair_Format");//NOI18N
        ///Object[] arguments = new Object[]{"Name", baseBean.name()};  //NOI18N
        ///System.out.println(MessageFormat.format(format, arguments));
        ///arguments = new Object[]{"FullName", baseBean.fullName()};   //NOI18N
        ///System.out.println(MessageFormat.format(format, arguments));

        BaseBean bean =  baseBean;
        BaseBean parentBean = null;
        String xpath = bean.dtdName();
        ///boolean root =  bean.isRoot();
        boolean root = isRootElement(bean);
        parentBean = bean.parent();
        while(!root){
            xpath = parentBean.dtdName() + Constants.XPATH_DELIMITER + xpath;
            bean = parentBean;
            parentBean = bean.parent();
            ///root = bean.isRoot();
            root = isRootElement(bean);
        }
        xpath = Constants.XPATH_DELIMITER + xpath;
        return xpath;
    
public java.lang.Objectinvoke(java.lang.reflect.Method method)

        return utils.invoke(baseBean, method);
    
public booleanisBeanElement(java.lang.String elementName)

        BaseProperty baseProperty = baseBean.getProperty(elementName);
        boolean returnValue = false;
        if(null != baseProperty) {
            returnValue =  baseProperty.isBean();
        } else {
            String format = 
                BundleReader.getValue("Error_does_not_exists");         //NOI18N
            Object[] arguments =    
                new Object[]{"Property", elementName};                  //NOI18N
            String message = MessageFormat.format(format, arguments);
            assert false : message;
        }
        return returnValue;
    
public booleanisIndexed(java.lang.String elementName)

        BaseProperty baseProperty = baseBean.getProperty(elementName);
        boolean returnValue =  false;
        if(null != baseProperty) {
            returnValue =  baseProperty.isIndexed();
        } else {
            String format = 
                BundleReader.getValue("Error_does_not_exists");         //NOI18N
            Object[] arguments =    
                new Object[]{"Property", elementName};                  //NOI18N
            String message = MessageFormat.format(format, arguments);
            assert false : message;
        }
        return returnValue;
    
booleanisRootElement(org.netbeans.modules.schema2beans.BaseBean bean)

        BaseBean parent = bean.parent();
        boolean root;
        if(parent.name().equals(bean.name())){
            root = true;
        } else {
            root = false;
        }
        return root;