public final class DefaultJobOwner extends java.lang.Object implements JobOwner
Default implementation of JobOwner
.
In this implementation, a job owner has only an ID and a pseudo (which may be the same).
However, other informations may be added thanks to putUserData(String, String)
.
These additional data will also be saved with the ID and the pseudo/name of the user
by a backup manager.
Constructor and Description |
---|
DefaultJobOwner(java.lang.String name)
Builds a Job Owner which has the given ID.
|
DefaultJobOwner(java.lang.String id,
java.lang.String pseudo) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
By default: a
DefaultJobOwner is equal to any JobOwner only if their ID are equals. |
java.util.Set<java.lang.String> |
getAllUserData() |
java.util.Map<java.lang.String,java.lang.Object> |
getDataToSave()
Gets all user data to save (including ID and pseudo/name).
|
java.lang.String |
getID()
Unique ID of a user.
|
java.lang.String |
getPseudo()
Pseudo of a user.
|
java.lang.String |
getUserData(java.lang.String name) |
boolean |
hasExecutePermission(UWSJob job)
By default: ONLY owners of the given job have the EXECUTE permission.
|
int |
hashCode()
By default: this function returns the hashCode of the ID.
|
boolean |
hasReadPermission(JobList jl)
By default: ALL users have the READ permission for ALL jobs lists.
|
boolean |
hasReadPermission(UWSJob job)
By default: ONLY owners of the given job have the READ permission.
|
boolean |
hasWritePermission(JobList jl)
By default: ALL users have the WRITE permission for ALL jobs lists.
|
boolean |
hasWritePermission(UWSJob job)
By default: ONLY owners of the given job have the WRITE permission.
|
java.lang.String |
putUserData(java.lang.String name,
java.lang.String value) |
java.lang.String |
removeUserData(java.lang.String name) |
void |
restoreData(java.util.Map<java.lang.String,java.lang.Object> data)
Restores any additional user data from the given map.
|
void |
setPseudo(java.lang.String pseudo) |
java.lang.String |
toString()
By default: the user ID.
|
public DefaultJobOwner(java.lang.String name)
name
- ID/Pseudo of the Job Owner to create.public DefaultJobOwner(java.lang.String id, java.lang.String pseudo)
public final java.lang.String getID()
JobOwner
public final java.lang.String getPseudo()
JobOwner
public final void setPseudo(java.lang.String pseudo)
public boolean hasReadPermission(JobList jl)
hasReadPermission
in interface JobOwner
jl
- A jobs list.JobOwner.hasReadPermission(uws.job.JobList)
public boolean hasWritePermission(JobList jl)
hasWritePermission
in interface JobOwner
jl
- A jobs list.JobOwner.hasWritePermission(uws.job.JobList)
public boolean hasReadPermission(UWSJob job)
hasReadPermission
in interface JobOwner
job
- A job.JobOwner.hasReadPermission(uws.job.UWSJob)
public boolean hasWritePermission(UWSJob job)
hasWritePermission
in interface JobOwner
job
- A job.JobOwner.hasWritePermission(uws.job.UWSJob)
public boolean hasExecutePermission(UWSJob job)
hasExecutePermission
in interface JobOwner
job
- A job.JobOwner.hasExecutePermission(uws.job.UWSJob)
public java.lang.String putUserData(java.lang.String name, java.lang.String value)
public java.lang.String getUserData(java.lang.String name)
public java.lang.String removeUserData(java.lang.String name)
public java.util.Set<java.lang.String> getAllUserData()
public java.util.Map<java.lang.String,java.lang.Object> getDataToSave()
JobOwner
getDataToSave
in interface JobOwner
public void restoreData(java.util.Map<java.lang.String,java.lang.Object> data)
JobOwner
restoreData
in interface JobOwner
data
- A map with some key/value pairs, null or an empty map if no additional user data.public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean equals(java.lang.Object obj)
DefaultJobOwner
is equal to any JobOwner
only if their ID are equals.equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()