1 14 package org.compiere.model; 15 16 import java.util.*; 17 import java.sql.*; 18 19 import javax.mail.internet.*; 20 21 27 public class MUser extends X_AD_User 28 { 29 34 public MUser (Properties ctx, int AD_User_ID) 35 { 36 this (ctx, AD_User_ID, 0); 37 } 39 45 public MUser (Properties ctx, int AD_User_ID, int C_BPartner_ID) 46 { 47 super (ctx, AD_User_ID); 48 if (AD_User_ID == 0) 49 { 50 if (C_BPartner_ID != 0) 51 setC_BPartner_ID (C_BPartner_ID); 52 53 } 55 } 57 63 public MUser (Properties ctx, ResultSet rs) 64 { 65 super (ctx, rs); 66 } 68 72 public String toString () 73 { 74 StringBuffer sb = new StringBuffer ("MUser[ID=") 75 .append(getID()) 76 .append(",Name=").append(getName()) 77 .append ("]"); 78 return sb.toString (); 79 } 81 85 public boolean isOnline () 86 { 87 if (getEmail() == null || getPassword() == null) 88 return false; 89 return true; 90 } 92 96 public InternetAddress getInternetAddress () 97 { 98 String email = getEmail(); 99 if (email == null || email.length() == 0) 100 return null; 101 try 102 { 103 return new InternetAddress (email, true); 104 } 105 catch (AddressException ex) 106 { 107 log.warn("getInternetAddress - " + email + " - " + ex.getLocalizedMessage()); 108 } 109 return null; 110 } 112 116 public boolean isEMailValid() 117 { 118 return getInternetAddress() != null; 119 } 121 126 public void setClientOrg (int AD_Client_ID, int AD_Org_ID) 127 { 128 setAD_Client_ID(AD_Client_ID); 129 setAD_Org_ID(AD_Org_ID); 130 } 132 } | Popular Tags |