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

Examples of org.springframework.ide.eclipse.core.internal.model.validation.ValidationRuleDefinition


    if (beanAlias == null) {
      beanAlias = new BeanAlias(config, definition);
    }

    IProject project = file.getProject();
    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanAliasRule.class);
    BeanAliasRule aliasRule = (BeanAliasRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);

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

    if (aliasRule != null) {
View Full Code Here


  public boolean validateAttributeWithConfig(IBeansConfig config, IResourceModelElement contextElement, IFile file,
      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());
View Full Code Here

  public boolean validateAttributeWithConfig(IBeansConfig config, IResourceModelElement contextElement, IFile file,
      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);
View Full Code Here

      BeansEditorValidator validator, String text) {
    ITextRegion valueRegion = attribute.getValueRegion();

    IProject project = file.getProject();

    ValidationRuleDefinition initRuleDefinition = getValidationRule(project, BeanInitDestroyMethodRule.class);
    BeanInitDestroyMethodRule initDestroyMethodRule = (BeanInitDestroyMethodRule) (initRuleDefinition != null ? initRuleDefinition
        .getRule()
        : null);

    BeanHelper parentBean = new BeanHelper(parent, file, project);

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

    AbstractBeanDefinition beanDefinition = (AbstractBeanDefinition) parentBean.getBeanDefinition();
    if (attribute.getNodeName().equals(BeansSchemaConstants.ATTR_INIT_METHOD)) {
      beanDefinition.setInitMethodName(attribute.getNodeValue());
    }
    else if (attribute.getNodeName().equals(BeansSchemaConstants.ATTR_DESTROY_METHOD)) {
      beanDefinition.setDestroyMethodName(attribute.getNodeValue());
    }

    // add rename refactoring option
    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) {

      validator.createAndAddEmptyMessage(valueRegion, parent, "", reporter,
          QuickfixProcessorFactory.RENAME_METHOD, null, new ValidationProblemAttribute("CLASS",
              mergedClassName), new ValidationProblemAttribute("METHOD", attribute.getNodeValue()));
    }

    if (initDestroyMethodRule != null) {
      context.setCurrentRuleDefinition(initRuleDefinition);
      initDestroyMethodRule.validate(parentBean, context, null);
    }

    if (context.getErrorFound()) {
      return true;
    }

    ValidationRuleDefinition depracationRuleDefinition = getValidationRule(project, BeanDeprecationRule.class);
    BeanDeprecationRule deprecationRule = (BeanDeprecationRule) (depracationRuleDefinition != null ? depracationRuleDefinition
        .getRule()
        : null);

    context = new BeansValidationContextHelper(attribute, parent, config, project, reporter, validator,
        QuickfixProcessorFactory.DEPRECATED, false, reportError, config);
View Full Code Here

      return false;
    }

    IProject project = file.getProject();

    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanReferenceRule.class);
    BeanReferenceRule refRule = (BeanReferenceRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);

    if (refRule != null) {

      IBeansModelElement modelElement = getBeansModelElement(attribute, parent, file, text);
      if (modelElement == null) {
View Full Code Here

  public boolean validateAttributeWithConfig(IBeansConfig config, IResourceModelElement contextElement, IFile file,
      AttrImpl attribute, IDOMNode parent, IReporter reporter, boolean reportError,
      BeansEditorValidator validator, String text) {
    IProject project = file.getProject();

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

    if (rule != null) {

      boolean errorFound = false;
      BeanReferenceXmlValidationContextHelper context = new BeanReferenceXmlValidationContextHelper(validator,
View Full Code Here

  public boolean validateAttributeWithConfig(IBeansConfig config, IResourceModelElement contextElement, IFile file,
      AttrImpl attribute, IDOMNode parent, IReporter reporter, boolean reportError,
      BeansEditorValidator validator, String text) {
    IProject project = file.getProject();

    ValidationRuleDefinition propertyRuleDefinition = getValidationRule(project, BeanPropertyRule.class);
    BeanPropertyRule propertyRule = (BeanPropertyRule) (propertyRuleDefinition != null ? propertyRuleDefinition
        .getRule() : null);

    ValidationRuleDefinition depracationRuleDefinition = getValidationRule(project, BeanDeprecationRule.class);
    BeanDeprecationRule deprecationRule = (BeanDeprecationRule) (depracationRuleDefinition != null ? depracationRuleDefinition
        .getRule() : null);

    IDOMNode parentBeanNode = getParentBeanNode(parent);
    if (parentBeanNode == null) {
      return false;
View Full Code Here

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

    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanClassRule.class);
    BeanClassRule classRule = (BeanClassRule) (ruleDefinition != null ? ruleDefinition.getRule() : null);

    if (classRule != null) {
      BeansValidationContextHelper classContext = new BeansValidationContextHelper(attribute, parent,
          contextElement, project, reporter, validator, QuickfixProcessorFactory.CLASS, false, reportError,
          config);

      classContext.setCurrentRuleDefinition(ruleDefinition);
      classRule.validate(parentBean, classContext, null);

      BeansValidationContextHelper deprecatedContext = new BeansValidationContextHelper(attribute, parent,
          contextElement, project, reporter, validator, QuickfixProcessorFactory.DEPRECATED, false,
          reportError, config);
      ruleDefinition = getValidationRule(project, BeanDeprecationRule.class);
      BeanDeprecationRule deprecationRule = (BeanDeprecationRule) (ruleDefinition != null ? ruleDefinition
          .getRule() : null);

      if (deprecationRule != null) {
        classContext.setCurrentRuleDefinition(ruleDefinition);
        deprecationRule.validate(parentBean, deprecatedContext, null);
      }

      Set<String> problemIdToIgnore = new HashSet<String>();
      problemIdToIgnore.add("MISSING_CONSTRUCTOR_ARG_NAME");
      BeansValidationContextHelper constructorArgContext = new BeansValidationContextHelper(attribute, parent,
          contextElement, project, reporter, validator, QuickfixProcessorFactory.CONSTRUCTOR_ARG, true,
          reportError, config, problemIdToIgnore);
      ruleDefinition = getValidationRule(project, BeanConstructorArgumentRule.class);
      BeanConstructorArgumentRule argRule = (BeanConstructorArgumentRule) (ruleDefinition != null ? ruleDefinition
          .getRule() : null);
      if (argRule != null) {
        constructorArgContext.setCurrentRuleDefinition(ruleDefinition);
        argRule.validate(parentBean, constructorArgContext, null);
      }

      BeansValidationContextHelper requiredContext = new BeansValidationContextHelper(attribute, parent,
          contextElement, project, reporter, validator, QuickfixProcessorFactory.REQUIRED_PROPERTY, false,
          reportError, config);
      ruleDefinition = getValidationRule(project, RequiredPropertyRule.class);
      RequiredPropertyRule requiredRule = (RequiredPropertyRule) (ruleDefinition != null ? ruleDefinition
          .getRule() : null);
      if (requiredRule != null) {
        requiredContext.setCurrentRuleDefinition(ruleDefinition);
        requiredRule.validate(parentBean, classContext, null);
      }
View Full Code Here

      BeansEditorValidator validator, String text) {
    IProject project = file.getProject();
    IDOMNode parentNode = getParentBeanNode(parent);
    BeanHelper parentBean = new BeanHelper(parentNode, file, project);

    ValidationRuleDefinition ruleDefinition = getValidationRule(project, BeanConstructorArgumentRule.class);
    BeanConstructorArgumentRule constructorArgRule = (BeanConstructorArgumentRule) (ruleDefinition != null ? ruleDefinition
        .getRule() : null);

    if (constructorArgRule != null) {
      BeansValidationContextHelper constructorArgContext = new BeansValidationContextHelper(attribute, parent,
          contextElement, project, reporter, validator, QuickfixProcessorFactory.CONSTRUCTOR_ARG, false,
          reportError, config);
      ruleDefinition = getValidationRule(project, BeanConstructorArgumentRule.class);
      BeanConstructorArgumentRule argRule = (BeanConstructorArgumentRule) (ruleDefinition != null ? ruleDefinition
          .getRule() : null);
      if (argRule != null) {
        constructorArgContext.setCurrentRuleDefinition(ruleDefinition);

        // NodeList childNodes = parentNode.getChildNodes();
View Full Code Here

    if (widget == configureButton) {
      IStructuredSelection selection = (IStructuredSelection) validatorViewer.getSelection();
      if (!selection.isEmpty()) {
        Object obj = selection.getFirstElement();
        if (obj instanceof ValidationRuleDefinition) {
          ValidationRuleDefinition ruleDef = (ValidationRuleDefinition) obj;
          Map<String, String> propertyValues = null;
          if (changedPropertyValues.containsKey(ruleDef)) {
            propertyValues = new HashMap<String, String>(changedPropertyValues.get(ruleDef));
          }
          else {
            propertyValues = new HashMap<String, String>(ruleDef.getPropertyValues());
          }

          Map<String, Integer> messageSeverities = null;
          if (changedMessageSeverities.containsKey(ruleDef)) {
            messageSeverities = new HashMap<String, Integer>(changedMessageSeverities.get(ruleDef));
          }
          else {
            messageSeverities = new HashMap<String, Integer>(ruleDef.getMessageSeverities());
          }

          ValidationRuleConfigurationDialog dialog = new ValidationRuleConfigurationDialog(this.shell,
              propertyValues, messageSeverities, ruleDef);
          if (dialog.open() == Dialog.OK) {
View Full Code Here

TOP

Related Classes of org.springframework.ide.eclipse.core.internal.model.validation.ValidationRuleDefinition

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.