Class Key

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

public class Key extends Object implements Serializable, SharedResource
Represents the keys metadata, and provides references for its cryptographic value.

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

    • Key

      public Key()
  • Method Details

    • isKey

      public boolean isKey()
      Description copied from interface: SharedResource
      Checks if the resource is a Key.
      Specified by:
      isKey in interface SharedResource
      Returns:
      true if the resource is a key, false otherwise.
    • isMission

      public boolean isMission()
      Description copied from interface: SharedResource
      Checks if resource is a Mission.
      Specified by:
      isMission in interface SharedResource
      Returns:
      true if the resource is a mission, false otherwise
    • toString

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

      public void patch(Key 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
    • 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.
    • getKeyID

      public long getKeyID()
    • setKeyID

      public void setKeyID(long id)
    • setMissionID

      public void setMissionID(long missionID)
    • getMissionID

      public long getMissionID()
    • getCreationDate

      public LocalDateTime getCreationDate()
    • setCreationDate

      public void setCreationDate(LocalDateTime localDateTime)
    • getCryptoPeriod

      public int getCryptoPeriod()
    • setCryptoPeriod

      public void setCryptoPeriod(int cryptoPeriod)
    • getActivationDate

      public LocalDateTime getActivationDate()
    • setActivationDate

      public void setActivationDate(LocalDateTime activationDate)
    • getExpirationDate

      public LocalDateTime getExpirationDate()
    • setExpirationDate

      public void setExpirationDate(LocalDateTime expirationDate)
    • getState

      public int getState()
    • setState

      public void setState(int state)
    • getType

      public String getType()
    • setType

      public void setType(String type)
    • getAlgorithm

      public String getAlgorithm()
    • setAlgorithm

      public void setAlgorithm(String algorithm)
    • getSize

      public int getSize()
    • setSize

      public void setSize(int size)
    • setMissionName

      public void setMissionName(String name)
    • getMissionName

      public String getMissionName()
    • getValidity

      public long getValidity()
    • setValidity

      public void setValidity(long validity)
    • getDeActivationDate

      public LocalDateTime getDeActivationDate()
    • setDeActivationDate

      public void setDeActivationDate(LocalDateTime deActivationDate)
    • getReference

      public String getReference()
    • setReference

      public void setReference(String reference)
    • getFormat

      public String getFormat()
    • setFormat

      public void setFormat(String format)
    • getKeyUUID

      public String getKeyUUID()
    • setKeyUUID

      public void setKeyUUID(String uuid)
    • getMissionUUID

      public String getMissionUUID()
      Description copied from interface: SharedResource
      Gets the resource's assigned MissionUUID.
      Specified by:
      getMissionUUID in interface SharedResource
      Returns:
      the missionUUID of the mission the resource is assigned to
    • setMissionUUID

      public void setMissionUUID(String missionUUID)
    • getUsageTime

      public long getUsageTime()
    • setUsageTime

      public void setUsageTime(long usageTime)