Giter VIP home page Giter VIP logo

alainn-basket-service's Introduction

Basket Service

Business Entity Service responsible for Persisted storing of Items for immediate or later Purchase.

Operations

  • getBasket

    Retrieves all Items in a Customer's Basket

  • removeFromBasket

    Delete Item from Customer's Basket

  • addToBasket

    Add Item to Customer's Basket

  • emptyBasket

    Remove all Items from Customer's Basket (checkout scenario)

Technical Points of Note

Transformation

  • DataMapper is not able to handle structural mis-matches easily. In the case of getBasket, we have our List of Maps retrieved from the Database and we need to create an Xml document according to the WSDL Schema. However, given that each Item has many Images and it's convenient for us to retrieve all in the one ResultSet, we need to de-duplicate the repeating Item data. We do this in MEL and we create a Map of data which is structurally similar to the target XML in order to give DataMapper a helping hand!
	<expression-transformer doc:name="to []" expression="
    	np = [ 'BasketItem' : [] ];
    	index = ['x' : 'x'];
    	for (record :  payload) {
    		if (index.containsKey(record.sku_id)) {
    			index[record.sku_id].images.add([ 'url' : record.url, 'type' : record.image_type_name ]);
    		}
    		else {
    			item = [ 'id' : record.sku_id, 'sku': record.sku_id, 'quantity' : record.quantity, 'name': record.sku_name, 'summary' : record.sku_summary, 'price' : record.price, 'stockQuantity' : record.stock_quantity,
    				'brand' : record.item_brand, 'type' : record.item_type_name, 'images' : [ ['url' : record.url, 'type' : record.image_type_name] ] ];
    			index.put(record.sku_id, item);
    		}
    	};
    	index.remove('x');
    	np.BasketItem	.addAll(index.values());
    	np
    ">
    </expression-transformer>

XPath Namespaces

  • Resolution is done using the Namespace Manager
	<mulexml:namespace-manager includeConfigNamespaces="true">
        <mulexml:namespace prefix="mes" uri="http://www.alainn.com/SOA/message/1.0" />
        <mulexml:namespace prefix="mod" uri="http://www.alainn.com/SOA/model/1.0" />
    </mulexml:namespace-manager>

SSL

  • The HTTPS (Jetty also) connector makes a reference to the keystore containing the Certificate in src/main/resources.
	<https:connector name="httpsConnector" cookieSpec="netscape" validateConnections="true" sendBufferSize="0" receiveBufferSize="0" receiveBacklog="0" clientSoTimeout="10000" serverSoTimeout="10000" socketSoLinger="0" doc:name="HTTP\HTTPS">
        <service-overrides messageFactory="org.mule.transport.http.HttpMultipartMuleMessageFactory" />
        <https:tls-key-store path="keystore.jks" keyPassword="changeit" storePassword="changeit" />
    </https:connector>

Contact

[email protected]

alainn-basket-service's People

Contributors

nialdarbey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.