Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

how to create imageset and add assets through java API in AEM 6.4

Avatar

Avatar
Level 1
vinilv37836543
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
vinilv37836543
Level 1

Likes

0 likes

Total Posts

2 posts

Correct Reply

0 solutions
View profile
vinilv37836543
Level 1

18-06-2019

I have created a program with the following code:

ResourceResolver resourceResolver = resolverFactory.getResourceResolver(Collections.singletonMap("user.jcr.session", (Object) adminSession)); 

Resource damResource = resourceResolver.resolve("/content/dam/images");

ImageSet imageset = S7SetHelper.createS7ImageSet(damResource, "ImageSet", null);

Through this code, i am able to create an imageset.

Now, I want to add assets to this imageset. So, I wrote this code:

Asset asset = resourceResolver.getResource("/content/dam/images/Cycling.jpeg").adaptTo(Asset.class);

imageset.add(asset);

But this code is not working. Can anyone help with how to add assets to the imageset created.