Build and deployment
of all portal artifacts can be automated using scripts, but recently we had
small issue with automation of personalization rule that uses dynamic attribute
(request) . I couldn't find sample xml (/PortalServer/doc/xml-samples/) or .nodes
file to automate the creation of dynamic attribute (And also there no option to
export from PZN Editor portlet) .
I couldn't find
anything related to this on the infocenter also so thought post this here and
this can be help if anybody looking on same lines.
To
create the dynamic attribute manually
- select specific application object and click on manage properties
- Enter the name of the dynamic attribute and select type.
- you can select the dynamic attribute once it is created, but here there is no option to export/import this dynamic attribute.
To
create the dynamic attribute using xml (.nodes)
After doing some
research, was able to create below xml(saved it as .nodes
file) that allowed me to create/import the dynamic attribute.
Filename : SivaTestRequestObjDynamicAttr.nodes
<?xml
version="1.0" encoding="UTF-8"?>
<sv:node
sv:name=".personalization/objects/ibmpersonalization:aoRequest/8448773582358480512"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
xmlns:ibmpzn="http://www.ibm.com/software/portal/personalization/ibmpzn/1.0"
xmlns:icm="http://www.ibm.com/software/data/cm/icm"
xmlns:sv="http://www.jcp.org/jcr/sv/1.0"
xmlns:ibmcontentwcm="http://content.ibm.com/wcm/1.0/"
xmlns:remote="http://content.ibm.com/remote/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:ibmpersonalization="http://www.ibm.com/software/data/cm/personalization"
xmlns:ibmpznnt="http://www.ibm.com/software/portal/personalization/ibmpznnt/1.0"
xmlns:lotus="http://content.ibm.com/lotus/1.0"
xmlns:ibmcmnt="http://www.ibm.com/software/portal/content/management/ibmcmnt/1.0"
xmlns:icmdefault="http://www.ibm.com/software/data/cm/icmdefault"
xmlns:pt="http://www.jcp.org/jcr/pt/1.0"
xmlns:pzn="http://www.ibm.com/software/data/cm/pzn"
xmlns:ibmcm="http://www.ibm.com/software/portal/content/management/ibmcm/1.0"
xmlns:jcrnt="http://www.jcp.org/jcrnt/1.0">
<sv:property
sv:name="jcr:nodeType" sv:type="pt:string">
<sv:value>ibmpersonalization:dynamicAttribute</sv:value>
</sv:property>
<sv:property
sv:name="ibmpersonalization:propertyDisplayName"
sv:type="pt:string">
<sv:value>testRequestObjDynamicAttr</sv:value>
</sv:property>
<sv:property
sv:name="ibmpersonalization:propertyName"
sv:type="pt:string">
<sv:value>testRequestObjDynamicAttr</sv:value>
</sv:property>
<sv:property
sv:name="ibmpersonalization:propertyType"
sv:type="pt:string">
<sv:value>java.lang.String</sv:value>
</sv:property>
<sv:property
sv:name="ibmpersonalization:publishedOnDate"
sv:type="pt:date">
</sv:property>
<sv:property
sv:name="icm:created" sv:type="pt:date">
<sv:value>2014-05-09T23:18:23.788Z</sv:value>
</sv:property>
<sv:property
sv:name="icm:lastModified" sv:type="pt:date">
<sv:value>2014-05-09T23:18:23.788Z</sv:value>
</sv:property>
</sv:node>
Couple of things are
highlighted in above xml snippet
- Pointing to proper application object
.personalization/objects/ibmpersonalization:aoRequest/8448773582358480512
For
Request ::::
".personalization/objects/ibmpersonalization:aoRequest"
For
Session ::::
".personalization/objects/ibmpersonalization:aoSession"
I
think you can try same for other objects also ( aoWcmWebContent ,
aoRenderParameter… etc) but I didn't try remaining.
/8448773582358480512
This
is random number (internal reference id) , if you want create multiple dynamic
attributes have this different for each dynamic attribute.
- Property Display Name: Give dynamic attribute display name
- Property Name : Give dynamic attribute name
- Property Type : Specify the type of the attribute i.e. java.lang.String , java.lang.Boolean..etc
Now you can automate
this by using PZNLoad (or manually import this .nodes file on different
installations from PZN Editor portlet).
NOTE : Tested on WP8.0.0.1 / WP 8.0 and WP 7.0
versions and working fine.