Package com.imc.iss.groovy.salesitem
Class SalesItemsTree
java.lang.Object
com.imc.iss.groovy.salesitem.SalesItemsTree
This is a class representing a quote for use by groovy scripts
Inside the script, an instance of this class, containing the data of the quote that the script will be run on, will be provided automatically and can be accessed as a variable named salesItemsTree
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttachmentFile(InputStream attachmentStream, String fileName, long fileSize, String attachmentType) Adds the attachment file as line item attachmentaddChildByProductErpId(String productErpId) Adds a new line item under this object by specifying its ERP ID.addChildByProductURI(String productURI) Adds a new line item under this object by specifying its Product URI.addNewPriceItem(PriceItemData priceItemData) Create and Add Price Item data to salesItem, without triggering SSC pricing.addPartnerFunctions(Collection<PartnerFunctionRecord> partnerFunctionRecords) Add partner function records into quote's Partner Function.deletePartnerFunctions(Collection<BusinessObject> partnerFunctionRecords) remove partner function records into quote's Partner Function.deletePriceItem(PriceItemData priceItem) Remove Price Item data from salesItem, without triggering SSC pricing.filterChildrenByDynamicAttribute(String dynamicAttributeName, Object dynamicAttributeValue) Retrieves the list of child line items that has dynamic attribute of a specific valuefilterChildrenByDynamicAttribute(String dynamicAttributeName, List<Object> dynamicAttributeValues) Retrieves the list of child line items that has dynamic attribute of one of the specified valuesfilterChildrenByProductERPID(List<String> productERPIDs) Retrieves the list of child line items that has one of the specified ERP IDs.filterChildrenByProductName(List<String> productNames) Retrieves the list of child line items that has one of the specified objectNamefilterChildrenByProductType(String productTypeURI) Retrieves the list of child line items that belongs to a particular Product Type onlyGet all salesItem business objects as a Collection for a quote.Get all SalesItemNodes as a List for a quote.getAttachmentFile(String fileName) Get a attachement file by file name.Get the list of the attachement file.getAttachmentFilesByType(String fileType) Get the list of the attachement file by file type.getAttachmentFolder(String folderName) Get an attachement folder by folder name.Get the list of the attachment folder.Retrieves the immediate line items.To get the name of the currency used by the quoteTo get the URI of the currency used by the quotegetDocumentHeaderDataAttributeValue(String attributeURI) getPartnerErpId(String PartnerFunctionURI) To get the ERPId of the partner function by partner function URI.getPartnerObjectId(String partnerFunctionURI) To get the object Id of the partner function by partner function URI.getPartnerObjectName(String partnerFunctionURI) To get the object Name of the partner function by partner function URI.Retrieves the partner functions of the quote.getPartnersErpId(String partnerFunctionURI) To get all the ERPId for a type of partner function.getPartnersObjectId(String partnerFunctionURI) To get all the object Id for a type of partner function.getPartnersObjectName(String partnerFunctionURI) To get all the object names for a type of partner function.getPartnersURI(String partnerFunctionURI) To get all the object URI for a type of partner function.getPartnerURI(String PartnerFunctionURI) To get the object URI of a partner functiongetPriceItemByTypeName(String name) To get the price Item data by name.To get the price Item data by URI.getPriceItemByUri(String uri) To get the price Item data by price item URI.To get all the price Item data by the name of the price item type.To get all the price Item data by price item URI.getPriceItemsJustified(String justificationURI) To get all user justified price Item data.Retrieves the name of the account that the quote belongs toRetrieves the erp id of the country that the quote belongs to The relationship is as follows: quote -> includesAddress -> hasCountrygetQuoteDataAttributeValue(String attributeURI) To get the value of a quote data attribute by attribute URI.Retrieves the ID of the quotegetQuoteRelationAttributeErpId(String attributeURI) To get the ERPID of a quote relation attribute by attribute URI.getQuoteRelationAttributeObjectId(String attributeURI) To get the object Id of a quote relation attribute by attribute URI.getQuoteRelationAttributeObjectName(String attributeURI) To get the object name of a quote relation attribute by attribute URI.getQuoteRelationAttributeURI(String attributeURI) To get the URI of a quote relation attribute by attribute URI.Retrieves the title of this quoteRetrieves the URI of this quoteRetrieves the latest version of this quoteRetrieve only routed users using the current transaction context (no HTTP call required).To get the total price.Retrieve routing users using the current transaction context (no HTTP call required).booleanIndicates the context that Quote object is created frombooleanIndicates the context that Quote object is created fromvoidrecallRouting(String userId) Recall routing for the given users within the current transaction to avoid nested HTTP calls/locks.voidrecallRouting(Collection<String> userIds) Recall routing for the given users within the current transaction to avoid nested HTTP calls/locks.setPriceItemByTypeName(String priceItemTypeName, BigDecimal baseAmount) Create or Update price item with baseAmount only.setQuoteDataAttribute(String attributeURI, Object value) To set a value for the quote data attribute.setQuoteRelationAttribute(String attributeURI, String valueURI) To set a value for the quote relation attribute.toString()Returns a string representation of the quote, which prints all the line items in hierarchical mannerupdatePriceItemBaseAmount(String priceItemURI, BigDecimal baseAmount) Update BaseAmount with targetCurrency of a Price ItemupdatePriceItemBaseCurrency(String priceItemURI, String baseCurrencyUri) Update baseCurrencyUri of a Price ItemupdatePriceItemBaseQuantity(String priceItemURI, BigDecimal baseQuantity) Update BaseQuantity with UoM of a Price ItemupdatePriceItemBaseUnitUoM(String priceItemURI, String baseUnitUoMUri, String baseUnitUoMName) Update baseUnitUoMUri and baseUnitUoMName of a Price ItemupdatePriceItemConditionIsInactive(String priceItemURI, boolean conditionIsInactive) Update sequence of a Price ItemupdatePriceItemJustification(String priceItemURI, String uri) Update Justification of a Price ItemupdatePriceItemSequence(String priceItemURI, int sequenceID) Update sequence of a Price ItemupdatePriceItemTargetAmount(String priceItemURI, BigDecimal targetAmount) Update TargetAmount of a Price ItemupdatePriceItemTargetCurrency(String priceItemURI, String targetCurrencyUri) Update TargetCurrency of a Price Item
-
Method Details
-
addAttachmentFile
public void addAttachmentFile(InputStream attachmentStream, String fileName, long fileSize, String attachmentType) throws IMCException Adds the attachment file as line item attachment- Parameters:
attachmentStream- Input File StreamfileName- Name of the file to be addedfileSize- Size of the File to be addedattachmentType- type of attachment File- Throws:
IMCException
-
addChildByProductErpId
Adds a new line item under this object by specifying its ERP ID.The validity of the given ERP ID will only be evaluated after the script has completed its execution and returns control back to the main application.
- Parameters:
productErpId- The ERP ID of the product to be added as the new line item- Returns:
- The
SalesItemNodeobject representing the newly added line item - Throws:
IMCException
-
addChildByProductURI
Adds a new line item under this object by specifying its Product URI.The validity of the given URI will only be evaluated after the script has completed its execution and returns control back to the main application.
- Parameters:
productURI- The URI of the product to be added as the new line item. The full path has to be provided.- Returns:
- The
SalesItemNodeobject representing the newly added line item - Throws:
IMCException
-
addNewPriceItem
Create and Add Price Item data to salesItem, without triggering SSC pricing. Should not be used unless that is the intention- Parameters:
priceItemData- as PriceItemData. SeePriceItemData- Returns:
- SalesItemNode
- Throws:
IMCException
-
addPartnerFunctions
Add partner function records into quote's Partner Function.- Parameters:
partnerFunctionRecords- . The partner function records to add into a quote.- Returns:
- The
SalesItemsTreeinstance.
-
deletePartnerFunctions
remove partner function records into quote's Partner Function.- Parameters:
partnerFunctionRecords- . The partner function records to remove into a quote.- Returns:
- The
SalesItemsTreeinstance.
-
deletePriceItem
Remove Price Item data from salesItem, without triggering SSC pricing. Should not be used unless that is the intention- Parameters:
priceItemData- as PriceItemData. SeePriceItemData- Returns:
- SalesItemsTree
- Throws:
IMCException
-
filterChildrenByDynamicAttribute
public List<SalesItemNode> filterChildrenByDynamicAttribute(String dynamicAttributeName, List<Object> dynamicAttributeValues) throws IMCException Retrieves the list of child line items that has dynamic attribute of one of the specified values- Parameters:
dynamicAttributeName- The object name of the dynamic attribute. It can be either Dynamic Symbolic Attribute (DSA) or Dynamic Data Attribute (DDA). Note that only the object name can be used here, not the language-specific labelsdynamicAttributeValues- The list of acceptable values for the dynamic attribute. For DSA, only the object name of the ranges can be used here, not the language-specific labels- Returns:
- All
SalesItemNodeobjects directly under this object that meets the filter criteria - Throws:
IMCException
-
filterChildrenByDynamicAttribute
public List<SalesItemNode> filterChildrenByDynamicAttribute(String dynamicAttributeName, Object dynamicAttributeValue) throws IMCException Retrieves the list of child line items that has dynamic attribute of a specific value- Parameters:
dynamicAttributeName- The object name of the dynamic attribute. It can be either Dynamic Symbolic Attribute (DSA) or Dynamic Data Attribute (DDA). Note that only the object name can be used here, not the language-specific labelsdynamicAttributeValue- The accepted value for the dynamic attribute. For DSA, only the object name of the ranges can be used here, not the language-specific labels- Returns:
- All
SalesItemNodeobjects directly under this object that meets the filter criteria - Throws:
IMCException
-
filterChildrenByProductERPID
Retrieves the list of child line items that has one of the specified ERP IDs.- Parameters:
productERPIDs- The list of accepted values of ERP ID- Returns:
- All
SalesItemNodeobjects directly under this object that meets the filter criteria
-
filterChildrenByProductName
Retrieves the list of child line items that has one of the specified objectName- Parameters:
productNames- The list of accepted values of product object name- Returns:
- All
SalesItemNodeobjects directly under this object that meets the filter criteria
-
filterChildrenByProductType
Retrieves the list of child line items that belongs to a particular Product Type only- Parameters:
productTypeURI- The URI of the product type. The full path has to be provided.- Returns:
- All
SalesItemNodeobjects directly under this object that meets the filter criteria
-
getAllSalesItemBO
Get all salesItem business objects as a Collection for a quote.- Parameters:
ctx- The groovy contextGroovyCtxUtil.- Returns:
- Collection <BusinessObject>.
- Throws:
IMCException- the platform exception
-
getAllSubSalesItems
Get all SalesItemNodes as a List for a quote.- Returns:
- List <SalesItemNode>. The
SalesItemNode. - Throws:
IMCException- the platform exception
-
getAttachmentFile
Get a attachement file by file name. @seeAttachmentData.- Parameters:
fileName- as String the name of the file.- Returns:
AttachmentData.- Throws:
IMCException
-
getAttachmentFiles
Get the list of the attachement file. @seeAttachmentData.- Returns:
AttachmentDatain List.- Throws:
IMCException
-
getAttachmentFilesByType
Get the list of the attachement file by file type. @seeAttachmentData.- Parameters:
fileType- as String. The file type.- Returns:
AttachmentDatain List.- Throws:
IMCException
-
getAttachmentFolder
Get an attachement folder by folder name. @seeAttachmentFolderData.- Parameters:
folderName- the name of the folder.- Returns:
AttachmentFolderData.- Throws:
IMCException
-
getAttachmentFolders
Get the list of the attachment folder.- Returns:
AttachmentFolderDatain List.- Throws:
IMCException
-
getChildren
Retrieves the immediate line items.- Returns:
- All
SalesItemNodeobjects directly under this object
-
getCurrencyName
To get the name of the currency used by the quote- Returns:
- the currencyName
- Throws:
IMCException
-
getCurrencyUri
To get the URI of the currency used by the quote- Returns:
- the currencyUri
- Throws:
IMCException
-
getDocumentHeaderDataAttributeValue
- Throws:
IMCException
-
getPartnerErpId
To get the ERPId of the partner function by partner function URI.- Parameters:
PartnerFunctionURI- the URI of the partner function.- Returns:
- The partner function ERPId as String.
nullif not found. - Throws:
IMCException
-
getPartnerObjectId
To get the object Id of the partner function by partner function URI.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- The partner function object Id as String.
nullif not found. - Throws:
IMCException
-
getPartnerObjectName
To get the object Name of the partner function by partner function URI.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- The partner function object Id as String.
nullif not found. - Throws:
IMCException
-
getPartners
Retrieves the partner functions of the quote.- Returns:
- The partners as Map<String, List<AbstractObjectDTO>> with the uri of the partner function as key (eg: http://www.inmindcloud.com/application/schema.owl#BUYER_PARTY)
- Throws:
IMCException
-
getPartnersErpId
To get all the ERPId for a type of partner function.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- List of erpId in String.
- Throws:
IMCException
-
getPartnersObjectId
To get all the object Id for a type of partner function.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- List of object Id in String.
- Throws:
IMCException
-
getPartnersObjectName
To get all the object names for a type of partner function.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- List of object name in String.
- Throws:
IMCException
-
getPartnersURI
To get all the object URI for a type of partner function.- Parameters:
partnerFunctionURI- the URI of the partner function.- Returns:
- List of object URI in String.
- Throws:
IMCException
-
getPartnerURI
To get the object URI of a partner function- Parameters:
PartnerFunctionURI- as String. The URI of the type of partner function.- Returns:
- The object URI of the partner function as String.
nullif not found. - Throws:
IMCException
-
getPriceItemByTypeName
To get the price Item data by name.PriceItemData- Parameters:
name- as String the name of the price item.- Returns:
PriceItemData.- Throws:
IMCException
-
getPriceItemByTypeUri
To get the price Item data by URI.PriceItemData- Parameters:
uri- as String the uri of the price item.- Returns:
PriceItemData.- Throws:
IMCException
-
getPriceItemByUri
To get the price Item data by price item URI.PriceItemData- Parameters:
uri- as String the uri of the price item.- Returns:
PriceItemData.- Throws:
IMCException
-
getPriceItemsByTypeName
To get all the price Item data by the name of the price item type.PriceItemData- Parameters:
name- as String the name of the price item type.- Returns:
PriceItemData.- Throws:
IMCException
-
getPriceItemsByTypeUri
To get all the price Item data by price item URI.PriceItemData- Parameters:
uri- as String the URI of the price item type.- Returns:
PriceItemDatain List- Throws:
IMCException
-
getPriceItemsJustified
To get all user justified price Item data.PriceItemData.- Returns:
PriceItemDatain List- Throws:
IMCException
-
getQuoteAccountName
Retrieves the name of the account that the quote belongs to- Returns:
- The account name of the quote
- Throws:
IMCException
-
getQuoteCountryErpId
Retrieves the erp id of the country that the quote belongs to The relationship is as follows: quote -> includesAddress -> hasCountry- Returns:
- The country erp id
- Throws:
IMCException
-
getQuoteDataAttributeValue
To get the value of a quote data attribute by attribute URI.- Parameters:
attributeURI- as String. The URI of the quote data attribute.- Returns:
- the value of the quote data attribute as Object.
- Throws:
IMCException
-
getQuoteID
Retrieves the ID of the quote- Returns:
- The quote ID
- Throws:
IMCException
-
getQuoteRelationAttributeErpId
To get the ERPID of a quote relation attribute by attribute URI.- Parameters:
attributeURI- as String. The URI of the quote relation attribute.- Returns:
- the ERPId of the quote relation attribute as String.
- Throws:
IMCException
-
getQuoteRelationAttributeObjectId
To get the object Id of a quote relation attribute by attribute URI.- Parameters:
attributeURI- as String. The URI of the quote relation attribute.- Returns:
- the objectId of the quote relation attribute as String.
- Throws:
IMCException
-
getQuoteRelationAttributeObjectName
To get the object name of a quote relation attribute by attribute URI.- Parameters:
attributeURI- as String. The URI of the quote relation attribute.- Returns:
- the object name of the quote relation attribute as String.
- Throws:
IMCException
-
getQuoteRelationAttributeURI
To get the URI of a quote relation attribute by attribute URI.- Parameters:
attributeURI- as String. The URI of the quote relation attribute.- Returns:
- the object URI of the quote relation attribute as String.
- Throws:
IMCException
-
getQuoteTitle
Retrieves the title of this quote- Returns:
- The quote title as String
- Throws:
IMCException
-
getQuoteURI
Retrieves the URI of this quote- Returns:
- The quote URI as String
-
getQuoteVersion
Retrieves the latest version of this quote- Returns:
- The quote version as Integer
- Throws:
IMCException
-
getRoutedUsers
Retrieve only routed users using the current transaction context (no HTTP call required).- Returns:
- Collection
- Throws:
IMCException
-
getTotalPrice
To get the total price.- Returns:
- the totalPrice as BigDecimal.
- Throws:
IMCException
-
getUsersForRouting
Retrieve routing users using the current transaction context (no HTTP call required).- Returns:
- Collection
- Throws:
IMCException
-
isCommerce
public boolean isCommerce()Indicates the context that Quote object is created from- Returns:
- the isCommerce as boolean. Return
TRUEif it is commerce Inquiry.
-
isQuoteAgreement
public boolean isQuoteAgreement()Indicates the context that Quote object is created from- Returns:
- the isQuoteAgreement as boolean. Return
TRUEif it is Agreement.
-
recallRouting
Recall routing for the given users within the current transaction to avoid nested HTTP calls/locks.- Parameters:
userIds- as userUrisBase64 of users to recall from routing.- Throws:
IMCException
-
recallRouting
Recall routing for the given users within the current transaction to avoid nested HTTP calls/locks.- Parameters:
userId- as userUrisBase64 of user to recall from routing.- Throws:
IMCException
-
setPriceItemByTypeName
public SalesItemsTree setPriceItemByTypeName(String priceItemTypeName, BigDecimal baseAmount) throws IMCException Create or Update price item with baseAmount only.
Note that this method assumes that there can only be one Price Item of a given type. Thus, if a Price Item of that type already exists it will update it, otherwise it will create a new Price Item. If there are already multiple Price Items of the given type, only the first one will be updated.- Parameters:
priceItemTypeName- as String. The name of the price item type.baseAmount- as BigDecimal. The baseAmount to update / create.- Returns:
- The
SalesItemsTree - Throws:
IMCException
-
setQuoteDataAttribute
To set a value for the quote data attribute.- Parameters:
attributeURI- as String. The URI of the quote data attribute.value- as Object. The value for the quote data attribute.- Returns:
- The
SalesItemsTree - Throws:
IMCException- the platform exception
-
setQuoteRelationAttribute
public SalesItemsTree setQuoteRelationAttribute(String attributeURI, String valueURI) throws IMCException To set a value for the quote relation attribute.- Parameters:
attributeURI- as String. The URI of the quote relation attribute.valueURI- as Object. The value for the quote relation attribute.- Returns:
- The
SalesItemsTree - Throws:
IMCException- the platform exception
-
toString
Returns a string representation of the quote, which prints all the line items in hierarchical manner -
updatePriceItemBaseAmount
public SalesItemsTree updatePriceItemBaseAmount(String priceItemURI, BigDecimal baseAmount) throws IMCException Update BaseAmount with targetCurrency of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.baseAmount- as BigDecimal. The BaseAmount of the price item.- Returns:
- SalesItemNode
- Throws:
IMCException
-
updatePriceItemBaseCurrency
public SalesItemsTree updatePriceItemBaseCurrency(String priceItemURI, String baseCurrencyUri) throws IMCException Update baseCurrencyUri of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.baseCurrencyUri- as String. The base Currency Uri of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemBaseQuantity
public SalesItemsTree updatePriceItemBaseQuantity(String priceItemURI, BigDecimal baseQuantity) throws IMCException Update BaseQuantity with UoM of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.baseQuantity- as BigDecimal. The Base Quantity value (base condition unit) of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemBaseUnitUoM
public SalesItemsTree updatePriceItemBaseUnitUoM(String priceItemURI, String baseUnitUoMUri, String baseUnitUoMName) throws IMCException Update baseUnitUoMUri and baseUnitUoMName of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.baseUnitUoMUri- as String. The base unit UoM Uri of the price item.baseUnitUoMName- as String. The base unit UoM Name of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemConditionIsInactive
public SalesItemsTree updatePriceItemConditionIsInactive(String priceItemURI, boolean conditionIsInactive) throws IMCException Update sequence of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.sequenceID- as int. The sequence of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemJustification
public SalesItemsTree updatePriceItemJustification(String priceItemURI, String uri) throws IMCException Update Justification of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.uri- as String. The URI of the justification. (http://www.inmindcloud.com/application/schema.owl#UserJustified or http://www.inmindcloud.com/application/schema.owl#SystemJustifiedERP)- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemSequence
public SalesItemsTree updatePriceItemSequence(String priceItemURI, int sequenceID) throws IMCException Update sequence of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.sequenceID- as int. The sequence of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemTargetAmount
public SalesItemsTree updatePriceItemTargetAmount(String priceItemURI, BigDecimal targetAmount) throws IMCException Update TargetAmount of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.targetAmount- as BigDecimal. The targetAmount of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-
updatePriceItemTargetCurrency
public SalesItemsTree updatePriceItemTargetCurrency(String priceItemURI, String targetCurrencyUri) throws IMCException Update TargetCurrency of a Price Item- Parameters:
priceItemURI- as String. The URI of the price item to be updated.targetCurrencyUri- as String. The target Currency Uri of the price item.- Returns:
- SalesItemsTree
- Throws:
IMCException
-