Class Receipt

java.lang.Object
com.inesm.KeyManager.model.Receipt
All Implemented Interfaces:
NetworkResource, Resource, Serializable

public class Receipt extends Object implements Serializable, NetworkResource
Represents an acknowledgment of the reception of a message.

All the getters and setters are the default ones.

Details about the meaning of each field are provided in the source code.

See Also:
  • Constructor Details

    • Receipt

      public Receipt(long messageID, String source, String destination, LocalDateTime time, int mode, boolean waiting)
    • Receipt

      public Receipt(long messageID, String source, String destination, int status)
    • Receipt

      public Receipt()
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isMessage

      public boolean isMessage()
      Description copied from interface: NetworkResource
      Checks if the network resource is a Message.
      Specified by:
      isMessage in interface NetworkResource
      Returns:
      true if it is, false otherwise
    • isReceipt

      public boolean isReceipt()
      Description copied from interface: NetworkResource
      Checks if network resource is a Receipt.
      Specified by:
      isReceipt in interface NetworkResource
      Returns:
      true if it is, false otherwise
    • serialize

      public String serialize() throws IOException
      Description copied from interface: Resource
      Serializes a resource into a string.
      Specified by:
      serialize in interface Resource
      Returns:
      the string representing the serialization of the resource.
      Throws:
      IOException - if an error occurred during serialization
    • deserialize

      public void deserialize(String data) throws IOException, ClassNotFoundException
      Description copied from interface: Resource
      Deserializes the resource from a data string generated by the Resource.serialize() method.
      Specified by:
      deserialize in interface Resource
      Parameters:
      data - the serialized data as a string
      Throws:
      IOException - if an error occurred during the serialization process
      ClassNotFoundException - if its was not possible to load the class data, or the class data was not found
    • getResourceID

      public String getResourceID()
      Description copied from interface: Resource
      Gets the station resource identifier.
      Specified by:
      getResourceID in interface Resource
      Returns:
      a string containing the resource identifier.
    • getReceiptID

      public long getReceiptID()
    • setReceiptID

      public void setReceiptID(long receiptID)
    • getMessageID

      public long getMessageID()
    • setMessageID

      public void setMessageID(long messageID)
    • getDestination

      public String getDestination()
      Description copied from interface: NetworkResource
      Gets the destination of the network resource.
      Specified by:
      getDestination in interface NetworkResource
      Returns:
      the path of the destination station
    • setDestination

      public void setDestination(String destination)
    • getSource

      public String getSource()
    • setSource

      public void setSource(String source)
    • getTime

      public LocalDateTime getTime()
    • setTime

      public void setTime(LocalDateTime time)
    • getStatus

      public int getStatus()
    • setStatus

      public void setStatus(int status)
    • getMode

      public int getMode()
      Description copied from interface: NetworkResource
      Gets the distribution mode of the network resource.
      Specified by:
      getMode in interface NetworkResource
      Returns:
      the distribution mode flag between NetworkResource.DIRECT_MODE and NetworkResource.HIERARCHICAL_MODE.
    • setMode

      public void setMode(int mode)
    • getSignature

      public String getSignature()
    • setSignature

      public void setSignature(String signature)
    • getNextHop

      public String getNextHop()
      Description copied from interface: NetworkResource
      Gets the nextHop of the network resource.
      Specified by:
      getNextHop in interface NetworkResource
      Returns:
      the path of the next-hop station
    • setNextHop

      public void setNextHop(String nextHop)
    • getWaiting

      public boolean getWaiting()
    • setWaiting

      public void setWaiting(boolean waiting)