public class AccountCmdUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASSNAME
The name of this class.
|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
Constructor and Description |
---|
AccountCmdUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
accountAttachmentSet(java.lang.Long argTradingId,
org.w3c.dom.Element argAttachmentElement,
java.lang.Long argOwnerId,
java.lang.String argUsageId)
Adds an attachment to the attachment table if the attachment does not exist yet,
and create a relationship between the specified trading agreement and the attachment.
|
static void |
accountAttachmentSet(java.lang.Long argTradingId,
java.lang.Long argOwnerId,
java.lang.String usageId,
java.lang.String uri,
java.lang.String mimeType,
java.lang.String mimeTypeEncoding)
Adds an attachment to the attachment table if the attachment does not exist yet,
and create a relationship between the specified trading agreement and the attachment.
|
static void |
accountDescriptionSet(org.w3c.dom.Element argAccountDescElement,
java.lang.Long argAccountId,
java.sql.Timestamp currentTime)
Adds or updates the business account description.
|
static void |
addParticipants(org.w3c.dom.NodeList argParticipants,
java.lang.Long argTradingId,
java.lang.Long argTCId,
java.sql.Timestamp currentTime)
Adds a participant to either trading agreement or terms and conditions
|
static void |
checkAccountHolderAndBuyers(java.lang.Long anAccountId)
Checks the account holder and buyer participants.
|
static void |
checkAccountLastUpdated(java.lang.String accountId,
java.lang.String lastUpdatedTime,
com.ibm.commerce.datatype.TypedProperty responseProperties,
java.lang.String returnViewForTools)
Checks the last updated time.
|
static void |
checkAccountParticipants(java.lang.Long anAccountId,
org.w3c.dom.NodeList aParticipants,
boolean bUpdateAccount)
Checks the business account participants (This method is for DTD based xml instance).
|
static void |
checkXSDBasedAccountParticipants(java.lang.Long anAccountId,
org.w3c.dom.NodeList aParticipants,
boolean bUpdateAccount)
Checks the business account participants (This method is for XSD based xml instance).
|
static java.lang.Long |
createNewAccount(org.w3c.dom.Element argAccount,
java.sql.Timestamp currentTime)
Creates the business account based on the given account Element object (This method is for DTD based xml instance).
|
static java.lang.Long |
getAccountOwnerIdFromAccountElement(org.w3c.dom.Element aelmAccount)
Returns the business account owner ID (This method is for DTD based xml instance).
|
static java.lang.Long |
getAccountOwnerIdFromXSDAccountElement(org.w3c.dom.Element accountUniqueKeyElm)
Returns the account owner id.
|
static java.lang.Integer |
getAccountParticipantRole(java.lang.String prty)
Gets the participant role of a participant based on the given participant role string.
|
static java.lang.String |
getAccountParticipantRoleInString(java.lang.Integer index)
Get the participant role of a participant based on the given participant role.
|
static java.lang.Integer |
getAccountState(com.ibm.commerce.payment.objects.AccountAccessBean abAccount)
Gets the state of the business account.
|
static java.lang.Integer |
getAccountState(java.lang.Long accountId)
Gets the state of the specified business account.
|
static java.lang.Integer |
getAccountState(java.lang.String state)
Gets the state of the business account based on the given business account state string.
|
static java.lang.String |
getAccountStateInString(java.lang.Integer index)
Gets the state of the business account based on the given business account state integer.
|
static java.lang.String |
getMemberType(org.w3c.dom.Element aelmParticipant)
Returns the member type of the given participant (This method is for DTD based xml instance).
|
static int |
getNumberOfParticipants(java.lang.Long anAccountId,
java.lang.Integer anRole)
Returns the number of the participants in the given business account which has the specified role type.
|
static java.lang.String |
getParticipantMemberType(org.w3c.dom.Element aelmParticipant)
Returns the member type of the given participant (This method is for XSD based xml instance).
|
static java.lang.Integer |
getStoreIdFromAccountElement(org.w3c.dom.Element aelmAccount)
Returns the ID of the store which business account belongs to (This method is for DTD based xml instance).
|
static java.lang.Integer |
getStoreIdFromXSDBasedAccountElement(org.w3c.dom.Element aelmAccount)
Returns the ID of the store which business account belongs to (This method is for DTD based xml instance).
|
static org.w3c.dom.Document |
getXMLDocumentObjectFromFile(java.lang.String xmlFileName)
Gets the xml Document object based on the specified xml instance file name (This method is for DTD based xml instance).
|
static org.w3c.dom.Document |
getXMLDocumentObjectFromReader(java.io.Reader reader)
Gets the xml Document object based on the specified Reader object (This method is for DTD based xml instance).
|
static boolean |
isDescendant(java.lang.Long anDescendantId,
java.lang.Long anAncestorId)
Checks if the first member ID is the descendant of the second member ID.
|
static boolean |
isMemberGroup(java.lang.Long anMemberId)
Checks if the given member ID is a member group
|
static java.lang.Long |
saveAccount(org.w3c.dom.Element argAccount,
java.sql.Timestamp currentTime,
boolean actionFlag)
Saves the business account (This method is for XSD based xml instance).
|
static void |
setAccountState(com.ibm.commerce.payment.objects.AccountAccessBean abAccount,
java.lang.Integer state)
Sets the state of the specified business account to the given state.
|
static void |
setAccountState(java.lang.Long accountId,
java.lang.Integer state)
Sets the state of the specified business account to the given state.
|
static void |
tcDescriptionSet(org.w3c.dom.Element argTCElement,
java.lang.Long argTCId)
Sets term and condition description.
|
static java.lang.Long |
updateAccount(org.w3c.dom.Element argAccount,
java.sql.Timestamp currentTime)
Updates the business account based on the given account Element object (This method is for DTD based xml instance).
|
static void |
validateAccount(java.lang.Long accountId,
java.lang.Integer targetStoreId)
Validate the business account.
|
static void |
validateAccount(java.lang.Long accountId,
java.lang.Integer targetStoreId,
java.lang.String returnView,
com.ibm.commerce.datatype.TypedProperty respProps)
Validate the business account.
|
static com.ibm.commerce.datatype.TypedProperty |
validateAccountAttributes(org.w3c.dom.Element accountElement,
com.ibm.commerce.datatype.TypedProperty responseProperties,
java.lang.String returnViewForTools,
java.lang.String actionFlag)
Validates the attributes and some of the child elements of the account element.
|
public static final java.lang.String CLASSNAME
public static final java.lang.String COPYRIGHT
public static void accountAttachmentSet(java.lang.Long argTradingId, org.w3c.dom.Element argAttachmentElement, java.lang.Long argOwnerId, java.lang.String argUsageId) throws javax.ejb.RemoveException
argAttachmentElement
- the attachment Element objectargTradingId
- the ID of the trading agreementargOwnerId
- the ID of the owner of the attachmentargUsageId
- the ID of the usage of the attachmentjavax.ejb.RemoveException
public static void accountAttachmentSet(java.lang.Long argTradingId, java.lang.Long argOwnerId, java.lang.String usageId, java.lang.String uri, java.lang.String mimeType, java.lang.String mimeTypeEncoding)
argTradingId
- id of the trading agreementargOwnerId
- the id of the attachment's ownerargUsageId
- the id of the attachment usageuri
- the attachment urimimeType
- the mime type of the attachmentmimeTypeEncoding
- the mime type encoding of the attachmentpublic static void accountDescriptionSet(org.w3c.dom.Element argAccountDescElement, java.lang.Long argAccountId, java.sql.Timestamp currentTime) throws com.ibm.commerce.exception.ECApplicationException
argAccountDescElement
- the business account description Element objectargAccountId
- the ID of the business accountcurrentTime
- The Timestamp object represents the current time.com.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the language ID which provided in the description Element cannot converted the language ID to an Integer objectpublic static void addParticipants(org.w3c.dom.NodeList argParticipants, java.lang.Long argTradingId, java.lang.Long argTCId, java.sql.Timestamp currentTime) throws com.ibm.commerce.contract.helper.TermCondCreateException, javax.ejb.RemoveException, com.ibm.commerce.exception.ECException
argParticipants
- the list of the participant objectargTradingId
- the trading agreement IDargTCId
- the term and condition IDcurrentTime
- the Timestamp object of the current timejavax.ejb.RemoveException
com.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_ACCOUNT_RESOLVE_PARTICIPANT_MEMBER_ID if the member ID of the participant cannot be resolved.
Raised with message _ERR_TERM_CONDITION_PARTICIPANT_ROLE if the role of a term and condition participant is not "Buyer".com.ibm.commerce.contract.helper.TermCondCreateException
com.ibm.commerce.exception.ECException
public static void checkAccountHolderAndBuyers(java.lang.Long anAccountId) throws com.ibm.commerce.exception.ECException
anAccountId
- the ID of the business accountcom.ibm.commerce.exception.ECException
- Raised with message _ERR_ACCOUNT_PARTICIPANT_INVALID_MULTIPLICITY if there is no or more than one AccountHolder participant in the business account.
Raised with message _ERR_ACCOUNT_PARTICIPANT_GENERIC_ERROR if the one of the cases 2, 3, 4, 5 happened.public static void checkAccountLastUpdated(java.lang.String accountId, java.lang.String lastUpdatedTime, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools) throws com.ibm.commerce.exception.ECApplicationException
accountId
- the ID of the business accountlastUpdatedTime
- The user provided last updated time of a trading agreement.responseProperties
- the response property objectreturnViewForTools
- the return view name for tools GUIcom.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_TRADING_HAS_BEEN_CHANGED if the utime and the lastUpdatedTims are not the same.public static void checkAccountParticipants(java.lang.Long anAccountId, org.w3c.dom.NodeList aParticipants, boolean bUpdateAccount) throws com.ibm.commerce.exception.ECException
anAccountId
- the ID of the business accountaParticipant
- the list of the participant Node elementbUpdateAccount
- the flag to indicate the action; true - updating; false - creatingcom.ibm.commerce.exception.ECException
- Raised with message _ERR_ACCOUNT_PARTICIPANT_INVALID_MEMBER_TYPE if the member type of the participant is incorrect.
Raised with message _ERR_ACCOUNT_PARTICIPANT_INVALID_MULTIPLICITY if the occurrence of a specific role of participant is incorrect.public static void checkXSDBasedAccountParticipants(java.lang.Long anAccountId, org.w3c.dom.NodeList aParticipants, boolean bUpdateAccount) throws com.ibm.commerce.exception.ECException
anAccountId
- the ID of the business accountaParticipant
- the list of the participant Node elementbUpdateAccount
- the flag to indicate the action; true - updating; false - creatingcom.ibm.commerce.exception.ECException
- Raised with message _ERR_ACCOUNT_PARTICIPANT_INVALID_MEMBER_TYPE if the member type of the participant is incorrect.
Raised with message _ERR_ACCOUNT_PARTICIPANT_INVALID_MULTIPLICITY if the occurrence of a specific role of participant is incorrect.public static java.lang.Long createNewAccount(org.w3c.dom.Element argAccount, java.sql.Timestamp currentTime) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException, java.sql.SQLException
argAccount
- the business account Element object.currentTime
- The Timestamp object represents the current time.java.sql.SQLException
com.ibm.commerce.exception.ECApplicationException
com.ibm.commerce.contract.helper.TermCondCreateException
getAccountOwnerIdFromAccountElement(Element aelmAccount)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getTimeFromElement(Element anElement, String tag, Timestamp time)
,
getStoreIdFromAccountElement(Element aelmAccount)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getIntegerFromTrueOrFalse(String str)
,
getAccountState(String state)
public static java.lang.Long getAccountOwnerIdFromAccountElement(org.w3c.dom.Element aelmAccount) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException
the
- account Element objectcom.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_ACCOUNT_RESOLVE_OWNER_ID if the account owner ID cannot be resolved based on the information provided by the element object.com.ibm.commerce.contract.helper.TermCondCreateException
ContractUtil.getMemberId(Element argMemberElement)
public static java.lang.Long getAccountOwnerIdFromXSDAccountElement(org.w3c.dom.Element accountUniqueKeyElm) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException
accountUniqueKeyElm
- the account unique key Element objectcom.ibm.commerce.exception.ECApplicationException
- Raised with the message _ERR_RETRIEVE_MEMBER_GROUP_ID if the membergroup id cannot be retrived.
Raised with the message _ERR_RETRIEVE_USER_ID if the user id cannot be retrived..
Raised with the message _ERR_RETRIEVE_ORG_ID if the orgination id cannot be retrived.com.ibm.commerce.contract.helper.TermCondCreateException
ContractUtil.getXSDMemberId(Element argElement)
public static java.lang.Integer getAccountParticipantRole(java.lang.String prty)
prty
- the participant role type in String objectpublic static java.lang.String getAccountParticipantRoleInString(java.lang.Integer index)
index
- the participant role type in Integer objectpublic static java.lang.Integer getAccountState(com.ibm.commerce.payment.objects.AccountAccessBean abAccount)
abAccount
- the AccountAccessBean of the business accountpublic static java.lang.Integer getAccountState(java.lang.Long accountId)
accountId
- the ID of the business accountpublic static java.lang.Integer getAccountState(java.lang.String state)
the
- business account state stringpublic static java.lang.String getAccountStateInString(java.lang.Integer index)
index
- the state of the business accountpublic static java.lang.String getMemberType(org.w3c.dom.Element aelmParticipant) throws com.ibm.commerce.exception.ECException
aelmParticipant
- the participant Element objectcom.ibm.commerce.exception.ECException
public static int getNumberOfParticipants(java.lang.Long anAccountId, java.lang.Integer anRole) throws com.ibm.commerce.exception.ECException
anAccountId
- the ID of the business accountanRole
- the role of the participantanRole
in the given business accountcom.ibm.commerce.exception.ECException
- Raised with message _ERR_FINDER_EXCEPTION if the FinderException occurred.
Raised with message _ERR_NAMING_EXCEPTION if the NamingException occurred.
Raised with message _ERR_REMOTE_EXCEPTION if the RemoteException occurred.public static java.lang.String getParticipantMemberType(org.w3c.dom.Element aelmParticipant)
aelmParticipant
- the participant Element objectpublic static java.lang.Integer getStoreIdFromAccountElement(org.w3c.dom.Element aelmAccount) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException
aelmAccount
- the business account Element objectcom.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_ACCOUNT_RESOLVE_STORE_OWNER_ID if the store owner ID cannot be resolved.
Raised with message _ERR_ACCOUNT_RESOLVE_STORE_ID if the store ID cannot be resolved.com.ibm.commerce.contract.helper.TermCondCreateException
public static java.lang.Integer getStoreIdFromXSDBasedAccountElement(org.w3c.dom.Element aelmAccount) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException
aelmAccount
- the business account Element objectcom.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_ACCOUNT_RESOLVE_STORE_OWNER_ID if the store owner ID cannot be resolved.
Raised with message _ERR_ACCOUNT_RESOLVE_STORE_ID if the store ID cannot be resolved.com.ibm.commerce.contract.helper.TermCondCreateException
public static org.w3c.dom.Document getXMLDocumentObjectFromFile(java.lang.String xmlFileName) throws org.xml.sax.SAXParseException, java.io.FileNotFoundException, org.xml.sax.SAXException, java.io.IOException
xmlFileName
- the name of the xml instance filejava.io.FileNotFoundException
java.io.IOException
org.xml.sax.SAXParseException
org.xml.sax.SAXException
ContractCmdUtil.getXMLDocumentObjectFromFile(String xmlFileName)
public static org.w3c.dom.Document getXMLDocumentObjectFromReader(java.io.Reader reader) throws org.xml.sax.SAXException, java.io.IOException
reader
- The Readed object includes the xml instance.java.io.IOException
org.xml.sax.SAXException
ContractCmdUtil.getXMLDocumentObjectFromReader(Reader reader)
public static boolean isDescendant(java.lang.Long anDescendantId, java.lang.Long anAncestorId) throws com.ibm.commerce.exception.ECException
anDescendantId
- the ID of the descendantanAncestorId
- the ID of the ancestoranDescendantId
is the descendant of the anAncestorId
; false otherwisecom.ibm.commerce.exception.ECException
- Raised with message _ERR_FINDER_EXCEPTION if the FinderException occurred.
Raised with message _ERR_NAMING_EXCEPTION if the NamingException occurred.
Raised with message _ERR_REMOTE_EXCEPTION if the RemoteException occurred.public static boolean isMemberGroup(java.lang.Long anMemberId) throws com.ibm.commerce.exception.ECException
anMemberId
- the ID of the member to be checkedcom.ibm.commerce.exception.ECException
- Raised with message _ERR_FINDER_EXCEPTION if the FinderException occurred.
Raised with message _ERR_NAMING_EXCEPTION if the NamingException occurred.
Raised with message _ERR_REMOTE_EXCEPTION if the RemoteException occurred.
Raised with message _ERR_CREATE_EXCEPTION if the CreateException occurred.public static java.lang.Long saveAccount(org.w3c.dom.Element argAccount, java.sql.Timestamp currentTime, boolean actionFlag) throws com.ibm.commerce.contract.helper.TermCondCreateException, com.ibm.commerce.exception.ECApplicationException, java.sql.SQLException
actionFlag
is set to true, a new account will be created, otherwise
the specified business account will be updated.argAccount
- the business account Element objectcurrentTime
- The Timestamp object represents the current time.actionFlag
- the flag which indicates the action; true if it is creating; false updating.java.sql.SQLException
com.ibm.commerce.exception.ECApplicationException
com.ibm.commerce.contract.helper.TermCondCreateException
getAccountOwnerIdFromXSDAccountElement(Element accountUniqueKeyElm)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getTimeFromXSDElement(Element anElement, String tag, Timestamp time)
,
getStoreIdFromXSDBasedAccountElement(Element aelmAccount)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getIntegerFromTrueOrFalse(String str)
,
getAccountState(String state)
public static void setAccountState(com.ibm.commerce.payment.objects.AccountAccessBean abAccount, java.lang.Integer state)
abAccount
- the AccountAccessBean object of the specified business accountstate
- the state of the business account to bepublic static void setAccountState(java.lang.Long accountId, java.lang.Integer state)
accountId
- the ID of the business accountstate
- the state of the business account to bepublic static void tcDescriptionSet(org.w3c.dom.Element argTCElement, java.lang.Long argTCId) throws com.ibm.commerce.exception.ECApplicationException
tcDescElement
- the term and condition description Element objectargTCId
- the term and condition IDcom.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_NUMBER_FORMAT_EXCEPTION if the language ID of the description cannot be resolved.public static java.lang.Long updateAccount(org.w3c.dom.Element argAccount, java.sql.Timestamp currentTime) throws com.ibm.commerce.exception.ECException, com.ibm.commerce.contract.helper.TermCondCreateException
argAccount
- the business account Element object.currentTime
- The Timestamp object represents the current time.java.sql.SQLException
com.ibm.commerce.exception.ECApplicationException
com.ibm.commerce.exception.ECException
com.ibm.commerce.contract.helper.TermCondCreateException
getAccountOwnerIdFromAccountElement(Element aelmAccount)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getTimeFromElement(Element anElement, String tag, Timestamp time)
,
getStoreIdFromAccountElement(Element aelmAccount)
,
com.ibm.commerce.contract.util.ContractCmdUtil.getIntegerFromTrueOrFalse(String str)
,
getAccountState(String state)
public static void validateAccount(java.lang.Long accountId, java.lang.Integer targetStoreId) throws com.ibm.commerce.exception.ECApplicationException
accountId
- the ID of the business accounttargetStoreId
- the store IDcom.ibm.commerce.exception.ECApplicationException
public static void validateAccount(java.lang.Long accountId, java.lang.Integer targetStoreId, java.lang.String returnView, com.ibm.commerce.datatype.TypedProperty respProps) throws com.ibm.commerce.exception.ECApplicationException
accountId
- the ID of the business accounttargetStoreId
- the store IDreturnView
- the return view for the tools GUIrespProps
- the response propertiescom.ibm.commerce.exception.ECApplicationException
public static com.ibm.commerce.datatype.TypedProperty validateAccountAttributes(org.w3c.dom.Element accountElement, com.ibm.commerce.datatype.TypedProperty responseProperties, java.lang.String returnViewForTools, java.lang.String actionFlag) throws com.ibm.commerce.exception.ECApplicationException
accountElement
- the account Element objectresponseProperties
- the response propertiesreturnViewForTools
- the return view for tools GUIactionFlag
- the action of calling command (AccountSave or AccountImport)com.ibm.commerce.exception.ECApplicationException
- Raised with message _ERR_MISSING_ACCOUNT_NAME if the name of the account is missing or empty.
Raised with message _ERR_ACCOUNT_REFERENCE_NUMBER_NOT_REQUIRED if the referenceNumber is provided for account importing
Raised with message _ERR_DUPLICATED_ACCOUNT_NAME if there are some accounts existed which have the same name and owner ID.
Raised with message _ERR_ACCOUNT_UPDATE if the account with same name and owner cannot be found in updating case.