com.tenduke.objectmodel
Class Account

java.lang.Object
  extended by com.tenduke.types.AbstractBindableObject
      extended by com.tenduke.objectmodel.TendukeObject
          extended by com.tenduke.objectmodel.Account
All Implemented Interfaces:
RelationObject, SerializableObject, java.lang.Cloneable

public class Account
extends TendukeObject

Account is a technical model that represents a user and primary credentials / primary login details for that user. This object model class may describe both technical (non human) and human users.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.tenduke.objectmodel.TendukeObject
TendukeObject.CreatedDateComparator<T extends TendukeObject>, TendukeObject.ModifiedDateComparator<T extends TendukeObject>
 
Field Summary
static int FIELD_LENGTH_PRIMARY_EMAIL
          Constant for maximum length of Account primaryEmail field.
static int FIELD_LENGTH_PRIMARY_PASSWORD
          Constant for maximum length of Account primaryPassword password hash field.
static int FIELD_LENGTH_PRIMARY_PASSWORD_PLAIN
          Constant for maximum length of Account primaryPassword plain-text password field.
static int FIELD_LENGTH_PRIMARY_PRINCIPAL
          Constant for maximum length of Account primaryPrincipal field.
static int FIELD_LENGTH_TEMPORARY_CREDENTIALS
          Constant for maximum length of Account temporaryCredentials field.
static int FIELD_LENGTH_VALIDATED_EMAIL
          Constant for maximum length of Account validatedEmail field.
static java.lang.String FIELD_NAME_ACCOUNT_ID
          Name that identifies Account accountId field.
static java.lang.String FIELD_NAME_ACTIVATED
          Name that identifies Account activated field.
static java.lang.String FIELD_NAME_OLD_PASSWORD_PLAIN
          Name that identifies Account oldPasswordPlain plain-text old password field.
static java.lang.String FIELD_NAME_PRIMARY_EMAIL
          Name that identifies Account primaryEmail field.
static java.lang.String FIELD_NAME_PRIMARY_PASSWORD_HASH
          Name that identifies Account primaryPassword password hash field.
static java.lang.String FIELD_NAME_PRIMARY_PASSWORD_PLAIN
          Name that identifies Account primaryPasswordPlain plain-text password field.
static java.lang.String FIELD_NAME_PRIMARY_PRINCIPAL
          Name that identifies Account primaryPrincipal field.
static java.lang.String FIELD_NAME_TEMPORARY_CREDENTIALS
          Name that identifies Account temporaryCredentials field (e.g.
static java.lang.String FIELD_NAME_TEMPORARY_CREDENTIALS_VALID_UNTIL
          Name that identifies Account fieldNameForTemporaryCredentialsValidUntil field, use case: serialization.
static java.lang.String FIELD_NAME_VALIDATED_EMAIL
          Name that identifies Account validatedEmail field.
 
Fields inherited from class com.tenduke.objectmodel.TendukeObject
FIELD_NAME_CREATED, FIELD_NAME_CREATED_BY_PROFILE, FIELD_NAME_MODIFIED, FIELD_NAME_MODIFIED_BY_PROFILE, FIELD_NAME_OBJECT_CATEGORY, FIELD_NAME_OBJECT_CATEGORY_ID, FIELD_NAME_OBJECT_CONSUMPTION, FIELD_NAME_OBJECT_FEATURES, FIELD_NAME_OBJECT_PROPERTIES, RELATED_FIELD_COPY_STYLE_DEEP, RELATED_FIELD_COPY_STYLE_NONE, RELATED_FIELD_COPY_STYLE_SHALLOW
 
Fields inherited from class com.tenduke.types.AbstractBindableObject
FIELD_LENGTH_SHORT_ID, FIELD_NAME_OBJECT_STATE_CHANGE, FIELD_NAME_REPLACES_OBJECT, FIELD_NAME_SHORT_ID, PERMISSION_ACTION_CREATE, PERMISSION_ACTION_DELETE, PERMISSION_ACTION_MODIFY, PERMISSION_ACTION_READ
 
Constructor Summary
Account()
          Creates a new instance of Account with null accountId.
Account(java.util.UUID accountId)
          Creates a new instance of Account with caller specified accountId.
 
Method Summary
 java.lang.Object clone()
          Clone Account.
 int compareTo(Account otherAccount)
          Compare this Account to an other (compares Account's accountId to other Account's accountIs).
 void copyThis(Account result)
          Copy this Account's data into given result Account.
 void fromAccount(Account account)
          Copies the specified accounts field values into this.
 java.nio.ByteBuffer generateKey()
           Utility that generates a ByteBuffer key for Account.
 java.util.UUID getAccountId()
          Gets unique id for Account.
 java.util.Date getActivated()
          Gets timestamp when this account has been activated.
 java.util.UUID getId()
          Gets the unique identifier of Account.
 java.lang.String getOldPasswordPlain()
          Gets old password as plain text.
 java.lang.String getPrimaryEmail()
          Gets primary email for Account.
 java.lang.String getPrimaryPasswordHash()
          Gets primary password hash.
 java.lang.String getPrimaryPasswordPlain()
          Gets primary password as plain text.
 java.lang.String getPrimaryPrincipal()
          Gets primary principal name used to authenticate Account.
 java.lang.String getTemporaryCredentials()
          Gets temporary credentials, e.g.
 java.util.Date getTemporaryCredentialsValidUntil()
          Gets timestamp until which current temporary credentials for this account are valid.
 java.lang.String getValidatedEmail()
          Gets email address that has been validated for this account.
 boolean isPrimaryEmailValidated()
          Checks if primaryEmail of the Account is validated, i.e.
 void merge(Account object2)
           Merge this instances members with argument's (object2) members.
 void setAccountId(java.lang.String accountId)
          Sets unique id for Account.
 void setAccountId(java.util.UUID accountId)
          Sets unique id for Account.
 void setActivated(java.util.Date activated)
          Sets timestamp when this account has been activated.
 void setId(java.util.UUID id)
          Sets the unique identifier of Account.
 void setOldPasswordPlain(java.lang.String oldPasswordPlain)
          Sets primary password as plain text.
 void setPrimaryEmail(java.lang.String primaryEmail)
          Sets primary email for Account.
 void setPrimaryEmail(java.lang.String primaryEmail, boolean toLower)
          Sets primary email for Account.
 void setPrimaryPasswordHash(java.lang.String primaryPassword)
          Sets primary password hash.
 void setPrimaryPasswordPlain(java.lang.String primaryPasswordPlain)
          Sets primary password as plain text.
 void setPrimaryPrincipal(java.lang.String primaryPrincipal)
          Sets primary principal name used to authenticate Account.
 void setTemporaryCredentials(java.lang.String temporaryCredentials)
          Sets temporary credentials, e.g.
 void setTemporaryCredentialsValidUntil(java.util.Date temporaryCredentialsValidUntil)
          Sets timestamp until which current temporary credentials for this account are valid.
 void setValidatedEmail(java.lang.String validatedEmail)
          Sets email address that has been validated for this account.
 
Methods inherited from class com.tenduke.objectmodel.TendukeObject
addFeature, addObjectConsumption, addObjectProperty, addProperty, addRelatedObjectDefault, addRelatedObjectDefault, addRelatedObjectsDefault, addRelatedObjectsDefault, clone, copyThis, copyThis, equals, fieldValueToString, findProperty, findProperty, getChangedSerializableFieldValues, getCreated, getCreatedBy, getCreatedByRecursive, getCreatingActor, getModified, getModifiedBy, getModifiedByRecursive, getModifyingActor, getObjectCategory, getObjectCategoryId, getObjectConsumption, getObjectContractName, getObjectContractName, getObjectFeature, getObjectFeatures, getObjectProperties, getObjectProperty, getObjectPropertyValue, getRelatedObjectsDefault, getRelatedObjectsDefault, hashCode, idFromString, merge, objectFeaturesToMap, objectPropertiesToMap, orderByCreatedDate, orderByModifiedDate, setCreated, setCreatedBy, setCreatedByRecursive, setCreatedByRecursive, setCreatingActor, setModified, setModifiedBy, setModifiedBy, setModifiedByRecursive, setModifiedByRecursive, setModifiedByRecursive, setModifyingActor, setObjectCategory, setObjectCategoryId, setObjectConsumption, setObjectFeatures, setObjectProperties, setRelatedObjectsDefault, setRelatedObjectsDefault, toString
 
Methods inherited from class com.tenduke.types.AbstractBindableObject
addRelatedObject, addRelatedObject, addRelatedObject, addRelatedObject, addRelatedObjects, addRelatedObjects, addRelatedObjects, copyThis, getFirstObjectById, getGrantedObjectPermissionActions, getParent, getParentBindableType, getParentBindableTypeChain, getParentId, getParentNode, getParentType, getRelatedObjectList, getRelatedObjectList, getRelatedObjectLists, getRelatedObjectLists, getRelatedObjects, getRelatedObjects, getRelatedObjects, getRelatedObjects, getRelatedObjects, getRelatedObjects, getRelationAttributeObject, getRelationField, getRelationHandler, getRelationType, getReplaces, getShortId, getStateChange, hasRelatedObjects, hasRelatedObjects, resolveParentBindableType, resolveParentBindableTypeByTreeParent, setGrantedObjectPermissionActions, setParent, setParent, setParentBindableType, setParentNode, setRelatedObjectList, setRelatedObjects, setRelatedObjects, setRelatedObjects, setRelatedObjects, setRelatedObjects, setRelatedObjects, setRelationAttributeObject, setRelationHandler, setReplaces, setShortId, setStateChange
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

FIELD_LENGTH_PRIMARY_EMAIL

public static final int FIELD_LENGTH_PRIMARY_EMAIL
Constant for maximum length of Account primaryEmail field.

See Also:
Constant Field Values

FIELD_LENGTH_PRIMARY_PASSWORD

public static final int FIELD_LENGTH_PRIMARY_PASSWORD
Constant for maximum length of Account primaryPassword password hash field.

See Also:
Constant Field Values

FIELD_LENGTH_PRIMARY_PASSWORD_PLAIN

public static final int FIELD_LENGTH_PRIMARY_PASSWORD_PLAIN
Constant for maximum length of Account primaryPassword plain-text password field.

See Also:
Constant Field Values

FIELD_LENGTH_PRIMARY_PRINCIPAL

public static final int FIELD_LENGTH_PRIMARY_PRINCIPAL
Constant for maximum length of Account primaryPrincipal field.

See Also:
Constant Field Values

FIELD_LENGTH_TEMPORARY_CREDENTIALS

public static final int FIELD_LENGTH_TEMPORARY_CREDENTIALS
Constant for maximum length of Account temporaryCredentials field.

See Also:
Constant Field Values

FIELD_LENGTH_VALIDATED_EMAIL

public static final int FIELD_LENGTH_VALIDATED_EMAIL
Constant for maximum length of Account validatedEmail field.

See Also:
Constant Field Values

FIELD_NAME_ACCOUNT_ID

public static final java.lang.String FIELD_NAME_ACCOUNT_ID
Name that identifies Account accountId field.

See Also:
Constant Field Values

FIELD_NAME_ACTIVATED

public static final java.lang.String FIELD_NAME_ACTIVATED
Name that identifies Account activated field.

See Also:
Constant Field Values

FIELD_NAME_OLD_PASSWORD_PLAIN

public static final java.lang.String FIELD_NAME_OLD_PASSWORD_PLAIN
Name that identifies Account oldPasswordPlain plain-text old password field.

See Also:
Constant Field Values

FIELD_NAME_PRIMARY_EMAIL

public static final java.lang.String FIELD_NAME_PRIMARY_EMAIL
Name that identifies Account primaryEmail field.

See Also:
Constant Field Values

FIELD_NAME_PRIMARY_PASSWORD_HASH

public static final java.lang.String FIELD_NAME_PRIMARY_PASSWORD_HASH
Name that identifies Account primaryPassword password hash field.

See Also:
Constant Field Values

FIELD_NAME_PRIMARY_PASSWORD_PLAIN

public static final java.lang.String FIELD_NAME_PRIMARY_PASSWORD_PLAIN
Name that identifies Account primaryPasswordPlain plain-text password field.

See Also:
Constant Field Values

FIELD_NAME_PRIMARY_PRINCIPAL

public static final java.lang.String FIELD_NAME_PRIMARY_PRINCIPAL
Name that identifies Account primaryPrincipal field.

See Also:
Constant Field Values

FIELD_NAME_TEMPORARY_CREDENTIALS

public static final java.lang.String FIELD_NAME_TEMPORARY_CREDENTIALS
Name that identifies Account temporaryCredentials field (e.g. one-time password.).

See Also:
Constant Field Values

FIELD_NAME_TEMPORARY_CREDENTIALS_VALID_UNTIL

public static final java.lang.String FIELD_NAME_TEMPORARY_CREDENTIALS_VALID_UNTIL
Name that identifies Account fieldNameForTemporaryCredentialsValidUntil field, use case: serialization.

See Also:
Constant Field Values

FIELD_NAME_VALIDATED_EMAIL

public static final java.lang.String FIELD_NAME_VALIDATED_EMAIL
Name that identifies Account validatedEmail field.

See Also:
Constant Field Values
Constructor Detail

Account

public Account()
Creates a new instance of Account with null accountId.


Account

public Account(java.util.UUID accountId)
Creates a new instance of Account with caller specified accountId.

Parameters:
accountId - The unique id for Account.
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone Account.

Overrides:
clone in class TendukeObject
Returns:
Cloned Account.
Throws:
java.lang.CloneNotSupportedException - Required by signature, exception no explicitly thrown.

compareTo

public int compareTo(Account otherAccount)
Compare this Account to an other (compares Account's accountId to other Account's accountIs).

Parameters:
otherAccount - The other Account to compare to.
Returns:
UUID compare to result.

copyThis

public void copyThis(Account result)
Copy this Account's data into given result Account.

Parameters:
result - An Account instance that will receive data from this.

fromAccount

public void fromAccount(Account account)
Copies the specified accounts field values into this.

Parameters:
account - The account to use as data source.
Throws:
java.lang.CloneNotSupportedException

generateKey

public java.nio.ByteBuffer generateKey()

Utility that generates a ByteBuffer key for Account.

Implementation converts accountId into a String and uses String to byte conversion with UTF-8 character encoding. The result bytes are wrapped by the returned ByteBuffer.

Returns:
ByteBuffer that wraps accountId as String bytes.

getAccountId

public java.util.UUID getAccountId()
Gets unique id for Account.

Returns:
Unique id of Account.

getActivated

public java.util.Date getActivated()
Gets timestamp when this account has been activated.

Returns:
Timestamp when this account has been activated, or null if account has not been activated.

getId

public java.util.UUID getId()
Gets the unique identifier of Account. Implementation of AbstractBindableObject.getId().

Specified by:
getId in interface SerializableObject
Specified by:
getId in class AbstractBindableObject
Returns:
unique id of Account.

getOldPasswordPlain

public java.lang.String getOldPasswordPlain()
Gets old password as plain text. Transient, plain text passwords are not written in database or serialized.

Returns:
the _oldPasswordPlain

getPrimaryEmail

public java.lang.String getPrimaryEmail()
Gets primary email for Account.

Returns:
Primary email of Account.

getPrimaryPasswordHash

public java.lang.String getPrimaryPasswordHash()
Gets primary password hash.

Returns:
Primary password hash.

getPrimaryPasswordPlain

public java.lang.String getPrimaryPasswordPlain()
Gets primary password as plain text. Transient, plain text passwords are not written in database or serialized.

Returns:
Plain text password.

getPrimaryPrincipal

public java.lang.String getPrimaryPrincipal()
Gets primary principal name used to authenticate Account.

Returns:
Primary principal name used to authenticate Account.

getTemporaryCredentials

public java.lang.String getTemporaryCredentials()
Gets temporary credentials, e.g. one-time password, set for this account.

Returns:
the temporary credentials set for this account

getTemporaryCredentialsValidUntil

public java.util.Date getTemporaryCredentialsValidUntil()
Gets timestamp until which current temporary credentials for this account are valid.

Returns:
Timestamp until which current temporary credentials for this account are valid

getValidatedEmail

public java.lang.String getValidatedEmail()
Gets email address that has been validated for this account.

Returns:
Email address validated for this account, or null if no email address has been validated.

isPrimaryEmailValidated

public boolean isPrimaryEmailValidated()
Checks if primaryEmail of the Account is validated, i.e. if getPrimaryEmail() and getValidatedEmail() have been set and are equal.

Returns:
True if primaryEmail is validated.

merge

public void merge(Account object2)

Merge this instances members with argument's (object2) members.

The strategy for merging is: if (this.aField == null && object2.aField != null) then set field value from object2 into this instance.

Parameters:
object2 - The other account to merge into this

setAccountId

public void setAccountId(java.lang.String accountId)
Sets unique id for Account. Note: String to UUID conversion in method body does not trap errors.

Parameters:
accountId - Unique id to set for Account.

setAccountId

public void setAccountId(java.util.UUID accountId)
Sets unique id for Account.

Parameters:
accountId - Unique id to set for Account.

setActivated

public void setActivated(java.util.Date activated)
Sets timestamp when this account has been activated.

Parameters:
activated - Timestamp when this account has been activated, or null if account not activated.

setId

public void setId(java.util.UUID id)
Sets the unique identifier of Account. Implementation of AbstractBindableObject.setId(UUID).

Specified by:
setId in interface SerializableObject
Specified by:
setId in class AbstractBindableObject
Parameters:
id - unique id to set for Account.

setOldPasswordPlain

public void setOldPasswordPlain(java.lang.String oldPasswordPlain)
Sets primary password as plain text. Transient, plain text passwords are not written in database or serialized.

Parameters:
oldPasswordPlain - the _oldPasswordPlain to set

setPrimaryEmail

public void setPrimaryEmail(java.lang.String primaryEmail)
Sets primary email for Account. This method overload converts the email to lower case.

Parameters:
primaryEmail - The email to set as primary email for Account.

setPrimaryEmail

public void setPrimaryEmail(java.lang.String primaryEmail,
                            boolean toLower)
Sets primary email for Account. Makes to lower case conversion for the email if toLower is true, otherwise the value is set as such.

Parameters:
primaryEmail - The email to set as primary email for Account.
toLower - true or false depending on if caller wants to make lower case conversion for defined primaryEmail.

setPrimaryPasswordHash

public void setPrimaryPasswordHash(java.lang.String primaryPassword)
Sets primary password hash.

Parameters:
primaryPassword - Primary password hash.

setPrimaryPasswordPlain

public void setPrimaryPasswordPlain(java.lang.String primaryPasswordPlain)
Sets primary password as plain text. Transient, plain text passwords are not written in database or serialized.

Parameters:
primaryPasswordPlain - Plain text password.

setPrimaryPrincipal

public void setPrimaryPrincipal(java.lang.String primaryPrincipal)
Sets primary principal name used to authenticate Account.

Parameters:
primaryPrincipal - Primary principal name to set for authenticating Account.

setTemporaryCredentials

public void setTemporaryCredentials(java.lang.String temporaryCredentials)
Sets temporary credentials, e.g. one-time password, for this account.

Parameters:
temporaryCredentials - the temporary credentials set for this account

setTemporaryCredentialsValidUntil

public void setTemporaryCredentialsValidUntil(java.util.Date temporaryCredentialsValidUntil)
Sets timestamp until which current temporary credentials for this account are valid.

Parameters:
temporaryCredentialsValidUntil - Timestamp until which current temporary credentials for this account are valid

setValidatedEmail

public void setValidatedEmail(java.lang.String validatedEmail)
Sets email address that has been validated for this account.

Parameters:
validatedEmail - Email address validated for this account, or null if no email address has been validated.