buildCommand method

  1. @override
String buildCommand()
override

Build the @ command to be sent to remote secondary for execution.

Implementation

@override
String buildCommand() {
  StringBuffer sb = StringBuffer();
  sb.write('notify:id:$id');

  if (operation != null) {
    sb.write(':${getOperationName(operation)}');
  }
  if (messageType != null) {
    sb.write(':messageType:${getMessageType(messageType)}');
  }
  if (priority != null) {
    sb.write(':priority:${getPriority(priority)}');
  }
  if (strategy != null) {
    sb.write(':strategy:${getStrategy(strategy)}');
  }
  if (latestN != null) {
    sb.write(':latestN:$latestN');
  }
  sb.write(':notifier:$notifier');
  if (ttln != null) {
    sb.write(':ttln:$ttln');
  }

  // Add in all of the metadata parameters in atProtocol command format
  sb.write(metadata.toAtProtocolFragment());

  if (sharedWith != null) {
    sb.write(':${VerbUtil.formatAtSign(sharedWith)}');
  }

  if (isPublic) {
    sb.write(':public');
  }
  sb.write(':${atKey!}');

  if (sharedBy != null) {
    sb.write('${VerbUtil.formatAtSign(sharedBy)}');
  }
  if (value != null) {
    sb.write(':$value');
  }

  sb.write('\n');

  return sb.toString();
}