AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

29
AlPaCiNO: a b2b commerce portal solution Architectural approach, pitfalls and the lessons learned solutions direkt GmbH / Sebastian Schulze, 06/09/2016 @51bby

Transcript of AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

Page 1: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

AlPaCiNO: a b2b commerce portal solution

Architectural approach, pitfalls and the lessons learned

solutions direkt GmbH / Sebastian Schulze, 06/09/2016 @51bby

Page 2: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite

A successful digital transformation requires changes in all enterprise areas, not only in marketing and IT. Consequently, all lines of business need to be involved in the implementation of a digital strategy - from product development over supply chain & logistics up to human resources. Silo mentality and "departmental thinking" should be things of the past! Nicole Dufft, Independent Vice President Pierre Audoin Consultants

Introduction

Page 3: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution4 09.06.2016

Who I am

Follow me on Twitter

@51bby

Sebastian Schulzee-commerce dev team lead

16 years of experience in software development mainly with Java technologies

solutions direkt AGHamburg, Germany

just married, father of one, rock musician, golfer (hcp -23,2)

Page 4: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution5

The Mission

09.06.2016

Towards the end of 2012British American Tobacco (Germany)asked direkt gruppe whether they could build a digital business platform to support their field force in b2b sales and marketing activities. Tracking

Bonus Points

Digitalize StockpilingQuizzes

Customer SegmentsEducate Retailers

Coupons

Surveys

Multitenancy

Customer Self Services

Reports

Special Offers

Legacy Backend Integration

Page 5: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution6

The Mission

09.06.2016

Towards the end of 2012British American Tobacco (Germany)asked direkt gruppe whether they could build a digital business platform to support their field force in b2b sales and marketing activities.

Serve Content

Sell Products

Page 6: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution7

The Solution: AlPaCiNO Software Stack

09.06.2016

Single Sign-on / Proxy Authentification

Fulfillment PartnersLogistics

SuppliersPayment

Central

Authentication

Service (CAS)

Presentation

Backend Systems ERP

Business IntegrationNEXUSe2e

Author

Magnolia

Shop Logic OFBiz

...CRM

PIM

Web

Serv

ice

Public

Web

Serv

ice

SQL,

H

TTP,

...

HTTP, SFTP, ...

Page 7: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite

A successful digital transformation requires changes in all enterprise areas, not only in marketing and IT. Consequently, all lines of business need to be involved in the implementation of a digital strategy - from product development over supply chain & logistics up to human resources. Silo mentality and "departmental thinking" should be things of the past! Nicole Dufft, Independent Vice President Pierre Audoin Consultants

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

Page 8: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution10

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

Freemarker Templates (UI)

Business Logic Events

Entity Framework (DAL)

DB

Page 9: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution11

Freemarker Templates (UI)

Business Logic Events

Entity Framework (DAL)

DB

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

public class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

<form name="addform" action="<@ofbizUrl>additem</@ofbizUrl>" method="post" enctype="multipart/form-data"> <input type="hidden" name="add_product_id” value="${productId}"/> <input type="hidden" name=“quantity” value="${quantity}"/></form>

Page 10: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution12

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

Freemarker Templates (UI)

Business Logic Events

Entity Framework (DAL)

DB

public class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

<form name="addform" action="<@ofbizUrl>additem</@ofbizUrl>" method="post" enctype="multipart/form-data"> <input type="hidden" name="add_product_id” value="${productId}"/> <input type="hidden" name=“quantity” value="${quantity}"/></form>

Page 11: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution13

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

Business Logic Events

Entity Framework (DAL)

DB

public class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

Page 12: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution14

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

RESTful Services

Business Logic Events

Entity Framework (DAL)

DB

public class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

POST /cart/{cartName}/{productId}?quantity={quantity}

Page 13: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution16

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016

RESTful Services

Business Logic Events

Entity Framework (DAL)

DBpublic class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

POST /cart/{cartName}/{productId}?quantity={quantity}

@RequestMapping(value = "{cartName}/{productId}", method = RequestMethod.POST, produces = {"application/json"})@ResponseBodypublic CartResponse addToCart( @PathVariable(value = "productId" ) String productId, @RequestParam(value = "quantity") String quantity, ...) { addToCart(new HttpServletRequestProxy(productId, quantity), …); …}

Page 14: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution18

Chop off the GUI of OFBiz and replace it with a restful interface for Magnolia

09.06.2016RESTful Services

{ "add_product_id": "5000815", "quantity": 1}

@RequestMapping(value = "{cartName}/{productId}", method = RequestMethod.POST, produces = {"application/json"})@ResponseBodypublic CartResponse addToCart( @PathVariable(value = "productId" ) String productId, @RequestParam(value = "quantity") String quantity, ...) { addToCart(new HttpServletRequestProxy(productId, quantity), …); …}

OFBiz Service Stubs

POST /cart/{cartName}/{productId}?quantity={quantity}

ContentApp/data/products

MCA Decorators

Freemarker Templates (UI)

public McaProductImpl(Product product, DamTemplatingFunctions damFunctions) { …}

public interface McaProduct extends Product { String getText(String nodeName); Asset getImage(String nodeName); Node getProductNode(); …}

Page 15: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution19

Products Content App

09.06.2016

Page 16: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution20

Products Content App

09.06.2016

Page 17: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution21

Products Content App

09.06.2016

Page 18: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution22

Products Content App

09.06.2016

Page 19: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution23

Shop Products Category Page

09.06.2016

Page 20: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite

A successful digital transformation requires changes in all enterprise areas, not only in marketing and IT. Consequently, all lines of business need to be involved in the implementation of a digital strategy - from product development over supply chain & logistics up to human resources. Silo mentality and "departmental thinking" should be things of the past! Nicole Dufft, Independent Vice President Pierre Audoin Consultants

Implement an authoring realm in OFBiz to publish content changes on Magnolia activation triggers

Page 21: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite 25 09.06.2016 AlPaCiNO: a b2b commerce portal solutionRESTful Services

{ "add_product_id": "5000815", "quantity": 1}

@RequestMapping(value = "{cartName}/{productId}", method = RequestMethod.POST, produces = {"application/json"})@ResponseBodypublic CartResponse addToCart( @PathVariable(value = "productId" ) String productId, @RequestParam(value = "quantity") String quantity, ...) { addToCart(new HttpServletRequestProxy(productId, quantity), …); …}

POST /cart/{cartName}/{productId}?quantity={quantity}

OFBiz Service Stubs

ContentApp/data/products

MCA Decorators

Freemarker Templates (UI)

public McaProductImpl(Product product, DamTemplatingFunctions damFunctions) { …}

public interface McaProduct extends Product { String getText(String nodeName); Asset getImage(String nodeName); Node getProductNode(); …}

Implement an authoring realm in OFBiz to publish content changes on Magnolia activation triggers

Page 22: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution26

Client‘s Backend

09.06.2016

Business Logic Events

Entity Framework (DAL)

DBpublic class ShoppingCartEvents { public static String addToCart(HttpServletRequest request, HttpServletResponse response) {…} …}

@RequestMapping(value = "{cartName}/{productId}", method = RequestMethod.POST, produces = {"application/json"})@ResponseBodypublic CartResponse addToCart( @PathVariable(value = "productId" ) String productId, @RequestParam(value = "quantity") String quantity, ...) { addToCart(new HttpServletRequestProxy(productId, quantity), …); …}

Implement an authoring realm in OFBiz to publish content changes on Magnolia activation triggers

Order Export Pipeline

Product Import Pipeline

<#list ["", "$"] as idPrefix> <#list data as product> <Product productId="${idPrefix}${product.ean}" productTypeId="FINISHED_GOOD" quantityIncluded="20"> <internalName>${product.description}</internalName> ...

Page 23: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution27

Implement an authoring realm in OFBiz to publish content changes on Magnolia activation triggers

09.06.2016

Author Public

Publish

OFBiz Service Stubs

POST

/activation/{productId}

$<EAN> <EAN>

ActivationController

ProductActivationAction

Copy

Page 24: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution28

Implement an authoring realm in OFBiz to publish content changes on Magnolia activation triggers

09.06.2016

Author Public

Publish

OFBiz Service Stubs

POST

/activation/{productId}

$<EAN> <EAN>

ActivationController

ProductActivationAction

Copy

POST /cart/{cartName}/{productId}?quantity={quantity}&scope={scope}

// String scope = (isAuthorInstance() ? "author" : "public")

String scopedProductId = ServiceUtils.prependScopePrefix( scope, productId);

Page 25: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite

A successful digital transformation requires changes in all enterprise areas, not only in marketing and IT. Consequently, all lines of business need to be involved in the implementation of a digital strategy - from product development over supply chain & logistics up to human resources. Silo mentality and "departmental thinking" should be things of the past! Nicole Dufft, Independent Vice President Pierre Audoin Consultants

Glue everything together with single sign-on and proxy authentication

Page 26: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution31

Glue everything together with single sign-on and proxy authentication

09.06.2016

Page Request

Redirect to login page

Login

Redirect after login w/ user info

Use RESTful Service w/ proxy

ticket

Confirm proxy ticket w/ user info

Verify proxy ticket

Add to cart

Return updated cart s

tate

POST /cart/{cartName}/{productId}?quantity={quantity}&scope={scope}&pt={proxyTicket}

Gather proxy ticket

Page 27: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite

A successful digital transformation requires changes in all enterprise areas, not only in marketing and IT. Consequently, all lines of business need to be involved in the implementation of a digital strategy - from product development over supply chain & logistics up to human resources. Silo mentality and "departmental thinking" should be things of the past! Nicole Dufft, Independent Vice President Pierre Audoin Consultants

Continuously deliver Magnolia with Docker containers for blue-green deployment

Page 28: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

© direkt gruppe 2016 Seite AlPaCiNO: a b2b commerce portal solution33

Continuously deliver Magnolia with Docker containers for blue-green deployment

09.06.2016

Few differing config params require a lot of config files to maintain3 environments * 4 tenant installations * 2 Mgnl webapps (author, public) = 24 setups+ SSL certs and trust stores for each domain + CAS setups for each environment

Configuring was error prone and deployment took up to hours!

Condensed and centralized config hierarchy2 setups (author, public) + Docker Compose files with specific parametersAll environments virtually run with same domain name => Less SSL setupConfigure once, run everywhere => Dev environment very similar to productionLess env dependent errors. Deployment time down to minutes.

Page 29: AlPaCiNO: a b2b commerce portal solution w/ Magnolia and OFBiz

direkt gruppe Hamburg I Griegstraße 75 I Haus 26 I 22763 HamburgKöln I Holzmarkt 2 I 50676 KölnMünchen I Landaubogen 1 I 81373 MünchenTel. +49 40 88155-0 I Fax +49 40 [email protected] I www.direkt-gruppe.de

www.youtube.com/user/direktgruppe

www.facebook.com/direktgruppe

www.direkt-gruppe.de/xing

Thanks for listening! Questions?

@51bby