The next step in the development process is to model the implementation of the operation queryProducts.

The first step when modeling complex activity diagrams is to define a rough sketch of the activities. The picture below shows the completed activity diagram and provides an overview of all required UML elements.

The first action calls the activity Read XML File and contains actions to read the XML file and to create the output object allProducts, which is of type Catalog. The object contains the data title, category, manufacturer, seller, sellerType, and priceUSD for each product record. To retrieve the data from the XML file you need to use the file system adapter.

The second action calls the activity Filter File Content, which has two input objects: the object userInput of type SearchParameters containing the array keywords, and the object allProducts, which is the output of the first action Read XML File. The output of the activity Filter File Content is a subset of records that have been read from the XML file. The filtered data is assigned to the output object filteredProducts. The object filteredProducts is of type Catalog.

The third action calls the activity Calculate Total and Currencies. For each product record found in the input object filteredProducts the attribute PriceCHF and some other data, such as total and delivery charge, is calculated and written to the final object searchResult.

The last step in the control flow is the action node called Get Title. It has two input objects, userInput and searchResult. The object userInput also contains the attribute title, which will be assigned to the attribute title of object searchResult.

In this first iteration, you will draw the reading of the XML file and the filtering of the file content, marked in the figure above. As no calculations will be done yet, the output parameter will be a list of products.

Now, start drawing the activity diagram.

Add the input parameter userInput to the diagram frame.
Place it on the left diagram frame border.

Add the output parameter productList to the diagram frame.
Place it on the right diagram frame border.

Add an initial node and an activity final node to the activity diagram. Assign the names Start and End.

Save  the UML model.

  • No labels