{"id":3263,"date":"2013-08-23T06:05:10","date_gmt":"2013-08-23T11:05:10","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=3263"},"modified":"2013-08-23T06:11:00","modified_gmt":"2013-08-23T11:11:00","slug":"adding-the-session_id-to-jboss-and-the-atg-order-repository","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2013\/08\/23\/adding-the-session_id-to-jboss-and-the-atg-order-repository\/","title":{"rendered":"Adding the session_id to JBOSS and the ATG order repository"},"content":{"rendered":"<p>We wanted to be able to track the path a shopper took through the initial order creation process in ATG.  The IP address is often insufficient for reasons such as a shared internet connection, proxy server, etc.<\/p>\n<p>We extended the order repository and CartFormHandler class to handle our session id.  We then added the column to our custom order extension table.  We also added the %S directive to JBOSS access log valve configuration so it would be written in the access log.  Using this, we can tie the access log to the database, and the access log to the server log to determine the impact of any errors.  In other words, if we have tons of INCOMPLETE orders and can directly tie them back to a specific session, and take a thread in that session and tie it to an error on that thread in the server.log, we can indirectly calculate the financial impact of errors.<\/p>\n<p>We are also considering just writing the order_id and sessionid in the server.log, as it will change as different sessions work on the order.  In our case, we are only interested in the initial order process. The server.log would be less work and space used in the database.<\/p>\n<p>For now, we are starting with this, though.<\/p>\n<p>Order repository\u2026<\/p>\n<pre lang=\"xml\">\r\n  <item-descriptor name=\"order\" xml-combine=\"append\">\r\n  <table shared-table-sequence=\"1\" name=\"our_order\" type=\"auxiliary\" id-column-name=\"ORDER_ID\">\r\n    <property name=\"ipAddress\" column-name=\"ip_address\" category=\"Extra Info\" display-name=\"IP Address\" data-type=\"string\"\/>\r\n    <property name=\"sessionId\" column-name=\"session_id\" category=\"Extra Info\" display-name=\"Session ID\" data-type=\"string\"\/>\r\n    <property name=\"trackingNumber\" column-name=\"tracking_number\" category=\"Extra Info\" display-name=\"Tracking Number\" data-type=\"string\"\/>\r\n    <property name=\"emailAddress\" column-name=\"email_address\" category=\"Extra Info\" display-name=\"Email Address\" data-type=\"string\"\/>\r\n<\/pre>\n<p>Snippet of added setter\/getter methods in the extended OurOrderImpl class&#8230;<\/p>\n<pre lang=\"java\">\r\n        public String getSessionId() {\r\n                return (String) getPropertyValue(SESSION_ID);\r\n        }\r\n\r\n        public void setSessionId(String pSessionId) {\r\n                setPropertyValue(SESSION_ID, pSessionId);\r\n        }\r\n<\/pre>\n<p>Snippet of extended OurCartFormHandler class\u2026<\/p>\n<pre lang=\"java\">\r\n  protected void doAddAsSeparateItemsToOrder(DynamoHttpServletRequest pRequest, DynamoHttpServletResponse pResponse) throws ServletException, IOException {\r\n    if (isLoggingDebug())\r\n      logDebug(\"Starting doAddItemsToOrder\");\r\n\r\n    \/\/ Fetch the order\r\n    Order order = getOrder();\r\n    ((OurOrderImpl) this.getOrder()).setSessionId(pRequest.getSession().getId());\r\n    if (order == null) {\r\n<\/pre>\n<p>\u2026and database\u2026<\/p>\n<pre lang=\"sql\">\r\nalter table atg_core_prod.our_order add session_id varchar2(64);\r\n<\/pre>\n<p>\u2026results in\u2026<\/p>\n<pre lang=\"text\">\r\nSESSION_ID\tORDER_ID\tPROFILE_ID\tSTATE\r\n7B79F5ADAEE7B820EADCF0F3C09CF6EA\tEXP285050152ATL\tu329510147ATL\tSUBMITTED\r\n789A0F47E4199282417E41E23070D6AB\tEXP285190104ATL\tu329650016ATL\tINCOMPLETE\r\n<\/pre>\n<p>\u2026and in the access log\u2026<\/p>\n<pre lang=\"text\">\r\n1.1.1.1 - [23\/Aug\/2013:09:03:46 -0400] \"POST \/catalog\/gadgets\/color_size_gadget.jsp HTTP\/1.1\" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 5253 16\r\n1.1.1.1 - [23\/Aug\/2013:09:03:54 -0400] \"POST \/catalog\/actions\/cart-submit.jsp?mTAS=3704080 HTTP\/1.1\" http-172.28.72.10-10180-6 789A0F47E4199282417E41E23070D6AB 302 5 149\r\n1.1.1.1 - [23\/Aug\/2013:09:03:55 -0400] \"GET \/catalog\/urls\/cart-submit-success.jsp?_requestid=350 HTTP\/1.1\" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 26 24\r\n1.1.1.1 - [23\/Aug\/2013:09:03:55 -0400] \"POST \/checkout\/gadgets\/minicartcontents.jsp HTTP\/1.1\" http-172.28.72.10-10180-6 789A0F47E4199282417E41E23070D6AB 200 3532 135\r\n1.1.1.1 - [23\/Aug\/2013:09:03:56 -0400] \"GET \/static\/img\/buttons\/ima-quickview-close.gif HTTP\/1.1\" http-172.28.72.10-10180-10 789A0F47E4199282417E41E23070D6AB 304 - 6\r\n1.1.1.1 - [23\/Aug\/2013:09:03:56 -0400] \"GET \/includes\/shoppingCartItemCount.jsp?returnVar=yes&_=1377223436811 HTTP\/1.1\" http-172.28.72.10-10180-9 789A0F47E4199282417E41E23070D6AB 200 11 14\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>We wanted to be able to track the path a shopper took through the initial order creation process in ATG. The IP address is often insufficient for reasons such as a shared internet connection, proxy server, etc. We extended the&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2013\/08\/23\/adding-the-session_id-to-jboss-and-the-atg-order-repository\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[48,37,38,49],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3263"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3263"}],"version-history":[{"count":11,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3263\/revisions"}],"predecessor-version":[{"id":3272,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/3263\/revisions\/3272"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3263"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}