1 Nov 2019

Oracle DB how to...


How to revert commited changes in Oracle DB, as example:

MERGE INTO cos_translations d
     USING (select * from cos_translations as of timestamp timestamp '2015-12-08 17:00:00') 
     ON (d.id = o.id and d.asset_version=o.asset_version)
     WHEN MATCHED THEN
         UPDATE SET d.resource_value_en = o.resource_value_en, d.resource_value_ro = o.resource_value_ro;

SSL configuration example for Developer VM with ATG 10/Weblogic 10/Spindrift Site Builder

Configuring Developer VM for SSL

SSL configuration example for Developer VM with ATG 10/Weblogic 10/Spindrift Site Builder

1) Open standard windows terminal cmd.exe
2) Environment variables
To be able to generate new certificate we should set two environment variables:
SET WL_HOME=C:\dev\Cosmote_ro\wl\wls103
SET CLASSPATH=%WL_HOME%\server\lib\weblogic.jar
3) Remove expired certificate
We have keystore in our VMs here C:/dev/Cosmote_ro/certs/rtc.keystore with pretty old certificate
So as the first step we should check and remove certificate if it's already expired.
To see list of certificates use command:
keytool -list -keystore C:/dev/Cosmote_ro/certs/rtc.keystore -storepass weblogic -v
Remove certificate if it's expired (if your VM is using certificate with different alias, please change it accordingly):
keytool -delete -alias rtc -keystore C:/dev/Cosmote_ro/certs/rtc.keystore -storepass weblogic
4) Generate new certificate and put it to the keystore:
keytool -genkey -v -alias rtc -keyalg RSA -keysize 2048 -sigalg MD5withRSA -dname "CN=wls-sysadm" -keypass weblogic -validity 3650 -keystore C:/dev/Cosmote_ro/certs/rtc.keystore -storepass weblogic
5) Make newly generated certificate trusted
Now we will put the same newly generated certificate as trusted with different alias to the keystore
For that we should export certificate from the keystore first:
keytool -export -alias rtc -file rtc_cert -keystore C:/dev/Cosmote_ro/certs/rtc.keystore -storepass weblogic
And then we should import this certificate as trusted back to the same keystore:
keytool -import -trustcacerts -alias rootcacert -file rtc_cert -keystore C:/dev/Cosmote_ro/certs/rtc.keystore -storepass weblogic
6) Weblogic 10 configuration
Open Environment > Servers > CosmoteStore-weblogic-prod, tab Configuration, subtab Keystores
Keystores: Custom Identity and Java Standard Trust
Custom Identity Keystore: C:/dev/Cosmote_ro/certs/rtc.keystore
Custom Identity Keystore Type: JKS
Custom Identity Keystore Passphrase: weblogic
Confirm Custom Identity Keystore Passphrase: weblogic
Save the changes pressing button "Save"
Now switch to "SSL" subtab:
Identity and Trust Locations: Keystores
Private Key Alias: rtc
Private Key Passphrase: weblogic
Confirm Private Key Passphrase: weblogic
Save the changes.
Then switch to "General" subtab and set:
SSL Listen Port: 8443
Make sure checkbox "SSL Listen Port Enabled" is checked.
Save your changes.
7) ATG 10 & SiteBuilder configuration
Below configuration is relevant for EAR built in development mode.
Since SSLv3 is considered as insecure by browsers we should change this in atg\dynamo\security\BasicSSLConfiguration
Also BasicSSLConfiguration refers to expired ATG certificate from atg-sample-keystore.jks keystore.
We will not generate another key but will use the same key we generated before.
So we should create properties file and override values as follows:
c:\dev\Cosmote_ro\ATG\ATG10.1.2\home\servers\CosmoteStore-prod\localconfig\atg\dynamo\security\BasicSSLConfiguration.properties
Put inside the file:
secureSocketProtocol=TLS
keyManagerAlgorithm=SunX509
keyStore=C:/dev/Cosmote_ro/certs/rtc.keystore
keyStoreType=JKS
keyStorePassword=weblogic
After this changes atg/dynamo/server/HttpsServer component will be able to create secure SSL socket with /atg/dynamo/service/socket/SSLServerSocketFactory.
Now we should also disable default behaviour of the SiteBuilderRequestServlet. By default it's checking if page should be served with secure or non-secure protocol and performs redirects.
Since it should serve all pages with secure protocol we will just disable this to avoid incorrect redirection loop
Create the next properties file:
c:\dev\Cosmote_ro\ATG\ATG10.1.2\home\servers\CosmoteStore-prod\localconfig\spindrift\sitebuilder\SiteBuilderConfiguration.properties
Put inside the file:
enableSslRedirects=false
Restart CosmoteStore-weblogic-prod server and try to access storefront using your VM IP (or network hostname) and 8443 port
https://< VM IP> :8443
The first time you will see browser warning since we have self-signed certificate.
8) Optional steps
When Secure port configuration is OK - we could disable insecure port in Weblogic admin console.
Open Environment > Servers > CosmoteStore-weblogic-prod, tab Configuration, subtab General and uncheck Listen Port Enabled
Also we could force Weblogic to serve all connections to our ATG application with secure protocol.
To do so put the next fragment of XML into your CosmoteStorefront.war\WEB-INF\web.xml under web-app tag
<security-constraint>
<web-resource-collection>
<web-resource-name>SecureResource</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
Rebuild and restart production server if necessary.
Command file for Windows to generate SSL certificate and also BasicSSLConfiguration.properties and SiteBuilderConfiguration.properties files attached

14 Nov 2016

ATG 11.1 Merchandising Browse Customisation Part 2

Let's say we want to see child items for the postcode, city and county.
We should provide links definition in the /atg/remote/content/browse/ContentBrowseHierarchy.xml 

Insert the following into the xml so that Merchandising will know parent/child for each item:

<links id="postCodeLinks" parent-type="/cognity/estore/repository/AddressBookRepository:addressBookPostCode"> 
      <list-definition allow-circular-reference="false" visible="true" retriever="property" set-site-context-on-drilldown="false" allow-load="true" show-header="conditionally" id="postCodeChildStreets" show-count-on-header="false" allow-drilldown="true" child-type="/cognity/estore/repository/AddressBookRepository:addressBookStreet" show-count-on-children="false">
        <retriever-parameter name="propertyName" value="parentPostCodeId"/>
        <retriever-parameter name="reverseLink" value="true"/>
      </list-definition>
    </links>
    <links id="cityLinks" parent-type="/cognity/estore/repository/AddressBookRepository:addressBookCity"> 
      <list-definition allow-circular-reference="false" visible="true" retriever="property" set-site-context-on-drilldown="false" allow-load="true" show-header="conditionally" id="cityChildPostCodes" show-count-on-header="false" allow-drilldown="true" child-type="/cognity/estore/repository/AddressBookRepository:addressBookPostCode" show-count-on-children="false">
        <retriever-parameter name="propertyName" value="parentCityId"/>
        <retriever-parameter name="reverseLink" value="true"/>
      </list-definition>
    </links>
    <links id="countyLinks" parent-type="/cognity/estore/repository/AddressBookRepository:addressBookCounty"> 
      <list-definition allow-circular-reference="false" visible="true" retriever="property" set-site-context-on-drilldown="false" allow-load="true" show-header="conditionally" id="countyChildCities" show-count-on-header="false" allow-drilldown="true" child-type="/cognity/estore/repository/AddressBookRepository:addressBookCity" show-count-on-children="false">
        <retriever-parameter name="propertyName" value="parentCountyId"/>
        <retriever-parameter name="reverseLink" value="true"/>
      </list-definition>
    </links>

ATG 11.1 Merchandising Browse Customisation Part 1

While searching the internet I can't find good examples of the BCC Merchandising Browse customisation. So here it is

Create a file /atg/remote/content/browse/ContentBrowseHierarchy.xml that will be appended to the main configuration from DCS-UI

Be sure that your xml file is appended last so other modules is not affecting resulting xml. It might be necessary to add DCS-UI module into your ATG module manifest file among required modules so that xml from DCS-UI will come before the xml from your module. To check the resulting file please open component /atg/remote/content/browse/ContentBrowseManager and watch it's 'definitionFile' property. Check the order of xml files first.

ContentBrowseHierarchy.xml example for the newly created custom repository:
<?xml version="1.0" encoding="UTF-8" ?>
<browse-hierarchy xml-combine="append">
<browse-item id="home" xml-combine="append">
<browse-item reference-id="addressBook"/>
</browse-item>
<browse-item id="addressBook" label="Address Book" >
<browse-item reference-id="addressBookCounties"/>
<browse-item reference-id="addressBookCities"/>
<browse-item reference-id="addressBookPostCodes"/>
<browse-item reference-id="addressBookStreet"/>
</browse-item>
<browse-item  is-root="true" id="addressBookCounties" label="Counties" >
    <list-definition id="countyItems" retriever="query" child-type="/cognity/estore/repository/AddressBookRepository:addressBookCounty">
         <retriever-parameter name="query" value="ALL" />
    </list-definition>
</browse-item>
<browse-item is-root="true" id="addressBookCities" label="Cities">
    <list-definition id="cityItems" retriever="query" child-type="/cognity/estore/repository/AddressBookRepository:addressBookCity">
         <retriever-parameter name="query" value="ALL" />
    </list-definition>
</browse-item>
<browse-item is-root="true" id="addressBookPostCodes" label="PostCodes">
    <list-definition id="postCodeItems" retriever="query" child-type="/cognity/estore/repository/AddressBookRepository:addressBookPostCode">
         <retriever-parameter name="query" value="ALL" />
    </list-definition>
</browse-item>
<browse-item is-root="true" id="addressBookStreet" label="Streets" >
    <list-definition id="parentPostCodeItems" retriever="query" child-type="/cognity/estore/repository/AddressBookRepository:addressBookPostCode">
         <retriever-parameter name="query" value="id equals parentPostCodeId" />
    </list-definition>
    <list-definition id="streetsItems" retriever="query" child-type="/cognity/estore/repository/AddressBookRepository:addressBookStreet">
         <retriever-parameter name="query" value="ALL" />
    </list-definition>
</browse-item>
</browse-hierarchy>

13 Sept 2016

ATG Search 10.1: configure incremental search indexing

I found strange behaviour for incremental search indexing process when incremental indexing works only without index deployment. To resolve this issue use configuration below. Actually this configuration been used to index ~2.5 millions products.


1. /atg/commerce/search/ProductCatalogOutputConfig/
incrementalUpdateSeconds=5 (BCC)

2. /atg/searchadmin/adapter/repository/SearchProjectIndexingOutputConfig/
enableIncrementalLoading=true (BCC)

3. /atg/search/routing/Configuration/
indexingReadTimeoutMs=900000 (SF1 & BCC)

4. /atg/search/routing/RoutingIndexService/
defaultActivePhysicalPartitions=6 (SF1 & BCC)

5. /atg/commerce/search/OrderOutputConfig/
incrementalUpdateSeconds=-1 (SF1 & BCC)

6. /atg/userprofiling/search/ProfileOutputConfig/
incrementalUpdateSeconds=-1 (SF1 & BCC)


17 Jun 2016

BCC Troubleshooting

Run a Full deployment is easy. Just go to CA Console -> View -> Production -> Full Deployment button.

If project came to queued state and you can see it in Plan tab - cancel the project and after that do a critical reset - this shoud put production deployment agent in a correct state.

9 Feb 2016

Export BCC Deployment Topology

Sometimes you need to store deployment topology - for example before applying new DB dump to your DB

To be able to do this use component /atg/epub/deployment/TopologyManager/
You will find Primary Topology - the one is live now. Just press button "Download XML" for topology export.



Troubleshooting: if you will see security exception please enable /atg/dynamo/servlet/adminpipeline/AuthenticationServlet/ and login into dyn/admin

When you need to import Deployment Topology use:
Content Administration -> Admin console -> Configuration



Thanks