test_class.declarator: testBaseDir = new File("target/repos/ChecklistExporterTest")
test_class.modifier: final
test_class.original_string: final File testBaseDir = new File("target/repos/ChecklistExporterTest");
test_class.type: File
test_class.var_name: testBaseDir
test_class.file: webster/src/test/java/net/adamcin/oakpal/webster/ChecklistExporterTest.java
test_class.identifier: ChecklistExporterTest
test_case.body: @Test
      public void testQuery() throws Exception {
          TestUtil.withInMemoryRepo(session -> {
              TestUtil.installCndFromURL(session, getClass().getResource("/sling_nodetypes.cnd"));
  
              final int sample = 5;
              List<String> paths = IntStream.range(0, sample).mapToObj(val -> "/test/node" + val).collect(Collectors.toList());
              assertEquals("should generate n paths: ", sample, paths.size());
              paths.forEach(Fun.tryOrVoid1(path ->
                      JcrUtils.getOrCreateByPath(path, "nt:folder",
                              "sling:Folder", session, true)));
  
              final ChecklistExporter exporter = new ChecklistExporter.Builder().build();
  
              List<ForcedRoot> byXPath = exporter.query(session, "//element(*, sling:Folder)");
  
              for (String path : paths) {
                  ForcedRoot root0 = byXPath.stream().filter(root -> path.equals(root.getPath())).findFirst().orElse(null);
                  assertNotNull(String.format("root for path %s should not be null", path), root0);
                  assertEquals(String.format("root primaryType for path %s should be sling:Folder", path),
                          "sling:Folder", root0.getPrimaryType());
              }
  
              List<ForcedRoot> bySQL2 = exporter.query(session, "select * from [sling:Folder]");
              for (String path : paths) {
                  ForcedRoot root0 = bySQL2.stream().filter(root -> path.equals(root.getPath())).findFirst().orElse(null);
                  assertNotNull(String.format("root for path %s should not be null", path), root0);
                  assertEquals(String.format("root primaryType for path %s should be sling:Folder", path),
                          "sling:Folder", root0.getPrimaryType());
              }
          });
      }
test_case.class_method_signature: ChecklistExporterTest.testQuery()
test_case.full_signature: @Test public void testQuery()
test_case.identifier: testQuery
test_case.invocations: withInMemoryRepo installCndFromURL getResource getClass collect mapToObj range toList assertEquals size forEach tryOrVoid1 getOrCreateByPath build query orElse findFirst filter stream equals getPath assertNotNull format assertEquals format getPrimaryType query orElse findFirst filter stream equals getPath assertNotNull format assertEquals format getPrimaryType
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testQuery()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ChecklistExporter.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ChecklistExporter.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: operations
focal_class.modifier: private final
focal_class.original_string: private final List<Op> operations;
focal_class.type: List<Op>
focal_class.var_name: operations
focal_class.declarator: exportTypeDefs
focal_class.modifier: private final
focal_class.original_string: private final List<String> exportTypeDefs;
focal_class.type: List<String>
focal_class.var_name: exportTypeDefs
focal_class.declarator: pathScopes
focal_class.modifier: private final
focal_class.original_string: private final List<Rule> pathScopes;
focal_class.type: List<Rule>
focal_class.var_name: pathScopes
focal_class.declarator: nodeTypeFilters
focal_class.modifier: private final
focal_class.original_string: private final List<Rule> nodeTypeFilters;
focal_class.type: List<Rule>
focal_class.var_name: nodeTypeFilters
focal_class.declarator: jcrNamespaces
focal_class.modifier: private final
focal_class.original_string: private final List<JcrNs> jcrNamespaces;
focal_class.type: List<JcrNs>
focal_class.var_name: jcrNamespaces
focal_class.declarator: DEFAULT_UPDATE_POLICY = ForcedRootUpdatePolicy.REPLACE
focal_class.modifier: public static final
focal_class.original_string: public static final ForcedRootUpdatePolicy DEFAULT_UPDATE_POLICY = ForcedRootUpdatePolicy.REPLACE;
focal_class.type: ForcedRootUpdatePolicy
focal_class.var_name: DEFAULT_UPDATE_POLICY
focal_class.declarator: COVARIANT_PREFIX = "+"
focal_class.modifier: public static final
focal_class.original_string: public static final String COVARIANT_PREFIX = "+";
focal_class.type: String
focal_class.var_name: COVARIANT_PREFIX
focal_class.declarator: COVARIANT_FILTER = name -> name.startsWith(COVARIANT_PREFIX)
focal_class.modifier: static final
focal_class.original_string: static final Predicate<String> COVARIANT_FILTER = name -> name.startsWith(COVARIANT_PREFIX);
focal_class.type: Predicate<String>
focal_class.var_name: COVARIANT_FILTER
focal_class.declarator: COVARIANT_FORMAT = name -> name.substring(COVARIANT_PREFIX.length())
focal_class.modifier: static final
focal_class.original_string: static final Function<String, String> COVARIANT_FORMAT = name -> name.substring(COVARIANT_PREFIX.length());
focal_class.type: Function<String, String>
focal_class.var_name: COVARIANT_FORMAT
focal_class.file: webster/src/main/java/net/adamcin/oakpal/webster/ChecklistExporter.java
focal_class.identifier: ChecklistExporter
focal_class.class_method_signature: ChecklistExporter.ChecklistExporter(final List<Op> operations,
                                final List<String> exportTypeDefs,
                                final List<Rule> pathScopes,
                                final List<Rule> nodeTypeFilters,
                                final List<JcrNs> jcrNamespaces)
focal_class.full_signature: private  ChecklistExporter(final List<Op> operations,
                                final List<String> exportTypeDefs,
                                final List<Rule> pathScopes,
                                final List<Rule> nodeTypeFilters,
                                final List<JcrNs> jcrNamespaces)
focal_class.identifier: ChecklistExporter
focal_class.modifiers: private
focal_class.parameters: (final List<Op> operations,
                                final List<String> exportTypeDefs,
                                final List<Rule> pathScopes,
                                final List<Rule> nodeTypeFilters,
                                final List<JcrNs> jcrNamespaces)
focal_class.signature:  ChecklistExporter(final List<Op> operations,
                                final List<String> exportTypeDefs,
                                final List<Rule> pathScopes,
                                final List<Rule> nodeTypeFilters,
                                final List<JcrNs> jcrNamespaces)
focal_class.class_method_signature: ChecklistExporter.ensureNamespaces(final @NotNull Session session,
                                   final @NotNull NamespaceMapping namespaces)
focal_class.full_signature: static void ensureNamespaces(final @NotNull Session session,
                                   final @NotNull NamespaceMapping namespaces)
focal_class.identifier: ensureNamespaces
focal_class.modifiers: static
focal_class.parameters: (final @NotNull Session session,
                                   final @NotNull NamespaceMapping namespaces)
focal_class.return: void
focal_class.signature: void ensureNamespaces(final @NotNull Session session,
                                   final @NotNull NamespaceMapping namespaces)
focal_class.class_method_signature: ChecklistExporter.findJcrPrefixesInForcedRoot(final @NotNull Set<String> acc, final @NotNull ForcedRoot forcedRoot)
focal_class.full_signature: static Set<String> findJcrPrefixesInForcedRoot(final @NotNull Set<String> acc, final @NotNull ForcedRoot forcedRoot)
focal_class.identifier: findJcrPrefixesInForcedRoot
focal_class.modifiers: static
focal_class.parameters: (final @NotNull Set<String> acc, final @NotNull ForcedRoot forcedRoot)
focal_class.return: Set<String>
focal_class.signature: Set<String> findJcrPrefixesInForcedRoot(final @NotNull Set<String> acc, final @NotNull ForcedRoot forcedRoot)
focal_class.class_method_signature: ChecklistExporter.findNodeTypesInForcedRoot(final Set<String> acc, final ForcedRoot forcedRoot)
focal_class.full_signature: static Set<String> findNodeTypesInForcedRoot(final Set<String> acc, final ForcedRoot forcedRoot)
focal_class.identifier: findNodeTypesInForcedRoot
focal_class.modifiers: static
focal_class.parameters: (final Set<String> acc, final ForcedRoot forcedRoot)
focal_class.return: Set<String>
focal_class.signature: Set<String> findNodeTypesInForcedRoot(final Set<String> acc, final ForcedRoot forcedRoot)
focal_class.class_method_signature: ChecklistExporter.preferDifferent(final @NotNull U value)
focal_class.full_signature: static BinaryOperator<U> preferDifferent(final @NotNull U value)
focal_class.identifier: preferDifferent
focal_class.modifiers: static
focal_class.parameters: (final @NotNull U value)
focal_class.return: BinaryOperator<U>
focal_class.signature: BinaryOperator<U> preferDifferent(final @NotNull U value)
focal_class.class_method_signature: ChecklistExporter.nsRemapName(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.full_signature: static Function<String, String> nsRemapName(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.identifier: nsRemapName
focal_class.modifiers: static
focal_class.parameters: (final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.return: Function<String, String>
focal_class.signature: Function<String, String> nsRemapName(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.class_method_signature: ChecklistExporter.nsRemapForcedRoot(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.full_signature: static Function<ForcedRoot, ForcedRoot> nsRemapForcedRoot(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.identifier: nsRemapForcedRoot
focal_class.modifiers: static
focal_class.parameters: (final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.return: Function<ForcedRoot, ForcedRoot>
focal_class.signature: Function<ForcedRoot, ForcedRoot> nsRemapForcedRoot(final NamespaceMapping fromMapping, final NamespaceMapping toMapping)
focal_class.class_method_signature: ChecklistExporter.getRetainFilter(final ForcedRootUpdatePolicy updatePolicy)
focal_class.full_signature:  Predicate<ForcedRoot> getRetainFilter(final ForcedRootUpdatePolicy updatePolicy)
focal_class.identifier: getRetainFilter
focal_class.parameters: (final ForcedRootUpdatePolicy updatePolicy)
focal_class.return: Predicate<ForcedRoot>
focal_class.signature: Predicate<ForcedRoot> getRetainFilter(final ForcedRootUpdatePolicy updatePolicy)
focal_class.class_method_signature: ChecklistExporter.exportTypeDefSelector()
focal_class.full_signature:  BiPredicate<NamePathResolver, NodeType> exportTypeDefSelector()
focal_class.identifier: exportTypeDefSelector
focal_class.parameters: ()
focal_class.return: BiPredicate<NamePathResolver, NodeType>
focal_class.signature: BiPredicate<NamePathResolver, NodeType> exportTypeDefSelector()
focal_class.class_method_signature: ChecklistExporter.updateChecklist(final WriterOpener writerOpener,
                                  final Session session,
                                  final Checklist checklist,
                                  final ForcedRootUpdatePolicy updatePolicy)
focal_class.full_signature: public void updateChecklist(final WriterOpener writerOpener,
                                  final Session session,
                                  final Checklist checklist,
                                  final ForcedRootUpdatePolicy updatePolicy)
focal_class.identifier: updateChecklist
focal_class.modifiers: public
focal_class.parameters: (final WriterOpener writerOpener,
                                  final Session session,
                                  final Checklist checklist,
                                  final ForcedRootUpdatePolicy updatePolicy)
focal_class.return: void
focal_class.signature: void updateChecklist(final WriterOpener writerOpener,
                                  final Session session,
                                  final Checklist checklist,
                                  final ForcedRootUpdatePolicy updatePolicy)
focal_class.class_method_signature: ChecklistExporter.addToLeft()
focal_class.full_signature: static BinaryOperator<U> addToLeft()
focal_class.identifier: addToLeft
focal_class.modifiers: static
focal_class.parameters: ()
focal_class.return: BinaryOperator<U>
focal_class.signature: BinaryOperator<U> addToLeft()
focal_class.class_method_signature: ChecklistExporter.findRoots(final Session session)
focal_class.full_signature: public List<ForcedRoot> findRoots(final Session session)
focal_class.identifier: findRoots
focal_class.modifiers: public
focal_class.parameters: (final Session session)
focal_class.return: List<ForcedRoot>
focal_class.signature: List<ForcedRoot> findRoots(final Session session)
focal_class.class_method_signature: ChecklistExporter.ntStatement(final Session session, final List<String> nodeTypeNames)
focal_class.full_signature:  String ntStatement(final Session session, final List<String> nodeTypeNames)
focal_class.identifier: ntStatement
focal_class.parameters: (final Session session, final List<String> nodeTypeNames)
focal_class.return: String
focal_class.signature: String ntStatement(final Session session, final List<String> nodeTypeNames)
focal_class.class_method_signature: ChecklistExporter.query(final Session session, final String statement)
focal_class.full_signature:  List<ForcedRoot> query(final Session session, final String statement)
focal_class.identifier: query
focal_class.parameters: (final Session session, final String statement)
focal_class.return: List<ForcedRoot>
focal_class.signature: List<ForcedRoot> query(final Session session, final String statement)
focal_class.class_method_signature: ChecklistExporter.traverse(final Session session, final List<String> paths)
focal_class.full_signature:  List<ForcedRoot> traverse(final Session session, final List<String> paths)
focal_class.identifier: traverse
focal_class.parameters: (final Session session, final List<String> paths)
focal_class.return: List<ForcedRoot>
focal_class.signature: List<ForcedRoot> traverse(final Session session, final List<String> paths)
focal_class.class_method_signature: ChecklistExporter.nodeToRoot(final Node node, final NamespaceMapping mapping)
focal_class.full_signature:  Optional<ForcedRoot> nodeToRoot(final Node node, final NamespaceMapping mapping)
focal_class.identifier: nodeToRoot
focal_class.parameters: (final Node node, final NamespaceMapping mapping)
focal_class.return: Optional<ForcedRoot>
focal_class.signature: Optional<ForcedRoot> nodeToRoot(final Node node, final NamespaceMapping mapping)
focal_method.body: List<ForcedRoot> query(final Session session, final String statement) throws RepositoryException {
          final QueryManager qm = session.getWorkspace().getQueryManager();
          final NamespaceMapping mapping = new NamespaceMapping(new SessionNamespaceResolver(session));
          final String language =
                  statement.toUpperCase().replaceFirst("^\\s*((MEASURE|EXPLAIN)\\s*)*", "")
                          .startsWith("SELECT") ? Query.JCR_SQL2 : Query.XPATH;
          final Query query = qm.createQuery(statement, language);
          final QueryResult result = query.execute();
          final Map<String, ForcedRoot> roots = new LinkedHashMap<>();
          for (NodeIterator nodes = result.getNodes(); nodes.hasNext(); ) {
              nodeToRoot(nodes.nextNode(), mapping).ifPresent(root -> roots.put(root.getPath(), root));
          }
          return new ArrayList<>(roots.values());
      }
focal_method.class_method_signature: ChecklistExporter.query(final Session session, final String statement)
focal_method.full_signature:  List<ForcedRoot> query(final Session session, final String statement)
focal_method.identifier: query
focal_method.invocations: getQueryManager getWorkspace startsWith replaceFirst toUpperCase createQuery execute getNodes hasNext ifPresent nodeToRoot nextNode put getPath values
focal_method.parameters: (final Session session, final String statement)
focal_method.return: List<ForcedRoot>
focal_method.signature: List<ForcedRoot> query(final Session session, final String statement)