Replicatable Datum and external parameter

Posted: 8 October 2009 in Components, CSSDK, External, Java, Pages, SitePublisher, Sites, Teamsite
Tags: , , , , , , ,

When you have an external in a SitePublisher component and the Datum parameter has a replicatable attribute set to yes, the parameter that gets passed to the external is the ReplicantSourceID made of comma separated list of the values of the replicants.

 <Datum Type="String" ID="dcrDir" Name="dcrDir" Replicatable="true" ReplicantSourceID="dcrDir">/templatedata/acme/article/data/</Datum>
 <Datum Type="String" ID="dcrDir-0" Name="dcrDir" Replicatable="true" ReplicantSourceID="dcrDir">/templatedata/acme/author/data/</Datum>
 <Object Scope="local">com.acme.SomeClass</Object>

Only thing, there’s a space before the comma and [] around the lot, so make sure to trim() the string after the split and remove the []!

String[] dcrDirs = context.getParameterString("dcrDir").split(",");
for (String dcrDir : dcrDirs) {
  String fullDcrDir = fileDal.getRoot() + dcrDir.trim();
  fullDcrDir = fullDcrDir.replace("[","");
  fullDcrDir = fullDcrDir.replace("]","");

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s