JcrPackageManager.listPackages(WorkspaceFilter) returns empty list

santhoshsrg

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)