org.opencrx.kernel.backend
Class Contracts

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

public class Contracts
extends AbstractImpl


Field Summary
static String CALCULATION_RULE_NAME_DEFAULT
           
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
protected Contracts()
           
 
Method Summary
 BigDecimal[] calculateAmounts(AbstractContract contract)
           
 BigDecimal[] calculateAmounts(ContractPosition position)
           
 String[] calculatePriceUomDescriptions(ContractPosition position)
           
 String[] calculateProductDescriptions(ContractPosition position)
           
 BigDecimal[] calculateQuantities(ContractPosition position)
           
 String[] calculateSalesTaxTypeDescriptions(ContractPosition position)
           
 String[] calculateUomDescriptions(ContractPosition position)
           
 void calculateUserHomeCharts(UserHome userHome)
           
 int countFilteredContract(AbstractFilterContract contractFilter)
           
 ContractPosition createContractPosition(AbstractContract contract, Boolean isIgnoreProductConfiguration, String name, BigDecimal quantity, Date pricingDate, Product product, Uom uom, Uom priceUom, PricingRule pricingRule)
           
 Invoice createInvoice(SalesOrder salesOrder)
           
 Opportunity createOpportunity(Lead lead)
           
 Quote createQuote(Opportunity opportunity)
           
 SalesOrder createSalesOrder(Quote quote)
           
 CalculationRule findCalculationRule(String name, Segment segment, javax.jdo.PersistenceManager pm)
           
protected  Description getAdditionalDescription(DescriptionContainer container, short language)
           
 GetContractAmountsResult getContractAmounts(CalculationRule calculationRule, AbstractContract contract, List<?> lineItemNumbers, List<?> positionBaseAmounts, List<?> positionDiscountAmounts, List<?> positionTaxAmounts, List<?> positionAmounts, List<?> salesCommissions, List<?> salesCommissionIsPercentages)
           
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)
           
 Segment getContractSegment(javax.jdo.PersistenceManager pm, String providerName, String segmentName)
           
protected  CalculationRule getDefaultCalculationRule(Segment contractSegment)
           
 AbstractContractQuery getFilteredContractQuery(AbstractFilterContract contractFilter, boolean forCounting)
           
static Contracts getInstance()
           
 long getMaxLineItemNumber(Collection<ContractPosition> positions)
           
protected  BigDecimal getMinMaxAdjustedQuantity(ContractPosition position)
           
 GetPositionAmountsResult getPositionAmounts(CalculationRule calculationRule, ContractPosition position)
           
static GetPositionAmountsResult getPositionAmounts(RefPackage_1_0 rootPkg, CalculationRule calculationRule, ContractPosition position, BigDecimal minMaxAdjustedQuantity, BigDecimal uomScaleFactor, BigDecimal salesTaxRate)
           
protected  BigDecimal getSalesTaxRate(ContractPosition position)
           
protected  BigDecimal getUomScaleFactor(ContractPosition position)
           
 CalculationRule initCalculationRule(String calculationRuleName, String description, String getPositionAmountsScript, String getContractAmountsScript, javax.jdo.PersistenceManager pm, String providerName, String segmentName)
           
 void markAsClosed(AbstractContract contract, short newContractState)
           
 void markContractAsDirty(AbstractContract contract)
           
static void register()
           
 void removeContractPosition(ContractPosition position, boolean checkForMinPositions, boolean preDelete)
           
 CompoundBooking removePendingInventoryBookings(AbstractContract contract)
          Remove all pending inventory bookings of contract.
 void repriceContract(AbstractContract contract)
           
 short repriceContractPosition(ContractPosition position)
           
 void updateContract(AbstractContract contract)
           
 void updateContractPosition(AbstractContract contract, ContractPosition position, Product product, boolean reprice)
           
 void updateContractPosition(ContractPosition position)
           
 CompoundBooking updateInventory(AbstractContract contract)
           
 void updateListPrice(ContractPosition position, AbstractContract contract, Product product, boolean overrideExistingPrice)
           
 
Methods inherited from class org.opencrx.kernel.backend.AbstractImpl
getInstance, getUidAsString, registerImpl
 
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
Constructor Detail

Contracts

protected Contracts()
Method Detail

register

public static void register()

getInstance

public static Contracts getInstance()
                             throws ServiceException
Throws:
ServiceException

findCalculationRule

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

getContractSegment

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

initCalculationRule

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

calculateUserHomeCharts

public void calculateUserHomeCharts(UserHome userHome)
                             throws ServiceException
Throws:
ServiceException

getAdditionalDescription

protected Description getAdditionalDescription(DescriptionContainer container,
                                               short language)
                                        throws ServiceException
Throws:
ServiceException

getDefaultCalculationRule

protected CalculationRule getDefaultCalculationRule(Segment contractSegment)
                                             throws ServiceException
Throws:
ServiceException

markAsClosed

public void markAsClosed(AbstractContract contract,
                         short newContractState)
                  throws ServiceException
Throws:
ServiceException

getUomScaleFactor

protected BigDecimal getUomScaleFactor(ContractPosition position)

getSalesTaxRate

protected BigDecimal getSalesTaxRate(ContractPosition position)

getMinMaxAdjustedQuantity

protected BigDecimal getMinMaxAdjustedQuantity(ContractPosition position)

getPositionAmounts

public GetPositionAmountsResult getPositionAmounts(CalculationRule calculationRule,
                                                   ContractPosition position)
                                            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

calculateAmounts

public BigDecimal[] calculateAmounts(ContractPosition position)
                              throws ServiceException
Throws:
ServiceException

calculateQuantities

public BigDecimal[] calculateQuantities(ContractPosition position)

calculateUomDescriptions

public String[] calculateUomDescriptions(ContractPosition position)

calculatePriceUomDescriptions

public String[] calculatePriceUomDescriptions(ContractPosition position)

calculateProductDescriptions

public String[] calculateProductDescriptions(ContractPosition position)

calculateSalesTaxTypeDescriptions

public String[] calculateSalesTaxTypeDescriptions(ContractPosition position)

markContractAsDirty

public void markContractAsDirty(AbstractContract contract)
                         throws ServiceException
Throws:
ServiceException

calculateAmounts

public BigDecimal[] calculateAmounts(AbstractContract contract)
                              throws ServiceException
Throws:
ServiceException

updateContract

public void updateContract(AbstractContract contract)
                    throws ServiceException
Throws:
ServiceException

createInvoice

public Invoice createInvoice(SalesOrder salesOrder)
                      throws ServiceException
Throws:
ServiceException

createSalesOrder

public SalesOrder createSalesOrder(Quote quote)
                            throws ServiceException
Throws:
ServiceException

createQuote

public Quote createQuote(Opportunity opportunity)
                  throws ServiceException
Throws:
ServiceException

createOpportunity

public Opportunity createOpportunity(Lead lead)
                              throws ServiceException
Throws:
ServiceException

updateListPrice

public void updateListPrice(ContractPosition position,
                            AbstractContract contract,
                            Product product,
                            boolean overrideExistingPrice)
                     throws ServiceException
Throws:
ServiceException

getMaxLineItemNumber

public long getMaxLineItemNumber(Collection<ContractPosition> positions)
                          throws ServiceException
Throws:
ServiceException

updateContractPosition

public void updateContractPosition(AbstractContract contract,
                                   ContractPosition position,
                                   Product product,
                                   boolean reprice)

createContractPosition

public ContractPosition createContractPosition(AbstractContract contract,
                                               Boolean isIgnoreProductConfiguration,
                                               String name,
                                               BigDecimal quantity,
                                               Date pricingDate,
                                               Product product,
                                               Uom uom,
                                               Uom priceUom,
                                               PricingRule pricingRule)

removeContractPosition

public void removeContractPosition(ContractPosition position,
                                   boolean checkForMinPositions,
                                   boolean preDelete)
                            throws ServiceException
Throws:
ServiceException

removePendingInventoryBookings

public CompoundBooking removePendingInventoryBookings(AbstractContract contract)
                                               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(AbstractContract contract)
                                throws ServiceException
Throws:
ServiceException

updateContractPosition

public void updateContractPosition(ContractPosition position)
                            throws ServiceException
Throws:
ServiceException

repriceContractPosition

public short repriceContractPosition(ContractPosition position)
                              throws ServiceException
Throws:
ServiceException

repriceContract

public void repriceContract(AbstractContract contract)
                     throws ServiceException
Throws:
ServiceException

getFilteredContractQuery

public AbstractContractQuery getFilteredContractQuery(AbstractFilterContract contractFilter,
                                                      boolean forCounting)
                                               throws ServiceException
Throws:
ServiceException

countFilteredContract

public int countFilteredContract(AbstractFilterContract contractFilter)
                          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-2009, CRIXP AG, Switzerland, All rights reserved. Use is subject to license terms.