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
FieldsModifier and TypeFieldDescriptionstatic final intStart Numberstatic final intStart 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_IDFields 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
ConstructorsConstructorDescriptionMSequence(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 booleanbeforeSave(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.static booleancheckClientSequences(Properties ctx, int AD_Client_ID, String trxName) Check/Initialize Client DocumentNo/Value Sequencesstatic booleancreateTableSequence(Properties ctx, String TableName, String trxName) Create Table ID Sequencestatic booleancreateTableSequence(Properties ctx, String TableName, String trxName, boolean tableID) Create Table Sequencestatic MSequenceget(Properties ctx, String tableName) Get Sequencestatic MSequenceget(Properties ctx, String tableName, String trxName) Get the tableID sequence based on the TableNamestatic MSequenceget(Properties ctx, String tableName, String trxName, boolean tableID) Get SequenceintGet Current Next.static StringgetDocumentNo(int C_DocType_ID, String trxName) Deprecated.static StringgetDocumentNo(int C_DocType_ID, String trxName, boolean definite) Get next Document No based on Document Typestatic StringgetDocumentNo(int C_DocType_ID, String trxName, boolean definite, PO po) Get next Document No based on Document Typestatic StringgetDocumentNo(int AD_Client_ID, String TableName, String trxName) Get next Document No for tablestatic StringgetDocumentNo(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 StringgetDocumentNoFromSeq(MSequence seq, String trxName, PO po) Get next document no from sequenceintDeprecated.use the static getNextID or getDocumentNo method insteadstatic intstatic intGet next number from table id sequencestatic intgetNextOfficialID_HTTP(String TableName) Get next official id through http callstatic intgetNextProjectID_HTTP(String TableName) Get next centralized id through http callGet Org Column.static StringgetPreliminaryNo(GridTab tab, int AD_Sequence_ID) Get preliminary document no by yearstatic booleanisExceptionCentralized(String tableName) booleanIs the sequence a sequence no level sequencestatic booleanisTableWithEntityType(String tableName) booleanIs the prefix used as key for the sequence nobooleanIs the suffix used as key for the sequence novoidsetCurrentNext(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, toStringMethods 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_TableAttribute, get_TableAttributeAsBoolean, get_TableAttributeAsInt, get_TableAttributes, 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, validForeignKeysExMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.compiere.model.I_AD_Sequence
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActiveMethods 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
-
isSequenceNoLevel
public boolean isSequenceNoLevel()Is the sequence a sequence no level sequence- Parameters:
seq- sequence- Returns:
- true if the sequence is a sequence no level sequence
-
isUsePrefixAsKey
public boolean isUsePrefixAsKey()Is the prefix used as key for the sequence no- Returns:
- true if the prefix starts with prefix key
-
isUseSuffixAsKey
public boolean isUseSuffixAsKey()Is the suffix used as key for the sequence no- Returns:
- true if the suffix starts with prefix key
-
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_SequenceGet Current Next.- Specified by:
getCurrentNextin interfaceI_AD_Sequence- Overrides:
getCurrentNextin classX_AD_Sequence- Returns:
- The next number to be used
-
setCurrentNext
public void setCurrentNext(int CurrentNext) Description copied from class:X_AD_SequenceSet Current Next.- Specified by:
setCurrentNextin interfaceI_AD_Sequence- Overrides:
setCurrentNextin 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:POCalled before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.- Overrides:
beforeSavein 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_SequenceGet Org Column.- Specified by:
getOrgColumnin interfaceI_AD_Sequence- Overrides:
getOrgColumnin classX_AD_Sequence- Returns:
- Fully qualified Organization column (AD_Org_ID)
-