org.opencrx.kernel.backend
Class Contracts

java.lang.Object
  extended by org.opencrx.kernel.backend.Contracts

public class Contracts
extends Object


Field Summary
protected  Map cachedDescriptions
           
protected  Map cachedObjects
           
static String CALCULATION_RULE_NAME_DEFAULT
           
protected  Cloneable cloning
           
static String DEFAULT_GET_CONTRACT_AMOUNTS_SCRIPT
           
static String DEFAULT_GET_POSITION_AMOUNTS_SCRIPT
           
protected static Map<String,Method> getContractAmountMethods
           
protected static Map<String,Method> getPositionAmountMethods
           
 
Constructor Summary
Contracts(Backend backend)
           
 
Method Summary
 boolean allowPositionCreation(Path contractIdentity, DataproviderObject_1_0 product, Path parentPositionIdentity, List positions)
           
 boolean allowPositionRemoval(Path contractIdentity, DataproviderObject_1_0 productRole, Path parentPositionIdentity)
           
 void calculateContractPosition(DataproviderObject_1_0 position, Set<String> fetchSet)
           
 void calculateForwardReferences(DataproviderObject_1_0 contract, Set fetchSet)
          calculate forward references, i.e.
static void calculateUserHomeCharts(UserHome userHome, javax.jdo.PersistenceManager pm)
           
 void completeContract(DataproviderObject_1_0 contract, Set<String> fetchSet)
           
 int countFilteredContract(Path contractFilterIdentity)
           
 ContractPosition createContractPosition(Path contractIdentity, Boolean isIgnoreProductConfiguration, String name, BigDecimal quantity, Date pricingDate, Path productIdentity, Path uomIdentity, Path priceUomIdentity, Path pricingRuleIdentity)
           
 Set createDepotReferences(Path depotHolderIdentity, Path positionIdentity, Set excludeDepotUsage)
          Copy depot references from product role to contract position.
 Invoice createInvoice(Path salesOrderIdentity)
           
 Opportunity createOpportunity(Path leadIdentity)
           
 Quote createQuote(Path opportunityIdentity)
           
 SalesOrder createSalesOrder(Path quoteIdentity)
           
static CalculationRule findCalculationRule(String name, Segment segment, javax.jdo.PersistenceManager pm)
           
 long getAdjustedLineItemNumber(long itemNumber, long lineItemNumber)
          Add itemNumber to lineItemNumber.
 GetContractAmountsResult getContractAmounts(CalculationRule calculationRule, AbstractContract contract, List<?> lineItemNumbers, List<?> positionBaseAmounts, List<?> positionDiscountAmounts, List<?> positionTaxAmounts, List<?> positionAmounts, List<?> salesCommissions, List<?> salesCommissionIsPercentages)
           
 void getContractAmounts(DataproviderObject_1_0 calcRule, DataproviderObject_1_0 params, DataproviderObject getContractAmountsResult)
           
static GetContractAmountsResult getContractAmounts(RefPackage_1_0 rootPkg, CalculationRule calculationRule, AbstractContract contract, Integer[] lineItemNumbers, BigDecimal[] positionBaseAmounts, BigDecimal[] positionDiscountAmounts, BigDecimal[] positionTaxAmounts, BigDecimal[] positionAmounts, BigDecimal[] salesCommissions, Boolean[] salesCommissionIsPercentages)
           
 FilterProperty[] getContractFilterProperties(Path contractFilterIdentity, boolean forCounting)
           
static Segment getContractSegment(javax.jdo.PersistenceManager pm, String providerName, String segmentName)
           
 long getMaxLineItemNumber(DataproviderObject_1_0 contract, Path parentPositionIdentity)
           
 int getNumberPositionsBasedOnProduct(Path contractIdentity, DataproviderObject_1_0 product, Path parentPositionIdentity, List positions)
           
 GetPositionAmountsResult getPositionAmounts(CalculationRule calculationRule, ContractPosition position)
           
 void getPositionAmounts(DataproviderObject_1_0 calcRule, DataproviderObject_1_0 params, DataproviderObject getPositionAmountsResult)
           
static GetPositionAmountsResult getPositionAmounts(RefPackage_1_0 rootPkg, CalculationRule calculationRule, ContractPosition position, BigDecimal minMaxAdjustedQuantity, BigDecimal uomScaleFactor, BigDecimal salesTaxRate)
           
static CalculationRule initCalculationRule(String calculationRuleName, String description, String getPositionAmountsScript, String getContractAmountsScript, javax.jdo.PersistenceManager pm, String providerName, String segmentName)
           
 void markAsClosed(Path contractIdentity, short newContractState)
           
 void markContractAsDirty(Path contractIdentity)
           
 void removeContractPosition(ServiceHeader header, DataproviderObject_1_0 position, boolean checkForMinPositions)
           
 CompoundBooking removePendingInventoryBookings(Path contractIdentity)
          Remove all pending inventory bookings of contract.
 void replaceContractPosition(DataproviderRequest request)
           
 void repriceContract(Path contractIdentity)
           
 short repriceContractPosition(Path contractPositionIdentity)
           
 void updateContract(ServiceHeader header, DataproviderObject object, DataproviderObject_1_0 oldValues)
           
 void updateContractPosition(DataproviderObject_1_0 contract, DataproviderObject position, DataproviderObject_1_0 oldValues, DataproviderObject_1_0 product, boolean reprice)
           
 void updateContractPosition(DataproviderObject object, DataproviderObject_1_0 oldValues)
           
 void updateContractPositionConfigurationProperty(DataproviderObject_1_0 contract, DataproviderObject property, DataproviderObject_1_0 oldValues)
           
 void updateContractPositionPrice(DataproviderObject_1_0 contract, DataproviderObject position, DataproviderObject_1_0 oldValues, DataproviderObject_1_0 product, boolean priceEnabledOverridesPosition)
           
 CompoundBooking updateInventory(Path contractIdentity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CALCULATION_RULE_NAME_DEFAULT

public static final String CALCULATION_RULE_NAME_DEFAULT
See Also:
Constant Field Values

DEFAULT_GET_POSITION_AMOUNTS_SCRIPT

public static final String DEFAULT_GET_POSITION_AMOUNTS_SCRIPT
See Also:
Constant Field Values

DEFAULT_GET_CONTRACT_AMOUNTS_SCRIPT

public static final String DEFAULT_GET_CONTRACT_AMOUNTS_SCRIPT
See Also:
Constant Field Values

getContractAmountMethods

protected static final Map<String,Method> getContractAmountMethods

getPositionAmountMethods

protected static final Map<String,Method> getPositionAmountMethods

cloning

protected final Cloneable cloning

cachedObjects

protected final Map cachedObjects

cachedDescriptions

protected final Map cachedDescriptions
Constructor Detail

Contracts

public Contracts(Backend backend)
Method Detail

findCalculationRule

public static CalculationRule findCalculationRule(String name,
                                                  Segment segment,
                                                  javax.jdo.PersistenceManager pm)

getContractSegment

public static Segment getContractSegment(javax.jdo.PersistenceManager pm,
                                         String providerName,
                                         String segmentName)
Returns:
Returns the contract segment.

initCalculationRule

public static CalculationRule initCalculationRule(String calculationRuleName,
                                                  String description,
                                                  String getPositionAmountsScript,
                                                  String getContractAmountsScript,
                                                  javax.jdo.PersistenceManager pm,
                                                  String providerName,
                                                  String segmentName)

calculateUserHomeCharts

public static void calculateUserHomeCharts(UserHome userHome,
                                           javax.jdo.PersistenceManager pm)
                                    throws ServiceException
Throws:
ServiceException

markAsClosed

public void markAsClosed(Path contractIdentity,
                         short newContractState)
                  throws ServiceException
Throws:
ServiceException

getPositionAmounts

public void getPositionAmounts(DataproviderObject_1_0 calcRule,
                               DataproviderObject_1_0 params,
                               DataproviderObject getPositionAmountsResult)
                        throws ServiceException
Throws:
ServiceException

getPositionAmounts

public GetPositionAmountsResult getPositionAmounts(CalculationRule calculationRule,
                                                   ContractPosition position)
                                            throws ServiceException
Throws:
ServiceException

getContractAmounts

public void getContractAmounts(DataproviderObject_1_0 calcRule,
                               DataproviderObject_1_0 params,
                               DataproviderObject getContractAmountsResult)
                        throws ServiceException
Throws:
ServiceException

getContractAmounts

public GetContractAmountsResult getContractAmounts(CalculationRule calculationRule,
                                                   AbstractContract contract,
                                                   List<?> lineItemNumbers,
                                                   List<?> positionBaseAmounts,
                                                   List<?> positionDiscountAmounts,
                                                   List<?> positionTaxAmounts,
                                                   List<?> positionAmounts,
                                                   List<?> salesCommissions,
                                                   List<?> salesCommissionIsPercentages)
                                            throws ServiceException
Throws:
ServiceException

calculateContractPosition

public void calculateContractPosition(DataproviderObject_1_0 position,
                                      Set<String> fetchSet)
                               throws ServiceException
Throws:
ServiceException

markContractAsDirty

public void markContractAsDirty(Path contractIdentity)
                         throws ServiceException
Throws:
ServiceException

completeContract

public void completeContract(DataproviderObject_1_0 contract,
                             Set<String> fetchSet)
                      throws ServiceException
Throws:
ServiceException

calculateForwardReferences

public void calculateForwardReferences(DataproviderObject_1_0 contract,
                                       Set fetchSet)
                                throws ServiceException
calculate forward references, i.e. Lead --> Opportunity Opportunity --> Quote Quote --> SalesOrder SalesOrder --> Invoice

Throws:
ServiceException

createInvoice

public Invoice createInvoice(Path salesOrderIdentity)
                      throws ServiceException
Throws:
ServiceException

createSalesOrder

public SalesOrder createSalesOrder(Path quoteIdentity)
                            throws ServiceException
Throws:
ServiceException

createQuote

public Quote createQuote(Path opportunityIdentity)
                  throws ServiceException
Throws:
ServiceException

createOpportunity

public Opportunity createOpportunity(Path leadIdentity)
                              throws ServiceException
Throws:
ServiceException

updateContractPositionPrice

public void updateContractPositionPrice(DataproviderObject_1_0 contract,
                                        DataproviderObject position,
                                        DataproviderObject_1_0 oldValues,
                                        DataproviderObject_1_0 product,
                                        boolean priceEnabledOverridesPosition)
                                 throws ServiceException
Throws:
ServiceException

getMaxLineItemNumber

public long getMaxLineItemNumber(DataproviderObject_1_0 contract,
                                 Path parentPositionIdentity)
                          throws ServiceException
Throws:
ServiceException

updateContractPosition

public void updateContractPosition(DataproviderObject_1_0 contract,
                                   DataproviderObject position,
                                   DataproviderObject_1_0 oldValues,
                                   DataproviderObject_1_0 product,
                                   boolean reprice)

updateContractPositionConfigurationProperty

public void updateContractPositionConfigurationProperty(DataproviderObject_1_0 contract,
                                                        DataproviderObject property,
                                                        DataproviderObject_1_0 oldValues)

createContractPosition

public ContractPosition createContractPosition(Path contractIdentity,
                                               Boolean isIgnoreProductConfiguration,
                                               String name,
                                               BigDecimal quantity,
                                               Date pricingDate,
                                               Path productIdentity,
                                               Path uomIdentity,
                                               Path priceUomIdentity,
                                               Path pricingRuleIdentity)

allowPositionRemoval

public boolean allowPositionRemoval(Path contractIdentity,
                                    DataproviderObject_1_0 productRole,
                                    Path parentPositionIdentity)
                             throws ServiceException
Throws:
ServiceException

getNumberPositionsBasedOnProduct

public int getNumberPositionsBasedOnProduct(Path contractIdentity,
                                            DataproviderObject_1_0 product,
                                            Path parentPositionIdentity,
                                            List positions)
                                     throws ServiceException
Throws:
ServiceException

allowPositionCreation

public boolean allowPositionCreation(Path contractIdentity,
                                     DataproviderObject_1_0 product,
                                     Path parentPositionIdentity,
                                     List positions)
                              throws ServiceException
Throws:
ServiceException

removeContractPosition

public void removeContractPosition(ServiceHeader header,
                                   DataproviderObject_1_0 position,
                                   boolean checkForMinPositions)
                            throws ServiceException
Throws:
ServiceException

createDepotReferences

public Set createDepotReferences(Path depotHolderIdentity,
                                 Path positionIdentity,
                                 Set excludeDepotUsage)
                          throws ServiceException
Copy depot references from product role to contract position.

Throws:
ServiceException

getAdjustedLineItemNumber

public long getAdjustedLineItemNumber(long itemNumber,
                                      long lineItemNumber)
Add itemNumber to lineItemNumber. Assert that itemNumber is adjusted to lineItemNumber.


removePendingInventoryBookings

public CompoundBooking removePendingInventoryBookings(Path contractIdentity)
                                               throws ServiceException
Remove all pending inventory bookings of contract. Return last final booking or null if no inventory booking is set on the contract

Throws:
ServiceException

updateInventory

public CompoundBooking updateInventory(Path contractIdentity)
                                throws ServiceException
Throws:
ServiceException

updateContractPosition

public void updateContractPosition(DataproviderObject object,
                                   DataproviderObject_1_0 oldValues)
                            throws ServiceException
Throws:
ServiceException

updateContract

public void updateContract(ServiceHeader header,
                           DataproviderObject object,
                           DataproviderObject_1_0 oldValues)
                    throws ServiceException
Throws:
ServiceException

repriceContractPosition

public short repriceContractPosition(Path contractPositionIdentity)
                              throws ServiceException
Returns:
new pricingState of contract position
Throws:
ServiceException

repriceContract

public void repriceContract(Path contractIdentity)
                     throws ServiceException
Throws:
ServiceException

replaceContractPosition

public void replaceContractPosition(DataproviderRequest request)
                             throws ServiceException
Throws:
ServiceException

getContractFilterProperties

public FilterProperty[] getContractFilterProperties(Path contractFilterIdentity,
                                                    boolean forCounting)
                                             throws ServiceException
Throws:
ServiceException

countFilteredContract

public int countFilteredContract(Path contractFilterIdentity)
                          throws ServiceException
Throws:
ServiceException

getPositionAmounts

public static GetPositionAmountsResult getPositionAmounts(RefPackage_1_0 rootPkg,
                                                          CalculationRule calculationRule,
                                                          ContractPosition position,
                                                          BigDecimal minMaxAdjustedQuantity,
                                                          BigDecimal uomScaleFactor,
                                                          BigDecimal salesTaxRate)

getContractAmounts

public static GetContractAmountsResult getContractAmounts(RefPackage_1_0 rootPkg,
                                                          CalculationRule calculationRule,
                                                          AbstractContract contract,
                                                          Integer[] lineItemNumbers,
                                                          BigDecimal[] positionBaseAmounts,
                                                          BigDecimal[] positionDiscountAmounts,
                                                          BigDecimal[] positionTaxAmounts,
                                                          BigDecimal[] positionAmounts,
                                                          BigDecimal[] salesCommissions,
                                                          Boolean[] salesCommissionIsPercentages)


This software is published under the BSD license. Copyright © 2003-2008, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.