Updating tags for jcr:content

33 views
Skip to first unread message

Vijay

unread,
Oct 4, 2011, 1:05:16 AM10/4/11
to jcrom

I am trying to create a node of type "jcr:content" in JCR repository.

The actual problem: Not able to insert a property "cq:tags" under the
jcr:content. This is actually a String[] and the values does not
reflect on insertion programatically.

It would be of great help if anyone can advice the solution for this.


The code I have is something like below:

PageContentNode pgcNode = new PageContentNode();
pgcNode.setPath("/");
pgcNode.setDescription("Content description");
pgcNode.setName("jcr:content");
pgcNode.setResourceType("foundation/components/redirect");
pgcNode.setTemplate("/apps/hyattlib/templates/hredirect");
pgcNode.setTitle("english");
pgcNode.setTags(new String[] {"abc", "def"});

// 1. Get JCROM object
Jcrom jcrom = RepositoryUtil.getJCROM(new Class[]
{ pgcNode.getClass() });

// 2. Login to repository
session = RepositoryUtil.login();

PageContentNodeDao pgcDao = new PageContentNodeDao(session,
jcrom);
pgcDao.create(pgcNode);
session.save();

and the POJO looks like this:

@JcrNode(nodeType = "cq:PageContent")
public class PageContentNode {

@JcrName
private String name;

@JcrPath
private String path;

@JcrProperty(name = "sling:resourceType")
private String resourceType;

@JcrProperty(name = "jcr:title")
private String title;

@JcrProperty(name = "jcr:description")
private String description;

@JcrProperty(name="cq:tags")
private String[] tags;
.........
Reply all
Reply to author
Forward
0 new messages