Package org.apache.camel.model

Examples of org.apache.camel.model.SetHeaderDefinition


        }
    }

    private static void renderSetHeader(StringBuilder buffer, ExpressionNode expNode) {
        ExpressionDefinition expression = expNode.getExpression();
        SetHeaderDefinition set = (SetHeaderDefinition)expNode;
        buffer.append("(\"").append(set.getHeaderName()).append("\")");
        if (expression.getExpressionValue() != null) {
            ExpressionRenderer.renderConstant(buffer, expression);
        } else if (expression.getExpressionType() != null) {
            ExpressionRenderer.render(buffer, expression);
        }
View Full Code Here


        }
    }

    private static void renderSetHeader(StringBuilder buffer, ExpressionNode expNode) {
        ExpressionDefinition expression = expNode.getExpression();
        SetHeaderDefinition set = (SetHeaderDefinition)expNode;
        buffer.append("(\"").append(set.getHeaderName()).append("\")");
        if (expression.getExpressionValue() != null) {
            ExpressionRenderer.renderConstant(buffer, expression);
        } else if (expression.getExpressionType() != null) {
            ExpressionRenderer.render(buffer, expression);
        }
View Full Code Here

            } else {
                buffer.append("()");
                ExpressionRenderer.renderConstant(buffer, expression);
            }
        } else if (expNode instanceof SetHeaderDefinition) {
            SetHeaderDefinition set = (SetHeaderDefinition)expNode;
            buffer.append("(\"").append(set.getHeaderName()).append("\")");
            if (expression.getExpressionValue() != null) {
                ExpressionRenderer.renderConstant(buffer, expression);
            } else if (expression.getExpressionType() != null) {
                ExpressionRenderer.render(buffer, expression);
            }
        } else if (expNode instanceof SetOutHeaderDefinition) {
            buffer.append("(\"unspported expressions in SetOutHeaderDefinition\")");
        } else if (expNode instanceof SetPropertyDefinition) {
            SetPropertyDefinition set = (SetPropertyDefinition)expNode;
            buffer.append("(\"").append(set.getPropertyName()).append("\")");
            if (expression.getExpressionValue() != null) {
                ExpressionRenderer.renderConstant(buffer, expression);
            } else if (expression.getExpressionType() != null) {
                ExpressionRenderer.render(buffer, expression);
            }
View Full Code Here

    if (CamelModelHelper.isPropertyListOFSetHeaders(id) && value instanceof List) {
      List list = (List) value;
      for (Object object : list) {
        Object newValue = object;
        if (object instanceof SetHeaderDefinition) {
          SetHeaderDefinition sh = (SetHeaderDefinition) object;
          ExpressionDefinition expression = sh.getExpression();
          if (expression instanceof LanguageExpressionBean) {
            LanguageExpressionBean lb = (LanguageExpressionBean) expression;
            sh.setExpression(lb.toXmlExpression());
          }
        }
      }
    }
    return value;
View Full Code Here

    clearColumns();

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        SetHeaderDefinition sh = DetailsSection.toSetHeaderDefinition(element);
        if (sh != null) {
          return sh.getHeaderName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Header");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        SetHeaderDefinition sh = DetailsSection.toSetHeaderDefinition(element);
        if (sh != null) {
          LanguageExpressionBean expression = LanguageExpressionBean.toLanguageExpressionBean(sh.getExpression());
          if (expression != null) {
            return expression.getExpression();
          }
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Expression");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        SetHeaderDefinition sh = DetailsSection.toSetHeaderDefinition(element);
        if (sh != null) {
          LanguageExpressionBean expression = LanguageExpressionBean.toLanguageExpressionBean(sh.getExpression());
          if (expression != null) {
            return expression.getLanguage();
          }
        }
        return null;
View Full Code Here

    final WritableList input = tableView.getInput();

    final Runnable addAction = new Runnable() {
      @Override
      public void run() {
        final SetHeaderDefinition sh = new SetHeaderDefinition("myHeaderName", new LanguageExpressionBean(CamelModelHelper.getDefaultLanguageName(), ""));
        final TableViewer viewer = tableView.getViewer();
        Refreshable refreshable = new Refreshable() {

          @Override
          public void refresh() {
            input.add(sh);
            viewer.setSelection(new StructuredSelection(sh));
            Viewers.refresh(viewer);
            layoutForm();
            panel.layout(true, true);
            fireNodePropertyChangedEvent(id);
          }
        };
        SetHeaderDialog.showDialog(sh, refreshable);
      }
    };
    final Runnable editAction = new Runnable() {
      @Override
      public void run() {
        Activator.getLogger().debug("Starting the edit...");

        final TableViewer viewer = tableView.getViewer();
        if (!viewer.getSelection().isEmpty()) {
          IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
          Iterator iter = selection.iterator();
          while (iter.hasNext()) {
            SetHeaderDefinition sh = toSetHeaderDefinition(iter.next());
            if (sh != null) {
              Refreshable refreshable = new Refreshable() {

                @Override
                public void refresh() {
                  Viewers.refresh(viewer);
                  fireNodePropertyChangedEvent(id);
                }
              };
              SetHeaderDialog.showDialog(sh, refreshable);
              break;
            }
          }
        }
      }
    };
    final Runnable deleteAction = new Runnable() {
      @Override
      public void run() {
        TableViewer viewer = tableView.getViewer();
        if (!viewer.getSelection().isEmpty()) {
          IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
          Iterator iter = selection.iterator();
          while (iter.hasNext()) {
            SetHeaderDefinition sh = toSetHeaderDefinition(iter.next());
            if (sh != null) {
              input.remove(sh);
            }
          }
          fireNodePropertyChangedEvent(id);
View Full Code Here

    }

    @SuppressWarnings("rawtypes")
    @Override
    public ProcessorDefinition createCamelDefinition() {
        SetHeaderDefinition answer = new SetHeaderDefinition();

        answer.setInheritErrorHandler(toXmlPropertyValue(PROPERTY_INHERITERRORHANDLER, Objects.<Boolean>getField(this, "inheritErrorHandler")));
        answer.setExpression(toXmlPropertyValue(PROPERTY_EXPRESSION, this.getExpression()));
        answer.setHeaderName(toXmlPropertyValue(PROPERTY_HEADERNAME, this.getHeaderName()));

        super.savePropertiesToCamelDefinition(answer);
        return answer;
    }
View Full Code Here

    @Override
    protected void loadPropertiesFromCamelDefinition(ProcessorDefinition processor) {
        super.loadPropertiesFromCamelDefinition(processor);

        if (processor instanceof SetHeaderDefinition) {
            SetHeaderDefinition node = (SetHeaderDefinition) processor;

            this.setInheritErrorHandler(Objects.<Boolean>getField(node, "inheritErrorHandler"));
            this.setExpression(node.getExpression());
            this.setHeaderName(node.getHeaderName());
        } else {
            throw new IllegalArgumentException("ProcessorDefinition not an instanceof SetHeaderDefinition. Was " + processor.getClass().getName());
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.model.SetHeaderDefinition

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.