Class Role

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

public class Role extends Object implements Serializable, Resource
Represents a container for a set of permissions. Used to enforce authorization for operations.

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

    • Role

      public Role()
  • Method Details

    • toString

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

      public void patch(Role 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
    • getColor

      public String getColor()
    • setColor

      public void setColor(String color)
    • getRoleID

      public long getRoleID()
    • setRoleID

      public void setRoleID(long roleID)
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getDescription

      public String getDescription()
    • setDescription

      public void setDescription(String description)
    • getPermissions

      public List<Operation> getPermissions()
    • setPermissions

      public void setPermissions(List<Operation> permissions)