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

JcrPackageManager.listPackages(WorkspaceFilter) returns empty list

Avatar

Avatar
Give Back 5
Level 3
santhoshsrg
Level 3

Likes

21 likes

Total Posts

56 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile

Avatar
Give Back 5
Level 3
santhoshsrg
Level 3

Likes

21 likes

Total Posts

56 posts

Correct Reply

2 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 3
Ignite 1
View profile
santhoshsrg
Level 3

20-08-2020

Hi,

 

I am just exploring on Jcr Package Manager. I tried methods listPackages() and listPackages(WorkspaceFilter). The non-parameterised method listPackages() works fine but listPackages(WorkspaceFilter) is always returning empty list. PFB the code snippets i have tried and share your thoughts.

 

Thanks in advance !!

 

Approach 1

DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();

String[] packageFilters = new String[] {PAGE1_PATH, PAGE2_PATH};

for (PathFilterSet packageFilter : packageFilters) {

workspaceFilter.add(packageFilter);

}

List<JcrPackage> pkgs = jcrPackageManager.listPackages(workspaceFilter); // This returns []

 

Approach 2

JcrPackage jcrPackage = jcrPackageManager.create(rootNode, pkgName);

JcrPackageDefinition jcrPackageDefinition = 

jcrPackageManager.create(rootNode, pkgName);

DefaultWorkspaceFilter workspaceFilter = new DefaultWorkspaceFilter();

String[] packageFilters = new String[] {PAGE1_PATH, PAGE2_PATH};

for (PathFilterSet packageFilter :packageFilters) {

workspaceFilter.add(packageFilter);

}

jcrPackageDefinition.setFilter(workspaceFilter, AUTO_SAVE);

jcrPackageDefinition.set(JcrPackageDefinition.PN_DESCRIPTION, PACKAGE_DESCRIPTION + pkgName, false);

jcrPackageDefinition.set(JcrPackageDefinition.PN_GROUP, rootNode.getName() , false);

List<JcrPackage> pkgs = jcrPackageManager.listPackages(jcrPackageDefinition.getMetaInf().getFilter()); // This returns []

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,356 likes

Total Posts

3,227 posts

Correct Reply

917 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

21-08-2020

What values are you using for PAGE1_PATH, PAGE2_PATH