buildCommand method

  1. @override
String buildCommand()
override

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

Implementation

@override
String buildCommand() {
  StringBuffer serverCommandBuffer = StringBuffer('notify:');

  if (operation != null) {
    serverCommandBuffer.write('${getOperationName(operation)}:');
  }
  if (atKey.metadata.ttl != null) {
    serverCommandBuffer.write('ttl:${atKey.metadata.ttl}:');
  }
  if (atKey.metadata.ttb != null) {
    serverCommandBuffer.write('ttb:${atKey.metadata.ttb}:');
  }
  if (atKey.metadata.ttr != null) {
    atKey.metadata.ccd ??= false;
    serverCommandBuffer
        .write('ttr:${atKey.metadata.ttr}:ccd:${atKey.metadata.ccd}:');
  }
  if (sharedWithList != null && sharedWithList!.isNotEmpty) {
    var sharedWith = sharedWithList!.join(',');
    serverCommandBuffer.write('${VerbUtil.formatAtSign(sharedWith)}:');
  }
  if (atKey.metadata.isPublic == true) {
    serverCommandBuffer.write('public:');
  }
  serverCommandBuffer.write(atKey.toString());
  if (atKey.sharedBy != null) {
    serverCommandBuffer.write('${VerbUtil.formatAtSign(atKey.sharedBy)}');
  }
  if (value != null) {
    serverCommandBuffer.write(':$value');
  }
  return (serverCommandBuffer..write('\n')).toString();
}