projects
/
lgpl
/
argeo-commons.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve CMS file system
[lgpl/argeo-commons.git]
/
org.argeo.cms
/
src
/
org
/
argeo
/
cms
/
file
/
provider
/
ContentDirectoryStream.java
diff --git
a/org.argeo.cms/src/org/argeo/cms/file/provider/ContentDirectoryStream.java
b/org.argeo.cms/src/org/argeo/cms/file/provider/ContentDirectoryStream.java
index 2cddf6275a67c4d338b7088ccc198e7ad1404248..55db44360f5ddb63ef75791b62f2c58be15270aa 100644
(file)
--- a/
org.argeo.cms/src/org/argeo/cms/file/provider/ContentDirectoryStream.java
+++ b/
org.argeo.cms/src/org/argeo/cms/file/provider/ContentDirectoryStream.java
@@
-7,7
+7,6
@@
import java.nio.file.Path;
import java.util.Iterator;
import org.argeo.api.acr.Content;
import java.util.Iterator;
import org.argeo.api.acr.Content;
-import org.argeo.api.acr.DName;
public class ContentDirectoryStream implements DirectoryStream<Path> {
private final CmsPath dir;
public class ContentDirectoryStream implements DirectoryStream<Path> {
private final CmsPath dir;
@@
-31,21
+30,13
@@
public class ContentDirectoryStream implements DirectoryStream<Path> {
return iterator;
}
return iterator;
}
- static boolean isFile(Content c) {
- return !c.get(DName.getcontenttype, String.class).isEmpty();
- }
-
- static boolean isDirectory(Content c) {
- return c.isContentClass(DName.collection);
- }
-
class FilesAndCollectionsIterator implements Iterator<Path> {
private Content next;
private final Iterator<Content> it;
public FilesAndCollectionsIterator() {
Content content = dir.getContent();
class FilesAndCollectionsIterator implements Iterator<Path> {
private Content next;
private final Iterator<Content> it;
public FilesAndCollectionsIterator() {
Content content = dir.getContent();
- if (!
content.isContentClass(DName.collection
))
+ if (!
ContentAttributes.isDirectory(content
))
throw new IllegalStateException("Content " + content + " is not a collection");
it = content.iterator();
findNext();
throw new IllegalStateException("Content " + content + " is not a collection");
it = content.iterator();
findNext();
@@
-53,9
+44,9
@@
public class ContentDirectoryStream implements DirectoryStream<Path> {
private void findNext() {
next = null;
private void findNext() {
next = null;
- while (it.hasNext() && next
!
= null) {
+ while (it.hasNext() && next
=
= null) {
Content n = it.next();
Content n = it.next();
- if (
isFile(n) ||
isDirectory(n)) {
+ if (
ContentAttributes.isRegularFile(n) || ContentAttributes.
isDirectory(n)) {
if (filter != null) {
try {
if (filter.accept(new CmsPath(dir.getFileSystem(), n)))
if (filter != null) {
try {
if (filter.accept(new CmsPath(dir.getFileSystem(), n)))