How to get a Resource when we have node path:
In Java:
@Reference
private ResourceResolverFactory resourceResolverFactory;
ResourceResolver resolver=null;
resolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
Resource res=null;
res= resolver.getResource("PATH");
In JSP:
Resource res= resourceResolver.getResource("PATH");
How to get a Node, Get node property, Add/Update node property:
Node node = res.adaptTo(Node.class);
Get propoerty:
String prop= node.getProperty("Prop_name").getValue().getString();
String prop = node.setProperty("Prop_name","Value");
Note: Don't forget to save the session when the node is updated.
Update Node using PersistableValueMap:
Resource resource = resolver.getResource("Node Path");
if(resource !=null)
{
PersistableValueMap valueMap= resource.adaptTo(PersistableValueMap.class);
valueMap.put("propname","value");
valueMap.save();
}
Note: PersistableValueMap is deprecated. So use ModifiableValueMap instead.
Example:
if(resource !=null)
{
ModifiableValueMap valueMap= resource.adaptTo(ModifiableValueMap.class);
valueMap.put("propname","value");
}
How to get a JackRabbit session in the Workflow:
final JackrabbitSession jackrabbitSession = (JackrabbitSession) wfsession.getSession();
UserManager userManager = jackrabbitSession.getUserManager();
How to get Page object using resolver?
@Reference
private PageManagerFactory pageManagerFactory;
@Reference
private ResourceResolverFactory resourceResolverFactory;
ResourceResolver resolver = null;
//get Resource resolver using resource resolver factory.
resolver = resourceResolverFactory
.getAdministrativeResourceResolver(null);
//Get page manager object using page manager Factory
PageManager pmanager = pageManagerFactory.getPageManager(resolver);
//Get page object using PageManager
Page page = pmanager.getContainingPage(path);
In Java:
@Reference
private ResourceResolverFactory resourceResolverFactory;
ResourceResolver resolver=null;
resolver = resourceResolverFactory.getAdministrativeResourceResolver(null);
Resource res=null;
res= resolver.getResource("PATH");
In JSP:
Resource res= resourceResolver.getResource("PATH");
How to get a Node, Get node property, Add/Update node property:
Node node = res.adaptTo(Node.class);
Get propoerty:
String prop= node.getProperty("Prop_name").getValue().getString();
String prop = node.setProperty("Prop_name","Value");
Note: Don't forget to save the session when the node is updated.
Update Node using PersistableValueMap:
Resource resource = resolver.getResource("Node Path");
if(resource !=null)
{
PersistableValueMap valueMap= resource.adaptTo(PersistableValueMap.class);
valueMap.put("propname","value");
valueMap.save();
}
Note: PersistableValueMap is deprecated. So use ModifiableValueMap instead.
Example:
if(resource !=null)
{
ModifiableValueMap valueMap= resource.adaptTo(ModifiableValueMap.class);
valueMap.put("propname","value");
}
resource.commit(); //Once
ResourceResolver.commit()
is called, the changes are finally persisted.final JackrabbitSession jackrabbitSession = (JackrabbitSession) wfsession.getSession();
UserManager userManager = jackrabbitSession.getUserManager();
How to get Page object using resolver?
@Reference
private PageManagerFactory pageManagerFactory;
@Reference
private ResourceResolverFactory resourceResolverFactory;
ResourceResolver resolver = null;
//get Resource resolver using resource resolver factory.
resolver = resourceResolverFactory
.getAdministrativeResourceResolver(null);
//Get page manager object using page manager Factory
PageManager pmanager = pageManagerFactory.getPageManager(resolver);
//Get page object using PageManager
Page page = pmanager.getContainingPage(path);
It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command
ReplyDeleterpa training in bangalore
best rpa training in bangalore
RPA training in bangalore
rpa courses in bangalore
Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
ReplyDeletepython Online training in chennai
python training institute in marathahalli
python training institute in btm
Python training course in Chennai
Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
ReplyDeleteAWS Training in Bangalore with Placements | AWS Training in Bangalore Cost
AWS Training in Pune With Placement | AWS Devops Training in Pune
AWS Online Training | AWS Online Training Cost
AWS Training in Bangalore cost| Aws training in Bangalore Besant Technologies
It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.thanks lot!!!
ReplyDeleteAndroid Training in Chennai
Android Online Training in Chennai
Android Training in Bangalore
Android Training in Hyderabad
Android Training in Coimbatore
Android Training
Android Online Training
I like the helpful info you supply in your articles. I’ll bookmark your weblog and take a look at once more here regularly. I am relatively certain I will learn a lot of new stuff right here! Good luck for the following!
ReplyDeletehardware and networking training in chennai
hardware and networking training in velachery
xamarin training in chennai
xamarin training in velachery
ios training in chennai
ios training in velachery
iot training in chennai
iot training in velachery
Providing details can offer more insight to those who might be interested in joining the institute. Remember, personal experiences and anecdotes can make your comment even more impactful.
ReplyDeletepython training in marathahalli