Example usage for org.springframework.beans.factory.config BeanDefinitionHolder getBeanDefinition

List of usage examples for org.springframework.beans.factory.config BeanDefinitionHolder getBeanDefinition

Introduction

In this page you can find the example usage for org.springframework.beans.factory.config BeanDefinitionHolder getBeanDefinition.

Prototype

public BeanDefinition getBeanDefinition() 

Source Link

Document

Return the wrapped BeanDefinition.

Usage

From source file:org.bigtester.ate.xmlschema.BasePageModelBeanDefinitionParser.java

/**
 * {@inheritDoc}//  www  . j  a  va  2  s  .c o  m
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(PageModelBase.class.getName());
    String myWd = element.getAttribute(XsdElementConstants.ATTR_BASEPAGEMODEL_MYWD);
    if (StringUtils.hasText(myWd)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(myWd));
    }
    // String text = element.getAttribute("text");
    // bd.getPropertyValues().addPropertyValue("text", text);
    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.BaseERValueBeanDefinitionParser.java

/**
 * {@inheritDoc}/*from   w  ww.  ja  v a  2  s .  c  om*/
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw new IllegalStateException("Incorrect xsd xml parsing.");
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(BaseERValue.class.getName());
    String stepERDao = element.getAttribute(XsdElementConstants.ELEMENT_BASEERVALUE_STEPERDAO);
    if (StringUtils.hasText(stepERDao)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(stepERDao));
    }

    //        String text = element.getAttribute("text");
    //        bd.getPropertyValues().addPropertyValue("text", text);
    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.BaseElementFinderBeanDefinitionParser.java

/**
 * {@inheritDoc}/*from  ww  w. ja  v a  2s  .c  om*/
 */
@Override
protected @Nullable AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();

    String findbyValue = element.getAttribute(XsdElementConstants.ATTR_GENERICELEMENTFIND_FINDBYVALUE);
    if (StringUtils.hasText(findbyValue))
        bDef.getConstructorArgumentValues().addGenericArgumentValue(findbyValue);

    String strIndex = element.getAttribute(XsdElementConstants.ATTR_GENERICELEMENTFIND_INDEXOFSAMEELEMENTS);
    if (StringUtils.hasText(strIndex)) {
        bDef.getPropertyValues().addPropertyValue(
                XsdElementConstants.ATTR_GENERICELEMENTFIND_INDEXOFSAMEELEMENTS,
                new RuntimeBeanReference(strIndex));
    }
    bDef.setAttribute("id", element.getAttribute("id"));
    return (AbstractBeanDefinition) bDef;
}

From source file:org.bigtester.ate.xmlschema.RegularPageBeanDefinitionParser.java

/**
 * {@inheritDoc}//from  ww  w.  j a  v  a2s  .  c  om
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(RegularPage.class.getName());

    String dataFile = element.getAttribute(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE);
    if (StringUtils.hasText(dataFile))
        bDef.getPropertyValues().addPropertyValue(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE, dataFile);

    bDef.setParentName(XsdElementConstants.ELEMENT_ID_MYBASEPAGEOBJECT);

    String idstring = element.getAttribute("id");

    parserContext.getRegistry().registerBeanDefinition(idstring, bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:com.bstek.dorado.spring.ClassTypeListShortCutDecorator.java

@SuppressWarnings({ "unchecked", "rawtypes" })
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext) {
    AbstractBeanDefinition beanDef = (AbstractBeanDefinition) definition.getBeanDefinition();
    MutablePropertyValues propertyValues = (beanDef.getPropertyValues() == null) ? new MutablePropertyValues()
            : beanDef.getPropertyValues();

    ManagedList list = null;/*from ww  w.  ja va2 s.c  om*/
    boolean firstPropertyValue = propertyValues.getPropertyValue(IMPL_TYPES) == null;

    if (!firstPropertyValue) {
        list = (ManagedList) (propertyValues.getPropertyValue(IMPL_TYPES).getValue());
    } else {
        list = new ManagedList();
        list.setSource(node);
        list.setMergeEnabled(true);
        propertyValues.addPropertyValue(IMPL_TYPES, list);
        beanDef.setPropertyValues(propertyValues);
    }

    Element el = (Element) node;
    String className = el.getAttribute("name");
    try {
        list.add(Class.forName(className));
    } catch (ClassNotFoundException e) {
        logger.warn(e, e);
    }
    return definition;
}

From source file:org.bigtester.ate.xmlschema.HomepageBeanDefinitionParser.java

/**
 * {@inheritDoc}//  ww w. java 2 s  .co m
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(Homepage.class.getName());

    String homeUrl = element.getAttribute(XsdElementConstants.ATTR_HOMEPAGE_HOMEURL);
    bDef.getConstructorArgumentValues().addGenericArgumentValue(homeUrl);

    String dataFile = element.getAttribute(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE);
    if (StringUtils.hasText(dataFile))
        bDef.getPropertyValues().addPropertyValue(XsdElementConstants.ATTR_BASEPAGEOBJECT_DATAFILE, dataFile);

    bDef.setParentName(XsdElementConstants.ELEMENT_ID_MYBASEPAGEOBJECT);
    String idstring = element.getAttribute("id");

    parserContext.getRegistry().registerBeanDefinition(idstring, bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.StepInputDataValueBeanDefinitionParser.java

/**
 * {@inheritDoc}/*from w  w  w .j av a 2 s. c o  m*/
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(StepInputDataValue.class.getName());
    //        String elementDataDao = element
    //            .getAttribute(XsdElementConstants.ATTR_BASEINPUTDATAVALUE_ELEMENTDATADAO);
    //      if (StringUtils.hasText(elementDataDao)) {
    //         bDef.getConstructorArgumentValues().addGenericArgumentValue(
    //               new RuntimeBeanReference(elementDataDao));
    //      }
    String dataValueId = element.getAttribute(XsdElementConstants.ATTR_STEPDATAVALUE_DATAVALUEID);
    bDef.getConstructorArgumentValues().addGenericArgumentValue(dataValueId);

    bDef.setParentName(XsdElementConstants.ELEMENT_ID_BASEINPUTDATAVALUE);

    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.ElementActionDefBeanDefinitionParser.java

/**
 * {@inheritDoc}/*from   w ww . j  ava  2 s  .c o m*/
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(MyWebElement.class.getName());

    String elementFind = element.getAttribute(XsdElementConstants.ATTR_ELEMENTACTIONDEF_ELEMENTFIND);
    if (StringUtils.hasText(elementFind)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(elementFind));
    }
    String elementAction = element.getAttribute(XsdElementConstants.ATTR_ELEMENTACTIONDEF_ELEMENTACTION);
    if (StringUtils.hasText(elementAction)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(elementAction));
    }
    //      String parent = element
    //            .getAttribute("parent");
    //      if (StringUtils.hasText(parent)) {
    bDef.setParentName("myBasePageModel");
    //      }

    //        String text = element.getAttribute("text");
    //        bd.getPropertyValues().addPropertyValue("text", text);
    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.MyWebElementBeanDefinitionParser.java

/**
 * {@inheritDoc}// w w  w.ja v  a 2  s.co  m
 */
@Override
protected AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {
    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(MyWebElement.class.getName());

    String elementFind = element.getAttribute(XsdElementConstants.ATTR_MYWEBELEMENT_ELEMENTFIND);
    if (StringUtils.hasText(elementFind)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(elementFind));
    }
    String elementAction = element.getAttribute(XsdElementConstants.ATTR_MYWEBELEMENT_ELEMENTACTION);
    if (StringUtils.hasText(elementAction)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(elementAction));
    }
    //      String parent = element
    //            .getAttribute("parent");
    //      if (StringUtils.hasText(parent)) {
    bDef.setParentName("myBasePageModel");
    //      }

    //        String text = element.getAttribute("text");
    //        bd.getPropertyValues().addPropertyValue("text", text);
    parserContext.getRegistry().registerBeanDefinition(element.getAttribute("id"), bDef);
    return (AbstractBeanDefinition) bDef;

}

From source file:org.bigtester.ate.xmlschema.CaseTypeServiceBeanDefinitionParser.java

/**
 * {@inheritDoc}/*from www. jav a 2s. c om*/
 */
@Override
protected @Nullable AbstractBeanDefinition parseInternal(@Nullable Element element,
        @Nullable ParserContext parserContext) {

    // Here we parse the Spring elements such as < property>
    if (parserContext == null || element == null)
        throw GlobalUtils.createNotInitializedException("element and parserContext");
    // Here we parse the Spring elements such as < property>
    BeanDefinitionHolder holder = parserContext.getDelegate().parseBeanDefinitionElement(element);
    BeanDefinition bDef = holder.getBeanDefinition();
    bDef.setBeanClassName(CaseTypeService.class.getName());

    String testCaseName = element.getAttribute(XsdElementConstants.ATTR_TESTCASE_TESTCASENAME);
    if (StringUtils.hasText(testCaseName)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(testCaseName);
    }
    String testCaseFName = element.getAttribute(XsdElementConstants.ATTR_TESTCASE_TESTCASEFILENAME);
    if (StringUtils.hasText(testCaseFName)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(testCaseFName);
    }
    String parentTestCase = element.getAttribute(XsdElementConstants.ATTR_TESTCASE_PARENTTESTCASE);
    if (StringUtils.hasText(parentTestCase)) {
        bDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(parentTestCase));
    }

    String idstring = element.getAttribute("id");

    parserContext.getRegistry().registerBeanDefinition(idstring, bDef);
    return (AbstractBeanDefinition) bDef;

}