JcrPackageManager.listPackages(WorkspaceFilter) returns empty list

Avatar

Avatar

santhoshsrg

Avatar

santhoshsrg

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)

Answers (1)

Answers (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

860

Avatar

Arun_Patidar

MVP

Total Posts

3.0K

Likes

1.1K

Correct Reply

860
Arun_Patidar
MVP

21-08-2020

What values are you using for PAGE1_PATH, PAGE2_PATH