/******************************************************************************
 * 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_AssignCriteria
 *  @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_AssignCriteria extends PO
{
/** Standard Constructor
@param ctx context
@param AD_AssignCriteria_ID id
@param trxName transaction
*/
public X_AD_AssignCriteria (Ctx ctx, int AD_AssignCriteria_ID, String trxName)
{
super (ctx, AD_AssignCriteria_ID, trxName);
/** if (AD_AssignCriteria_ID == 0)
{
setAD_AssignCriteria_ID (0);
setAD_AssignTarget_ID (0);
setAD_SourceColumn_ID (0);
setOperation (null);
setSeqNo (0);	// @SQL=SELECT COALESCE(MAX(SeqNo),0)+10 AS DefaultValue FROM AD_AssignCriteria WHERE AD_AssignTarget_ID=@AD_AssignTarget_ID@
}
 */
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_AD_AssignCriteria (Ctx ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** Serial Version No */
static final long serialVersionUID = 27462586530789L;
/** Last Updated Timestamp 2007-05-30 02:53:34.0 */
public static final long updatedMS = 1180461214000L;
/** AD_Table_ID=932 */
public static final int Table_ID=932;

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

protected static KeyNamePair Model = new KeyNamePair(932,"AD_AssignCriteria");

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_AssignCriteria[").append(get_ID()).append("]");
return sb.toString();
}
/** Set Assign Criteria.
@param AD_AssignCriteria_ID Auto assignment Criteria */
public void setAD_AssignCriteria_ID (int AD_AssignCriteria_ID)
{
if (AD_AssignCriteria_ID < 1) throw new IllegalArgumentException ("AD_AssignCriteria_ID is mandatory.");
set_ValueNoCheck ("AD_AssignCriteria_ID", new Integer(AD_AssignCriteria_ID));
}
/** Get Assign Criteria.
@return Auto assignment Criteria */
public int getAD_AssignCriteria_ID() 
{
Integer ii = (Integer)get_Value("AD_AssignCriteria_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_SourceColumn_ID AD_Reference_ID=414 */
public static final int AD_SOURCECOLUMN_ID_AD_Reference_ID=414;
/** Set Source Column.
@param AD_SourceColumn_ID The column used as the criteria */
public void setAD_SourceColumn_ID (int AD_SourceColumn_ID)
{
if (AD_SourceColumn_ID < 1) throw new IllegalArgumentException ("AD_SourceColumn_ID is mandatory.");
set_Value ("AD_SourceColumn_ID", new Integer(AD_SourceColumn_ID));
}
/** Get Source Column.
@return The column used as the criteria */
public int getAD_SourceColumn_ID() 
{
Integer ii = (Integer)get_Value("AD_SourceColumn_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** 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");
}

/** Operation AD_Reference_ID=205 */
public static final int OPERATION_AD_Reference_ID=205;
/** != = != */
public static final String OPERATION_NotEq = "!=";
/** < = << */
public static final String OPERATION_Le = "<<";
/** <= = <= */
public static final String OPERATION_LeEq = "<=";
/**  = = == */
public static final String OPERATION_Eq = "==";
/** >= = >= */
public static final String OPERATION_GtEq = ">=";
/** > = >> */
public static final String OPERATION_Gt = ">>";
/** |<x>| = AB */
public static final String OPERATION_X = "AB";
/** sql = SQ */
public static final String OPERATION_Sql = "SQ";
/**  ~ = ~~ */
public static final String OPERATION_Like = "~~";
/** Is test a valid value.
@param test testvalue
@returns true if valid **/
public boolean isOperationValid (String test)
{
return test.equals("!=") || test.equals("<<") || test.equals("<=") || test.equals("==") || test.equals(">=") || test.equals(">>") || test.equals("AB") || test.equals("SQ") || test.equals("~~");
}
/** Set Operation.
@param Operation Compare Operation */
public void setOperation (String Operation)
{
if (Operation == null) throw new IllegalArgumentException ("Operation is mandatory");
if (!isOperationValid(Operation))
throw new IllegalArgumentException ("Operation Invalid value - " + Operation + " - Reference_ID=205 - != - << - <= - == - >= - >> - AB - SQ - ~~");
if (Operation.length() > 2)
{
log.warning("Length > 2 - truncated");
Operation = Operation.substring(0,2);
}
set_Value ("Operation", Operation);
}
/** Get Operation.
@return Compare Operation */
public String getOperation() 
{
return (String)get_Value("Operation");
}
/** 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();
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair */
public KeyNamePair getKeyNamePair() 
{
return new KeyNamePair(get_ID(), String.valueOf(getSeqNo()));
}
/** 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");
}
}
