Package org.compiere.model
Record Class MCost.CostingKey
java.lang.Object
java.lang.Record
org.compiere.model.MCost.CostingKey
- Record Components:
AD_Org_ID- the resolved org ID (zeroed for Client and BatchLot costing levels)M_AttributeSetInstance_ID- the resolved ASI ID (zeroed for Client and Organization costing levels)
- Enclosing class:
- MCost
Represents a resolved (AD_Org_ID, M_AttributeSetInstance_ID) key pair, derived by applying
costing-level normalization rules, used to look up or create
MCost/MCostHistory
records. Depending on the product's costing level (X_C_AcctSchema.COSTINGLEVEL_Client,
X_C_AcctSchema.COSTINGLEVEL_Organization, or X_C_AcctSchema.COSTINGLEVEL_BatchLot),
one or both of the raw org/ASI values supplied by the caller are zeroed out to match the
granularity at which cost is tracked.
Callers should always obtain instances via resolve(int, int, String) rather
than constructing this record directly, to ensure the normalization rules are applied
consistently.
-
Constructor Summary
ConstructorsConstructorDescriptionCostingKey(int AD_Org_ID, int M_AttributeSetInstance_ID) Creates an instance of aCostingKeyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintReturns the value of theAD_Org_IDrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisSkipCostingProcessing(String costingLevel) Indicates whether cost lookup/processing should be skipped entirely for this key, because BatchLot-level costing requires a specific attribute set instance (lot) to associate cost with, and none could be resolved (M_AttributeSetInstance_ID is 0).intReturns the value of theM_AttributeSetInstance_IDrecord component.static MCost.CostingKeyResolves the org/ASI key pair for the given costing level, zeroing out whichever fields are not significant at that costing granularity:Client- both AD_Org_ID and M_AttributeSetInstance_ID are zeroedOrganization- only M_AttributeSetInstance_ID is zeroedBatchLot- only AD_Org_ID is zeroed; ASI is preserved since cost is tracked per lot Any other costing level is passed through unchanged.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CostingKey
public CostingKey(int AD_Org_ID, int M_AttributeSetInstance_ID) Creates an instance of aCostingKeyrecord class.- Parameters:
AD_Org_ID- the value for theAD_Org_IDrecord componentM_AttributeSetInstance_ID- the value for theM_AttributeSetInstance_IDrecord component
-
-
Method Details
-
resolve
public static MCost.CostingKey resolve(int AD_Org_ID, int M_AttributeSetInstance_ID, String costingLevel) Resolves the org/ASI key pair for the given costing level, zeroing out whichever fields are not significant at that costing granularity:Client- both AD_Org_ID and M_AttributeSetInstance_ID are zeroedOrganization- only M_AttributeSetInstance_ID is zeroedBatchLot- only AD_Org_ID is zeroed; ASI is preserved since cost is tracked per lot
- Parameters:
AD_Org_ID- the raw org ID before normalizationM_AttributeSetInstance_ID- the raw ASI ID before normalizationcostingLevel- one of theMAcctSchema.COSTINGLEVEL_*constants- Returns:
- a new
CostingKeywith fields normalized per the costing level
-
isSkipCostingProcessing
Indicates whether cost lookup/processing should be skipped entirely for this key, because BatchLot-level costing requires a specific attribute set instance (lot) to associate cost with, and none could be resolved (M_AttributeSetInstance_ID is 0).When this returns
true, callers should abort the current cost lookup or costing-record retrieval and returnnull(or otherwise skip processing), rather than falling back to a client- or organization-level cost record — no BatchLot-level cost record can exist without a lot to key it against.Used by
MProduct.getCostInfo(MAcctSchema, int, int, String, Timestamp)andMProduct.getCostingRecord(MAcctSchema, int, int, String)as an early-exit guard before resolving cost elements or cost records.- Parameters:
costingLevel- one of theMAcctSchema.COSTINGLEVEL_*constants- Returns:
trueif costingLevel is BatchLot and no ASI (lot) could be resolved, meaning the caller should skip cost processing and returnnull
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
AD_Org_ID
public int AD_Org_ID()Returns the value of theAD_Org_IDrecord component.- Returns:
- the value of the
AD_Org_IDrecord component
-
M_AttributeSetInstance_ID
public int M_AttributeSetInstance_ID()Returns the value of theM_AttributeSetInstance_IDrecord component.- Returns:
- the value of the
M_AttributeSetInstance_IDrecord component
-