Solved! Go to Solution.
Views
Replies
Total Likes
Hi @georhe6
In AEM as a Cloud Service, storing metadata like page path and timestamp for later processing by a scheduler is a valid use case. Yes, you can store this data under /var/project/storeData, but there are a few important considerations:
Recommendations:
You can store the data programmatically using a Sling POST or via a service user and ResourceResolver, like:
Map<String, Object> properties = new HashMap<>();
properties.put("pagePath", "/content/your-site/your-page");
properties.put("timestamp", System.currentTimeMillis());
ResourceResolver resolver = ...; // get with service user
Resource parent = resolver.getResource("/var/project/storeData");
if (parent != null) {
resolver.adaptTo(PageManager.class).create(
parent.getPath(),
"entry-" + UUID.randomUUID(), // unique node
null,
properties
);
}
Or using JCR API:
Node storeData = session.getNode("/var/project/storeData");
Node entry = storeData.addNode("entry-" + UUID.randomUUID(), "nt:unstructured");
entry.setProperty("pagePath", "/content/your-site/your-page");
entry.setProperty("timestamp", Calendar.getInstance());
session.save();
Make sure you:
Hope this helpful.
Regards,
Karishma.
Hi @georhe6
In AEM as a Cloud Service, storing metadata like page path and timestamp for later processing by a scheduler is a valid use case. Yes, you can store this data under /var/project/storeData, but there are a few important considerations:
Recommendations:
You can store the data programmatically using a Sling POST or via a service user and ResourceResolver, like:
Map<String, Object> properties = new HashMap<>();
properties.put("pagePath", "/content/your-site/your-page");
properties.put("timestamp", System.currentTimeMillis());
ResourceResolver resolver = ...; // get with service user
Resource parent = resolver.getResource("/var/project/storeData");
if (parent != null) {
resolver.adaptTo(PageManager.class).create(
parent.getPath(),
"entry-" + UUID.randomUUID(), // unique node
null,
properties
);
}
Or using JCR API:
Node storeData = session.getNode("/var/project/storeData");
Node entry = storeData.addNode("entry-" + UUID.randomUUID(), "nt:unstructured");
entry.setProperty("pagePath", "/content/your-site/your-page");
entry.setProperty("timestamp", Calendar.getInstance());
session.save();
Make sure you:
Hope this helpful.
Regards,
Karishma.
Views
Likes
Replies
Views
Likes
Replies