addToSetArticle
Synopsis
void addToSetArticle(
SessionId sessionId,
string[] itemIds,
OperationMode opMode)
throws BasketServiceFault;
See also: SessionId, OperationMode, BasketServiceFault
This operation adds zero or more items as set-article parts to the set-article represented by their first set-article item or part ancestor. The flags of the operation mode ‘opMode’ control the behavior of the operation as described below.
The operation takes a set of items, represented by the item IDs in the ‘itemIds’ parameter, and tries to convert them to set-article parts of the set-article represented by their first ancestor that is either a set-article item or set-article part. To do so, it creates a mapping from new parts to the set article they will be added to. Once this has been done, all items in this map are added to the respective set-article. The following list describes this process in detail:
-
For each set-article item in the set of items, test whether there is an ancestor that belongs to another set-article. If there is such an ancestor, and if the ‘breakUpSetArticles’ flag is set in ‘opMode’, then add the set-article item and its parts to the map of new parts, with the ancestor’s set-article being the set-article they will be added to.
-
For each item, that is neither a set-article item, a set-article part, or a sub-article item, test whether there is an ancestor that belongs to a set-article. If there is one, add the item to the map of new parts, with the ancestor’s set-article being the set-article the item will be added to.
-
If the ‘mainArticles’ flag is set in ‘opMode’, then test for each sub-article item, whose main article item is not already a member of the map of new parts, whether the main article item has an ancestor that belongs to a set-article. If there is one, add the main article to the map of new parts, with the ancestor’s set-article being the set-article the main article item (and thus the sub-article item) will be added to.
-
If the map of new parts contains one or more set-articles, the set-articles are broken up and the set-article items are replaced in the map of new parts with the folders created in place of the set-article items, retaining the set-article they will be added to. Furthermore, if the map of new parts contains items to be added to the broken-up set-article, these items will now be added to the same set-article as the broken-up set-article and its parts.
-
Finally, all items from the map of new parts are added to the set-article specified in the map