Examples of Function1


Examples of org.fusesource.ide.commons.util.Function1

  @Override
  protected void createColumns() {
    clearColumns();
    int bounds = 100;
    int column = 0;
    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getProfile();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Profile");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getCount();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Count");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMinimumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Minumum");
    function = new FunctionInteger() {
      @Override
      public Integer apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getMaximumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Maximum");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return toHealth(status);
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Status",
        new HealthLabelProvider(function));
    function = new Function1() {
      @Override
      public Double apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getHealth(status.getCount());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Health",
        new PercentFunctionLabelProvider(function));
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatus status = asProfileStatus(element);
        if (status != null) {
          return status.getDependentProfiles();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

  protected void createColumns() {
    int bounds = 100;
    int column = 0;
    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());
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

  protected void createColumns() {
    int bounds = 100;
    int column = 0;
    clearColumns();

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getEventTimestamp();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Time");
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getEventhost();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Host");


    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getContainer();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Container");


    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getLogLevel();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Level", new LogLevelImageProvider());

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getLogger();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Category");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getThreadName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Thread");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          String msg = log.getLogMessage();
          if (msg.indexOf('\n') != -1) {
            return log.getLogMessage().substring(0, log.getLogMessage().indexOf('\n'));
          }
          return log.getLogMessage();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Message");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        return element;
      }
    };
    column = addColumnFunction(bounds, column, function, "Location", new LocationLabelProvider());

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getPropertiesMap();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Properties");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getSeq();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "ID");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        LogEventDTO log = (LogEventDTO)element;
        if (log != null) {
          return log.getException();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

    clearColumns();

        int bounds = 100;
        int column = 0;

        Function1 function = new Function1() {
            @Override
            public Object apply(Object element) {
                VersionDTO version = asVersionDTO(element);
                if (version != null) {
                    return version.getId();
                }
                return null;
            }
        };
        column = addColumnFunction(250, column, function, "Id");

        function = new Function1() {
            @Override
            public Boolean apply(Object element) {
              VersionDTO version = asVersionDTO(element);
                if (version != null) {
                    return version.isDefaultVersion();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

    clearColumns();

    int bounds = 100;
    int column = 0;

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getProfile();
        }
        return null;
      }
    };
    column = addColumnFunction(250, column, function, "Profile");

    function = new FunctionInteger() {
      @Override
      public BigInteger apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getCount();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Count");

    function = new FunctionInteger() {
      @Override
      public BigInteger apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getMinimumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Minumum");

    function = new FunctionInteger() {
      @Override
      public BigInteger apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getMaximumInstances();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Maximum");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return toHealth(status);
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Status", new HealthLabelProvider(function));

    function = new Function1() {
      @Override
      public BigDecimal apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getHealth(status.getCount());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Health", new PercentFunctionLabelProvider(function));

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ProfileStatusDTO status = asProfileStatus(element);
        if (status != null) {
          return status.getDependentProfiles();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

    int bounds = 100;
    int column = 0;
    clearColumns();

    if (browser instanceof ITraceExchangeBrowser) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          Exchange exchange = Exchanges.asExchange(element);
          if (exchange != null) {
            return exchange.getExchangeIndex();
          }
          return null;
        }
      };
      column = addColumnFunction(bounds, column, function, "Trace ID");
    }

    // TODO add exchange / message ID??
    if (browser instanceof ITraceExchangeBrowser) {
      if (showTraceExchangeId) {
        final Function1 function = new Function1() {
          @Override
          public Object apply(Object element) {
            Exchange exchange = Exchanges.asExchange(element);
            if (exchange != null) {
              return exchange.getId();
            }
            return null;
          }
        };
        column = addColumnFunction(bounds, column, function, "Exchange ID");
      }
    }
    if (showBody) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          if (element instanceof IExchange) {
            IExchange exchange = (IExchange) element;
            String answer = MessageUIHelper.getBody(exchange);
            if (answer != null) {
              // lets replace newlines
              return answer.replace('\n', ' ');
            }
          }
          return null;
        }
      };
      column = addColumnFunction(bounds, column, function, "Message Body");
    }

    SortedSet<String> headers = new TreeSet<String>();
    for (IExchange exchange : exchanges) {
      IMessage in = exchange.getIn();
      if (in != null) {
        headers.addAll(in.getHeaders().keySet());
      }
    }
    for (final String header : headers) {
      final Function1 function = new Function1() {
        @Override
        public Object apply(Object element) {
          if (element instanceof IExchange) {
            IExchange exchange = (IExchange) element;
            IMessage in = exchange.getIn();
            if (in != null) {
              return in.getHeaders().get(header);
            }
          }
          return null;
        }
      };
      column = addColumnFunction(bounds, column, function, header);
    }
    if (browser instanceof ITraceExchangeBrowser) {
      if (showToNode) {
        final Function1 function = new Function1() {
          @Override
          public Object apply(Object element) {
            IMessage message = Exchanges.asMessage(element);
            if (message != null) {
              return message.getToNode();
            }
            return null;
          }
        };
        column = addColumnFunction(bounds, column, function, "Trace Node Id");
      }
      if (showTimestamp) {
        final Function1 function = new Function1() {
          @Override
          public Object apply(Object element) {
            IMessage message = Exchanges.asMessage(element);
            if (message != null) {
              return message.getTimestamp();
            }
            return null;
          }
        };
        column = addColumnFunction(bounds, column, function, "Trace Timestamp");
      }
      if (showRelativeTime) {
        final Function1 function = new FunctionLong() {
          @Override
          public Long apply(Object element) {
            IMessage message = Exchanges.asMessage(element);
            if (message != null) {
              return message.getRelativeTime();
            }
            return null;
          }
        };
        column = addColumnFunction(bounds, column, function, "Relative Time (ms)");
      }
      if (showElapsedTime) {
        final Function1 function = new FunctionLong() {
          @Override
          public Long apply(Object element) {
            IMessage message = Exchanges.asMessage(element);
            if (message != null) {
              return message.getElapsedTime();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

    clearColumns();

    int bounds = 150;
    int column = 0;

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getId();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Id");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Name");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getStatus();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "State");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          Hardware hardware = value.getHardware();
          if (hardware != null) {
            return JClouds.text(hardware);
          }
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Hardware");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getImageId();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Image");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          OperatingSystem operatingSystem = value.getOperatingSystem();
          if (operatingSystem != null) {
            return JClouds.text(operatingSystem);
          }
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "OS");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return value.getGroup();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Group");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getPublicAddresses());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Public IPs");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        NodeMetadata value = JClouds.asNodeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getPrivateAddresses());
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Private IPs");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        Location value = JClouds.asLocation(element);
        if (value != null) {
          return value.getDescription();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Location");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return value.getUri();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "URI");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        ComputeMetadata value = JClouds.asComputeMetadata(element);
        if (value != null) {
          return joinSpaces(value.getTags());
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

    clearColumns();

    int bounds = 150;
    int column = 0;

    Function1 function = new Function1() {
      @Override
      public Object apply(Object element) {
        CloudDetails exchange = CloudDetails.asCloudDetails(element);
        if (exchange != null) {
          return exchange.getName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Name");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        CloudDetails exchange = CloudDetails.asCloudDetails(element);
        if (exchange != null) {
          return exchange.getProviderName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Provider");

    function = new Function1() {
      @Override
      public Object apply(Object element) {
        CloudDetails exchange = CloudDetails.asCloudDetails(element);
        if (exchange != null) {
          return exchange.getApiName();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Api");
   
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        CloudDetails exchange = CloudDetails.asCloudDetails(element);
        if (exchange != null) {
          return exchange.getEndpoint();
        }
        return null;
      }
    };
    column = addColumnFunction(bounds, column, function, "Endpoint");
   
    function = new Function1() {
      @Override
      public Object apply(Object element) {
        CloudDetails exchange = CloudDetails.asCloudDetails(element);
        if (exchange != null) {
          return exchange.getIdentity();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

        clearColumns();

        int bounds = 100;
        int column = 0;

        Function1 function = new Function1() {
            @Override
            public Object apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getProfile();
                }
                return null;
            }
        };
        column = addColumnFunction(250, column, function, "Profile");

        function = new FunctionInteger() {
            @Override
            public BigInteger apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getCount();
                }
                return null;
            }
        };
        column = addColumnFunction(bounds, column, function, "Count");

        function = new FunctionInteger() {
            @Override
            public BigInteger apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getMinimumInstances();
                }
                return null;
            }
        };
        column = addColumnFunction(bounds, column, function, "Minumum");

        function = new FunctionInteger() {
            @Override
            public BigInteger apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getMaximumInstances();
                }
                return null;
            }
        };
        column = addColumnFunction(bounds, column, function, "Maximum");

        function = new Function1() {
            @Override
            public Object apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return toHealth(status);
                }
                return null;
            }
        };
        column = addColumnFunction(bounds, column, function, "Status", new HealthLabelProvider(function));

        function = new Function1() {
            @Override
            public BigDecimal apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getHealth(status.getCount());
                }
                return null;
            }
        };
        column = addColumnFunction(bounds, column, function, "Health", new PercentFunctionLabelProvider(function));

        function = new Function1() {
            @Override
            public Object apply(Object element) {
                ProfileStatusDTO status = asProfileStatus(element);
                if (status != null) {
                    return status.getDependentProfiles();
View Full Code Here

Examples of org.fusesource.ide.commons.util.Function1

        clearColumns();

        int bounds = 100;
        int column = 0;

        Function1 function = new Function1() {
            @Override
            public Object apply(Object element) {
                VersionDTO version = asVersionDTO(element);
                if (version != null) {
                    return version.getId();
                }
                return null;
            }
        };
        column = addColumnFunction(250, column, function, "Id");

        function = new Function1() {
            @Override
            public Boolean apply(Object element) {
              VersionDTO version = asVersionDTO(element);
                if (version != null) {
                    return version.isDefaultVersion();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.