Class Request

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

public class Request extends Object implements Serializable, Resource
Implementation of No-Lone Zones. Represents an operation that was intercepted before being executed, and turned into an operation request. The operation held inside the request will only be executed after being approved by a second user.

All the getters and setters are the default ones.

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

See Also:
  • Field Details

  • Constructor Details

    • Request

      public Request()
    • Request

      public Request(int operationID, String userFullname, String userCitizenCard, Resource operationData, LocalDateTime time, int scope)
  • Method Details

    • getDataAsString

      public String getDataAsString() throws IOException
      Calls the Resource.serialize() method for the Resource object inside the data field.
      Returns:
      a string serialization of the data field
      Throws:
      IOException - if an error occurred during serialization
    • setDataAsString

      public void setDataAsString(String string) throws BadOperationIDProvidedException, InvalidFormatException
      Gets a string serialization of an object an deserializes it into to a java object.
      Parameters:
      string - the string representation of the serialized data
      Throws:
      BadOperationIDProvidedException - if the operationID provided did not map to any known operation
      InvalidFormatException - if a deserialization error occurred
    • patch

      public void patch(Request upd)
      Updates the fields in the current object instance with the ones from another object. Will only update the fields that have been modified after the initialization.
      Parameters:
      upd - the object containing the fields to update the current instance with
    • 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.
    • 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
    • toString

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

      public long getRequestID()
    • setRequestID

      public void setRequestID(long requestID)
    • getOperationID

      public int getOperationID()
    • setOperationID

      public void setOperationID(int operationID)
    • getOperationName

      public String getOperationName()
    • setOperationName

      public void setOperationName(String operationName)
    • getUserFullname

      public String getUserFullname()
    • setUserFullname

      public void setUserFullname(String userFullname)
    • getUserCitizenCard

      public String getUserCitizenCard()
    • setUserCitizenCard

      public void setUserCitizenCard(String userCitizenCard)
    • getVerifierFullname

      public String getVerifierFullname()
    • setVerifierFullname

      public void setVerifierFullname(String verifierFullname)
    • getVerifierCitizenCard

      public String getVerifierCitizenCard()
    • setVerifierCitizenCard

      public void setVerifierCitizenCard(String verifierCitizenCard)
    • getTime

      public LocalDateTime getTime()
    • setTime

      public void setTime(LocalDateTime time)
    • getStatus

      public int getStatus()
    • setStatus

      public void setStatus(int status)
    • getReason

      public String getReason()
    • setReason

      public void setReason(String reason)
    • getData

      public Resource getData()
    • setData

      public void setData(Resource data)
    • getScope

      public int getScope()
    • setScope

      public void setScope(int scope)
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)