Tuesday, December 4, 2012

Access control for Views

The data load project in V7 makes, it really easy to load the access control changes. This blog explains a sample custom view access policies for guest and registered user and how this can be verified in the database using the query below. Even for guest users to access views, it is required for the view to belong to AllSiteUsersViews policy. If one tries to create a view and  access it, you would get the following error below and -1002 is (generic user). The first time user comes on a site, it would run user as generic user and as soon as it tries to perform any action specific to a user such as add to cart, it is converted to a guest user.

Error without policy:
AccManager isAllowed CMN1501E: User -1002 does not have the authority to perform action "NewView" on resource "com.ibm.commerce.command.HttpForwardViewCommandImpl" for command "null".

view_acpolicies.xml

<!DOCTYPE Policies SYSTEM "../dtd/accesscontrolpolicies.dtd">
<Policies>
<Action Name="GuestView" CommandName="GuestView" />
        <Action Name="RegisteredView" CommandName="RegisteredView" />
   <!-- Guest USERS VIEWS -->
<ActionGroup Name="AllSiteUsersViews" OwnerID="RootOrganization">
<ActionGroupAction Name="GuestView" />
</ActionGroup>

  <!-- REGISTERED USERS VIEWS -->
<ActionGroup Name="RegisteredUserViews" OwnerID="RootOrganization">
<ActionGroupAction Name="RegisteredView" />
  </ActionGroup>

</Policies>
-------------------------------------------------
select * from acpolicy where acactgrp_id in (select acactgrp_id
from acactactgp where acaction_id
in (select ACACTION_ID from ACACTION where ACTION = 'GuestView'))

Friday, November 9, 2012

SOLR adding custom attributes in SRCHATTRPROP !


If you need to filter SOLR queries based on a dynamic attribute. In the sample java code below the value for the custom attribute _custom.ItemType is retrieved from SRCHATTRPROP table. The code uses out of the box getIndexColumnNameByType on SolrSearchConfigurationRegistry object to retrieve the custom attribute value.

Monday, November 5, 2012

Elite Store Order Flow JSPs

Out of the box V7->EliteStorefrontAssetStore ->Order flow.
Useful to check for JSP's in a certain flow quickly. I have moved header\footer\mincart\breadcrumb\leftside\rightside\espot JSP's to the bottom.Internally it calls multiple JSP fragments that are not captured here.

Cart --> ViewName->AjaxOrderItemDisplayView
Starting point of flow JSP::OrderItemDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/ShopcartSection/OrderItemDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/OrderCreationSection/RequisitionListSubsection/RequisitionListPopupDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/OrderCreationSection/RequisitionListSubsection/RequisitionListPopupTableDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionChoiceOfFreeGiftsPopupContent.jsp
/EliteStorefrontAssetStore/ShoppingArea/ShopcartSection/ShopCartDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Order/Cart/ShipmodeSelectionExt.jsp
/EliteStorefrontAssetStore/Snippets/Order/Cart/OrderItemDetail.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionPickYourFreeGift.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentOrderTotalsSummary.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionCodeDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/CouponWalletTable.jsp
/EliteStorefrontAssetStore/Snippets/Order/Cart/CheckoutLogon.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedHeaderDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/ESpot/CachedContentAreaESpot.jsp
/EliteStorefrontAssetStore/include/MiniShopCartDisplay.jsp
/EliteStorefrontAssetStore/include/BreadCrumbTrailDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedLeftSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedRightSidebarDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/ESpot/ESpotNavDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedFooterDisplay.jsp

Shipping and Billing page--> OrderShippingBillingView
Starting point of flow JSP:OrderShippingBillingDetails.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/OrderShippingBillingDetails.jsp
/EliteStorefrontAssetStore/ShoppingArea/OrderCreationSection/RequisitionListSubsection/RequisitionListPopupDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/OrderCreationSection/RequisitionListSubsection/RequisitionListPopupTableDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/ShippingDetailsDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionChoiceOfFreeGiftsPopupContent.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/ShippingAddressSelect.jsp
/EliteStorefrontAssetStore/Snippets/Member/Address/AddressDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentShippingMethodDetails.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentShipChargeExt.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/OrderItemDetails.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionPickYourFreeGift.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentOrderTotalsSummary.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/PromotionCodeDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Promotions/CouponWalletTable.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/ScheduleOrderDisplayExt.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/BillingAddressDropDownDisplay.jsp
/EliteStorefrontAssetStore/Snippets/EDP/PaymentMethods/Empty.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedHeaderDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/ESpot/CachedContentAreaESpot.jsp
/EliteStorefrontAssetStore/include/MiniShopCartDisplay.jsp
/EliteStorefrontAssetStore/include/BreadCrumbTrailDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedLeftSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedRightSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedFooterDisplay.jsp

 Order Summary page-->SingleShipmentOrderSummaryView
 Starting point of flow JSP:BillingAddressDropDownDisplay
 /EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/BillingAddressDropDownDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Member/Address/AddressDisplay.jsp
/EliteStorefrontAssetStore/Snippets/EDP/PaymentMethods/StandardCOD.jsp
/AjaxActionResponse.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/OrderTotalInJSON.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentSummary.jsp
/EliteStorefrontAssetStore/include/MiniShopCartDisplay.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/OrderItemDetailSummary.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentOrderTotalsSummary.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/ScheduleOrderDisplayExt.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedHeaderDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/ESpot/CachedContentAreaESpot.jsp
/EliteStorefrontAssetStore/include/BreadCrumbTrailDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedLeftSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedRightSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedFooterDisplay.jsp

Order Confirmation page-->OrderShippingBillingConfirmationView
Starting point of flow JSP:OrderReceivedNotify.jsp
/EliteStorefrontAssetStore/Messages/OrderReceivedNotify.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/Content/ContentSpotDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Member/Address/AddressDisplay.jsp
/AjaxActionResponse.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/OrderShippingBillingConfirmationPage.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/OrderItemDetailSummary.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/SingleShipment/SingleShipmentOrderTotalsSummary.jsp
/EliteStorefrontAssetStore/ShoppingArea/CheckoutSection/ScheduleOrderDisplayExt.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedHeaderDisplay.jsp
/EliteStorefrontAssetStore/Snippets/Marketing/ESpot/CachedContentAreaESpot.jsp
/EliteStorefrontAssetStore/include/MiniShopCartDisplay.jsp
/EliteStorefrontAssetStore/include/BreadCrumbTrailDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedLeftSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedRightSidebarDisplay.jsp
/EliteStorefrontAssetStore/include/styles/style1/CachedFooterDisplay.jsp

Thursday, November 1, 2012

Increase HeapSize on server.xml for OutOfMemory Exception

If you are running SOLR or any other high memory process, there is a chance, you have seen the OutOfMemory exception. You can increase the heap-size using WAS or directly in the file. Recommended approach would be directly in the file. 

From WAS console:
  1. In the administrative console, click Servers > Server Types > WebSphere application servers, and then click on an application server name.
  2. In the Server Infrastructure section, click Java and process management > Process definition .
Directly updating the file, as this is the same file that gets updated while changing WAS console: On toolkit, this would be the path
C:\WCDE_ENT70\wasprofile\config\cells\localhost\nodes\localhost\servers\server1\server.xml
Search for initialHeapSize and maximumHeapSize and change 
initialHeapSize=512
maximumHeapSize=1536
or you have only 1024 try
initialHeapSize=1024
maximumHeapSize=1024
If you give incorrect values here, it could result in your server not starting so please be cognizant about that.

Analyzing memory heaps from WebSphere Commerce


You need two install 2 plug-ins in RAD:
  1. Eclipse Memory Analyzer Plug-in: http://www.eclipse.org/mat/
  2. IBM Diagnostic Tool Framework for Java Plug-in: http://www.ibm.com/developerworks/java/jdk/tools/dtfj.html#download

This should allow you to read WCS dump files (*.phd). Install #1 then #2.

After that you can follow this tutorial to get ideas on what to investigate:

Friday, September 21, 2012

Activating users using a script

This is usually a problem with a lot of sites where due to a security password policy, users are deactivated after a certain number of unsuccessful attempts in trying to log in. It could be frustrating for support folks to manually activate the users.

A cron job can be created with a script to activate users deactivated in the last day. There is 2 things required one to run the script below and second to refresh the customer profile cache registry.

Step1:

update userreg
set status=1,passwordinvalid=null
where trunc(passwordinvalid) >= sysdate-1 and status=0;

Step2:
Refresh Customer profile Cache Registry

Tuesday, September 18, 2012

Installing RAD SQL Profiler in WebSphere Commerce Developer 7

The IBM SQL profiler is a great tool to find database related performance problems.
However, the current guide only covers how to install it on WCS 6.

Here is an updated list of steps for those of you that need to install it in WCS developer 7.