Tabnine Logo
ResourceFile$Finder.results
Code IndexAdd Tabnine to your IDE (free)

How to use
results
method
in
it.tidalwave.northernwind.core.model.ResourceFile$Finder

Best Java code snippets using it.tidalwave.northernwind.core.model.ResourceFile$Finder.results (Showing top 12 results out of 315)

origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

 @Override @Nonnull
 protected List<? extends ResourceFile> computeResults()
  {
   if (name != null)
    {
     if (name.contains("/"))
      {
       throw new IllegalArgumentException("relativePath: " + name);
      }
     final ResourceFile child = getChildrenMap().get(name);
     return (child != null) ? Collections.singletonList(child) : Collections.<ResourceFile>emptyList();
    }
   //
   // FIXME: this reproduces the behaviour before the refactoring for NW-192 - but it's (and was) wrong
   // since it doesn't consider delegates. It should be rewritten by relying on getChildrenMap() and
   // making it eventually support recursion.
   //
   else if (recursive)
    {
     return delegate.findChildren().withRecursion(recursive).results();
    }
   else
    {
     return new ArrayList<>(getChildrenMap().values());
    }
  }
};
origin: it.tidalwave.northernwind.rca/it-tidalwave-northernwind-rca-model

 @Override @Nonnull
 protected List<? extends T> computeResults()
  {
   // FIXME: it's not flyweight
   final List<T> results = new ArrayList<>();
   for (final ResourceFile childFile : resourceFile.findChildren().results())
    {
     if (childFile.isFolder())
      {
       try
        {
         results.add(productCreator.createProduct(childFile));
        }
       catch (IOException | NotFoundException e)
        {
         throw new RuntimeException(e);
        }
      }
    }
   return results;
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

/*******************************************************************************************************************
 *
 *
 ******************************************************************************************************************/
private void emptyFolder (final @Nonnull ResourceFile folder)
 throws IOException
 {
  log.trace("emptyFolder({}, {}", folder);
  for (final ResourceFile child : folder.findChildren().results())
   {
    child.delete();
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

for (final ResourceFile fo : zipFolder.findChildren().results())
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

for (final ResourceFile fileObject : delegateDirectory.findChildren().results())
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

@BeforeMethod
public void setup()
 throws Exception
 {
  final ClassPathXmlApplicationContext context =
      new ClassPathXmlApplicationContext("META-INF/CommonsAutoBeans.xml",
                        "META-INF/XsltTemplateTestBeans.xml",
                        "META-INF/CachedUriResolverBeans.xml");
  filter = context.getBean(XsltMacroFilter.class);
  context.getBean(CachedURIResolver.class).setCacheFolderPath("target/CachedUriResolver");
  final SiteProvider siteProvider = context.getBean(SiteProvider.class);
  final Site site = mock(Site.class);
  when(siteProvider.getSite()).thenReturn(site);
  final ResourceFileSystemProvider fileSystemProvider = mock(ResourceFileSystemProvider.class);
  when(site.getFileSystemProvider()).thenReturn(fileSystemProvider);
  final File root = new File("src/main/resources/content/library/XsltTemplates").getAbsoluteFile();
  final ResourceFileSystemProvider localFileSystemProvider = new LocalFileSystemProvider();
  final ResourceFile file = localFileSystemProvider.getFileSystem().findFileByPath(root.getAbsolutePath());
  final List<Resource> resources = new ArrayList<>();
  for (final ResourceFile xsltFile : file.findChildren().results())
   {
    final Resource resource = mock(Resource.class);
    when(resource.getFile()).thenReturn(xsltFile);
    resources.add(resource);
   }
  when(site.find(eq(Resource.class))).thenReturn(new MockResourceFinder(resources));
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 * {@inheritDoc}
 *
 ******************************************************************************************************************/
@Override @Nonnull
protected List<? extends Type> computeResults()
 {
  final List<Type> result = new ArrayList<>();
  for (final ResourceFile childFile : parentFile.findChildren().withRecursion(true).results())
   {
    if (childFile.isFolder())
     {
      try
       {
        final String relativeUri = childFile.getPath().relativeTo(resourceRootPath).urlDecoded().asString();
        result.add(siteProvider.get().getSite().find(typeClass).withRelativePath(relativeUri).result());
       }
      catch (NotFoundException e)
       {
        log.error("", e);
       }
     }
   }
  return result;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

 /*******************************************************************************************************************
  *
  *
  ******************************************************************************************************************/
 private void copyFolder (final @Nonnull ResourceFile sourceFolder, final @Nonnull ResourceFile targetFolder)
  throws IOException
  {
   log.trace("copyFolder({}, {}", sourceFolder, targetFolder);
   for (final ResourceFile sourceChild : sourceFolder.findChildren().results())
    {
     if (!sourceChild.isFolder())
      {
       log.trace(">>>> copying {} into {} ...", sourceChild, targetFolder);
       sourceChild.copyTo(targetFolder);
      }
    }
   for (final ResourceFile sourceChild : sourceFolder.findChildren().results())
    {
     if (sourceChild.isFolder())
      {
       copyFolder(sourceChild, targetFolder.createFolder(sourceChild.getName()));
      }
    }
  }
}
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 * Traverse the file system with a {@link FilePredicate}.
 *
 * @param  file        the file to traverse
 * @param  fileFilter  the filter for directory contents
 * @param  predicate   the predicate
 *
 ******************************************************************************************************************/
private void traverse (final @Nonnull ResourcePath rootPath,
            final @Nonnull ResourceFile file,
            final @Nonnull FileFilter fileFilter,
            final @Nonnull FilePredicate predicate)
 {
  log.trace("traverse({}, {}, {}, {})", rootPath, file, fileFilter, predicate);
  final ResourcePath relativePath = file.getPath().urlDecoded().relativeTo(rootPath);
  if (fileFilter.accept(file))
   {
    predicate.apply(file, relativePath);
   }
  for (final ResourceFile child : file.findChildren().results())
   {
    traverse(rootPath, child, fileFilter, predicate);
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
@Nonnull
protected ResourceFile createMockFolder (final @Nonnull ResourceFileSystem fileSystem,
                     final @Nonnull ResourceFile parentFolder,
                     final @Nonnull String name)
 {
  final ResourcePath path = parentFolder.getPath().appendedWith(name);
  final ResourceFile folder = createMockFolder(name);
  when(folder.getParent()).thenReturn(parentFolder);
  when(folder.getPath()).thenReturn(path);
  when(folder.toString()).thenReturn(path.asString());
  when(fileSystem.findFileByPath(eq(path.asString()))).thenReturn(folder);
  final Collection<ResourceFile> children = new ArrayList<>(parentFolder.findChildren().results());
  children.add(folder);
  when(parentFolder.findChildren()).thenReturn(new ListFinder(children));
  return folder;
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-filesystem-basic

/*******************************************************************************************************************
 *
 *
 *
 ******************************************************************************************************************/
private static void dump (final @Nonnull List<String> lines, final @Nonnull ResourceFile fileObject)
 throws IOException
 {
  if (fileObject.isData())
   {
    lines.add(String.format("%s: %s", fileObject.getPath().asString(), fileObject.asText("UTF-8")));
   }
  else
   {
    for (final ResourceFile child : fileObject.findChildren().results())
     {
      dump(lines, child);
     }
   }
 }
origin: it.tidalwave.northernwind/it-tidalwave-northernwind-core-default

/*******************************************************************************************************************
 *
 ******************************************************************************************************************/
@Nonnull
protected ResourceFile createMockFile (final @Nonnull ResourceFileSystem fileSystem,
                    final @Nonnull ResourceFile parentFolder,
                    final @Nonnull String name)
 {
  final ResourcePath path = parentFolder.getPath().appendedWith(name);
  final ResourceFile file = createMockFile(name);
  when(file.getParent()).thenReturn(parentFolder);
  when(file.getPath()).thenReturn(path);
  when(file.toString()).thenReturn(path.asString());
  when(fileSystem.findFileByPath(eq(path.asString()))).thenReturn(file);
  final Collection<ResourceFile> children = new ArrayList<>(parentFolder.findChildren().results());
  children.add(file);
  when(parentFolder.findChildren()).thenReturn(new ListFinder(children));
  return file;
 }
it.tidalwave.northernwind.core.modelResourceFile$Finderresults

Popular methods of ResourceFile$Finder

  • result
  • withName
  • withRecursion

Popular in Java

  • Making http post requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getSharedPreferences (Context)
  • setContentView (Activity)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • ImageIO (javax.imageio)
  • JCheckBox (javax.swing)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now