Tuesday 18 September 2012

WCS Derby Backup


Start a command prompt session.

  1. Navigate to the WCDE_installdir\bin directory.
  2. Issue the following command to start an SQL session:
    ij.bat
  3. Issue the following command to connect to the WebSphere Commerce database:
    connect '..\db\mall'; 
    You can now issue SQL statements that will run against your development database. Ensure that you end each of your SQL statements with a semicolon.
  4. Use CALL SYSCS_UTIL.SYSCS_BACKUP_DATABASE('D:/dbbackups/'); for taking back up in to the specified location.
  5. To restore then use restoreFrom=<backup path>
  6. EX: restoreFrom=D:/dbbackups/
  7. To end your session, issue the following command: exit;

Search engine optimization (SEO)


Search engines, such as Google, are considered to be one of the most important channels for a site to reach new customers.
to reach new customers and search engines provide an effective way to reach new customers.
Problem::
Dynamic, database-driven URLs, such as those generated by WebSphere Commerce, contain stop characters (?, &, and %) that can easily overwhelm search engine crawlers. For this reason, search engines limit the amount of dynamic URLs that they index.
To overcome this limitation, WebSphere Commerce provides functionality to help improve the results of search engine indexing.



WebSphere Commerce's search engine optimization feature consists of the following functions:
  1. URL mapping that provides the ability to remove the stop characters by mapping WebSphere Commerce's dynamic URLs to static ones so that search engines can index the dynamic pages.
  2. Site map capability that provides an entry point for the search engine crawler to easily follow the links within your Web pages.
  3. Page content optimization that facilitates keyword modification so that the page is ranked high in search engine results. It provides the ability to easily modify words in the locations that are important for crawlers, by using the Product Management GUI, or by using the Change Pages GUI in WebSphere Commerce Accelerator.



URL Mapping

The URL mapping function allows Web pages to be accessed through a static looking URL by converting the URL from static to dynamic based on a mapping file:
I mean it will simplies the complex urls i.e urls which are dynamic(having special characaters etc..,) to simple one's.
URL mapping function
For example, it can map the following static URL:
webapp/wcs/stores/servlet/product_10001_10001_10032_-1
to the following dynamic WebSphere Commerce URL:
webapp/wcs/stores/servlet/ProductDisplay?storeId=10001&catalogId=10001&productId=10032&langId=-1






Site Maps
A site map is used to address the following two challenges:
  • Changes to the site are not quickly reflected in the search engine indices.
  • Most Web pages are designed for human visitors, not crawlers, and the design can reject crawlers due to an excessive number of graphics and large page size.
A site map builts web pages specifically for crawlers to quickly access and index a large number of embedded pages.
The following image shows how the site map function is implemented:
It is possible that the site map might affect positioning within search results in search engines such as Google, as if the search engine finds two URLs that link to the same content, they might rank that result lower if it assumes the site is attempting to manipulate the search algorithms in repeatedly discovering the same content.



Optimization of page content for search ranking

There are many different factors that search engines use to determine the ranking of pages. Search engines have crawlers that follow the links in a site's Web pages, collect the content from Web pages, and analyze the content by conducting sophisticated pattern matching.
When a search engine analyzes a page, some specific locations are given more weight than others. It is important to put appropriate keywords in these locations. Some of the locations that are ranked high in search results are:



Page title
The page title is the text that appears in a browser's title bar. The page title tag is an important consideration in how searches are ranked. Put the most commonly searched keywords in the title.
Page heading
The page heading is also an important place for keywords that are used by search engines.
First sentence of the body
Use words in the first sentence that describe the purpose of the page and attract visitors to click on this entry in the search results page.
WebSphere Commerce helps you optimize your page content by providing the Change Pages function and the Product Management tool to allow marketing personnel to easily update text in these locations.



Making of website/webpages/url's SEO friendly.
for home page we have following url in wcs7
http://www.myclient.com/webapp/wcs/stores/servlet/TopCategories_10101_10101

In order to make this SEO friendly we have to shorten this even more by removing the /webapp/wcs/stores/servlet/ portion and store, catalog ids in the URL If possible.
Now question is where and how do make this change.
the final URL to look like.
for the home page:
http://www.myclient.com

for catgeory:
existing:
http://www.myclient.com/webapp/wcs/stores/servlet/Category3_10101_10101_11655_-1_Y_Design%20Your%20Car%20Mats%E2%84%A2

to modify
http://www.myclient.com/Categoryname






ANSWER(this didn't work for me)
1. Need to make changes to the web.xml and change the Stores webpath from /webapp/wcs/stores --> /<some value>
and the Stores Request Servlet from /servlet/* --> /<some value>

I don't think you can have empty values specified, so you may need to specify a context path

2. You'd also have to modify the "context-root" in application.xml under your <EAR_ROOT>/META-INF/applicaiton.xml and change the following to a value you have specified above in web.xml.

<module id="WebModule_1041293846133">
<web>
<web-uri>Stores.war</web-uri>
<context-root>/webapp/wcs/stores</context-root>
</web>
</module>

3. Lastly, you have to change the <instance>.xml file and make the necessary changes to StoresWebPath and WebAppPath attributes.

Propagate your instance.xml, restart your server and test the changes.






Creating Pop-Up window

PopUp Creation

Here we are giving a proceadre for creating a popup , which is by clicking a button a popup will
appear.

Step 1: In order to create a popup window follow the below steps.


Here we are adding a hyper link in the footer page(CachedFooterDisplay.jsp)

as sarwesh

<p><a href="javascript:showAdPopup();"> Sarwes</a></p>

Add the following script at the top of the CachedFooterDisplay.jsp

<script type="text/javascript" src="<c:out value="$
{jsAssetsDir}javascript/StoreCommonUtilities.js"/>"></script>



When we click the above link it will show a popup.

Step 2 : Add the follwing code at bottom of the CachedFooterDisplay.jsp


<div id="ad_popup_main_div">
<div id="ad_popup" dojoType="dijit.Dialog" >
<div class="top_left" id="ad_popup_div_1"><img alt="" src="<c:out
value="${jspStoreImgDir}" />images/trasparent.gif" /></div>
<div class="top_right" id="ad_popup_div_2"><img alt="" src="<c:out
value="${jspStoreImgDir}" />images/trasparent.gif" /></div>
<div class="header" id="popupHeader">
<div class="close" id="ad_popup_div_3">
<a id="closeLink" href="javascript:hideAdPopup();"
>
<span onclick="javaScript:hideAdPopup();"
class="icon" id="ad_popup_div_4">
<img alt="" src="<c:out value="$
{jspStoreImgDir}${vfileColor}" />popup_close.png" />
</span>
<fmt:message key="QuickInfo_Close" bundle="$
{storeText}"/>

</a>
</div>
</div>

<div class="bodyarea" id="ad_popup_div_5">
<div class="bodycontent" id="ad_popup_div_6">
<div class="title" id="ad_popup_div_7">
</div>
<div class="ad_details" id="ad_popup_div_8">
<div class="ad_visual" id="ad_popup_div_9">
</div>
<div class="ad_information"
id="ad_popup_div_10">
<!-- <img alt="" src="<c:out value="$
{jspStoreImgDir}${vfileColor}" />logo.gif" /> -->
<p>This is a new popup is created by Sarwes and Rajsheaker. <i><u><b>Now Start
your work</b></u></i></p>

</div>
</div>
</div>

<div class="footer" id="ad_popup_div_11">
<div class="bot_left" id="ad_popup_div_12"></div>
<div class="bot_right" id="ad_popup_div_13"></div>
</div>
</div>
</div>
<script type="text/javascript">dojo.addOnLoad(function()
{ parseWidget("ad_popup"); } );</script>

Step 3: Add the following javascript code at the end in StoreCommonutilities.js file for show

popup and hide popup.

function showAdPopup(){

dijit.byId('ad_popup').show();

/**
* This function hides the advertisement popup.
*/
function hideAdPopup(){
dijit.byId('ad_popup').hide();
}

Step 4: Add the following code at bottom in the common1_1.css file.


/* Add the below CSS classes for the advertisement popup*/

#ad_popup_main_div {
display:none;
}
#ad_popup {
width: 498px;
position: absolute;
display:block;
z-index: 9999;
background-image: url('../images/colors/color1/transparent.gif');

background-repeat:no-repeat;
overflow: hidden;

}
#ad_popup .top_left{
background-image: url('../images/colors/color1/popup_topleft.png');
background-repeat:no-repeat;
height:10px;
width:8px;
float:left;
}
#ad_popup .top_right{
background-image: url('../images/colors/color1/popup_topright.png');
background-repeat:no-repeat;
background-position:right;
height:10px;
width:490px;
float:left;
}
#ad_popup .closeText{
display: none;
}
#ad_popup .header{
background-image: url('../images/colors/color1/popup_center_tile.png');
background-repeat:repeat-y;
text-align: right;
height: 23px;
clear:left;
}
#ad_popup .close{
padding: 5px 15px 2px 0px;
color: #666666;
}
#ad_popup .close .icon{
padding-top: 2px;
padding-left: 4px;
float: right;
}
#ad_popup .bodycontent{
background-image: url('../images/colors/color1/popup_center_tile.png');
background-repeat:repeat-y;
margin: 0;
padding: 0 0 15px 0;
}
#ad_popup .bodycontent .title{
padding: 0 17px 0 15px;

}
#ad_popup .bodycontent .ad_details {
padding: 15px 24px 0 18px;
display:inline-block;
}
#ad_popup .bodycontent .ad_details .ad_visual {
float: left;
width: 190px;
text-align: center;
}
#ad_popup .bodycontent .ad_details .ad_information{
width:245px;
float:right;
padding-left:15px;
}
#ad_popup .footer {
text-align: right;
height: 14px;

width: 498px;
}
#ad_popup .footer .bot_left{
background-image: url('../images/colors/color1/popup_botleft.png');
background-repeat:no-repeat;
height:14px;
width:8px;
float:left;
}
#ad_popup .footer .bot_right{
background-image: url('../images/colors/color1/popup_botright.png');
background-repeat:no-repeat;
background-position:right;
height:14px;
width:490px;
float:left;
}

Changing order of catalog menu


In kitchen ware arrange the products form last to first- Management Center

  1. Open the management center.
  2. Login with the crediantials
  3. Click on the mangement Center tab and then click on the Catalogs Menu and select store in the right corner drop down menu.
  4. From the Catalogs list, select the kitchenware category and right click on it select show subcategories.
  5. chagining the sequence number as you want to display.

EMarketing spot and content spot


e-Marketing Spots Using Accelerator

  • Click Marketing > e-Marketing Spots in Accelerator
  • Click New. The New e-Marketing Spot wizard opens, enabling you to define your e-Marketing Spot.
  • Complete the e-Marketing Spot Definition page as appropriate.
  • Click Finish to save the e-Marketing Spot.
  • If you already have a Web activity click Add
  • Select the check box to the left of the Web activity that you want to schedule for this e-Marketing spot. Click Add to return to the e-Marketing Spot Properties page. The selected Web activity now displays in the Scheduled Web Activities list.
  • Specify a Start Date and End Date for the Web activity.
  • Click OK to save the schedule assignment.
  • Add the e-Marketing Spot to the JSP file by dynamically including the spot using the JSTL <c:import> tag structure with any associated parameters. Your code should look similar to the following:
<c:import url="../../include/eMarketingSpotDisplay.jsp">
   <c:param name="emsName" value="StoreHomePage" />
   <c:param name="maxNumDisp" value="8" />
   <c:param name="catalogId" value="${WCParam.catalogId}" />
   <c:param name="maxItemsInRow" value="4" />
   <c:param name="maxColInRow" value="3" />
</c:import>

Working with e-Marketing Spots(Management Center)

  • open the Management center
  • From the explorer view, click E-Marketing Spots. The E-Marketing Spots - List page opens.
  • From the toolbar, click the arrow on the right side of Create NewCreate New; then select e-Marketing Spot. The New e-Marketing Spot page displays.
  • Enter the e-Marketing Spot properties:
  • Click Save.
  • Use the WebServiceeMarketingSpotDisplay.jsp sample snippet to display an e-Marketing Spot in a store page. The code uses Web services to call the marketing runtime to get the data to display in the e-Marketing Spot. Use this snippet for e-Marketing Spots that are used in Web activities managed with the Management Center.
  • The WebServiceeMarketingSpotDisplay.jsp file is available under the following directory:
  • WC_installdir\samples\Snippets\web\Marketing\Campaigns
  • WCDE_installdir\samples\Snippets\web\Marketing\Campaigns
  • Add the e-Marketing Spot to the JSP file by dynamically including the e-Marketing Spot using the JSTL <c:import> tag structure with any associated parameters. Your code should look similar to the following example:
  <c:import url="${jspStoreDir}include/WebServiceeMarketingSpotDisplay.jsp">
  <c:param name="emsName" value="ShoppingCartPage" />
  <c:param name="catalogId" value="${WCParam.catalogId}" />
  </c:import>

Content spots

  1. Open the WebSphere Commerce Accelerator
  2. Click Store > Content Spots. The Content Spot list displays, containing the content spots currently defined for the selected store.
  3. Click New. The New content spot wizard opens, enabling you to define your content spot.
  4. Complete the Content spot Definition page as appropriate.
  5. Click Finish to save the content spot. The content spot is displayed in the content spots list.
  6. In the description box just add comments with parameter like {SampleParam} is came from the Jsp page using params.
  7. If you already have content click Add. This opens the Content selection list.
  8. Select the check box to the left of the content that you want to schedule for this content spot. Click Add to return to the Content Spot Properties page. The selected content now displays in the Scheduled Content list.
  9. Specify a Start Date and End Date, and select the order value for the content. The order value helps determine which content to display when multiple contents are scheduled to display in the same content spot. The content which has an order value of 1 is the highest priority content, and will display before other content that the customer is qualified to view. The content can be moved in the Order list using the Move up and Move down buttons.
  10. Click OK to save the schedule assignment.
  11. Select the page and place to place this content spot and add the content spot to the JSP file by dynamically including the spot using the JSTL <c:import> tag structure with any associated parameters. Your code should look similar to the following:
<c:import url="${jspStoreDir}/Snippets/Marketing/Content/ContentSpotDisplay.jsp">
    <c:param name="spotName" value="HelpSpot_part1" />
    <c:param name="substitutionValues" value="{storeName},${storeName}" />
    <c:param name="substitutionValues" value="{SampleParam},SampleParam" />
</c:import>

Dojo WCS :: Refresh Area(WCS AJAX)



In WCS we can do AJAX programming in 3 ways,
1. Refresh Area
2. Service
3. General Dojo Ajax

Following tutorial will aware you Refresh Area in WCS

First of all we need two pages one which runs at client side and fires the event for refresh area and another is the at server side which takes the request parameters from the client and process the data, prints the content for the refresh area.

The whole story is simple, we going to have a context, a controller with unique id, and a widget. All this are linked while writing the widget in the client page. We are going a take event like whenever text is entered in the text box then i am going to update the context, rest all things are handled by dojo only.

In addition to above i wrote a script file which handles the KeyUp event for a text box in the client page, as this event will be the root for the RefreshArea.

We have to make few changes in the predefined files.

For each and every new RefreshArea, we have to add a context in CommonContextDeclarations.js
as follows
  1. It should have a unique context name, here its "RefreshArea_Context".
  2. And it contains the varible names that we are going to pass during the request as in the JSON format and with default values, here its "{searchTerm: ""}".
  3. The last one is the updateContextUrl, this will fire after successful updation of context.
wc.render.declareContext("RefreshArea_Context",{searchTerm: ""},"")

We have to declare a controller for the RefreshArea as follows
  1. it should have a controllerid, here its "RefreshAreaController"
  2. A render context declared in the CommonContextDeclarations.js file
  3. A default url to be called, here i kept null because i will update this when i am loading the client page.
  4. Next is renderContextChangedHandler function, this will be called when the change in the context occurs.
  5. In this function we are going to refresh the renderContext of the widget.
  6. PostRefreshHandler is fired after the above function execution.
wc.render.declareRefreshController( {
id : "RefreshAreaController",
renderContext : wc.render.getContextById("RefreshArea_Context"),
url : "",
formId : "",
renderContextChangedHandler : function(message, widget) {
var controller = this;
var renderContext = this.renderContext;
widget.refresh(renderContext.properties);
//alert("renderContextChangedHandler");
},
postRefreshHandler : function(widget) {
//document.getElementById('RefreshAreaContent').value = "Hai";
//alert("postRefreshHandler");
}
})


Preparing Client Page (RefreshClient.jsp)

Simple Jsp Page as follows,

<%@ page language="java" contentType="text/html"%>

<%-- include all tag libs which are needed for our page --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://commerce.ibm.com/base" prefix="wcbase"%>
<%@ taglib uri="http://commerce.ibm.com/foundation" prefix="wcf"%>
<%@ taglib uri="flow.tld" prefix="flow"%>
<%@ taglib uri="http://commerce.ibm.com/coremetrics" prefix="cm"%>

<%-- include the neede jsp files--%>

<%@ include file="./include/JSTLEnvironmentSetup.jspf"%>
<%@ include file="./include/nocache.jspf"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Refresh Area Client</title>

<%-- include the script file dojo --%>
<script type="text/javascript" src="<c:out value="${dojoFile}"/>" djConfig="${dojoConfigParams}"></script>

<%-- this will include all the javascripts that are needed for --%>
<%@ include file="./include/CommonJSToInclude.jspf"%>

<%-- this is the script file that i wrote to update the context --%>
<script type="text/javascript" src="<c:out value="${jsAssetsDir}javascript/RefreshAreaJS.js"/>"></script>

</head>
<body>
<%-- This will be used as the URL which will call server Page--%>
<wcf:url var="refreshAreaLink" value="RefreshAreaPageView" type="Ajax">
<wcf:param name="storeId" value="${WCParam.storeId}" />
<wcf:param name="catalogId" value="${WCParam.catalogId}" />
<wcf:param name="langId" value="${WCParam.langId}" />
</wcf:url>

<%-- Common utilities which includes all the wc.widgets files etc.., --%>
<%@ include file="./include/StoreCommonUtilities.jspf"%>

<%-- Widget --%>
<div dojoType="wc.widget.RefreshArea" widgetId="RefreshAreaDisplay"
id="RefreshAreaDisplay" controllerId="RefreshAreaController"
role="wairole:region" waistate:live="polite" waistate:atomic="false"
waistate:relevant="all">
</div>

<%-- this will parse the widget --%>
<%-- Sets the url for controller to refresh the area --%>
<script type="text/javascript">
dojo.addOnLoad(function() {
parseWidget("RefreshAreaDisplay");
CommonControllersDeclarationJS.setControllerURL('RefreshAreaController','<c:out value='${refreshAreaLink}'/>');
});
</script>

<%-- Text box which will fire the event in the RefreshAreaJS.js file--%>
<input
id="WC_QuickOrderForm_input_1" type="text" value="" tabindex="-1"
onKeyUp="javascript:refreshAreaJS.refreshData();" />

</body>
</html>


RefreshServer.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%-- picks up the request parameter --%>
${WCParam.searchTerm}

RefreshAreaJS.js
// import all common required files.
dojo.require("wc.service.common");

refreshAreaJS={
// this function called as soon as the text in the textbox entered
refreshData:function(){
//alert("refreshData");
wc.render.updateContext('RefreshArea_Context',{'searchTerm':document.getElementById('WC_QuickOrderForm_input_1').value});
}

}




wcbase:usebean and JSP best Practices


JSP programming best practice: Use the Commerce-specific tag for bean activation

WebSphere Commerce data beans require activation prior to their use. WebSphere Commerce provides a Commerce-specific version of the useBean tag, <wcbase:useBean>, that performs data bean activation in Java-free manner and is the recommended method of data bean activation in store JSP pages.
As an example, the generic way of activating a category data bean is as follows:
<jsp:useBean id="categoryBean"
class="com.ibm.commerce.catalog.beans.CategoryDataBean">
<%
com.ibm.commerce.beans.DataBeanManager.activate(categoryBean,
request, response); %>
</jsp:useBean>
The recommended way of accomplishing the same task in WebSphere Commerce store pages is as follows:
<wcbase:useBean id="categoryBean"
Note: Data bean activation can fail and cause an exceptional condition. To comply with the JavaServer Pages Specification requirement that no output be written to the output stream when forwarding to other Web assets, including error pages, data beans should be activated at the beginning of the JSP page.


WebSphere Commerce useBean tag

The useBean tag instantiates a WebSphere Commerce data bean and automatically populates it for you. A new programming direction has also been undertaken with our starter stores that now use the JavaServer Pages Standard Tag Library (JSTL) to perform view logic, instead of Java code. At the same time, business logic has been moving into data beans. The combination of these steps allows for less Java code in a JSP page.
The useBean tag takes the following attributes:
id
Required: The ID that the new bean will have. This ID must be a valid Java identifier and must be unique as it is also used to create a new scripting variable for the JSP page. The ID must also be unique to a page.
classname
Required: The class for the data bean that will be instantiated.
scope
The scope in which the bean should be stored such as page, request, session, and application. The default scope is page.
In order to be able to use the new useBean tag library, a JSP page must first be told how to locate the tag. In order to locate and use the new tag, the following line must be located at the top of the JSP file:
<%@ taglib uri="http://commerce.ibm.com/base" prefix="wcbase"%>
This line will make the useBean tag available to the JSP page with the prefix of wcbase.
The following are examples of using the useBean tag:
  • A new OrderDataBean is created and is accessible on the JSP page as orderBean.
    <wcbase:useBean
id="orderBean"classname="com.ibm.commerce.order.beans.OrderDataBean"scope="page"/>
  • A new OrderDataBean is created and is accessible on the JSP page as orderBean. In this case, the useBean tag has a body. Inside of the bean's body tag, the <c:set> is used to set properties on the OrderDataBean.
    <wcbase:useBean id="orderBean" 
      classname="com.ibm.commerce.order.beans.OrderDataBean"
    scope="page">    
      <c:set value="${orderId[0]}" target="${orderBean}"
    property="orderId"/>
    </wcbase:useBean> 


<wcbase:useBean classname="com.ibm.commerce.fulfillment.beans.InventoryDataBean" id="SivaInventory" >
<c:set property="dataBeanKeyCatalogEntryId" target="${SivaInventory}" value="10002" />
<c:set property="dataBeanKeyFulfillmentCenterId" target="${SivaInventory}" value="10001" />
<c:set property="dataBeanKeyStoreId" target="${SivaInventory}" value="10001" />
</wcbase:useBean>

<c:out value="${SivaInventory.quantity}" />




<!-- <wcbase:useBean classname="com.ibm.commerce.catalog.beans.AttributeDataBean" id="attrib">
<c:set property="dataBeanKeyAttributeId" target="${attrib}" value="10004"></c:set>


</wcbase:useBean>
<c:out value="${attrib.name}"/> -->



WCS interview quetions and answers

Following are the questions and answers which I took questions from kingofwcs.blogspot.com site,


  1. Explain the access control policy?What is the purpose of access control policy?
    There are two types of access control, both of which are policy-based: command-level access control and resource-level access control.
    • Command-level access control determines whether the user is allowed to execute the particular command within the store you have specified. 
    • Resource-level access control policy could be applied to determine if the user can access the resource in question. 
    Access control in a WebSphere Commerce application is composed of the following elements: users, actions, resources, and relationships.
    • Users are the people that use the system. For access control purposes, users must be grouped into relevant access groups. 
    • Actions are the activities that users can perform on the resource. For access control purposes, actions must also be grouped into relevant action groups. For example, a common action used in a store is a view. A view is invoked to display a store page to customers. The views used in your store must be declared as actions and assigned to an action group before they can be accessed. 
    • Resources are the entities that are protected. For example, if the action is a view, the resource to be protected is the command that invoked the view, for example com.ibm.commerce.command.ViewCommand. 
    • Relationships are the relationship between the user and the resource. Access control policies may require that a relationship between the user and the resource be satisfied. For example, users may only be allowed to display the orders that they have created.

  2. Explain the Dynacache?
    Now a days the requirement is changed that caching should be implemented for the content that changes frequently.
    The bright solution for this is DynaCache system which is provided by IBM Websphere Application server.
    • Dyna Cache is to be configured to catch some objects and later based on some matching rules Dyna cache retrive those objects from the cache.
      
      
    •  Caching rules are specified in Cachespec.xml file.
      
      
  3. What the EJB transaction parameters?
    Possible values for TRANSATTRIBUTE are:
    • NotSupported:Bean cannot be involved in a transaction. If the client has started a transaction, the existing transaction is suspended until the bean's method has completed.
    • Required :Bean must always run within a transaction
    • Supports :If the client has started a transaction, the bean joins the transaction.
    • RequiresNew:Bean always starts a new transaction.
    • Mandatory:The client must start a transaction when the bean is invoked.
    • Never :If the client has started a transaction, the bean throws an exception. 

  4. which are different types of entity beans n which one is used in commerce?
    There are 2 types of entity beans available namely
    • BMP-Bean Managed Persistence
    • CMP -Container Managed Persistence
      CMP is used in commerce to interact with the database in commerce.

  5. Which are the different types of databeans. What is commonly used in commerce.when do we use it?
    A data bean is a Java bean that is used within a JSP page to provide dynamic content. A data bean normally provides a simple representation of a WebSphere Commerce entity bean.
    There are two types of data beans: smart data beans and command data beans.
    •  A smart data bean uses a lazy fetch method to retrieve its own data. This type of data bean can provide better performance in situations where not all data from the access bean is required, since it retrieves data only as required. Smart data beans that require access to the database should extend from the access bean for the corresponding entity bean and implement thecom.ibm.commerce.SmartDataBean interface. When database access is not required, the smart data bean should extend the SmartDataBeanImpl class.
    • A command data bean relies on a command to retrieve its data and is a more lightweight data bean. The command retrieves all attributes for the data bean at once, regardless of whether the JSP page requires them. As a result, for JSP pages that use only a selection of attributes from the data bean, a command data bean may be costly in terms of performance time. Command data beans can also extend from their corresponding access beans and implement thecom.ibm.commerce.CommandDataBean interface.
    SmartDataBean is commonly used in wcs.We use command databean only when using Command databean is impractical.

  6. which are the different flavours of EJB in wcs ?
    Different flavours of EJB available in WCS are Session Bean and Entity Bean.

  7. What are acessbeans? What is the advantage of accessbean?
    WebSphere Commerce commands interact with access beans rather than directly with entity beans. Access beans provide a simpler interface to clients, caching of the home object, and reduced call traffic to the enterprise bean.Access beans behave like Java beans, and hide all enterprise bean-specific programming interfaces from the client, like the JNDI, home and remote interfaces.
    Advantage of accessbean:
    •  At run time the access bean caches the enterprise bean home object because look ups to the home object are expensive, in terms of time and resource usage.
    • The access bean implements a copyHelper object that reduces the number of calls to the enterprise bean when commands get and set enterprise bean attributes. Only a single call to the enterprise bean is required when reading or writing multiple enterprise bean attributes. 

  8. State one diff between 6.0 and 7.0 commerce version?
    Social Commerce Support,Coshoping provision, rich look and feel,starter stores optimized for mobile devices.

  9. what is optimistic locking?
    WebSphere Commerce uses an optimistic locking scheme that allows the database transaction isolation level to be lowered from repeatable read to read committed. Using that scheme, database rows not normally accessed concurrently are not locked with an intent to update when they are read. Instead, when the update is eventually made, the row is checked to make sure it has not been updated concurrently since it was read. If it has been updated concurrently, then the transaction is rolled back and the command may be restarted from the beginning in a new transaction, if appropriate. In this scheme, performance is improved when concurrent updates do not normally occur, because the relatively expensive process of obtaining the database locks with intent to update is avoided. On the other hand, for those operations where concurrent updates are more likely to occur, pessimistic locking, whereby intent to update locks are obtained when the row is read, continues to be used, thus avoiding the more expensive process of rolling back and re-starting from the beginning in a new transaction.

  10. Which are the different subsystems in commerce?
    There are mainly 6 subsystems available in WCS namely:
    1)Catalog 2)Member 3)Order 4)Marketing 5)Merchandising 6)Trading.


  11. What are the different tools available in commerce?
  12. Explain Control command and task command in wcs ?
  13. What is the use of KEYS table in wcs ?
  14. What is the use of CMDREG table in wcs ?
  15. What is a command context.?
  16. How do you instantiate a task command ?
  17. Can we instantiate controller command from another controller command ?
  18. How do you pass data from controller command to task command?
  19. Name five methods available in a Controller command?
  20. what is the use of optCounter field?

  21. Why is struts-config entry required while creating a JSP or a command?
    To map views to corresponding JSP pages .
    
    
  22. What is the use of commitCopyHelper() and refreshCopyHelper()?
    commitCopyHelper():Instead of using the remote interface, CopyHelper Access Beans exist that contain getters and setters for CMP fields that do not exist on the remote interface. The methods within the CopyHelper Access Beans write data to a hash table that in turn updates the database when commitCopyHelper() is called. The hash table can record multiple database changes then update the database in one transaction, unlike the remote methods which require one transaction per change.

     RefreshCopyHelper():which does the reverse function of commitCopyHelper(). The method refreshCopyHelper() writes to the hash table from the database.
    
    
  23. What does map.mapxmi file contain?
    Mappings from EJB bean attribute definitions to database table schema column definitions .

  24. List the different business models of wcs ?
    The different business models of wcs are:

    a)B2C b)B2B c)Demand chain d)Supply chain e)Value chain and f)Extended sites.

  25. Which are different types of Exceptions used in commerce?

    ECApplicationException

    This exception is thrown if the error is related to user input and will always fail. For example, when a user enters an invalid parameter, an ECApplicationException is thrown. When this exception is thrown, the solution controller does not retry the command, even if it is specified as a retriable command.
    ECSystemException
    This exception is thrown if a runtime exception or a WebSphere Commerce configuration error is detected. Examples of this type of exception include create exceptions, remote exceptions, and other EJB exceptions. When this type of exception is thrown, the solution controller retries the command if the command is retriable and the exception was caused by either a database deadlock or database rollback.   
  26. Which exception is retriable?
    ECSystemException

  27. How can we make a command retriable?


    A retriable command is a controller command that can re-execute itself after encountering a system-level exception during the command execution.

    To make an existing controller command retriable, must perform one of the following steps:
    1. Set the retriable properties in the PROPERTIES column of the CMDREG database table, where PROPERTIES is the default properties associated with this command. The properties are in the property1=value1&property2=value2 form, where propertyn is the name of the property and valuen is the value corresponding to the property.
    2. Set an instance property <CommandRegistryRetriableProperty defaultValue="1" /> in the wc-server.xml file.

  28. Functional architecture and Runtime architecture of WCS 6.0/WCS 7.0.

  29. Difference between mastercatalog and sales catalog?


    There are two types of catalogs in a WebSphere Commerce system: master and sales. While a master catalog is the central location to manage all your store's merchandise and services, a sales catalog is a subset of the merchandise and services found in the master catalog.
          Every store in the WebSphere Commerce system must have a master catalog. Only one master catalog can exist at a time, and multiple stores can share a master catalog. However, you can create one or more sales catalogs for customer display purposes. A sales catalog has a flexible display structure that allows you to associate products to more than one category, to suit the requirements of your store. 
    
    
  30. Explain the SKU,partnumber?


    Every product has a unique identification number when it is manufatured i.e.,PartNumber.SKU is a store keeping unit which is a number when a products  are orderable.
    
    
  31. Which tool is used for catalog management ?


    Product Management Tool.
    
    
  32. what is the difference between product and item?


    Products: A product acts as template for a group of items(or SKUs) that exhibits the same attributes.
    Items: An item is a tangible unit of merchandise that has a specific name, part number and price.
    
    
    
  33. What is attribute dictionary?


    An attribute dictionary is a set of common attributes and attribute values that can be reused by multiple products. The attribute management tool in Management Center provides business users the ability to create,update, assign, and manage product attributes.
    
    
  34. Difference between Static Kit and Packages


    Packages: A package is an atomic collection of catalog entries. It is that all the items in a package can sold together but individual selling of items in a package is not allowed.
    Static Kits: A static kit is a group of products that are ordered as a unit.
    A static kit will back order if any of its components are unavailable.
    A static kit is first created as a package then configured by an administrator.

  35. Explain Organization hirarchy?

  36. What are the identifiers for root and default organizations
  37. what are the features of and the services offered by Member subsystem.
  38. Different tables used for user registraton?
  39. Releationship between the user and organization?
  40. How does the user change from generic to registered via guest.
  41. How to create users?
  42. How to create organization?
  43. What are the different typs of user types?
  44. What are the different types of member groups
  45. What is Range-based customer registration information

  46. What is calculation usage?


    Calculation usage consists of types of taxes that can be attached to an order item.
    By default we have 7 types of taxes like shipping, discount, shipping tax, etc.
    All those can be found in CALUSAGE database table.
  47. Different types of Charges?


    There are 7 types of charges, those are:
    a)discount
    b)shipping
    c)sales tax
    d)shipping tax
    e)coupon
    f)surcharge
    g)shipping adjustment
    
    
  48. Wkat is fulfillment center?


    Stores use fulfillment centers as both inventory warehouses and shipping and receiving centers. One store can have one or many fulfillment centers.
  49. What is calcode?


    While attachment is defined outside of a calculation code, the following properties are defined as part of a calculation code:
    A calculation usage. This specifies the calculation type for which a calculation code can be used. Calculation usages are covered in Calculation usages.
    Calculation methods that are used to qualify, calculate, and apply the calculation code.
    A flag indicating if a calculation code must be qualified or not.
    A flag indicating if the calculation code is active, inactive, or marked for deletion.
    The method of grouping order items for calculations.
    A sequence number that is used to determine the order of calculations when multiple calculation codes of the same calculation usage apply to an order item.
    A time range during which the calculation code is in effect.
    These properties are defined in the CALCODE database table.
    
    
  50. What are calmethods?


    Calculation methods use the information that is part of calculation usages, calculation codes, and calculation scales to determine monetary amounts for order items. Calculation methods are categorized by the task that they perform within the calculation framework and the part of the calculation framework to which the calculation method belongs.
  51. When taxes are calculated?


    Taxes are calculated when we proceed to checkout.
  52. How many ways calcode can be attached?


    3 ways calcode can be attached.
    a)Direct attachment: Here, we can attach a calcode to order or orderitem directly
    b)Indirect attachment: Here, we attach a calcode to catalog or catalog group. Hence, every item in a particular catalog or catalog group is indirectly attached to calcode that is attached to that catalog or catalog group.
    c)Default attachment: Here, we implicitly attach a calcode specifying a calcode to an orderitem in STENCALUSG table.
  53. How many types of inventory exists?


    There are 4 types of inventory exists in wcs namely:
    a)ATP  b)Non ATP c)External Inventory d)No Inventory.
  54. Whar are the different types of order capture?


    WebSphere Commerce supports several mechanisms for submitting orders. A customer or Customer Service Representative can submit an order using any of the following methods:
    a)Requisition lists 
    b)Wish lists 
    c)Shopping carts 
    d)Scheduled orders are recurring orders 
    e)Quick orders 
    f)Copied orders 
    g)Sales quotes.
  55. How to know whether an inventory is allocated for the order or not?


    By checking in to OrderItems table InventoryStatus column.If that column has an value as allc then an inventory is allocated for the order.