java.lang.Object
pt.unl.fct.di.novasys.babel.generic.ProtoIPC
pt.unl.fct.di.novasys.babel.generic.ProtoReply

public class ExecuteJSONReply extends CommonExecuteReply
A reply of an operation parsed as a JSON string. The object representing the result is passed as an argument in the construct and converted to a JSON string by the GSON package. It stores information about the result of the operation as well as the type of operation (e.g., READ, UPDATE, etc.) issued.
  • Field Details

    • REPLY_ID

      public static final short REPLY_ID
      See Also:
    • gson

      public static final com.google.gson.Gson gson
  • Constructor Details

    • ExecuteJSONReply

      public ExecuteJSONReply(CommonOperationStatus status, CommonOperationType type, Object result)
      Creates a execute JSON reply with the status of the operation, the type of operation issued, and an object representing the result, that is going to be converted to a JSON string. No information about the keySpace or collection is passed
      Parameters:
      status - the status of the operation.
      type - the type of operation committed.
      result - the result of the operation.
    • ExecuteJSONReply

      public ExecuteJSONReply(CommonOperationStatus status, CommonOperationType type, String keySpace, String collection, String objectID, Object result)
      Creates a execute JSON reply with the status of the operation, the type of operation issued, and an object representing the result, that is going to be converted to a JSON string.
      Parameters:
      status - the status of the operation.
      type - the type of operation committed.
      keySpace - the keySpace where the operation was executed
      collection - the collection where the operation was executed
      objectID - the identifier of the object
      result - the result of the operation.
    • ExecuteJSONReply

      public ExecuteJSONReply(CommonOperationStatus status, CommonOperationType type, String keySpace, String collection, String objectID, String message, Object result)
      Creates a execute JSON reply with the status of the operation, the type of operation issued, and an object representing the result, that is going to be converted to a JSON string. The message should detail the status of the operation.
      Parameters:
      status - the status of the operation.
      type - the type of operation committed.
      keySpace - the keySpace where the operation was executed
      collection - the collection where the operation was executed
      objectID - the identifier of the object
      message - a message detailing the status.
      result - the result of the operation.
    • ExecuteJSONReply

      public ExecuteJSONReply(CommonOperationStatus status, CommonOperationType type, String keySpace, String collection, String objectID, String message, Object result, String reqID)
      Creates a execute JSON reply with the status of the operation, the type of operation issued, and an object representing the result, that is going to be converted to a JSON string. The message should detail the status of the operation. Additionally, the reply also stores the request identifier associated with the reply.
      Parameters:
      status - the status of the operation.
      type - the type of operation committed.
      keySpace - the keySpace where the operation was executed
      collection - the collection where the operation was executed
      objectID - the identifier of the object
      message - a message detailing the status.
      result - the result of the operation.
      reqID - the request identifier associated with the reply.
  • Method Details

    • getResult

      public String getResult()
      Gets the result of the operation as a JSON string.
      Returns:
      the result of the operation.
    • getResultType

      public Class<? extends Object> getResultType()
      Gets the class type associated with the result. This can aid in parsing the result back to a readable object.
      Returns:
      the class type associated with the result.