Monday, March 30, 2015

How to Use Profile Realms on (ATG Oracle Commerce)

Profile Realms were introduced into ATG 10.1, and it is a feature that will allow a MultiSite environment being able delimit users profiles among Sites.

Let's use ATG Commerce Reference Store as example.

OOTB uses Default Profile Realm  which basically allows you to use the same profile on all the sites.



But if you want to restrict the profiles per site you can do this configuring Profile realms:

Let's see this example:





The First thing to do is create your Profile Realms, in order to do it go to PUB dyn admin and browse to component /atg/multisite/ProfileRealmManager/ there is a form to create the realm and it ask for and ID, name and description. refer to http://docs.oracle.com/cd/E52191_02/Platform.11-1/ATGMultisiteAdminGuide/html/s1703creatingaprofilerealm01.html



Provide that information and click on create, we have created 2 Profile Realms for CRS, crsUS and crsDE, when this is done BCC is able to see them.




After the profiles are present, it is time to associate those with the Sites.


In terms of configuration this is the only thing you need to do, CRS is able to handle profile realms, but if your custom applications is not using CRS as base store you need to take care of some considerations on your code.

But In code you need to take care of some things, like push and pop the profile realmId every time you are doing any action with the profile, such as Login, Logout, Edit account information, edit Profile Credit Card and so on, this can be found on the documentation at http://docs.oracle.com/cd/E35319_01/Platform.10-2/ATGPlatformProgGuide/html/s0908profilerealmcontextpushandpopmet01.html


This is a video of how the profile realms we configured above work inside CRS.







Thursday, March 26, 2015

How to hide a workflow into BCC (ATG Oracle Commerce)

As Developer you can create your own custom BCC workflows, for example you can have a workflow that advance by itself (let's say an automatic workflow), and you do not want the BCC users see that into bcc, because is something they will not use:



You need to change 2 properties on /atg/bizui/activity/PublishingActivitySource/

One is to tell bcc which directories are having your BCC workflows, OOTB this is the value:


And there is another property that can be used to hide workflows, OOTB is empty, but you can change it as follows:






As Example, I have this configuration:





And it uses the .wdl on Common on BCC and hide the Content Administration directory, where are my custom workflows:


This hide the workflow from the BCC:

Tuesday, March 17, 2015

Add a Logger to Non Nucleus Classes (ATG Oracle Commerce)

There are some situations where you need to create a class that will not be a nucleus component, for example PropertyDescriptor Classes or Util classes used as TagLibs, or many other examples.

So you want to have a good logging for those classes, in order to log with them ATG provides a Nucleus Logger component that can help to achieve this.

This component can be found at /atg/dynamo/service/logging/ClassLoggingFactory

And Works as follows:

First you need to add an instance of this logger to your Class as Follows:



Once this is done, you can use it as regular logger:


The ClassLoggingFactor will create an entry for your class and you will be able to see this:

/dyn/admin/nucleus/atg/dynamo/service/logging/ClassLoggingFactory/




You will notice that loggingDebug and loggingError flags are present, is up to you when to turn them on Live.

You can turn on logging for ClassLoggingFactory client classes when your application starts up by creating a properties file at the appropriate location. In the above example one could create a properties file

/atg/dynamo/service/logging/ClassLoggingFactory/com.ocorp.MyClass.properties with the contents:



This can be found on ATG and is out there since ATG 2007 at minimum:

http://docs.oracle.com/cd/E23507_01/Platform.20073/ATGProgGuide/html/s1003loggingwithnonnucleusinstantiate01.html


Thursday, March 12, 2015

How to set up set your context-path to be / on JbossEAP 6.1.0

These steps are easier to understand if you already have an application deployed and you want to move that to use context-path as / instead the app name on the context-path.

In order to accomplish this we need to do some things on our application and on our Jboss installation:

These are the steps you need to do to make this happen:

  • Change your application.xml to set up context-root follows:
  • do similar on web.xml 
  • Change your .xml server deployment file located at $JBOSS_HOME/standalone/configuration/ and set enable-welcome-root to false

  • Create a Symbolic Link for ROOT.war to point to your war at the following path: $JBOSS_HOME/standalone/deployment/

    • If you are on Linux it is as simple as this:  
      ln -s $JBOSS_HOME/standalone/deployments/app/app.ear/app.war ROOT.war
    • Then do create a file at the same path called: ROOT.war.deployed the content does not matter so you can just do touch ROOT.war.deployed
    If you have made all those changes you are done, and you will be able to see your app running on http://yourhost:port/ 


    This information can be found also at https://developer.jboss.org/thread/204687 which is the jboss official forum.





Monday, March 2, 2015

How to validate an xml against a dtd

xmllint is a command line XML tool, you can find this out of the box on must linux distributions.

In Windows you can use cygwin to install it.

Just install it as follows:

setup-x86_64 -qP libxml2
once is installed on your cygwin

Just call it as follows:

 xmllint --noout --dtdvalid orders.dtd order.xml

Where:

--noout will not print the xml as output.
--dtdvalid will check if an xml is valid against a particular .dtd.
The first file is your .dtd definition
and the Secnond file is the file that will be validated.


The output that you will get if the validation fails is as follows: