Beispiel #1
0
  public int sortAlpha_WebToBottom(Channel item1, Channel item2) {
    boolean isWeb1 =
        (item1.channelType().equals(ChannelType.Web)
            || item1.channelType().equals(ChannelType.URL));
    boolean isWeb2 =
        (item2.channelType().equals(ChannelType.Web)
            || item2.channelType().equals(ChannelType.URL));

    String label1 = item1.channelType().getLabel();
    String label2 = item2.channelType().getLabel();

    int weight1 = item1.channelType().getWeight();
    int weight2 = item2.channelType().getWeight();
    int compareFirst = ObjectUtils.compare(weight1, weight2);

    if (isWeb1 && isWeb2) {
      return 0;
    } else {
      if (compareFirst == 0 || (weight1 > 3 && weight2 > 3)) {
        if (isWeb2) {
          return -1;
        } else {
          return label1.compareTo(label2);
        }
      } else {
        return compareFirst;
      }
    }
  }