com.irisel.sv.faces.mgdbeans
Class UserMB

java.lang.Object
  extended by com.irisel.sv.faces.mgdbeans.BaseMB
      extended by com.irisel.sv.faces.mgdbeans.UserMB

public class UserMB
extends BaseMB


Field Summary
static java.lang.String CLASSNAME
           
static java.text.DateFormat DATE_FORMAT
           
static java.lang.String S_DATE_FORMAT
           
 
Constructor Summary
UserMB(CLBrowser clbrowser)
           
UserMB(CLBrowser clbrowser, JSONObject obj)
           
UserMB(CLBrowser clbrowser, long oid)
           
UserMB(CLBrowser clbrowser, java.lang.Long oid)
           
UserMB(CLBrowser clbrowser, java.lang.String username)
           
 
Method Summary
static long countAccountsByEmail(CLGuiomBrowser clbrowser, java.lang.String email)
           
 void delete(boolean soft)
          Deletes this instance from the database
static java.lang.String encryptPassword(java.lang.String cleartext)
           
static UserMB[] findByEmail(CLGuiomBrowser clbrowser, java.lang.String email)
           
 java.lang.String getEmail()
           
 java.lang.String getFirstName()
           
 long getId()
           
 java.lang.String getLang()
           
 java.lang.String getLastName()
           
 java.lang.String getName()
           
 void load(JSONObject obj)
          Loads from the given JSON to this object for the class given by getClassname(), each property is read and copied from the json obj.
 void load(long oid)
          Loads the instance from database into this object, uses the classname associated to the object which is implemented by the abstract getClassname().
 void save()
          Saves this object to database.
 void setInstance(Instance instance)
           
 void setPassword(java.lang.String clearpasswd)
           
 
Methods inherited from class com.irisel.sv.faces.mgdbeans.BaseMB
get, getInstance, load, logout, main, set
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

S_DATE_FORMAT

public static java.lang.String S_DATE_FORMAT

DATE_FORMAT

public static java.text.DateFormat DATE_FORMAT

CLASSNAME

public static final java.lang.String CLASSNAME
See Also:
Constant Field Values
Constructor Detail

UserMB

public UserMB(CLBrowser clbrowser)
       throws java.lang.Exception
Throws:
java.lang.Exception

UserMB

public UserMB(CLBrowser clbrowser,
              long oid)
       throws java.lang.Exception
Throws:
java.lang.Exception

UserMB

public UserMB(CLBrowser clbrowser,
              java.lang.Long oid)
       throws java.lang.Exception
Throws:
java.lang.Exception

UserMB

public UserMB(CLBrowser clbrowser,
              java.lang.String username)
       throws java.lang.Exception
Throws:
java.lang.Exception

UserMB

public UserMB(CLBrowser clbrowser,
              JSONObject obj)
       throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

getName

public java.lang.String getName()
Overrides:
getName in class BaseMB
Returns:
the "name" value of this object's instance.

getFirstName

public java.lang.String getFirstName()

getLastName

public java.lang.String getLastName()

encryptPassword

public static java.lang.String encryptPassword(java.lang.String cleartext)

save

public void save()
          throws QuerySaveException,
                 java.rmi.RemoteException,
                 java.sql.SQLException,
                 DataException
Description copied from class: BaseMB
Saves this object to database. Calls clbrowser.setAutomaticFields first. If getId() is 0, calls clbrowser.create(), otherwise clbrowser.update()

Overrides:
save in class BaseMB
Throws:
QuerySaveException
java.rmi.RemoteException
java.sql.SQLException
DataException

getId

public long getId()
Overrides:
getId in class BaseMB
Returns:
the id of this object's instance.

load

public void load(long oid)
          throws java.rmi.RemoteException,
                 java.sql.SQLException,
                 org.jboss.resteasy.spi.NoLogWebApplicationException,
                 DataException
Description copied from class: BaseMB
Loads the instance from database into this object, uses the classname associated to the object which is implemented by the abstract getClassname().

Overrides:
load in class BaseMB
Parameters:
oid - is the primary key of the instance
Throws:
java.rmi.RemoteException
java.sql.SQLException
DataException
org.jboss.resteasy.spi.NoLogWebApplicationException

setInstance

public void setInstance(Instance instance)
Overrides:
setInstance in class BaseMB

load

public void load(JSONObject obj)
Description copied from class: BaseMB
Loads from the given JSON to this object for the class given by getClassname(), each property is read and copied from the json obj.

Overrides:
load in class BaseMB
Parameters:
obj - is the JSON representation of the object

delete

public void delete(boolean soft)
            throws java.rmi.RemoteException,
                   java.sql.SQLException,
                   DataException
Description copied from class: BaseMB
Deletes this instance from the database

Overrides:
delete in class BaseMB
Parameters:
soft - will flag the record as deleted, without actually deleting it
Throws:
java.rmi.RemoteException
java.sql.SQLException
DataException

setPassword

public void setPassword(java.lang.String clearpasswd)

findByEmail

public static UserMB[] findByEmail(CLGuiomBrowser clbrowser,
                                   java.lang.String email)
                            throws java.lang.Exception
Throws:
java.lang.Exception

countAccountsByEmail

public static long countAccountsByEmail(CLGuiomBrowser clbrowser,
                                        java.lang.String email)
                                 throws java.lang.Exception
Throws:
java.lang.Exception

getEmail

public java.lang.String getEmail()

getLang

public java.lang.String getLang()