Пример #1
0
  /**
   * @param inTag
   * @param inRef
   * @param inStatus
   * @param inEntry
   * @return
   */
  public static Message createSubResponse(
      Long inTag, int inRef, Status inStatus, ISTMEntryKey inKey, ISTMEntry inEntry) {

    SubQueryResponseMessage.Builder builder = SubQueryResponseMessage.newBuilder();
    builder.setReference(inRef);
    builder.setTag(inTag.intValue());
    builder.setStatus(inStatus.ordinal());

    if (inEntry != null) {
      DataMap.Builder dataBuilder = DataMap.newBuilder();
      parseMapValues(inEntry.getDataMap(), dataBuilder);
      builder.setData(dataBuilder.build());
    }

    if (inKey != null) {
      DataKey dKey = createDataKey(inKey);

      builder.setKey(dKey);
    }

    Message.Builder messBuilder = Message.newBuilder();
    messBuilder.setSubQueryResponseMessage(builder.build());
    messBuilder.setType(Message.Type.SubQueryResponseMessage);

    return messBuilder.build();
  }
Пример #2
0
  /**
   * @param inTag
   * @param inRef
   * @return
   */
  public static Message createSubResponse(Long inTag, int inRef, Status inStatus) {
    SubQueryResponseMessage.Builder builder = SubQueryResponseMessage.newBuilder();
    builder.setReference(inRef);
    builder.setTag(inTag.intValue());
    builder.setStatus(inStatus.ordinal());

    Message.Builder messBuilder = Message.newBuilder();
    messBuilder.setSubQueryResponseMessage(builder.build());
    messBuilder.setType(Message.Type.SubQueryResponseMessage);

    return messBuilder.build();
  }