Package org.compiere.model
Class MSequence
- java.lang.Object
-
- org.compiere.model.PO
-
- org.compiere.model.X_AD_Sequence
-
- org.compiere.model.MSequence
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_AD_Sequence
,I_Persistent
,Evaluatee
public class MSequence extends X_AD_Sequence
Sequence Model.- Version:
- $Id: MSequence.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
SequenceCheck
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MSequence.GetIDs
Test Sequence - Get IDs
-
Field Summary
Fields Modifier and Type Field Description static int
INIT_NO
Start Numberstatic int
INIT_SYS_NO
Start System Number-
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_AD_Sequence
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_AD_Sequence_ID, COLUMNNAME_AD_Sequence_UU, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_CurrentNext, COLUMNNAME_CurrentNextSys, COLUMNNAME_DateColumn, COLUMNNAME_DecimalPattern, COLUMNNAME_Description, COLUMNNAME_IncrementNo, COLUMNNAME_IsActive, COLUMNNAME_IsAudited, COLUMNNAME_IsAutoSequence, COLUMNNAME_IsOrgLevelSequence, COLUMNNAME_IsTableID, COLUMNNAME_Name, COLUMNNAME_OrgColumn, COLUMNNAME_Prefix, COLUMNNAME_StartNewMonth, COLUMNNAME_StartNewYear, COLUMNNAME_StartNo, COLUMNNAME_Suffix, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_VFormat, Model, Table_ID, Table_Name
-
-
Constructor Summary
Constructors Constructor Description MSequence(Properties ctx, int AD_Sequence_ID, String trxName)
Standard ConstructorMSequence(Properties ctx, int AD_Client_ID, String sequenceName, int StartNo, String trxName)
New Document Sequence ConstructorMSequence(Properties ctx, int AD_Client_ID, String tableName, String trxName)
New Document Sequence ConstructorMSequence(Properties ctx, ResultSet rs, String trxName)
Load Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected boolean
beforeSave(boolean newRecord)
Called before Save for Pre-Save Operationstatic boolean
checkClientSequences(Properties ctx, int AD_Client_ID, String trxName)
Check/Initialize Client DocumentNo/Value Sequencesstatic boolean
createTableSequence(Properties ctx, String TableName, String trxName)
static boolean
createTableSequence(Properties ctx, String TableName, String trxName, boolean tableID)
Create Table ID Sequencestatic MSequence
get(Properties ctx, String tableName)
Get Sequencestatic MSequence
get(Properties ctx, String tableName, String trxName)
static MSequence
get(Properties ctx, String tableName, String trxName, boolean tableID)
Get Sequenceint
getCurrentNext()
Get Current Next.static String
getDocumentNo(int C_DocType_ID, String trxName)
Deprecated.static String
getDocumentNo(int C_DocType_ID, String trxName, boolean definite)
Get Document No based on Document Typestatic String
getDocumentNo(int C_DocType_ID, String trxName, boolean definite, PO po)
Get Document No based on Document Typestatic String
getDocumentNo(int AD_Client_ID, String TableName, String trxName)
Get Document No from tablestatic String
getDocumentNo(int AD_Client_ID, String TableName, String trxName, PO po)
Get Document No from table (when the document doesn't have a c_doctype)static String
getDocumentNoFromSeq(MSequence seq, String trxName, PO po)
int
getNextID()
Get Next No and increase current nextstatic int
getNextID(int AD_Client_ID, String TableName)
static int
getNextID(int AD_Client_ID, String TableName, String trxName)
Get next number for Key column = 0 is Error.static int
getNextOfficialID_HTTP(String TableName)
Get next number for Key columnstatic int
getNextProjectID_HTTP(String TableName)
Get next number for Key columnString
getOrgColumn()
Get Org Column.static String
getPreliminaryNo(GridTab tab, int AD_Sequence_ID)
Get preliminary document no by yearstatic void
main(String[] args)
Testvoid
setCurrentNext(int CurrentNext)
Set Current Next.String
validateTableIDValue()
String
validateTableIDValue(String trxName)
Validate Table Sequence Values trxName the Transaction-
Methods inherited from class org.compiere.model.X_AD_Sequence
get_AccessLevel, getAD_Sequence_ID, getAD_Sequence_UU, getCurrentNextSys, getDateColumn, getDecimalPattern, getDescription, getIncrementNo, getKeyNamePair, getName, getPrefix, getStartNo, getSuffix, getVFormat, initPO, isAudited, isAutoSequence, isOrgLevelSequence, isStartNewMonth, isStartNewYear, isTableID, setAD_Sequence_ID, setAD_Sequence_UU, setCurrentNextSys, setDateColumn, setDecimalPattern, setDescription, setIncrementNo, setIsAudited, setIsAutoSequence, setIsOrgLevelSequence, setIsTableID, setName, setOrgColumn, setPrefix, setStartNewMonth, setStartNewYear, setStartNo, setSuffix, setVFormat, toString
-
Methods inherited from class org.compiere.model.PO
afterDelete, afterSave, 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_AD_Sequence
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
-
-
-
-
Field Detail
-
INIT_NO
public static final int INIT_NO
Start Number- See Also:
- Constant Field Values
-
INIT_SYS_NO
public static final int INIT_SYS_NO
Start System Number- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MSequence
public MSequence(Properties ctx, int AD_Sequence_ID, String trxName)
Standard Constructor- Parameters:
ctx
- contextAD_Sequence_ID
- idtrxName
- transaction
-
MSequence
public MSequence(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MSequence
public MSequence(Properties ctx, int AD_Client_ID, String tableName, String trxName)
New Document Sequence Constructor- Parameters:
ctx
- contextAD_Client_ID
- ownertableName
- nametrxName
- transaction
-
MSequence
public MSequence(Properties ctx, int AD_Client_ID, String sequenceName, int StartNo, String trxName)
New Document Sequence Constructor- Parameters:
ctx
- contextAD_Client_ID
- ownersequenceName
- nameStartNo
- starttrxName
- trx
-
-
Method Detail
-
getNextID
public static int getNextID(int AD_Client_ID, String TableName)
-
getNextID
public static int getNextID(int AD_Client_ID, String TableName, String trxName)
Get next number for Key column = 0 is Error.- Parameters:
AD_Client_ID
- clientTableName
- table nametrxName
-- Returns:
- next no or (-1=not found, -2=error)
-
getDocumentNo
public static String getDocumentNo(int AD_Client_ID, String TableName, String trxName)
Get Document No from table- Parameters:
AD_Client_ID
- clientTableName
- table nametrxName
- optional Transaction Name- Returns:
- document no or null
-
getDocumentNo
public static String getDocumentNo(int AD_Client_ID, String TableName, String trxName, PO po)
Get Document No from table (when the document doesn't have a c_doctype)- Parameters:
AD_Client_ID
- clientTableName
- table nametrxName
- optional Transaction Namepo
- - used to get the date, org and parse context variables- Returns:
- document no or null
-
getDocumentNoFromSeq
public static String getDocumentNoFromSeq(MSequence seq, String trxName, PO po)
-
getDocumentNo
public static String getDocumentNo(int C_DocType_ID, String trxName)
Deprecated.Get Document No based on Document Type- Parameters:
C_DocType_ID
- document typetrxName
- optional Transaction Name- Returns:
- document no or null
-
getDocumentNo
public static String getDocumentNo(int C_DocType_ID, String trxName, boolean definite)
Get Document No based on Document Type- Parameters:
C_DocType_ID
- document typetrxName
- optional Transaction Namedefinite
- asking for a definitive or temporary sequence- Returns:
- document no or null
-
getDocumentNo
public static String getDocumentNo(int C_DocType_ID, String trxName, boolean definite, PO po)
Get Document No based on Document Type- Parameters:
C_DocType_ID
- document typetrxName
- optional Transaction Namedefinite
- asking for a definitive or temporary sequencepo
-- Returns:
- document no or null
-
checkClientSequences
public static boolean checkClientSequences(Properties ctx, int AD_Client_ID, String trxName)
Check/Initialize Client DocumentNo/Value Sequences- Parameters:
ctx
- contextAD_Client_ID
- clienttrxName
- transaction- Returns:
- true if no error
-
createTableSequence
public static boolean createTableSequence(Properties ctx, String TableName, String trxName)
-
createTableSequence
public static boolean createTableSequence(Properties ctx, String TableName, String trxName, boolean tableID)
Create Table ID Sequence- Parameters:
ctx
- contextTableName
- table nametrxName
- transaction- Returns:
- true if created
-
get
public static MSequence get(Properties ctx, String tableName)
Get Sequence- Parameters:
ctx
- contexttableName
- table name- Returns:
- Sequence
-
get
public static MSequence get(Properties ctx, String tableName, String trxName)
-
get
public static MSequence get(Properties ctx, String tableName, String trxName, boolean tableID)
Get Sequence- Parameters:
ctx
- contexttableName
- table nametrxName
- optional transaction nametableID
-- Returns:
- Sequence
-
getNextID
public int getNextID()
Get Next No and increase current next- Returns:
- next no to use
-
validateTableIDValue
public String validateTableIDValue()
-
validateTableIDValue
public String validateTableIDValue(String trxName)
Validate Table Sequence Values trxName the Transaction- Returns:
- true if updated
-
getCurrentNext
public int getCurrentNext()
Description copied from class:X_AD_Sequence
Get Current Next.- Specified by:
getCurrentNext
in interfaceI_AD_Sequence
- Overrides:
getCurrentNext
in classX_AD_Sequence
- Returns:
- The next number to be used
-
setCurrentNext
public void setCurrentNext(int CurrentNext)
Description copied from class:X_AD_Sequence
Set Current Next.- Specified by:
setCurrentNext
in interfaceI_AD_Sequence
- Overrides:
setCurrentNext
in classX_AD_Sequence
- Parameters:
CurrentNext
- The next number to be used
-
main
public static void main(String[] args)
Test- Parameters:
args
- ignored
-
getNextOfficialID_HTTP
public static int getNextOfficialID_HTTP(String TableName)
Get next number for Key column- Parameters:
TableName
- table name- Returns:
- next no or (-1=error)
-
getNextProjectID_HTTP
public static int getNextProjectID_HTTP(String TableName)
Get next number for Key column- Parameters:
TableName
- table name- Returns:
- next no or (-1=error)
-
beforeSave
protected boolean beforeSave(boolean newRecord)
Description copied from class:PO
Called before Save for Pre-Save Operation- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- new record- Returns:
- true if record can be saved
-
getPreliminaryNo
public static String getPreliminaryNo(GridTab tab, int AD_Sequence_ID)
Get preliminary document no by year- Parameters:
tab
-AD_Sequence_ID
-- Returns:
- Preliminary document no
-
getOrgColumn
public String getOrgColumn()
Description copied from class:X_AD_Sequence
Get Org Column.- Specified by:
getOrgColumn
in interfaceI_AD_Sequence
- Overrides:
getOrgColumn
in classX_AD_Sequence
- Returns:
- Fully qualified Organization column (AD_Org_ID)
-
-