Package org.compiere.model
Class MPeriod
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_C_Period
-
- org.compiere.model.MPeriod
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_C_Period
,I_Persistent
,Evaluatee
,ImmutablePOSupport
public class MPeriod extends X_C_Period implements ImmutablePOSupport
Calendar Period Model- Version:
- $Id: MPeriod.java,v 1.4 2006/07/30 00:51:05 jjanke Exp $
- Author:
- Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
- BF [ 1779438 ] Minor auto period control bug
- BF [ 1893486 ] Auto Period Control return that period is always open, victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
- FR [ 2520591 ] Support multiples calendar for Org
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.compiere.model.X_C_Period
PERIODTYPE_AD_Reference_ID, PERIODTYPE_AdjustmentPeriod, PERIODTYPE_StandardCalendarPeriod
-
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
-
Fields inherited from interface org.compiere.model.I_C_Period
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_C_Period_ID, COLUMNNAME_C_Period_UU, COLUMNNAME_C_Year_ID, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_EndDate, COLUMNNAME_IsActive, COLUMNNAME_Name, COLUMNNAME_PeriodNo, COLUMNNAME_PeriodType, COLUMNNAME_Processing, COLUMNNAME_StartDate, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MPeriod(Properties ctx, int C_Period_ID, String trxName)
Standard ConstructorMPeriod(Properties ctx, ResultSet rs, String trxName)
Load ConstructorMPeriod(Properties ctx, MPeriod copy)
MPeriod(Properties ctx, MPeriod copy, String trxName)
MPeriod(MPeriod copy)
MPeriod(MYear year, int PeriodNo, String name, Timestamp startDate, Timestamp endDate)
Parent constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
afterSave(boolean newRecord, boolean success)
After Saveprotected boolean
beforeSave(boolean newRecord)
Before Save.static MPeriod
findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID)
Deprecated.static MPeriod
findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID, String trxName)
static MPeriod
get(int C_Period_ID)
Get Period from Cache (immutable)static MPeriod
get(Properties ctx, int C_Period_ID)
Get Period from Cache (immutable)static MPeriod
get(Properties ctx, Timestamp DateAcct)
Deprecated.static MPeriod
get(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Deprecated.static MPeriod
get(Properties ctx, Timestamp DateAcct, int AD_Org_ID, String trxName)
Find standard Period of DateAcct based on Client Calendarint
getC_Calendar_ID()
Get Calendar of Periodstatic int
getC_Calendar_ID(Properties ctx, int AD_Org_ID)
Get Calendar for Organizationstatic int
getC_Period_ID(Properties ctx, Timestamp DateAcct)
Deprecated.static int
getC_Period_ID(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Find valid standard Period of DateAcct based on Client Calendarstatic MPeriod
getCopy(Properties ctx, int C_Period_ID, String trxName)
Get updateable copy of MPeriod from cachestatic MPeriod
getFirstInYear(Properties ctx, Timestamp DateAcct)
Deprecated.static MPeriod
getFirstInYear(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Find first Year Period of DateAcct based on Client CalendarMPeriodControl
getPeriodControl(String DocBaseType)
Get Period ControlMPeriodControl[]
getPeriodControls(boolean requery)
Get Period Controlboolean
isInPeriod(Timestamp date)
Date In Periodboolean
isOpen(String DocBaseType)
Deprecated.since 3.3.1b; useisOpen(String, Timestamp)
insteadboolean
isOpen(String DocBaseType, Timestamp dateAcct)
Is Period Open for Doc Base Typestatic boolean
isOpen(Properties ctx, int tableID, int recordID, String trxName)
Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)static boolean
isOpen(Properties ctx, Timestamp DateAcct, String DocBaseType)
Deprecated.static boolean
isOpen(Properties ctx, Timestamp DateAcct, String DocBaseType, int AD_Org_ID)
Is standard Period Open for Document Base Typeboolean
isStandardPeriod()
Standard PeriodMPeriod
markImmutable()
mark PO as immutablestatic void
testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID)
Deprecated.static void
testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID, int AD_Org_ID)
Convenient method for testing if a period is openstatic void
testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType)
Deprecated.static void
testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType, int AD_Org_ID)
Convenient method for testing if a period is openString
toString()
String Representation-
Methods inherited from class org.compiere.model.X_C_Period
get_AccessLevel, getC_Period_ID, getC_Period_UU, getC_Year, getC_Year_ID, getEndDate, getKeyNamePair, getName, getPeriodNo, getPeriodType, getStartDate, initPO, isProcessing, setC_Period_ID, setC_Period_UU, setC_Year_ID, setEndDate, setName, setPeriodNo, setPeriodType, setProcessing, setStartDate
-
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, equals, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, hashCode, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock, update_Tree, validForeignKeys
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.compiere.model.I_C_Period
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
-
Methods inherited from interface org.compiere.model.I_Persistent
save
-
-
-
-
Constructor Detail
-
MPeriod
public MPeriod(Properties ctx, int C_Period_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextC_Period_ID
- idtrxName
- transaction
-
MPeriod
public MPeriod(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MPeriod
public MPeriod(MYear year, int PeriodNo, String name, Timestamp startDate, Timestamp endDate)
Parent constructor- Parameters:
year
- yearPeriodNo
- noname
- namestartDate
- startendDate
- end
-
MPeriod
public MPeriod(MPeriod copy)
- Parameters:
copy
-
-
MPeriod
public MPeriod(Properties ctx, MPeriod copy)
- Parameters:
ctx
-copy
-
-
MPeriod
public MPeriod(Properties ctx, MPeriod copy, String trxName)
- Parameters:
ctx
-copy
-trxName
-
-
-
Method Detail
-
get
public static MPeriod get(int C_Period_ID)
Get Period from Cache (immutable)- Parameters:
C_Period_ID
- id- Returns:
- MPeriod
-
get
public static MPeriod get(Properties ctx, int C_Period_ID)
Get Period from Cache (immutable)- Parameters:
ctx
- contextC_Period_ID
- id- Returns:
- MPeriod
-
get
public static MPeriod get(Properties ctx, Timestamp DateAcct)
Deprecated.Find standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- active Period or null
-
get
public static MPeriod get(Properties ctx, Timestamp DateAcct, int AD_Org_ID, String trxName)
Find standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- Organization- Returns:
- active Period or null
-
get
@Deprecated public static MPeriod get(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Deprecated.
-
getCopy
public static MPeriod getCopy(Properties ctx, int C_Period_ID, String trxName)
Get updateable copy of MPeriod from cache- Parameters:
ctx
-C_Period_ID
-trxName
-- Returns:
- MPeriod
-
findByCalendar
public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID)
Deprecated.- Parameters:
ctx
-DateAcct
-C_Calendar_ID
-- Returns:
- MPeriod
-
findByCalendar
public static MPeriod findByCalendar(Properties ctx, Timestamp DateAcct, int C_Calendar_ID, String trxName)
- Parameters:
ctx
-DateAcct
-C_Calendar_ID
-trxName
-- Returns:
- MPeriod
-
getC_Period_ID
public static int getC_Period_ID(Properties ctx, Timestamp DateAcct)
Deprecated.Find valid standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- C_Period_ID or 0
-
getC_Period_ID
public static int getC_Period_ID(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Find valid standard Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- Organization- Returns:
- C_Period_ID or 0
-
isOpen
public static boolean isOpen(Properties ctx, Timestamp DateAcct, String DocBaseType)
Deprecated.Is standard Period Open for Document Base Type- Parameters:
ctx
- contextDateAcct
- dateDocBaseType
- base type- Returns:
- true if open
-
isOpen
public static boolean isOpen(Properties ctx, Timestamp DateAcct, String DocBaseType, int AD_Org_ID)
Is standard Period Open for Document Base Type- Parameters:
ctx
- contextDateAcct
- dateDocBaseType
- base typeAD_Org_ID
- Organization- Returns:
- true if open
-
isOpen
public static boolean isOpen(Properties ctx, int tableID, int recordID, String trxName)
Is standard Period Open - based on tableID+recordID (for IDEMPIERE-2392)- Parameters:
ctx
- contexttableID
-recordID
-- Returns:
- true if open
-
getFirstInYear
public static MPeriod getFirstInYear(Properties ctx, Timestamp DateAcct)
Deprecated.Find first Year Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- date- Returns:
- active first Period
-
getFirstInYear
public static MPeriod getFirstInYear(Properties ctx, Timestamp DateAcct, int AD_Org_ID)
Find first Year Period of DateAcct based on Client Calendar- Parameters:
ctx
- contextDateAcct
- dateAD_Org_ID
- TODO- Returns:
- active first Period
-
getPeriodControls
public MPeriodControl[] getPeriodControls(boolean requery)
Get Period Control- Parameters:
requery
- requery- Returns:
- period controls
-
getPeriodControl
public MPeriodControl getPeriodControl(String DocBaseType)
Get Period Control- Parameters:
DocBaseType
- Document Base Type- Returns:
- period control or null
-
isInPeriod
public boolean isInPeriod(Timestamp date)
Date In Period- Parameters:
date
- date- Returns:
- true if in period
-
isOpen
public boolean isOpen(String DocBaseType)
Deprecated.since 3.3.1b; useisOpen(String, Timestamp)
insteadIs Period Open for Doc Base Type- Parameters:
DocBaseType
- document base type- Returns:
- true if open
-
isOpen
public boolean isOpen(String DocBaseType, Timestamp dateAcct)
Is Period Open for Doc Base Type- Parameters:
DocBaseType
- document base typedateAcct
- date; Applies only for "Auto Period Control":- if not null, date should be in auto period range (today - OpenHistory, today+OpenHistory)
- if null, this period should be in auto period range
- Returns:
- true if open
- Since:
- 3.3.1b
-
isStandardPeriod
public boolean isStandardPeriod()
Standard Period- Returns:
- true if standard calendar periods
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Before Save. Truncate Dates- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new- Returns:
- true
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success)
After Save
-
toString
public String toString()
String Representation- Overrides:
toString
in classX_C_Period
- Returns:
- info
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType) throws PeriodClosedException
Deprecated.Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-docBaseType
-- Throws:
PeriodClosedException
- if period is closed- See Also:
isOpen(Properties, Timestamp, String)
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, String docBaseType, int AD_Org_ID) throws PeriodClosedException
Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-docBaseType
-AD_Org_ID
- Organization- Throws:
PeriodClosedException
- if period is closed- See Also:
isOpen(Properties, Timestamp, String, int)
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID) throws PeriodClosedException
Deprecated.Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-C_DocType_ID
-- Throws:
PeriodClosedException
-
testPeriodOpen
public static void testPeriodOpen(Properties ctx, Timestamp dateAcct, int C_DocType_ID, int AD_Org_ID) throws PeriodClosedException
Convenient method for testing if a period is open- Parameters:
ctx
-dateAcct
-C_DocType_ID
-AD_Org_ID
- Organization- Throws:
PeriodClosedException
-
getC_Calendar_ID
public int getC_Calendar_ID()
Get Calendar of Period- Returns:
- calendar
-
getC_Calendar_ID
public static int getC_Calendar_ID(Properties ctx, int AD_Org_ID)
Get Calendar for Organization- Parameters:
ctx
- ContextAD_Org_ID
- Organization- Returns:
-
markImmutable
public MPeriod markImmutable()
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-
-