Package org.springframework.ide.eclipse.beans.core.internal.model.validation.rules

Examples of org.springframework.ide.eclipse.beans.core.internal.model.validation.rules.BeanFactoryRule


      AttrImpl attribute, IDOMNode parent, IReporter reporter, boolean reportError,
      BeansEditorValidator validator, String text) {
    IProject project = file.getProject();

    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanFactoryRule.class);
    BeanFactoryRule rule = (BeanFactoryRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);
    if (rule != null) {

      BeanHelper parentBean = new BeanHelper(parent, file, project);
      parentBean.getBeanDefinition().setFactoryBeanName(attribute.getNodeValue());

      Node factoryMethodAttr = parent.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_FACTORY_METHOD);
      if (factoryMethodAttr != null) {
        parentBean.getBeanDefinition().setFactoryMethodName(factoryMethodAttr.getNodeValue());
      }

      BeansValidationContextHelper context = new BeansValidationContextHelper(attribute, parent, contextElement,
          project, reporter, validator, QuickfixProcessorFactory.FACTORY_BEAN, false, reportError, config);
      context.setCurrentRuleDefinition(ruleDefinition);
      rule.validate(parentBean, context, null);

      if (context.getErrorFound()) {
        return true;
      }
    }
View Full Code Here


      AttrImpl attribute, IDOMNode parent, IReporter reporter, boolean reportError,
      BeansEditorValidator validator, String text) {
    IProject project = file.getProject();

    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanFactoryRule.class);
    BeanFactoryRule rule = (BeanFactoryRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);
    BeanHelper parentBean = new BeanHelper(parent, file, project);
    parentBean.getBeanDefinition().setFactoryMethodName(text);

    AttrImpl factoryBeanAttr = (AttrImpl) parent.getAttributes().getNamedItem(
        BeansSchemaConstants.ATTR_FACTORY_BEAN);
    if (factoryBeanAttr != null) {
      parentBean.getBeanDefinition().setFactoryBeanName(factoryBeanAttr.getNodeValue());
    }

    BeansValidationContextHelper context = new BeansValidationContextHelper(attribute, parent, contextElement,
        project, reporter, validator, QuickfixProcessorFactory.FACTORY_METHOD, false, reportError, config);

    ITextRegion valueRegion = attribute.getValueRegion();

    AbstractBeanDefinition mergedBd = (AbstractBeanDefinition) BeansModelUtils.getMergedBeanDefinition(parentBean,
        context.getContextElement());

    // For non-factory beans validate it's init-method and destroy-method
    String mergedClassName = mergedBd.getBeanClassName();
    if (valueRegion != null && mergedClassName != null) {
      // add rename refactoring option
      validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
          QuickfixProcessorFactory.RENAME_METHOD, null, new ValidationProblemAttribute("CLASS",
              mergedClassName));
    }

    if (rule != null) {
      context.setCurrentRuleDefinition(ruleDefinition);
      rule.validate(parentBean, context, null);

      if (context.getErrorFound()) {
        return true;
      }
    }
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.beans.core.internal.model.validation.rules.BeanFactoryRule

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.