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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

JcrPackageManager.listPackages(WorkspaceFilter) returns empty list

santhoshsrg
Level 4
Level 4

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 []

 

 

1 Reply
Arun_Patidar
Community Advisor
Community Advisor

What values are you using for PAGE1_PATH, PAGE2_PATH