use of org.pentaho.reporting.libraries.repository.ContentEntity in project pentaho-kettle by pentaho.
the class FileObjectContentLocation method listContents.
/**
* Lists all content entities stored in this content-location. This method filters out all files that have an invalid
* name (according to the repository rules).
*
* @return the content entities for this location.
* @throws ContentIOException if an repository error occured.
*/
public ContentEntity[] listContents() throws ContentIOException {
try {
final FileObject file = getBackend();
final FileObject[] files = file.getChildren();
final ContentEntity[] entities = new ContentEntity[files.length];
for (int i = 0; i < files.length; i++) {
final FileObject child = files[i];
if (RepositoryUtilities.isInvalidPathName(child.getPublicURIString())) {
continue;
}
if (child.isFolder()) {
entities[i] = new FileObjectContentLocation(this, child);
} else if (child.isFile()) {
entities[i] = new FileObjectContentLocation(this, child);
}
}
return entities;
} catch (FileSystemException e) {
throw new RuntimeException(e);
}
}
use of org.pentaho.reporting.libraries.repository.ContentEntity in project pentaho-platform by pentaho.
the class PentahoURLRewriterTest method testRewriteRoot.
@Test
public void testRewriteRoot() throws Exception {
String pattern = TEST_SRC + "/solution/test/reporting/system/{0}/param";
PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
File dataDirectory = new File("/");
FileRepository dataRepository = new FileRepository(dataDirectory);
File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
String result = rewriter.rewrite(contentEntry, dataEntity);
assertEquals(TEST_SRC + "/solution/test/reporting/system/dataEntityBackend/param", result);
}
use of org.pentaho.reporting.libraries.repository.ContentEntity in project pentaho-platform by pentaho.
the class PentahoURLRewriterTest method testRewriteWithSimplePattern.
@Test
public void testRewriteWithSimplePattern() throws Exception {
String pattern = TEST_SRC + "/solution/test/reporting/system";
PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
FileRepository dataRepository = new FileRepository(dataDirectory);
File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
String result = rewriter.rewrite(contentEntry, dataEntity);
assertEquals(pattern, result);
}
use of org.pentaho.reporting.libraries.repository.ContentEntity in project pentaho-platform by pentaho.
the class PentahoURLRewriterTest method testRewriteWithPatternParam.
@Test
public void testRewriteWithPatternParam() throws Exception {
String pattern = TEST_SRC + "/solution/test/reporting/system/{0}/param";
PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
FileRepository dataRepository = new FileRepository(dataDirectory);
File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
String result = rewriter.rewrite(contentEntry, dataEntity);
assertEquals(TEST_SRC + "/solution/test/reporting/system/dataEntityBackend/param", result);
}
use of org.pentaho.reporting.libraries.repository.ContentEntity in project pentaho-platform by pentaho.
the class PentahoURLRewriterTest method testRewriteWithNullPattern.
@Test
public void testRewriteWithNullPattern() throws Exception {
String pattern = null;
PentahoURLRewriter rewriter = new PentahoURLRewriter(pattern);
File dataDirectory = new File(TEST_SRC + "/solution/test/reporting/");
FileRepository dataRepository = new FileRepository(dataDirectory);
File contentEntryBackend = new File(TEST_SRC + "/solution/test/reporting/contentEntryBackend");
File dataEntityBackend = new File(TEST_SRC + "/solution/test/reporting/dataEntityBackend");
ContentEntity contentEntry = new FileContentItem(dataRepository.getRoot(), contentEntryBackend);
ContentEntity dataEntity = new FileContentItem(dataRepository.getRoot(), dataEntityBackend);
String result = rewriter.rewrite(contentEntry, dataEntity);
assertEquals("dataEntityBackend", result);
}
Aggregations