com.ibm.commerce.utf.utils
Class UTFCmdUtil

java.lang.Object
  |
  +--com.ibm.commerce.utf.utils.UTFCmdUtil

public class UTFCmdUtil
extends java.lang.Object

The class UTFCmdUtil includes static methods for creating XML fragments for various terms and conditions. It also has utility methods to process multi-valued attributes.


Field Summary
static java.lang.String CLASSNAME
           
static java.lang.String COPYRIGHT
           
 
Constructor Summary
UTFCmdUtil()
          UTFCmdUtil constructor.
 
Method Summary
static org.w3c.dom.Element createCustomPriceListTCElement(java.lang.String priceListName, RFQProduct[] offerlist, java.lang.String pListOwner, java.lang.String precedence)
          Creates the custom price list fragment of the Trading DTD.
static org.w3c.dom.Element createOrderTCOrderComments(java.lang.String comment, java.lang.Integer mandatory, java.lang.Integer changeable)
          Creates the OrderTCOrderComments fragments of the Trading DTD using the incoming free form comment.
static org.w3c.dom.Element createOrderTCOrderItemPAttribute(java.lang.Long catentry_id, java.lang.String attrName, java.lang.String operator, java.lang.String[] operatorArray, java.lang.String unit, java.lang.String[] values, java.lang.Integer mandatory, java.lang.Integer changeable)
          This method creates the OrderItemPAttribute TC fragment of the Trading DTD for the incoming attribute.
static org.w3c.dom.Element createPaymentTCElement(java.lang.String billToNickName, java.lang.String billToMemberId, java.lang.String policyName, java.lang.String policyType, java.lang.String storeIdentity, java.lang.String storeMemberId)
          This method creates the Payment TC fragment of the Trading DTD.
static org.w3c.dom.Element createReturnTCRefundPaymentMethodElement(java.lang.String policyName, java.lang.String policyType, java.lang.String storeIdentity, java.lang.String storeMemberId)
          This method creates the RefundPaymentMethod TC fragment of the Trading DTD.
static org.w3c.dom.Element createReturnTCReturnChargeElement(java.lang.String returnChargePolicyName, java.lang.String returnChargePolicyType, java.lang.String returnChargeStoreIdentity, java.lang.String returnChargeStoreMemberId, java.lang.String returnApprovalPolicyName, java.lang.String returnApprovalPolicyType, java.lang.String returnApprovalStoreIdentity, java.lang.String returnApprovalStoreMemberId)
          This method creates the ReturnCharge TC fragment of the Trading DTD
static org.w3c.dom.Element createShippingTCShippingAddressElement(java.lang.String nickname, java.lang.String memberId)
          This method creates the ShippingAddress TC fragment of the Trading DTD.
static org.w3c.dom.Element createShippingTCShippingChargeElement(java.lang.String policyName, java.lang.String policyType, java.lang.String storeIdentity, java.lang.String storeMemberId)
          This method creates the ShippingCharge TC fragment of the Trading DTD
static org.w3c.dom.Element createShippingTCShippingModeElement(java.lang.String policyName, java.lang.String policyType, java.lang.String storeIdentity, java.lang.String storeMemberId)
          This method creates the ShippingMode TC fragment of the Trading DTD.
static java.lang.Integer determineDisplayOperatorForMultiValuedAttributes(java.lang.Integer[] operatorArray)
          Returns a single operator for display for both single-valued and multi-valued attributes.
For multi-valued attributes, the user might have input a single operator say "Inclusive Range", but the operators stored with each value are different.
static java.lang.String getDistinguishedName(java.lang.String memberId, java.lang.String memberType)
          Returns the distinguishing name for a user, member group or organization.
static java.lang.String[] getOperatorsIntoArray(java.lang.Integer operator, java.lang.String[] valueArray)
          Processes the single operator that has been input by the user into one or more operators depending on the length of the incoming array of values.
static java.lang.String getStoreGroupIdForStore(java.lang.String storeEntityId)
          If the incoming store entity is a store, returns the identifier of the store group this store belongs to.
static java.lang.String[] getValuesIntoArrray(java.lang.String value, java.lang.String delimiter)
          Splits the incoming value into a set of values using the value delimiter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSNAME

public static final java.lang.String CLASSNAME

COPYRIGHT

public static final java.lang.String COPYRIGHT
Constructor Detail

UTFCmdUtil

public UTFCmdUtil()
UTFCmdUtil constructor.
Method Detail

createCustomPriceListTCElement

public static org.w3c.dom.Element createCustomPriceListTCElement(java.lang.String priceListName,
                                                                 RFQProduct[] offerlist,
                                                                 java.lang.String pListOwner,
                                                                 java.lang.String precedence)
                                                          throws java.lang.Exception
Creates the custom price list fragment of the Trading DTD.
Parameters:
priceListName - The name of the price list.
offerlist - An array of catalog entry identifiers.
pListOwner - The identifier of the member who will own the price list.
precedence - A number that assigns priority to offers, so that when multiple offers are effective at a time, the one with highest precedence may be used.
Returns:
org.w3c.dom.Element

createOrderTCOrderComments

public static org.w3c.dom.Element createOrderTCOrderComments(java.lang.String comment,
                                                             java.lang.Integer mandatory,
                                                             java.lang.Integer changeable)
                                                      throws java.lang.Exception
Creates the OrderTCOrderComments fragments of the Trading DTD using the incoming free form comment.
Parameters:
comment - A free form comment that need to be converted into a T&C.
mandatory - If set to 1, indicates that this comment is to be responded to.
changeable - If set to 1,indicates that an alternate comment could be specified in the response.
Returns:
org.w3c.dom.Element

createOrderTCOrderItemPAttribute

public static org.w3c.dom.Element createOrderTCOrderItemPAttribute(java.lang.Long catentry_id,
                                                                   java.lang.String attrName,
                                                                   java.lang.String operator,
                                                                   java.lang.String[] operatorArray,
                                                                   java.lang.String unit,
                                                                   java.lang.String[] values,
                                                                   java.lang.Integer mandatory,
                                                                   java.lang.Integer changeable)
                                                            throws java.lang.Exception
This method creates the OrderItemPAttribute TC fragment of the Trading DTD for the incoming attribute.
Parameters:
catentry_id - The catalog entry identifier.
attrName - The name of the personalized attribute.
operator - A single operator symbol as specified by the user.
operatorArray - An array of operators to be used in conjunction with the incoming array of values.
values - An array of attribute values.
mandatory - If set to 1, this attribute must be included in the response.
changeable - If set to 1, the attribute value may be changed in the response.
Returns:
org.w3c.dom.Element

createPaymentTCElement

public static org.w3c.dom.Element createPaymentTCElement(java.lang.String billToNickName,
                                                         java.lang.String billToMemberId,
                                                         java.lang.String policyName,
                                                         java.lang.String policyType,
                                                         java.lang.String storeIdentity,
                                                         java.lang.String storeMemberId)
                                                  throws java.lang.Exception
This method creates the Payment TC fragment of the Trading DTD.
Parameters:
billToNickName - The identifier for the billing address.
billToMemberId - The identifier of the member who is to be billed.
policyName - The name of the payment policy.
policyType - The type of the payment policy.
storeIdentity - The identifier of the store for which this policy is defined.
storeMemberId - The identifier of the store owner.
Returns:
org.w3c.dom.Element

createReturnTCRefundPaymentMethodElement

public static org.w3c.dom.Element createReturnTCRefundPaymentMethodElement(java.lang.String policyName,
                                                                           java.lang.String policyType,
                                                                           java.lang.String storeIdentity,
                                                                           java.lang.String storeMemberId)
                                                                    throws java.lang.Exception
This method creates the RefundPaymentMethod TC fragment of the Trading DTD.
Parameters:
policyName - The name of the RefundPayment policy.
policyType - The type of the RefundPayment policy.
storeIdentity - The identifier of the store for which this policy is defined.
storeMemberId - The identifier of the store owner.
Returns:
org.w3c.dom.Element

createReturnTCReturnChargeElement

public static org.w3c.dom.Element createReturnTCReturnChargeElement(java.lang.String returnChargePolicyName,
                                                                    java.lang.String returnChargePolicyType,
                                                                    java.lang.String returnChargeStoreIdentity,
                                                                    java.lang.String returnChargeStoreMemberId,
                                                                    java.lang.String returnApprovalPolicyName,
                                                                    java.lang.String returnApprovalPolicyType,
                                                                    java.lang.String returnApprovalStoreIdentity,
                                                                    java.lang.String returnApprovalStoreMemberId)
                                                             throws java.lang.Exception
This method creates the ReturnCharge TC fragment of the Trading DTD
Parameters:
returnChargePolicyName - The name of the return charge policy.
returnChargePolicyType - The type of the return charge policy.
returnChargeStoreIdentity - The identifier of the store that owns the return charge policy.
returnChargeStoreMemberId - The identifier of the owner for the above store.
returnApprovalPolicyName - The name of the return approval policy.
returnApprovalPolicyType - The type of the return approval policy.
returnApprovalStoreIdentity - The identifier of the store that owns the return approval policy.
returnApprovalStoreMemberId - The identifier of the owner for the above store.
Returns:
org.w3c.dom.Element

createShippingTCShippingAddressElement

public static org.w3c.dom.Element createShippingTCShippingAddressElement(java.lang.String nickname,
                                                                         java.lang.String memberId)
                                                                  throws java.lang.Exception
This method creates the ShippingAddress TC fragment of the Trading DTD.
Parameters:
nickname - The identifier for the shipping address.
memberId - The identifier of the member who has this nickname in his/her address book.
Returns:
org.w3c.dom.Element

createShippingTCShippingChargeElement

public static org.w3c.dom.Element createShippingTCShippingChargeElement(java.lang.String policyName,
                                                                        java.lang.String policyType,
                                                                        java.lang.String storeIdentity,
                                                                        java.lang.String storeMemberId)
                                                                 throws java.lang.Exception
This method creates the ShippingCharge TC fragment of the Trading DTD
Parameters:
policyName - The name of the ShippingCharge policy.
policyType - The type of the ShippingCharge policy.
storeIdentity - The identifier of the store for which this policy is defined.
storeMemberId - The identifier of the store owner.
Returns:
org.w3c.dom.Element

createShippingTCShippingModeElement

public static org.w3c.dom.Element createShippingTCShippingModeElement(java.lang.String policyName,
                                                                      java.lang.String policyType,
                                                                      java.lang.String storeIdentity,
                                                                      java.lang.String storeMemberId)
                                                               throws java.lang.Exception
This method creates the ShippingMode TC fragment of the Trading DTD.
Parameters:
policyName - The name of the ShippingMode policy.
policyType - The type of the ShippingMode policy.
storeIdentity - The identifier of the store for which this policy is defined.
storeMemberId - The identifier of the store owner.
Returns:
org.w3c.dom.Element

determineDisplayOperatorForMultiValuedAttributes

public static java.lang.Integer determineDisplayOperatorForMultiValuedAttributes(java.lang.Integer[] operatorArray)
Returns a single operator for display for both single-valued and multi-valued attributes.
For multi-valued attributes, the user might have input a single operator say "Inclusive Range", but the operators stored with each value are different. Consider this attribute definition:

Attribute Name = "Length"
Operator = "Inclusive Range"
Value = 20-40
Unit = metre

Essentially, the user has specified that the length should be between 20 and 40 metres, 20 and 40 inclusive. However, this information is parsed out into two sets of detail:

Length >= 20
Length <= 40

Therefore, when retrieving this information, it becomes necessary to convert multiple operators into a single operator, in this case "Inclusive Range" for display purposes.

Parameters:
policyName - The name of the ShippingCharge policy.
policyType - The type of the ShippingCharge policy.
storeIdentity - The identifier of the store for which this policy is defined.
storeMemberId - The identifier of the store owner.
Returns:
org.w3c.dom.Element

getDistinguishedName

public static java.lang.String getDistinguishedName(java.lang.String memberId,
                                                    java.lang.String memberType)
                                             throws javax.naming.NamingException,
                                                    java.rmi.RemoteException,
                                                    javax.ejb.FinderException,
                                                    javax.ejb.CreateException
Returns the distinguishing name for a user, member group or organization.
Parameters:
memberId - The identifier of the member.
memberType - The type of the member.
Returns:
The distinguishing name of the member.

getOperatorsIntoArray

public static java.lang.String[] getOperatorsIntoArray(java.lang.Integer operator,
                                                       java.lang.String[] valueArray)
Processes the single operator that has been input by the user into one or more operators depending on the length of the incoming array of values. For multi-valued attributes, the user might have input a single operator say "Inclusive Range", but the operators stored with each value are different. Consider this attribute definition:

Attribute Name = "Length"
Operator = "Inclusive Range"
Value = 20-40
Unit = metre

Essentially, the user has specified that the length should be between 20 and 40 metres, 20 and 40 inclusive. However, this information is parsed out into two sets of detail:

Length >= 20
Length <= 40

Therefore, when saving this information, it becomes necessary to convert a single operator into a set of operators, one for each value, in this case ">=" and "<=".

Parameters:
operator - The single operator specified by the user.
valueArray - One or more values for a attribute.
Returns:
An array of operators, one for each value.

getStoreGroupIdForStore

public static java.lang.String getStoreGroupIdForStore(java.lang.String storeEntityId)
If the incoming store entity is a store, returns the identifier of the store group this store belongs to.
Parameters:
storeEntityId - The identifier of the store entity.
Returns:
The store group Id of the store, or null.

getValuesIntoArrray

public static java.lang.String[] getValuesIntoArrray(java.lang.String value,
                                                     java.lang.String delimiter)
Splits the incoming value into a set of values using the value delimiter.

If the incoming value is 20-40-50 and the value delimiter is "-", returns an array consisting of 20, 40 and 50 as three values.

Parameters:
value - The value that needs to be split into multiple values.
delimiter - The delimiter at which the split is to take place.
Returns:
An array of values.