|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.silverpeas.token.persistent.PersistentResourceToken
@Entity @TokenGenerator(value=PersistentResourceTokenGenerator.class) public class PersistentResourceToken
A persistent token used to identify uniquely a resource. This token has the particularity to be persisted in a data source and to refer the resource it identifies uniquely both by the resource identifier and by the resource type.
| Field Summary | |
|---|---|
static PersistentResourceToken |
NoneToken
Represents none token to replace in more typing way the null keyword. |
| Constructor Summary | |
|---|---|
protected |
PersistentResourceToken()
|
protected |
PersistentResourceToken(EntityReference resource,
String value)
Constructs a new persistent token for the specified resource and with the specified value. |
| Method Summary | ||
|---|---|---|
static PersistentResourceToken |
createToken(EntityReference resource)
Creates a token for the specified resource. |
|
boolean |
exists()
Indicates if the token is well registred |
|
Long |
getId()
|
|
static PersistentResourceToken |
getOrCreateToken(EntityReference resource)
Gets a token for the specified resource and creates it if it doesn't exist. |
|
|
getResource(Class<R> referenceClass)
Gets a reference to the resource this token is for. |
|
int |
getSaveCount()
|
|
Date |
getSaveDate()
|
|
static PersistentResourceToken |
getToken(String token)
Gets a the token from the specified value. |
|
String |
getValue()
Gets the String representation of this token. |
|
boolean |
isDefined()
Is this token defined? |
|
boolean |
notExists()
Indicates if the token isn't registered. |
|
void |
setId(Long id)
|
|
void |
setResource(EntityReference resource)
Sets the resource to which this token belongs. |
|
void |
setSaveCount(int saveCount)
|
|
void |
setSaveDate(Date saveDate)
|
|
void |
setValue(String value)
|
|
String |
toString()
|
|
void |
validate()
Validates data |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final PersistentResourceToken NoneToken
| Constructor Detail |
|---|
protected PersistentResourceToken()
protected PersistentResourceToken(EntityReference resource,
String value)
resource - a reference to the resource for which this token is constructed.value - the token value.| Method Detail |
|---|
public static PersistentResourceToken createToken(EntityReference resource)
throws TokenException
resource - the resource for which the token has to be generated.
TokenException
public static PersistentResourceToken getOrCreateToken(EntityReference resource)
throws TokenException
resource - the resource for which the token has to be generated.
TokenExceptionpublic static PersistentResourceToken getToken(String token)
NoneToken is returned.
token - the value of the token to get.
public boolean exists()
public boolean notExists()
public void validate()
throws TokenValidationException
TokenValidationExceptionpublic Long getId()
public void setId(Long id)
id - the id to setpublic <E,R extends EntityReference<E>> R getResource(Class<R> referenceClass)
E - the concrete type of the entity.R - the concrete type of the reference to the entity.referenceClass - the expected concrete class of the EntityReference. This
class must be conform to the type of the resource.
public void setResource(EntityReference resource)
resource - an identifier of the resource for which this token is.public String getValue()
Token
getValue in interface Tokenpublic void setValue(String value)
value - the value to setpublic int getSaveCount()
public void setSaveCount(int saveCount)
saveCount - the saveCount to setpublic Date getSaveDate()
public void setSaveDate(Date saveDate)
saveDate - the saveDate to setpublic String toString()
toString in class Objectpublic boolean isDefined()
Token
isDefined in interface Token
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||