net.sf.borg.model.entity
Class EncryptableEntity<T>

java.lang.Object
  extended by net.sf.borg.model.entity.KeyedEntity<T>
      extended by net.sf.borg.model.entity.EncryptableEntity<T>
Type Parameters:
T - the entity class
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Appointment, Memo

public abstract class EncryptableEntity<T>
extends KeyedEntity<T>

Abstract base class for entities that can have encrypted fields. It is up to the entity specific decrypt and encrypt methods to determine which fields are to be encrypted

See Also:
Serialized Form

Constructor Summary
EncryptableEntity()
           
 
Method Summary
 boolean canEqual(Object other)
           
abstract  void decrypt(String password)
          decrypt the entity.
abstract  void encrypt(String password)
          encrypt the entity.
 boolean equals(Object o)
           
 int hashCode()
           
 boolean isEncrypted()
           
 void setEncrypted(boolean encrypted)
           
 String toString()
           
 
Methods inherited from class net.sf.borg.model.entity.KeyedEntity
clone, copy, getKey, setKey
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EncryptableEntity

public EncryptableEntity()
Method Detail

decrypt

public abstract void decrypt(String password)
                      throws Exception
decrypt the entity. This will use the password to get the borg encryption key from the keystore and then will decrypt those fields in the entity that are encrypted. the entity encrypted flag will be set to false.

Parameters:
password - the keystore password
Throws:
Exception

encrypt

public abstract void encrypt(String password)
                      throws Exception
encrypt the entity. This will use the password to get the borg encryption key from the keystore and then will encrypt those fields in the entity that are encryptable. the entity encrypted flag will be set to true.

Parameters:
password - the keystore password
Throws:
Exception

isEncrypted

public boolean isEncrypted()

setEncrypted

public void setEncrypted(boolean encrypted)

toString

public String toString()
Overrides:
toString in class KeyedEntity<T>

equals

public boolean equals(Object o)
Overrides:
equals in class KeyedEntity<T>

canEqual

public boolean canEqual(Object other)
Overrides:
canEqual in class KeyedEntity<T>

hashCode

public int hashCode()
Overrides:
hashCode in class KeyedEntity<T>


Generated December 30 2011 by mbb using Apache Ant(TM) version 1.8.2 compiled on December 20 2010 and Java version 1.6.0_30 from Sun Microsystems Inc. on Linux i386 3.0.0-14-generic-pae