Source:
public PublisherFilter createPublisherFilter(final String bundleId) throws DotDataException, DotSecurityException { final String filterKey = APILocator.getBundleAPI().getBundleById(bundleId).getFilterKey(); final FilterDescriptor filterDescriptor = this.getFilterDescriptorByKey(filterKey); final PublisherFilterImpl publisherFilter = new PublisherFilterImpl((Boolean)filterDescriptor.getFilters().getOrDefault("dependencies",true), (Boolean)filterDescriptor.getFilters().getOrDefault("relationships",true)); if(filterDescriptor.getFilters().containsKey("excludeClasses")){ ((ArrayList)filterDescriptor.getFilters().get("excludeClasses")).stream().forEach(type -> publisherFilter.addTypeToExcludeClassesSet(type.toString())); } if(filterDescriptor.getFilters().containsKey("excludeDependencyClasses")){ ((ArrayList)filterDescriptor.getFilters().get("excludeDependencyClasses")).stream().forEach(type -> publisherFilter.addTypeToExcludeDependencyClassesSet(type.toString())); } if(filterDescriptor.getFilters().containsKey("excludeQuery")){ final String query = filterDescriptor.getFilters().get("excludeQuery").toString(); final List<Contentlet> contentlets = APILocator.getContentletAPI().search(query, 0, 0, "moddate", APILocator.systemUser(), false); contentlets.stream().forEach(contentlet -> publisherFilter.addContentletIdToExcludeQueryAssetIdSet(contentlet.getIdentifier())); } if(filterDescriptor.getFilters().containsKey("excludeDependencyQuery")){ final String query = filterDescriptor.getFilters().get("excludeDependencyQuery").toString(); final List<Contentlet> contentlets = APILocator.getContentletAPI().search(query, 0, 0, "moddate", APILocator.systemUser(), false); contentlets.stream().forEach(contentlet -> publisherFilter.addContentletIdToExcludeDependencyQueryAssetIdSet(contentlet.getIdentifier())); } return publisherFilter; }

Target:
public PublisherFilter createPublisherFilter(final String bundleId) throws DotDataException, DotSecurityException { final String filterKey = APILocator.getBundleAPI().getBundleById(bundleId).getFilterKey(); final FilterDescriptor filterDescriptor = this.getFilterDescriptorByKey(filterKey); final PublisherFilterImpl publisherFilter = new PublisherFilterImpl((Boolean)filterDescriptor.getFilters().getOrDefault("dependencies",true), (Boolean)filterDescriptor.getFilters().getOrDefault("relationships",true)); if(filterDescriptor.getFilters().containsKey("excludeClasses")){ List.class.cast(filterDescriptor.getFilters().get("excludeClasses")).stream().forEach(type -> publisherFilter.addTypeToExcludeClassesSet(type.toString())); } if(filterDescriptor.getFilters().containsKey("excludeDependencyClasses")){ List.class.cast(filterDescriptor.getFilters().get("excludeDependencyClasses")).stream().forEach(type -> publisherFilter.addTypeToExcludeDependencyClassesSet(type.toString())); } if(filterDescriptor.getFilters().containsKey("excludeQuery")){ final String query = filterDescriptor.getFilters().get("excludeQuery").toString(); APILocator.getContentletAPI().search(query, 0, 0, "moddate", APILocator.systemUser(), false) .stream().forEach(contentlet -> publisherFilter.addContentletIdToExcludeQueryAssetIdSet(contentlet.getIdentifier())); } if(filterDescriptor.getFilters().containsKey("excludeDependencyQuery")){ final String query = filterDescriptor.getFilters().get("excludeDependencyQuery").toString(); APILocator.getContentletAPI().search(query, 0, 0, "moddate", APILocator.systemUser(), false) .stream().forEach(contentlet -> publisherFilter.addContentletIdToExcludeDependencyQueryAssetIdSet(contentlet.getIdentifier())); } return publisherFilter; }