Compiere 3.1

org.compiere.model
Class MUser

java.lang.Object
  extended by org.compiere.framework.PO
      extended by org.compiere.model.X_AD_User
          extended by org.compiere.model.MUser
All Implemented Interfaces:
Serializable, Cloneable, Comparator<PO>, Evaluatee

public class MUser
extends X_AD_User

User Model

Version:
$Id: MUser.java,v 1.3 2006/07/30 00:58:18 jjanke Exp $
Author:
Jorg Janke
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.compiere.model.X_AD_User
accessLevel, AD_ORGTRX_ID_AD_Reference_ID, AD_TREE_MENUFAVORITE_ID_AD_Reference_ID, AD_TREE_MENUNEW_ID_AD_Reference_ID, CONNECTIONPROFILE_AD_Reference_ID, CONNECTIONPROFILE_LAN, CONNECTIONPROFILE_TerminalServer, CONNECTIONPROFILE_VPN, CONNECTIONPROFILE_WAN, Model, NOTIFICATIONTYPE_AD_Reference_ID, NOTIFICATIONTYPE_EMail, NOTIFICATIONTYPE_EMailPlusNotice, NOTIFICATIONTYPE_None, NOTIFICATIONTYPE_Notice, SALESREP_ID_AD_Reference_ID, SUPERVISOR_ID_AD_Reference_ID, Table_ID, Table_Name, updatedMS
 
Fields inherited from class org.compiere.framework.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, log, p_changeVO, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
 
Constructor Summary
MUser(Ctx ctx, int AD_User_ID, String trxName)
          Default Constructor
MUser(Ctx ctx, ResultSet rs, String trxName)
          Load Constructor
MUser(X_C_BPartner partner)
          Parent Constructor
 
Method Summary
 void addDescription(String description)
          Add to Description
 boolean addUserMenuFavorite(int AD_Menu_ID, int sequenceNo)
          Add menu item to user's Favorite list.
 boolean addUserMenuNewFavorite(int AD_Menu_ID, int sequenceNo)
          Add menu item to user's Favorite "new" list (Saves Tree if necessary)
protected  boolean beforeSave(boolean newRecord)
          Before Save
static MUser get(Ctx ctx)
          Get Current User (cached)
static MUser get(Ctx ctx, int AD_User_ID)
          Get User (cached) Also loads Admninistrator (0)
static MUser get(Ctx ctx, String email, String trxName)
          Get User from email
static MUser get(Ctx ctx, String name, String password, String trxName)
          Get active User with name/pwd
static int getAD_User_ID(String email, int AD_Client_ID)
          Get AD_User_ID
 X_AD_UserBPAccess[] getBPAccess(boolean requery)
          Get active BP Access records
static String getEmailOfUser(int AD_User_ID, int AD_Client_ID)
          Get Email of AD_User
 String getEMailVerifyCode()
          Get EMail Validation Code
 String getFirstName()
          Get First Name
 InternetAddress getInternetAddress()
          Convert EMail
 String getLastName()
          Get Last Name
static String getNameOfUser(int AD_User_ID)
          Get Name of AD_User
static MUser[] getOfBPartner(Ctx ctx, int C_BPartner_ID)
          Get active Users of BPartner
 MUserPreference getPreference()
          Get User Preference
 MRole[] getRoles(int AD_Org_ID)
          Get User Roles for Org
 MTree getUserFavoriteTree()
          Gets the user's tree for favorites
 MTree getUserNewFavoriteTree()
          Gets the user's tree for create list favorites
 String getValue()
          Get Value - 7 bit lower case alpha numerics max length 8
static MUser[] getWithRole(MRole role)
          Get Users with Role
 boolean hasBPAccess(String BPAccessType, Object[] params)
          Has the user Access to BP info and resources
 boolean hasRole()
          Has the user a role?
 boolean isAdministrator()
          Is User an Administrator?
 boolean isCanSendEMail()
          Could we send an email
 boolean isEMailValid()
          Is the email valid
 boolean isEMailVerified()
          Is EMail Verified by response
 boolean isNotificationEMail()
          Get Notification via EMail
 boolean isNotificationNote()
          Get Notification via Note
 boolean isOnline()
          Is it an Online Access User
static boolean isSalesRep(int AD_User_ID)
          User is SalesRep
 boolean isSystemAdministrator()
          Is User a System Administrator?
static void main(String[] args)
          Test
 void setEMail(String EMail)
          Set EMail - reset validation
 boolean setEMailVerifyCode(String code, String info)
          Check & Set EMail Validation Code.
 void setValue(String Value)
          Set Value - 7 bit lower case alpha numerics max length 8
 String toString()
          String Representation
 
Methods inherited from class org.compiere.model.X_AD_User
get_AccessLevel, getAD_OrgTrx_ID, getAD_Tree_MenuFavorite_ID, getAD_Tree_MenuNew_ID, getAD_User_ID, getBirthday, getBouncedInfo, getC_BPartner_ID, getC_BPartner_Location_ID, getC_Greeting_ID, getC_Job_ID, getComments, getConnectionProfile, getDescription, getEMail, getEMailUser, getEMailUserPW, getEMailVerify, getEMailVerifyDate, getFax, getKeyNamePair, getLastContact, getLastRegistrationReminder, getLastResult, getLDAPUser, getName, getNotificationType, getPassword, getPhone, getPhone2, getSalesRep_ID, getSupervisor_ID, getTitle, initPO, isConnectionProfileValid, isEMailBounced, isFullBPAccess, isNotificationTypeValid, isProcessing, setAD_OrgTrx_ID, setAD_Tree_MenuFavorite_ID, setAD_Tree_MenuNew_ID, setAD_User_ID, setBirthday, setBouncedInfo, setC_BPartner_ID, setC_BPartner_Location_ID, setC_Greeting_ID, setC_Job_ID, setComments, setConnectionProfile, setDescription, setEMailUser, setEMailUserPW, setEMailVerify, setEMailVerifyDate, setFax, setIsEMailBounced, setIsFullBPAccess, setLastContact, setLastRegistrationReminder, setLastResult, setLDAPUser, setName, setNotificationType, setPassword, setPhone, setPhone2, setProcessing, setSalesRep_ID, setSupervisor_ID, setTitle
 
Methods inherited from class org.compiere.framework.PO
addAttachment, addAttachment, addError, afterDelete, afterSave, beforeDelete, compare, convertToBigDecimal, convertToBoolean, convertToInt, convertToTimestamp, copy, copyValues, copyValues, createAttachment, delete_Accounting, delete, delete, dump, dump, equals, get_ChangeVO, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_EntityType, get_HashMap, get_ID, get_IDOld, get_Info, get_KeyColumns, get_Logger, get_Table_ID, get_Table_ID, get_TableName, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_ValuesAsString, get_WhereClause, get_xmlDocument, get_xmlString, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getVO, hashCode, insert_Accounting, is_Changed, is_KeyColumn, is_new, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, load, load, load, load, loadComplete, loadDefaults, loadSpecial, lock, save, save, saveNew_getID, saveNewInsertSQL, saveNewSpecial, saveUpdate, set_ChangeVO, set_ColumnUpdateable, set_CustomColumn, set_TrxName, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueString, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setContext, setCtx, setDocWorkflowMgr, setIsActive, setStandardDefaults, setUpdateable, setUpdatedBy, toStringX, unlock, update
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MUser

public MUser(Ctx ctx,
             int AD_User_ID,
             String trxName)
Default Constructor

Parameters:
ctx - context
AD_User_ID - id
trxName - transaction

MUser

public MUser(X_C_BPartner partner)
Parent Constructor

Parameters:
partner - partner

MUser

public MUser(Ctx ctx,
             ResultSet rs,
             String trxName)
Load Constructor

Parameters:
ctx - context
rs - current row of result set to be loaded
trxName - transaction
Method Detail

getOfBPartner

public static MUser[] getOfBPartner(Ctx ctx,
                                    int C_BPartner_ID)
Get active Users of BPartner

Parameters:
ctx - context
C_BPartner_ID - id
Returns:
array of users

getWithRole

public static MUser[] getWithRole(MRole role)
Get Users with Role

Parameters:
role - role
Returns:
array of users

get

public static MUser get(Ctx ctx,
                        int AD_User_ID)
Get User (cached) Also loads Admninistrator (0)

Parameters:
ctx - context
AD_User_ID - id
Returns:
user

get

public static MUser get(Ctx ctx)
Get Current User (cached)

Parameters:
ctx - context
Returns:
user

get

public static MUser get(Ctx ctx,
                        String name,
                        String password,
                        String trxName)
Get active User with name/pwd

Parameters:
ctx - context
name - name
password - password
Returns:
user or null

get

public static MUser get(Ctx ctx,
                        String email,
                        String trxName)
Get User from email

Parameters:
ctx - context
email - email
Returns:
user or null

getNameOfUser

public static String getNameOfUser(int AD_User_ID)
Get Name of AD_User

Parameters:
AD_User_ID - System User
Returns:
Name of user or ?

isSalesRep

public static boolean isSalesRep(int AD_User_ID)
User is SalesRep

Parameters:
AD_User_ID - user
Returns:
true if sales rep

getAD_User_ID

public static int getAD_User_ID(String email,
                                int AD_Client_ID)
Get AD_User_ID

Parameters:
email - mail
AD_Client_ID - client
Returns:
user id or 0

getEmailOfUser

public static String getEmailOfUser(int AD_User_ID,
                                    int AD_Client_ID)
Get Email of AD_User

Parameters:
AD_User_ID - user
AD_Client_ID - client
Returns:
Email of user or ?

getValue

public String getValue()
Get Value - 7 bit lower case alpha numerics max length 8

Overrides:
getValue in class X_AD_User
Returns:
value

setValue

public void setValue(String Value)
Set Value - 7 bit lower case alpha numerics max length 8

Overrides:
setValue in class X_AD_User
Parameters:
Value -

getFirstName

public String getFirstName()
Get First Name

Returns:
first name

getLastName

public String getLastName()
Get Last Name

Returns:
first name

addDescription

public void addDescription(String description)
Add to Description

Parameters:
description - description to be added

getPreference

public MUserPreference getPreference()
Get User Preference

Returns:
user preference

toString

public String toString()
String Representation

Overrides:
toString in class X_AD_User
Returns:
Info

isOnline

public boolean isOnline()
Is it an Online Access User

Returns:
true if it has an email and password

setEMail

public void setEMail(String EMail)
Set EMail - reset validation

Overrides:
setEMail in class X_AD_User
Parameters:
EMail - email

getInternetAddress

public InternetAddress getInternetAddress()
Convert EMail

Returns:
Valid Internet Address

isEMailValid

public boolean isEMailValid()
Is the email valid

Returns:
return true if email is valid (artificial check)

isCanSendEMail

public boolean isCanSendEMail()
Could we send an email

Returns:
true if EMail Uwer/PW exists

getEMailVerifyCode

public String getEMailVerifyCode()
Get EMail Validation Code

Returns:
code

setEMailVerifyCode

public boolean setEMailVerifyCode(String code,
                                  String info)
Check & Set EMail Validation Code.

Parameters:
code - code
info - info
Returns:
true if valid

isEMailVerified

public boolean isEMailVerified()
Is EMail Verified by response

Returns:
true if verified

isNotificationEMail

public boolean isNotificationEMail()
Get Notification via EMail

Returns:
true if email

isNotificationNote

public boolean isNotificationNote()
Get Notification via Note

Returns:
true if note

getRoles

public MRole[] getRoles(int AD_Org_ID)
Get User Roles for Org

Parameters:
AD_Org_ID - org
Returns:
array of roles

hasRole

public boolean hasRole()
Has the user a role?

Returns:
true if yes

isSystemAdministrator

public boolean isSystemAdministrator()
Is User a System Administrator?

Returns:
true if System Admin

isAdministrator

public boolean isAdministrator()
Is User an Administrator?

Returns:
true id Admin

hasBPAccess

public boolean hasBPAccess(String BPAccessType,
                           Object[] params)
Has the user Access to BP info and resources

Parameters:
BPAccessType - access type
params - opt parameter
Returns:
true if access

getBPAccess

public X_AD_UserBPAccess[] getBPAccess(boolean requery)
Get active BP Access records

Parameters:
requery - requery
Returns:
access list

addUserMenuFavorite

public boolean addUserMenuFavorite(int AD_Menu_ID,
                                   int sequenceNo)
Add menu item to user's Favorite list. (Saves Tree if necessary)

Parameters:
AD_Menu_ID - menu to be added
sequenceNo - ordering to be added, 0 if unused
Returns:
true if added

addUserMenuNewFavorite

public boolean addUserMenuNewFavorite(int AD_Menu_ID,
                                      int sequenceNo)
Add menu item to user's Favorite "new" list (Saves Tree if necessary)

Parameters:
AD_Menu_ID - menu to be added
sequenceNo - ordering to be added, 0 if unused
Returns:
true if added

getUserNewFavoriteTree

public MTree getUserNewFavoriteTree()
Gets the user's tree for create list favorites

Returns:
MTree for user, or null if can't be created

getUserFavoriteTree

public MTree getUserFavoriteTree()
Gets the user's tree for favorites

Returns:
MTree for user, or null if can't be created

beforeSave

protected boolean beforeSave(boolean newRecord)
Before Save

Overrides:
beforeSave in class PO
Parameters:
newRecord - new
Returns:
true

main

public static void main(String[] args)
Test

Parameters:
args - ignored

Compiere 3.1

Compiere® is a registered trademark of ComPiere, Inc. ©2004-2008 HumanFlash.com All rights reserved.