/******************************************************************************
 * 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 PA_Measure
 *  @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_PA_Measure extends PO
{
/** Standard Constructor
@param ctx context
@param PA_Measure_ID id
@param trxName transaction
*/
public X_PA_Measure (Ctx ctx, int PA_Measure_ID, String trxName)
{
super (ctx, PA_Measure_ID, trxName);
/** if (PA_Measure_ID == 0)
{
setMeasureDataType (null);	// T
setMeasureType (null);	// M
setName (null);
setPA_Measure_ID (0);
}
 */
}
/** Load Constructor 
@param ctx context
@param rs result set 
@param trxName transaction
*/
public X_PA_Measure (Ctx ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
}
/** Serial Version No */
static final long serialVersionUID = 27419484053789L;
/** Last Updated Timestamp 2006-01-16 05:58:57.0 */
public static final long updatedMS = 1137358737000L;
/** AD_Table_ID=441 */
public static final int Table_ID=441;

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

protected static KeyNamePair Model = new KeyNamePair(441,"PA_Measure");

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_PA_Measure[").append(get_ID()).append("]");
return sb.toString();
}
/** Set Project Type.
@param C_ProjectType_ID Type of the project */
public void setC_ProjectType_ID (int C_ProjectType_ID)
{
if (C_ProjectType_ID <= 0) set_Value ("C_ProjectType_ID", null);
else
set_Value ("C_ProjectType_ID", new Integer(C_ProjectType_ID));
}
/** Get Project Type.
@return Type of the project */
public int getC_ProjectType_ID() 
{
Integer ii = (Integer)get_Value("C_ProjectType_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Calculation Class.
@param CalculationClass Java Class for calculation, implementing Interface Measure */
public void setCalculationClass (String CalculationClass)
{
if (CalculationClass != null && CalculationClass.length() > 60)
{
log.warning("Length > 60 - truncated");
CalculationClass = CalculationClass.substring(0,60);
}
set_Value ("CalculationClass", CalculationClass);
}
/** Get Calculation Class.
@return Java Class for calculation, implementing Interface Measure */
public String getCalculationClass() 
{
return (String)get_Value("CalculationClass");
}
/** 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 Manual Actual.
@param ManualActual Manually entered actual value */
public void setManualActual (BigDecimal ManualActual)
{
set_Value ("ManualActual", ManualActual);
}
/** Get Manual Actual.
@return Manually entered actual value */
public BigDecimal getManualActual() 
{
BigDecimal bd = (BigDecimal)get_Value("ManualActual");
if (bd == null) return Env.ZERO;
return bd;
}
/** Set Note.
@param ManualNote Note for manual entry */
public void setManualNote (String ManualNote)
{
if (ManualNote != null && ManualNote.length() > 2000)
{
log.warning("Length > 2000 - truncated");
ManualNote = ManualNote.substring(0,2000);
}
set_Value ("ManualNote", ManualNote);
}
/** Get Note.
@return Note for manual entry */
public String getManualNote() 
{
return (String)get_Value("ManualNote");
}

/** MeasureDataType AD_Reference_ID=369 */
public static final int MEASUREDATATYPE_AD_Reference_ID=369;
/** Status Qty/Amount = S */
public static final String MEASUREDATATYPE_StatusQtyAmount = "S";
/** Qty/Amount in Time = T */
public static final String MEASUREDATATYPE_QtyAmountInTime = "T";
/** Is test a valid value.
@param test testvalue
@returns true if valid **/
public boolean isMeasureDataTypeValid (String test)
{
return test.equals("S") || test.equals("T");
}
/** Set Measure Data Type.
@param MeasureDataType Type of data - Status or in Time */
public void setMeasureDataType (String MeasureDataType)
{
if (MeasureDataType == null) throw new IllegalArgumentException ("MeasureDataType is mandatory");
if (!isMeasureDataTypeValid(MeasureDataType))
throw new IllegalArgumentException ("MeasureDataType Invalid value - " + MeasureDataType + " - Reference_ID=369 - S - T");
if (MeasureDataType.length() > 1)
{
log.warning("Length > 1 - truncated");
MeasureDataType = MeasureDataType.substring(0,1);
}
set_Value ("MeasureDataType", MeasureDataType);
}
/** Get Measure Data Type.
@return Type of data - Status or in Time */
public String getMeasureDataType() 
{
return (String)get_Value("MeasureDataType");
}

/** MeasureType AD_Reference_ID=231 */
public static final int MEASURETYPE_AD_Reference_ID=231;
/** Achievements = A */
public static final String MEASURETYPE_Achievements = "A";
/** Calculated = C */
public static final String MEASURETYPE_Calculated = "C";
/** Manual = M */
public static final String MEASURETYPE_Manual = "M";
/** Project = P */
public static final String MEASURETYPE_Project = "P";
/** Request = Q */
public static final String MEASURETYPE_Request = "Q";
/** Ratio = R */
public static final String MEASURETYPE_Ratio = "R";
/** User defined = U */
public static final String MEASURETYPE_UserDefined = "U";
/** Is test a valid value.
@param test testvalue
@returns true if valid **/
public boolean isMeasureTypeValid (String test)
{
return test.equals("A") || test.equals("C") || test.equals("M") || test.equals("P") || test.equals("Q") || test.equals("R") || test.equals("U");
}
/** Set Measure Type.
@param MeasureType Determines how the actual performance is derived */
public void setMeasureType (String MeasureType)
{
if (MeasureType == null) throw new IllegalArgumentException ("MeasureType is mandatory");
if (!isMeasureTypeValid(MeasureType))
throw new IllegalArgumentException ("MeasureType Invalid value - " + MeasureType + " - Reference_ID=231 - A - C - M - P - Q - R - U");
if (MeasureType.length() > 1)
{
log.warning("Length > 1 - truncated");
MeasureType = MeasureType.substring(0,1);
}
set_Value ("MeasureType", MeasureType);
}
/** Get Measure Type.
@return Determines how the actual performance is derived */
public String getMeasureType() 
{
return (String)get_Value("MeasureType");
}
/** Set Name.
@param Name Alphanumeric identifier of the entity */
public void setName (String Name)
{
if (Name == null) throw new IllegalArgumentException ("Name is mandatory.");
if (Name.length() > 60)
{
log.warning("Length > 60 - truncated");
Name = Name.substring(0,60);
}
set_Value ("Name", Name);
}
/** Get Name.
@return Alphanumeric identifier of the entity */
public String getName() 
{
return (String)get_Value("Name");
}
/** Get Record ID/ColumnName
@return ID/ColumnName pair */
public KeyNamePair getKeyNamePair() 
{
return new KeyNamePair(get_ID(), getName());
}
/** Set Benchmark.
@param PA_Benchmark_ID Performance Benchmark */
public void setPA_Benchmark_ID (int PA_Benchmark_ID)
{
if (PA_Benchmark_ID <= 0) set_Value ("PA_Benchmark_ID", null);
else
set_Value ("PA_Benchmark_ID", new Integer(PA_Benchmark_ID));
}
/** Get Benchmark.
@return Performance Benchmark */
public int getPA_Benchmark_ID() 
{
Integer ii = (Integer)get_Value("PA_Benchmark_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Reporting Hierarchy.
@param PA_Hierarchy_ID Optional Reporting Hierarchy - If not selected the default hierarchy trees are used. */
public void setPA_Hierarchy_ID (int PA_Hierarchy_ID)
{
if (PA_Hierarchy_ID <= 0) set_Value ("PA_Hierarchy_ID", null);
else
set_Value ("PA_Hierarchy_ID", new Integer(PA_Hierarchy_ID));
}
/** Get Reporting Hierarchy.
@return Optional Reporting Hierarchy - If not selected the default hierarchy trees are used. */
public int getPA_Hierarchy_ID() 
{
Integer ii = (Integer)get_Value("PA_Hierarchy_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Measure Calculation.
@param PA_MeasureCalc_ID Calculation method for measuring performance */
public void setPA_MeasureCalc_ID (int PA_MeasureCalc_ID)
{
if (PA_MeasureCalc_ID <= 0) set_Value ("PA_MeasureCalc_ID", null);
else
set_Value ("PA_MeasureCalc_ID", new Integer(PA_MeasureCalc_ID));
}
/** Get Measure Calculation.
@return Calculation method for measuring performance */
public int getPA_MeasureCalc_ID() 
{
Integer ii = (Integer)get_Value("PA_MeasureCalc_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Measure.
@param PA_Measure_ID Concrete Performance Measurement */
public void setPA_Measure_ID (int PA_Measure_ID)
{
if (PA_Measure_ID < 1) throw new IllegalArgumentException ("PA_Measure_ID is mandatory.");
set_ValueNoCheck ("PA_Measure_ID", new Integer(PA_Measure_ID));
}
/** Get Measure.
@return Concrete Performance Measurement */
public int getPA_Measure_ID() 
{
Integer ii = (Integer)get_Value("PA_Measure_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Ratio.
@param PA_Ratio_ID Performace Ratio */
public void setPA_Ratio_ID (int PA_Ratio_ID)
{
if (PA_Ratio_ID <= 0) set_Value ("PA_Ratio_ID", null);
else
set_Value ("PA_Ratio_ID", new Integer(PA_Ratio_ID));
}
/** Get Ratio.
@return Performace Ratio */
public int getPA_Ratio_ID() 
{
Integer ii = (Integer)get_Value("PA_Ratio_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Request Type.
@param R_RequestType_ID Type of request (e.g. Inquiry, Complaint, ..) */
public void setR_RequestType_ID (int R_RequestType_ID)
{
if (R_RequestType_ID <= 0) set_Value ("R_RequestType_ID", null);
else
set_Value ("R_RequestType_ID", new Integer(R_RequestType_ID));
}
/** Get Request Type.
@return Type of request (e.g. Inquiry, Complaint, ..) */
public int getR_RequestType_ID() 
{
Integer ii = (Integer)get_Value("R_RequestType_ID");
if (ii == null) return 0;
return ii.intValue();
}
}
