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
Sequence Model.
- Version:
- $Id: MSequence.java,v 1.3 2006/07/30 00:58:04 jjanke Exp $
- Author:
- Jorg Janke
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Start Numberstatic final int
Start System NumberFields 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, UUID_NEW_RECORD, 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
ConstructorDescriptionMSequence
(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, String AD_Sequence_UU, String trxName) UUID based ConstructorMSequence
(Properties ctx, ResultSet rs, String trxName) Load Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static boolean
checkClientSequences
(Properties ctx, int AD_Client_ID, String trxName) Check/Initialize Client DocumentNo/Value Sequencesstatic boolean
createTableSequence
(Properties ctx, String TableName, String trxName) Create Table ID Sequencestatic boolean
createTableSequence
(Properties ctx, String TableName, String trxName, boolean tableID) Create Table Sequencestatic MSequence
get
(Properties ctx, String tableName) Get Sequencestatic MSequence
get
(Properties ctx, String tableName, String trxName) Get the tableID sequence based on the TableNamestatic MSequence
get
(Properties ctx, String tableName, String trxName, boolean tableID) Get Sequenceint
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 next Document No based on Document Typestatic String
getDocumentNo
(int C_DocType_ID, String trxName, boolean definite, PO po) Get next Document No based on Document Typestatic String
getDocumentNo
(int AD_Client_ID, String TableName, String trxName) Get next Document No for tablestatic String
getDocumentNo
(int AD_Client_ID, String TableName, String trxName, PO po) Get next Document No for table (when the document doesn't have a c_doctype)static String
getDocumentNoFromSeq
(MSequence seq, String trxName, PO po) Get next document no from sequenceint
Deprecated.use the static getNextID or getDocumentNo method insteadstatic int
static int
Get next number from table id sequencestatic int
getNextOfficialID_HTTP
(String TableName) Get next official id through http callstatic int
getNextProjectID_HTTP
(String TableName) Get next centralized id through http callGet Org Column.static String
getPreliminaryNo
(GridTab tab, int AD_Sequence_ID) Get preliminary document no by yearstatic boolean
isExceptionCentralized
(String tableName) static boolean
isTableWithEntityType
(String tableName) void
setCurrentNext
(int CurrentNext) Set Current Next.Validate Table Sequence ValuesvalidateTableIDValue
(String trxName) Validate Table Sequence Values trxName the TransactionMethods 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, buildInsertSQL, 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_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, 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, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, 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, toInsertSQL, 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 Details
-
INIT_NO
public static final int INIT_NOStart Number- See Also:
-
INIT_SYS_NO
public static final int INIT_SYS_NOStart System Number- See Also:
-
-
Constructor Details
-
MSequence
UUID based Constructor- Parameters:
ctx
- ContextAD_Sequence_UU
- UUID keytrxName
- Transaction
-
MSequence
Standard Constructor- Parameters:
ctx
- contextAD_Sequence_ID
- idtrxName
- transaction
-
MSequence
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MSequence
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 Details
-
getNextID
- Parameters:
AD_Client_ID
-TableName
-- Returns:
- next id from table id sequence
-
getNextID
Get next number from table id sequence- Parameters:
AD_Client_ID
- clientTableName
- table nametrxName
-- Returns:
- next id or (-1=not found, -2=error)
-
getDocumentNo
Get next Document No for table- Parameters:
AD_Client_ID
- clientTableName
- table nametrxName
- optional Transaction Name- Returns:
- document no or null
-
getDocumentNo
Get next Document No for 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
Get next document no from sequence- Parameters:
seq
-trxName
-po
-- Returns:
- document no or null
-
getDocumentNo
Deprecated.Get Document No based on Document Type- Parameters:
C_DocType_ID
- document typetrxName
- optional Transaction Name- Returns:
- document no or null
-
getDocumentNo
Get next 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
Get next 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
Check/Initialize Client DocumentNo/Value Sequences- Parameters:
ctx
- contextAD_Client_ID
- clienttrxName
- transaction- Returns:
- true if no error
-
createTableSequence
Create Table ID Sequence- Parameters:
ctx
-TableName
-trxName
-- Returns:
- true if created
-
createTableSequence
public static boolean createTableSequence(Properties ctx, String TableName, String trxName, boolean tableID) Create Table Sequence- Parameters:
ctx
- contextTableName
- table nametrxName
- transactiontableID
- true for table id sequence, false for documentno/value sequence- Returns:
- true if created
-
get
Get Sequence- Parameters:
ctx
- contexttableName
- table name- Returns:
- Sequence
-
get
Get the tableID sequence based on the TableName- Parameters:
ctx
-tableName
-trxName
-- Returns:
- sequence
-
get
Get Sequence- Parameters:
ctx
- contexttableName
- table nametrxName
- optional transaction nametableID
- IsTableID flag- Returns:
- Sequence
-
getNextID
Deprecated.use the static getNextID or getDocumentNo method insteadGet Next No and increase current next- Returns:
- next no to use
-
validateTableIDValue
Validate Table Sequence Values- Returns:
- info
-
validateTableIDValue
Validate Table Sequence Values trxName the Transaction- Returns:
- info
-
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
-
getNextOfficialID_HTTP
Get next official id through http call- Parameters:
TableName
- table name- Returns:
- next official id or (-1=error)
-
getNextProjectID_HTTP
Get next centralized id through http call- Parameters:
TableName
- table name- Returns:
- next centralized id or (-1=error)
-
isExceptionCentralized
- Parameters:
tableName
-- Returns:
- true if centralized id shouldn't be used for tableName
-
isTableWithEntityType
- Parameters:
tableName
-- Returns:
- true if table has entity type column
-
beforeSave
protected boolean beforeSave(boolean newRecord) Description copied from class:PO
Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSave
in classPO
- Parameters:
newRecord
- true if it is a new record- Returns:
- true if record can be saved
-
getPreliminaryNo
Get preliminary document no by year- Parameters:
tab
-AD_Sequence_ID
-- Returns:
- Preliminary document no
-
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)
-