/******************************************************************************
 * Product: Compiere ERP & CRM Smart Business Solution                        *
 * Copyright (C) 1999-2007 ComPiere, Inc. All Rights Reserved.                *
 * This program is free software, you can redistribute it and/or modify it    *
 * under the terms version 2 of the GNU General Public License as published   *
 * by the Free Software Foundation. This program is distributed in the hope   *
 * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.           *
 * See the GNU General Public License for more details.                       *
 * You should have received a copy of the GNU General Public License along    *
 * with this program, if not, write to the Free Software Foundation, Inc.,    *
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.                     *
 * For the text or an alternative of this public license, you may reach us    *
 * ComPiere, Inc., 3600 Bridge Parkway #102, Redwood City, CA 94065, USA      *
 * or via info@compiere.org or http://www.compiere.org/license.html           *
 *****************************************************************************/
package org.compiere.model;

/** Generated Model - DO NOT CHANGE */
import java.sql.*;
import java.math.*;
import org.compiere.framework.*;
import org.compiere.util.*;
/** Generated Model for AD_AssignTarget
 *  @author Jorg Janke (generated) 
 *  @version Release 3.0.0 - $Id: GenerateModel.java,v 1.1 2008/01/16 07:34:32 jrmt Exp $ */
public class X_AD_AssignTarget extends PO
{
/** Standard Constructor
@param ctx context
@param AD_AssignTarget_ID id
@param trxName transaction
*/
public X_AD_AssignTarget (Ctx ctx, int AD_AssignTarget_ID, String trxName)
{
super (ctx, AD_AssignTarget_ID, trxName);
/** if (AD_AssignTarget_ID == 0)
{
setAD_AssignSet_ID (0);
setAD_AssignTarget_ID (0);
setAD_TargetColumn_ID (0);
setAssignRule (null);	// A
}
 */
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_AD_AssignTarget (Ctx ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** Serial Version No */
static final long serialVersionUID = 27462590563789L;
/** Last Updated Timestamp 2007-05-30 04:00:47.0 */
public static final long updatedMS = 1180465247000L;
/** AD_Table_ID=931 */
public static final int Table_ID=931;

/** TableName=AD_AssignTarget */
public static final String Table_Name="AD_AssignTarget";

protected static KeyNamePair Model = new KeyNamePair(931,"AD_AssignTarget");

protected BigDecimal accessLevel = new BigDecimal(6);
/** AccessLevel
@return 6 - System - Client 
*/
protected int get_AccessLevel()
{
return accessLevel.intValue();
}
/** Load Meta Data
@param ctx context
@return PO Info
*/
protected POInfo initPO (Ctx ctx)
{
POInfo poi = POInfo.getPOInfo (ctx, Table_ID);
return poi;
}
/** Info
@return info
*/
public String toString()
{
StringBuffer sb = new StringBuffer ("X_AD_AssignTarget[").append(get_ID()).append("]");
return sb.toString();
}
/** Set Auto Assignment.
@param AD_AssignSet_ID Automatic Assignment of values */
public void setAD_AssignSet_ID (int AD_AssignSet_ID)
{
if (AD_AssignSet_ID < 1) throw new IllegalArgumentException ("AD_AssignSet_ID is mandatory.");
set_ValueNoCheck ("AD_AssignSet_ID", new Integer(AD_AssignSet_ID));
}
/** Get Auto Assignment.
@return Automatic Assignment of values */
public int getAD_AssignSet_ID() 
{
Integer ii = (Integer)get_Value("AD_AssignSet_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Assign Target.
@param AD_AssignTarget_ID Automatic Assignment Target Column */
public void setAD_AssignTarget_ID (int AD_AssignTarget_ID)
{
if (AD_AssignTarget_ID < 1) throw new IllegalArgumentException ("AD_AssignTarget_ID is mandatory.");
set_ValueNoCheck ("AD_AssignTarget_ID", new Integer(AD_AssignTarget_ID));
}
/** Get Assign Target.
@return Automatic Assignment Target Column */
public int getAD_AssignTarget_ID() 
{
Integer ii = (Integer)get_Value("AD_AssignTarget_ID");
if (ii == null) return 0;
return ii.intValue();
}

/** AD_TargetColumn_ID AD_Reference_ID=414 */
public static final int AD_TARGETCOLUMN_ID_AD_Reference_ID=414;
/** Set Target Column.
@param AD_TargetColumn_ID Target column to be set */
public void setAD_TargetColumn_ID (int AD_TargetColumn_ID)
{
if (AD_TargetColumn_ID < 1) throw new IllegalArgumentException ("AD_TargetColumn_ID is mandatory.");
set_Value ("AD_TargetColumn_ID", new Integer(AD_TargetColumn_ID));
}
/** Get Target Column.
@return Target column to be set */
public int getAD_TargetColumn_ID() 
{
Integer ii = (Integer)get_Value("AD_TargetColumn_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair */
public KeyNamePair getKeyNamePair() 
{
return new KeyNamePair(get_ID(), String.valueOf(getAD_TargetColumn_ID()));
}

/** AssignRule AD_Reference_ID=425 */
public static final int ASSIGNRULE_AD_Reference_ID=425;
/** Always = A */
public static final String ASSIGNRULE_Always = "A";
/** Only if NULL = N */
public static final String ASSIGNRULE_OnlyIfNULL = "N";
/** Only if NOT NULL = X */
public static final String ASSIGNRULE_OnlyIfNOTNULL = "X";
/** Is test a valid value.
@param test testvalue
@returns true if valid **/
public boolean isAssignRuleValid (String test)
{
return test.equals("A") || test.equals("N") || test.equals("X");
}
/** Set Assignment Rule.
@param AssignRule Assignment Rule */
public void setAssignRule (String AssignRule)
{
if (AssignRule == null) throw new IllegalArgumentException ("AssignRule is mandatory");
if (!isAssignRuleValid(AssignRule))
throw new IllegalArgumentException ("AssignRule Invalid value - " + AssignRule + " - Reference_ID=425 - A - N - X");
if (AssignRule.length() > 1)
{
log.warning("Length > 1 - truncated");
AssignRule = AssignRule.substring(0,1);
}
set_Value ("AssignRule", AssignRule);
}
/** Get Assignment Rule.
@return Assignment Rule */
public String getAssignRule() 
{
return (String)get_Value("AssignRule");
}
/** Set Description.
@param Description Optional short description of the record */
public void setDescription (String Description)
{
if (Description != null && Description.length() > 255)
{
log.warning("Length > 255 - truncated");
Description = Description.substring(0,255);
}
set_Value ("Description", Description);
}
/** Get Description.
@return Optional short description of the record */
public String getDescription() 
{
return (String)get_Value("Description");
}
/** Set Record ID.
@param Record_ID Direct internal record ID */
public void setRecord_ID (int Record_ID)
{
if (Record_ID <= 0) set_Value ("Record_ID", null);
else
set_Value ("Record_ID", new Integer(Record_ID));
}
/** Get Record ID.
@return Direct internal record ID */
public int getRecord_ID() 
{
Integer ii = (Integer)get_Value("Record_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Sequence.
@param SeqNo Method of ordering elements;
 lowest number comes first */
public void setSeqNo (int SeqNo)
{
set_Value ("SeqNo", new Integer(SeqNo));
}
/** Get Sequence.
@return Method of ordering elements;
 lowest number comes first */
public int getSeqNo() 
{
Integer ii = (Integer)get_Value("SeqNo");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Value.
@param ValueString Value as String */
public void setValueString (String ValueString)
{
if (ValueString != null && ValueString.length() > 40)
{
log.warning("Length > 40 - truncated");
ValueString = ValueString.substring(0,40);
}
set_Value ("ValueString", ValueString);
}
/** Get Value.
@return Value as String */
public String getValueString() 
{
return (String)get_Value("ValueString");
}
}
