www.pudn.com > code_source_compiere_erp_crm_logiciel_java.zip > MBPartner_Contact.java


/****************************************************************************** 
 * The contents of this file are subject to the   Compiere License  Version 1.1 
 * ("License"); You may not use this file except in compliance with the License 
 * You may obtain a copy of the License at http://www.compiere.org/license.html 
 * Software distributed under the License is distributed on an  "AS IS"  basis, 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for 
 * the specific language governing rights and limitations under the License. 
 * The Original Code is             Compiere  ERP & CRM Smart Business Solution 
 * The Initial Developer of the Original Code is Jorg Janke  and ComPiere, Inc. 
 * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts 
 * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved. 
 * Contributor(s): ______________________________________. 
 *****************************************************************************/ 
package org.compiere.model; 
 
import java.util.*; 
import java.sql.*; 
import java.math.*; 
import java.io.Serializable; 
import javax.mail.internet.InternetAddress; 
 
import org.compiere.util.*; 
import javax.mail.internet.*; 
 
/** 
 *	Partner Contact Model 
 * 
 *  @author Jorg Janke 
 *  @version $Id: MBPartner_Contact.java,v 1.7 2003/04/07 04:18:32 jjanke Exp $ 
 */ 
public class MBPartner_Contact 
  extends PO 
{ 
	/** 
	 * 	Default Constructor 
	 *	@param ctx context 
	 *	@param C_BPartner_Contact_ID id 
	 */ 
	public MBPartner_Contact (Properties ctx, int C_BPartner_Contact_ID) 
	{ 
		this (ctx, C_BPartner_Contact_ID, 0); 
	}	//	MBPartner_Contact 
 
	/** 
	 * 	Default Constructor 
	 *	@param ctx context 
	 *	@param C_BPartner_Contact_ID id 
	 * 	@param C_BPartner_ID parent 
	 */ 
	public MBPartner_Contact (Properties ctx, int C_BPartner_Contact_ID, int C_BPartner_ID) 
	{ 
		super (ctx, C_BPartner_Contact_ID); 
		if (C_BPartner_Contact_ID == 0) 
		{ 
			if (C_BPartner_ID != 0) 
				setC_BPartner_ID (C_BPartner_ID); 
 
		//	setName ("."); 
			setIsOnline (true); 
		} 
	}	//	MBPartner_Contact 
 
	/** 
	 * 	Constructor from ResultSet row 
	 * 
	 * 	@param ctx context 
	 * 	@param rs current row of result set to be loaded 
	 */ 
	public MBPartner_Contact (Properties ctx, ResultSet rs) 
	{ 
		super (ctx, rs); 
	}	//	MBPartner_Contact 
 
	protected POInfo initPO (Properties ctx) 
	{ 
		int AD_Table_ID = 292; 
		POInfo poi = POInfo.getPOInfo (ctx, AD_Table_ID); 
		return poi; 
	} 
 
	public boolean save () 
	{ 
		Log.trace (Log.l4_Data, "MBPartner_Contact.save"); 
		return super.save (); 
	} 
 
	public String toString () 
	{ 
		StringBuffer sb = new StringBuffer ("MBPartner_Contact[ID=") 
			.append(getID()) 
			.append(",Name=").append(getName()) 
			.append ("]"); 
		return sb.toString (); 
	} 
 
	public void setPassword (String Password) 
	{ 
		setValue ("Password", Password); 
	} 
 
	public String getPassword () 
	{ 
		return (String)getValue ("Password"); 
	} 
 
	public void setIsOnline (boolean IsOnline) 
	{ 
		setValue ("IsOnline", new Boolean(IsOnline)); 
	} 
 
	public boolean isOnline () 
	{ 
		Boolean bb = (Boolean)getValue ("IsOnline"); 
		if (bb != null) 
			return bb.booleanValue (); 
		return false; 
	} 
 
	public int getC_BPartner_Contact_ID () 
	{ 
		return getID(); 
	} 
 
	public void setBirthday (Timestamp Birthday) 
	{ 
		setValue ("Birthday", Birthday); 
	} 
 
	public Timestamp getBirthday () 
	{ 
		return (Timestamp)getValue ("Birthday"); 
	} 
 
	public void setC_Greeting_ID (int C_Greeting_ID) 
	{ 
		setValue ("C_Greeting_ID", new Integer (C_Greeting_ID)); 
	} 
 
	public int getC_Greeting_ID () 
	{ 
		Integer ii = (Integer)getValue ("C_Greeting_ID"); 
		if (ii == null) 
			return 0; 
		return ii.intValue (); 
	} 
 
	public void setC_BPartner_ID (int C_BPartner_ID) 
	{ 
		setValueNoCheck ("C_BPartner_ID", new Integer (C_BPartner_ID)); 
	} 
 
	public int getC_BPartner_ID () 
	{ 
		Integer ii = (Integer)getValue ("C_BPartner_ID"); 
		if (ii == null) 
			return 0; 
		return ii.intValue (); 
	} 
 
	public void setFax (String Fax) 
	{ 
		setValue ("Fax", Fax); 
	} 
 
	public String getFax () 
	{ 
		return (String)getValue ("Fax"); 
	} 
 
	public void setLastContact (Timestamp LastContact) 
	{ 
		setValue ("LastContact", LastContact); 
	} 
 
	public Timestamp getLastContact () 
	{ 
		return (Timestamp)getValue ("LastContact"); 
	} 
 
	public void setName (String Name) 
	{ 
		if (Name == null) 
			throw new IllegalArgumentException ("Name is mandatory"); 
		setValue ("Name", Name); 
	} 
 
	public String getName () 
	{ 
		return (String)getValue ("Name"); 
	} 
 
	public void setDescription (String Description) 
	{ 
		setValue ("Description", Description); 
	} 
 
	public String getDescription () 
	{ 
		return (String)getValue ("Description"); 
	} 
 
	public void setComments (String Comments) 
	{ 
		setValue ("Comments", Comments); 
	} 
 
	public String getComments () 
	{ 
		return (String)getValue ("Comments"); 
	} 
 
	public void setPhone2 (String Phone2) 
	{ 
		setValue ("Phone2", Phone2); 
	} 
 
	public String getPhone2 () 
	{ 
		return (String)getValue ("Phone2"); 
	} 
 
	public void setLastResult (String LastResult) 
	{ 
		setValue ("LastResult", LastResult); 
	} 
 
	public String getLastResult () 
	{ 
		return (String)getValue ("LastResult"); 
	} 
 
	public void setEmail (String Email) 
	{ 
		setValue ("Email", Email); 
	} 
 
	public String getEmail () 
	{ 
		return (String)getValue ("Email"); 
	} 
 
	public InternetAddress getInternetAddress () 
	{ 
		String email = getEmail(); 
		if (email == null || email.length() == 0) 
			return null; 
		try 
		{ 
			return new InternetAddress (email, true); 
		} 
		catch (AddressException ex) 
		{ 
			log.warn("getInternetAddress - " + email + " - " + ex.getLocalizedMessage()); 
		} 
		return null; 
	}	//	getInternetAddress 
 
	/** 
	 * 	Return Email Validation. 
	 * 	@return return true if email is valid 
	 */ 
	public boolean isEMailValid() 
	{ 
		return getInternetAddress() != null; 
	}	//	isEMaulValid 
 
 
	public void setC_BPartner_Location_ID (int C_BPartner_Location_ID) 
	{ 
		setValue ("C_BPartner_Location_ID", new Integer (C_BPartner_Location_ID)); 
	} 
 
	public int getC_BPartner_Location_ID () 
	{ 
		Integer ii = (Integer)getValue ("C_BPartner_Location_ID"); 
		if (ii == null) 
			return 0; 
		return ii.intValue (); 
	} 
 
	public void setPhone (String Phone) 
	{ 
		setValue ("Phone", Phone); 
	} 
 
	public String getPhone () 
	{ 
		return (String)getValue ("Phone"); 
	} 
 
	public void setTitle (String Title) 
	{ 
		setValue ("Title", Title); 
	} 
 
	public String getTitle () 
	{ 
		return (String)getValue ("Title"); 
	} 
 
}	//	MBPartner_Contact