Package com.inesm.KeyManager.model
Class Request
java.lang.Object
com.inesm.KeyManager.model.Request
- All Implemented Interfaces:
Resource,Serializable
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserialize(String data) Deserializes the resource from a data string generated by theResource.serialize()method.getData()Calls theResource.serialize()method for the Resource object inside the data field.intlongGets the station resource identifier.intgetScope()intgetTime()voidUpdates the fields in the current object instance with the ones from another object.Serializes a resource into a string.voidvoidsetDataAsString(String string) Gets a string serialization of an object an deserializes it into to a java object.voidsetOperationID(int operationID) voidsetOperationName(String operationName) voidvoidsetRequestID(long requestID) voidsetScope(int scope) voidsetStatus(int status) voidsetTime(LocalDateTime time) voidsetUserCitizenCard(String userCitizenCard) voidsetUserFullname(String userFullname) voidsetUsername(String username) voidsetVerifierCitizenCard(String verifierCitizenCard) voidsetVerifierFullname(String verifierFullname) toString()
-
Field Details
-
STATUS_ACCEPTED
public static final int STATUS_ACCEPTED- See Also:
-
STATUS_WAITING
public static final int STATUS_WAITING- See Also:
-
STATUS_DENIED
public static final int STATUS_DENIED- See Also:
-
STATUS_INVALID
public static final int STATUS_INVALID- See Also:
-
STATUS_TRANSFORMED
public static final int STATUS_TRANSFORMED- See Also:
-
LOCAL
public static final int LOCAL- See Also:
-
GLOBAL
public static final int GLOBAL- See Also:
-
UNDEFINED
public static final int UNDEFINED- See Also:
-
-
Constructor Details
-
Request
public Request() -
Request
public Request(int operationID, String userFullname, String userCitizenCard, Resource operationData, LocalDateTime time, int scope)
-
-
Method Details
-
getDataAsString
Calls theResource.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 operationInvalidFormatException- if a deserialization error occurred
-
patch
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
Description copied from interface:ResourceGets the station resource identifier.- Specified by:
getResourceIDin interfaceResource- Returns:
- a string containing the resource identifier.
-
serialize
Description copied from interface:ResourceSerializes a resource into a string.- Specified by:
serializein interfaceResource- Returns:
- the string representing the serialization of the resource.
- Throws:
IOException- if an error occurred during serialization
-
deserialize
Description copied from interface:ResourceDeserializes the resource from a data string generated by theResource.serialize()method.- Specified by:
deserializein interfaceResource- Parameters:
data- the serialized data as a string- Throws:
IOException- if an error occurred during the serialization processClassNotFoundException- if its was not possible to load the class data, or the class data was not found
-
toString
-
getRequestID
public long getRequestID() -
setRequestID
public void setRequestID(long requestID) -
getOperationID
public int getOperationID() -
setOperationID
public void setOperationID(int operationID) -
getOperationName
-
setOperationName
-
getUserFullname
-
setUserFullname
-
getUserCitizenCard
-
setUserCitizenCard
-
getVerifierFullname
-
setVerifierFullname
-
getVerifierCitizenCard
-
setVerifierCitizenCard
-
getTime
-
setTime
-
getStatus
public int getStatus() -
setStatus
public void setStatus(int status) -
getReason
-
setReason
-
getData
-
setData
-
getScope
public int getScope() -
setScope
public void setScope(int scope) -
getUsername
-
setUsername
-