Thursday 10 December 2015

Web Logic Debug Mode

Go to the path C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\bin

1.       Copy startWebLogic.cmd file at the same location with name startWebLogic_debug.cmd.

Search for %JAVA_HOME%\bin\java %JAVA_VM% -version in the startWebLogic_debug.cmd file.

Add below 2 lines after this line:

echo "Launching Java with debug port: 8453"
set JAVA_OPTIONS=%JAVA_OPTIONS% -Xdebug -Djava.compiler=NONE -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8453,suspend=n

2.       Copy startManagedWebLogic.cmd at the same location with name startManagedWebLogic_debug.cmd

Search for ‘startWeblogic.cmd’ in startManagedWebLogic_debug.cmd file and replace it with startWeblogic_debug.cmd.

Please find below the changes for reference:
               
                if "%1"=="" (
                                @REM  Call Weblogic Server with our default params since the user did not specify any other ones
                                call "%DOMAIN_HOME%\bin\startWeblogic_Debug.cmd" nodebug noderby noiterativedev notestconsole noLogErrorsToConsole
) else (
                                @REM  Call Weblogic Server with the params the user sent in INSTEAD of the defaults
                                call "%DOMAIN_HOME%\bin\startWeblogic_Debug.cmd" %1 %2 %3 %4 %5 %6 %7 %8 %9
)
               
3.       Now, start the server using the newly created startWeblogic_Debug.cmd file.

4.       Once the server is started, do the following changes in eclipse:

i.                     Click on  Run –> Debug Configurations ->Remote Java Application ->New launch configuration
ii.                   Give the following details:
Name: Any name say Test
Project : Browse and select the required project where the file that needs to be debugged.
Port : 8453

iii.                  Click on Apply and Debug.

Thursday 26 November 2015

How to resolve unable to start atg wizard(Plug-in "atg.project" was unable to instantiate class "atg.eclipse.project.wizard.ProjectWizard".)

How to resolve:

When we are creating new atg project will get below error some times..

The selected wizard could not be started.
Plug-in "atg.project" was unable to instantiate class "atg.eclipse.project.wizard.ProjectWizard".
atg/applauncher/AppLauncherException

Step1 : In Eclipse got Window-->Preferences -->ATG Preferences

In ATG Prefeernces please select/browse the exact path of ATG Root Directory



Step 2.Select the Perspective as ATG 





Step 3: Copy the ATGUpdateSite.jar file from D:\project\ATG\ATG11.1\Eclipse\ATGUpdateSite.jar
to D:\project\Eclipse\plugins Folder

Note : Restart your eclipse if its already opened.

































Wednesday 4 November 2015

IsEmpty and IsNull in ATG

Java differences 


StringUtils.isEmpty()   : checks empty or null)

StringUtils.isEmpty("")        = true
StringUtils.isEmpty(null)      = true
StringUtils.isEmpty(" ")       = false
StringUtils.isEmpty("hoo")     = false
StringUtils.isEmpty("  omg  ") = false




StringUtils.isBlank() : checks white space,null ,empty

 StringUtils.isBlank(null)      = true
 StringUtils.isBlank("")        = true
 StringUtils.isBlank(" ")       = true
 StringUtils.isBlank("hoo")     = false
 StringUtils.isBlank("  omg  ") = false

ATG Droplets


isEmpty Droplet in Atg  :
                            Here we are checking hobbies are empty or not in MyProfile.

 <dsp:importbean bean="atg/dynamo/droplet/IsEmpty"/>
  <dsp:importbean bean="atg/dynamo/droplet/ForEach"/>
 <dsp:droplet name="IsEmpty">
   <dsp:param name="value" bean="MyProfile.hobbies"/>
   <dsp:oparam name="false">
      Your hobbies are:
        <dsp:droplet name="ForEach">
           <dsp:param name="array" bean="MyProfile.hobbies"/>
           <dsp:oparam name="output">
              <dsp:valueof param="element"/>
           </dsp:oparam>
        </dsp:droplet>
   </dsp:oparam>
   <dsp:oparam name="true">
      All work and no play makes Jack a dull boy.
   </dsp:oparam>
</dsp:droplet>


IsNull Droplet in Atg :
                                     Here we are checking email is null or not in MyProfileFormHandler,if its null
we are updating it with the user provided value.

 <dsp:importbean bean="atg/dynamo/droplet/IsNull"/>
  <dsp:droplet name="IsNull">
  <dsp:param bean="MyProfile.email" name="value"/>
  <dsp:oparam name="true">
    <dsp:form action="address_book.jsp" method="POST">
      My email address:
      <dsp:input type="text" bean="MyProfileFormHandler.email"/>
      <dsp:input type="submit" bean="MyProfileFormHandler.update value="Update"/>
    </dsp:form>
  </dsp:oparam>
</dsp:droplet>



Order pipeline chain differances

LoadOrder : 

                                      When an Order is loaded from the Order Repository, the loadOrder() method in the OrderManager calls into the PipelineManager to execute the loadOrder pipeline, which creates and loads the Order object, as well as its OrderPriceInfo and TaxPriceInfo objects.
 


RefreshOrder:

       When an Order property is accessed (for example, by callinggetCommerceItems() or getPriceInfo()), the refreshOrder pipeline is invoked, which creates and loads the rest of the contained objects in the Order.


UpdateOrder:

                
                                        Updates the order in the repository with any changes that may have been made during the execution of this chain (splitting of shipping groups, update of states, etc.).


ProcessOrder

                                        When ever you are committing the order using commitorder() that time processorder pipeline chain will call.

                  

Thursday 2 April 2015

Create New Endeca Application.

Step 1:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Lenovo>cd C:\MY\ENDECA\Apps

C:\MY\ENDECA\Apps>cd C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\bin

C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\bin>deploy.bat --app
04/02/2015 18:40:30 [deploy.pl] FATAL: Invalid application descriptor file
   specified:

C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\bin>deploy.bat --app C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\reference\discover-data\deploy.xml

 ------------------------------------------------------------------------------
   Found version 6.1 of the Endeca IAP installed in directory
   C:\\\MY\ENDECA\\PlatformServices\6.1.4. If either the version or location
   are incorrect, type 'Q' to quit and adjust your ENDECA_ROOT environment
   variable. Press enter to continue with these settings.

   Continue?
    y

 ------------------------------------------------------------------------------
     Deployment Template installation script.

     This script creates the directory structure for your
     deployment and installs configuration files and scripts
     into the directory structure.

  04/02/2015 18:44:42 [deploy.pl] INFO:  Starting deployment template
   installation.

 ------------------------------------------------------------------------------
   The following app modules were specified on the command line argument:

   C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\reference\discover-data\deploy.xml


   Modules may be deployed standalone or on top of a base deployment type. Do
   you want to install a base deployment with the specified module(s)?

   Install base deployment? [Y/N]:
y
04/02/2015 18:44:46 [AppDescriptorReader] INFO:  Parsing application descriptor
   file
   C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\reference\discover-data\deploy.xml.
04/02/2015 18:44:46 [AppDescriptorReader] INFO:  Parsing application descriptor
   file
   C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\app-templates\base_descriptor.xml.

 ------------------------------------------------------------------------------
   Enter a short name for your application.

   Note: The name must conform to this regular expression: ^[a-zA-Z0-9]+$
    [default: Discover]

   Choosing a different application name may require additional configuration on
   your web application.

   Application name:
TESTAPP

 ------------------------------------------------------------------------------
   Specify the path into which the application will be deployed. The specified
   directory must exist and cannot contain spaces.

   For example, to deploy into c:\apps\TESTAPP, specify the path as c:\apps.

   Deployment directory:
C:\MY\ENDECA\Apps

 ------------------------------------------------------------------------------
   Specify the port on which the Endeca Application Controller is running. This
   is configured in the server.xml file in the workspace of the Endeca software
   install and should be the same for all applications deployed in this
   environment. Ports must be in the range 1024-65535 [default: 8888].

   EAC port:
8888
04/02/2015 18:46:05 [deploy.pl] INFO:  Deploying application into
   C:\MY\ENDECA\Apps\TESTAPP

 ------------------------------------------------------------------------------
   What port is the Workbench running? [Default: 8006]


 ------------------------------------------------------------------------------
   What port should be used for the Live Dgraph? [Default: 15000]


 ------------------------------------------------------------------------------
   What port should be used for the Authoring Dgraph? [Default: 15002]


 ------------------------------------------------------------------------------
   What port should be used for LogServer? [Default: 15010]

04/02/2015 18:46:28 [AppDescriptorReader] INFO:  Parsing application descriptor
   file
   C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\app-templates\base_descriptor.xml.
04/02/2015 18:46:28 [deploy.pl] INFO:  Processing install with id 'Dgraph'
04/02/2015 18:46:30 [AppDescriptorReader] INFO:  Parsing application descriptor
   file
   C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\reference\discover-data\deploy.xml.
04/02/2015 18:46:30 [deploy.pl] INFO:  Processing install with id
   'DefaultTemplateManagerApp'
04/02/2015 18:46:32 [deploy.pl] INFO:  Application successfully deployed.

C:\MY\ENDECA\ToolsAndFrameworks\3.1.2\deployment_template\bin>




*************************************************
Step2 :
Once Application is created in the location C:\MY\ENDECA\Apps
run the below command in command prompt
C:\MY\ENDECA\Apps\TESTAPP\control>initialize_services.bat

open http://localhost:8006/ifcr/sites/TESTAPP.html

now you can able to see your created application in ExperianceManager

Tuesday 31 March 2015

1.One to Many  RelationShip Example:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<gsa-template>
   <item-descriptor name="stdinfo" display-property="studentName">
<table name="studentInfo" id-column-name="stdid" type="primary">
<property name="stdid" column-name="STUDENT_ID" data-type="String"/>
<property name="studentname" column-name="STUDENT_NAME" data-type="String"/>
<property name="studentage" column-name="STUDENT_AGE" data-type="String"/>
<property name="studentaddress" column-name="STUDENT_ADDRESS" data-type="String"/>
<property name="state" column-name="STATE" item-type="state" ></property>
<property name="city" column-name="CITY"  item-type="city" ></property>
   </table>
</item-descriptor>

 <item-descriptor name="state" display-property="statename">
<table name="stateInfo" id-column-name="stateid" type="primary">
<property name="stateid" column-name="stateid" data-type="String"/>
<property name="statename" column-name="STATE_NAME" data-type="String"/>
</table>
<table name="state_cities" id-column-name="stateid" type="multi">
 <property name="cities" column-name="cityid" data-type="set" component-item-type="city"/>
</table>
</item-descriptor>


 <item-descriptor name="city" display-property="cityname">
<table name="cityInfo" id-column-name="cityid" type="primary">
<property name="cityid" column-name="cityid" data-type="String"/>
                <property name="cityname" column-name="CITY_NAME" data-type="String"/>          
</table>
</item-descriptor>

</gsa-template>




Wednesday 21 January 2015

Differences between CartModifierFormHandler & ShoppingCartFormHandler?

1.CartModifierFormHandler :- Used to modify the shopping cart by adding items, deleting items and modifying the quantities of items in cart and preparing for checkout.

  ShoppingCartFormHandler Used for handling cart management (add/remove/adjust item quantity) and checkout process (shipping, billing, committing order).

2.CartModifierFormHandler :- you would have to handle checkout flow yourself by using ExpressCheckoutFormHandler in case of express checkout and in case of full checkout by using ShippingGroup & PaymentGroup form handlers and finally CommitFormHandler to confirm and commit the ordr.

  ShoppingCartFormHandler :- Various functions for cart to checkout are exposed via different handleXXX methods.

3.CartModifierFormHandler :-doesn't provide you the checkout flow.

  ShoppingCartFormHandler :- provides simpler cart management and checkout implementation all in itself.

4.CartModifierFormHandler :- would provide some benefits like better handling and security for concurrent updates of orders.

  ShoppingCartFormHandler  : not that much secure for concurrent updates of orders

5.CartModifierFormHandler:Based implementation would not be that simple and require other form handlers.

  ShoppingCartFormHandler  : simple and all checkout flow provided by it.

Thursday 6 November 2014

Assigning Items to Shipping Groups In ATG

                   when ever first order is created,it has an empty shipping group,this will serves as default shipping group,this default shipping group is defined by a property defaultShippingGroupType in OrderTools component.
OrderTools.properties
defaultShippingGroupType=hardgoodShippingGroup
1.If there is a only one shipping group,if you add any commerce item to order that item is part of default shipping group.
Ex1:
Shipping group : default shipping group.
Commerce Items : ci1,ci2,ci3,ci4
Order : all the items will set to default shipping group
2.if there is any other shipping groups in order,then the items we have to explicitly assigned to one of the existed shipping groups.
Ex2:
Shipping group : sgp1,sgp2
Commerce Items : ci1,ci2,ci3
Order : so order contains 3 items and 2 shipping groups
1. ci1 and ci2 we are setting to sgp1
2. c i3 setting to sgp2
Before order is checked every item in the order must and should part of shipping group(s),this requirement check by the validateForCheckout pipeline,validateForCheckout pipeline validates a different part of theOrder as complete.

In validateForCheckout pipelinechain we have one processor validateShippingGroupsForCheckout,this processor validates the shipping groups in the order.As per the ATG,shipping group will complete when ever it met the below criteria.

I..name, address, city, state, and postal code these fields should not be empty in ShippingGroup

II.All of the items in order should be assigned to shipping group,for this some requirements are there.

            If there is only one ShippingGroup in the Order and no relationships exist between that ShippingGroup and the commerce items in the Order, then the shipping of all commerce items in the Order implicitly is accounted for by that ShippingGroup.

             If there is only one ShippingGroup in the Order and relationships exist between that ShippingGroup and the commerce items in the Order, or if there is more than one ShippingGroup in the Order, then every CommerceItem in the Order must have its shipping explicitly accounted for with one or more ShippingGroupCommerceItemRelationship objects, as follows:

              *1.If a CommerceItem has a ShippingGroupCommerceItemRelationship of type ShippingQuantityRemaining, then the item’s shipping is accounted for regardless of whether it has other shipping relationships. This is because a “remaining” relationship type covers any quantity of the CommerceItem that is not accounted for by other shipping relationships.

              *2.If a CommerceItem has one or more ShippingGroupCommerceItemRelationship objects of type ShippingQuantity, but no relationship of typeShippingQuantityRemaining, then the total quantity of the CommerceItem covered by the relationships must be equal to or greater than the quantity in theCommerceItem.
The range property in the ShippingGroupCommerceItemRelationship identifies which particular items out of the total quantity of a CommerceItem are associated with a given ShippingGroup.

Wednesday 5 November 2014

Pipeline Customization in ATG


Pipeline is a collection of processors which executes sequentially.

 Step 1 : Updated commercepipeline.xml to add new processor class

 Step 2 : Here we are injecting the new processor class as the sepcond processor in the updateOrder chain.
 Step 3 :we have to Register the new processor as a nucleus component.



 Step 4 :we have to create Custom Processor class that should be an implementation of PipelineProcessor
 Step 5 :Restart your ATG  Server.

Explanation :
OOTB : \config\atg\commerce\commercepipeline.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <pipelinemanager>
       <pipelinechain name="updateOrder" transaction="TX_REQUIRED" headlink="updateOrderObject">
        <pipelinelink name="updateOrderObject" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveOrderObject"/>
            <transition returnvalue="1" link="updateCommerceItemObjects"/>
        </pipelinelink>

        <pipelinelink name="updateCommerceItemObjects" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveCommerceItemObjects"/>
            <transition returnvalue="1" link="updateShippingGroupObjects"/>
        </pipelinelink>
..........
   </pipelinemanager>
 
 
Step 1 and Step2 :Customization/Configuration:
   <pipelinemanager>
       <pipelinechain name="updateOrder" transaction="TX_REQUIRED" headlink="updateOrderObject">
        <pipelinelink name="updateOrderObject" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveOrderObject"/>
            <transition returnvalue="1" link="checkInventoryObject"/>
        </pipelinelink>

<pipelinelink name="checkInventoryObject" transaction="TX_MANDATORY">
            <processor jndi="/inventory/processor/ProcCheckInventory"/>
            <transition returnvalue="1" link="updateCommerceItemObjects"/>
       </pipelinelink>

        <pipelinelink name="updateCommerceItemObjects" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveCommerceItemObjects"/>
            <transition returnvalue="1" link="updateShippingGroupObjects"/>
        </pipelinelink>
...........
   </pipelinemanager>
 
Step3 : ProcCheckInventory.properties(/inventory/processor/ProcCheckInventory)
        $class=/info/atgblog/inventory/processor/ProcCheckInventory

Step4 :ProcCheckInventory.java

        public class ProcCheckInventory extends ApplicationLoggingImpl implements PipelineProcessor {

          public int[] getRetCodes() {
       return new int{1,2};
        }
  public int runProcess(final Object pParam, final PipelineResult pResult)
throws Exception {
// check inventory and return the status accordingly
return 1;
   }
       }




Tuesday 4 November 2014

ATG Local Set Up


 Required Softwares
  Oracle 11g XE

  ATG10.1.1
  Jboss-eap-5.1  
  SqlDeveloper
  Eclipse 
Step 1: Create a connection with system/admin in Sql developer,system is just like a administrator   hence using system schema will create our own schema/user 



Step 2: In system, create a table space like atgtablespace.DBF with the help of following query and create a User in that table space and grant permissions to that user like,hence all our tables will store in our own schema under the path C:\oraclexe\app\oracle\oradata\XE

atg_dev.
create tablespace atg_tablespace
logging
datafile 'C:/oraclexe/app/oracle/oradata/XE/atgtablespace.DBF'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
create user atg_dev identified by atg_dev default tablespace atg_tablespace;
grant connect,resource,dba to atg_dev;
commit;
Step 3:
Create a new database connection with 
   Connectionname: atg_dev
   Username: atg_dev        paassword:atg_dev



Step 4: 
   For getting all OOTB tables into our schema we have to run those tables into our own schema
In atg_dev, Execute below scripts sequence order from the sql developer.
\ATG\ATG10.1.1\DAS\sql\install\oracle\das_ddl.sql
\ATG\ATG10.1.1\DPS\sql\install\oracle\dps_ddl.sql
\ATG\ATG10.1.1\DSS\sql\install\oracle\dss_ddl.sql
\ATG\ATG10.1.1\DCS\sql\install\oracle\dcs_ddl.sql


Step 5: We need to create ds file like atg_ds. xml in the folder 
C:\jboss-eap-5.1\jboss-as\server\dev\deploy 
  <?xml version="1.0" encoding="UTF-8"?>
<datasources>
<!-- @version $Id: //product/CIM/version/10.1.1/plugins/Base/filetemplate/jboss-open-ds.xml#1 $$Change: 690623 $-->
<xa-datasource>
          <jndi-name>ATGProductionDS</jndi-name>
          <isSameRM-override-value>false</isSameRM-override-value>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>100</max-pool-size>
          <blocking-timeout-millis>5000</blocking-timeout-millis>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
          <xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
 <xa-datasource-property name="URL">jdbc:oracle:thin:@localhost:1521:xe</xa-datasource-property>


          <xa-datasource-property name="User">atg_training</xa-datasource-property>
          <xa-datasource-property name="Password">atg_training</xa-datasource-property>
          <!-- Uncomment the following if you are using Oracle 9i
          <xa-datasource-property name="oracle.jdbc.V8Compatible">true</xa-datasource-property>
         -->
          <exception-sorter-class-name>
              org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
          </exception-sorter-class-name>
    </xa-datasource>
<!-- @version $Id: //product/CIM/version/10.1.1/plugins/Base/filetemplate/jboss-oraclethin-xa-ds.xml#1 $$Change: 690623 $-->
</datasources>
<!-- @version $Id: //product/CIM/version/10.1.1/plugins/Base/filetemplate/jboss-close-ds.xml#1 $$Change: 690623 $-->
    
In this Datasource file we need to change URL, username, Password as per our data base schema
   
     URL: jdbc:oracle:thin:@localhost:1521:xe
     Username: atg_dev
      Password: atg_dev
JNDI Name: We can give anything but same name we need to mention in JTDataSource property file of your component.  <Jndi-name>ATGProductionDS</Jndi-name>
Step 6: In the module we need to create JTDataSource.properties file in the path atg/dynamo/service/jdbc/JTDataSource.properties
  
 Need to Give following code in atg/dynamo/service/jdbc/JTDataSource.properties
    $class=atg.nucleus.JNDIReference
    JNDIName=java:/ATGProductionDS


Step 7Create deploy.bat and run.bat in your module.



Deploy.bat
   set ATG_HOME=C:\xxx\ATG\ATG10.1.1\home
set ATG_ROOT=C:\xxx\ATG\ATG10.1.1
set DYNAMO_HOME=C:\xxx\ATG\ATG10.1.1\home
set DYNAMO_ROOT=C:\xxx\ATG\ATG10.1.1
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_35
set JBOSS_HOME=C:\jboss-eap-5.1\jboss-as
set PATH=%PATH%;%JAVA_HOME%\bin;%JBOSS_HOME%\bin;
set CLASSPATH=%JBOSS_HOME%\lib;%JAVA_HOME%\lib;
cd %ATG_HOME%\bin
runAssembler %JBOSS_HOME%\server\dev\deploy\Atg.ear -m DafEar.Admin Training

Run.bat
set ATG_HOME=C:\xxx\ATG\ATG10.1.1\home
set ATG_ROOT=C:\xxx\ATG\ATG10.1.1
set DYNAMO_HOME=C:\xxx\ATG\ATG10.1.1\home
set DYNAMO_ROOT=C:\xxx\ATG\ATG10.1.1
set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_35
set JBOSS_HOME=C:\jboss-eap-5.1\jboss-as
set PATH=%PATH%;%JAVA_HOME%\bin;%JBOSS_HOME%\bin;
set CLASSPATH=%JBOSS_HOME%\lib;%JAVA_HOME%\lib;
cd C:\jboss-eap-5.1\jboss-as\bin
run -c dev -b localhost | ATGLogColorizer_v1_2
Note: If you want to change the port number 
   Go to--> C:\jboss-eap-5.1\jboss-as\server\dev\deploy\jbossweb.sar\server.xml
Then create a new atg project in eclipse.

Then have to run deploy.bat like below





Then run.bat just like same.   
Before starting the application we have to change the port number because 8080 is already using by the oracle server hence we have to change the port in the locations.
C:\xxx\jboss-eap-5.1\jboss-as\server\dev\deploy\jbossweb.sar
Dev our own path 


<Connector protocol="HTTP/1.1" port="8888" address="${jboss.bind.address}" 
               connectionTimeout="20000" redirectPort="8443" />
And also in default folder path also 
C:\xxx\jboss-eap-5.1\jboss-as\server\dev\default\jbossweb.sar
<Connector protocol="HTTP/1.1" port="8888" address="${jboss.bind.address}" 
               connectionTimeout="20000" redirectPort="8443" />