setProperty not working as expected

Avatar

Avatar
Validate 1
Level 2
mark_julianp181
Level 2

Likes

7 likes

Total Posts

16 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
mark_julianp181
Level 2

Likes

7 likes

Total Posts

16 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
mark_julianp181
Level 2

28-09-2017

Hi,

I have a process step in a workflow that launches when a content fragment is created. It calls a custom process with the following code:

public void execute(WorkItem item, WorkflowSession session, MetaDataMap args) throws WorkflowException {

try {

Map<String, Object> serviceParams = new HashMap<String, Object>();

serviceParams.put(ResourceResolverFactory.SUBSERVICE, "test");

   ResourceResolver resourceResolver;

resourceResolver = resolverFactory.getServiceResourceResolver(serviceParams);

Node node = resourceResolver.getResource(item.getContentPath()).adaptTo(Node.class);

Node tempNode = node.getNode("/jcr:content");

tempNode.setProperty("activated", "false");

but the setProperty is not adding the property to the jcr:content as expected. Is there something I am missing or doing wrong?

View Entire Topic

Avatar

Avatar
Validate 1
Level 2
mark_julianp181
Level 2

Likes

7 likes

Total Posts

16 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
mark_julianp181
Level 2

Likes

7 likes

Total Posts

16 posts

Correct reply

1 solution
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
mark_julianp181
Level 2

28-09-2017

Jörg,

Thank you, changed my code to the following:

Session session = workflowSession.adaptTo(Session.class);

Node node = session.getNode(item.getContentPath()+"/jcr:content");

node.setProperty("activated", "false");

session.save();

session.logout();