diff options
Diffstat (limited to '')
-rw-r--r-- | branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/FileDocumentProcessor.java | 107 |
1 files changed, 54 insertions, 53 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/FileDocumentProcessor.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/FileDocumentProcessor.java index 87125d5c0e..553a5b57cd 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/FileDocumentProcessor.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/FileDocumentProcessor.java @@ -27,81 +27,82 @@ import org.apache.tuscany.sca.domain.search.DocumentProcessor; * * @version $Rev$ $Date$ */ -public class FileDocumentProcessor extends LinkedList<DocumentProcessor> - implements DocumentProcessor { +public class FileDocumentProcessor extends LinkedList<DocumentProcessor> implements DocumentProcessor { - private static final long serialVersionUID = 7843338343970738591L; + private static final long serialVersionUID = 7843338343970738591L; - public Document process(DocumentProcessor parentProcessor, - DocumentMap documents, Object object, Document doc, String parent) { + public Document process(DocumentProcessor parentProcessor, + DocumentMap documents, + Object object, + Document doc, + String parent) { - if (object instanceof FileContent) { - FileContent file = (FileContent) object; + if (object instanceof FileContent) { + FileContent file = (FileContent)object; - if (!file.isLeaf()) { + if (!file.isLeaf()) { - if (doc == null) { - doc = documents.get(SearchFields.FILE_CONTENT_FIELD + file.getPath()); - } + if (doc == null) { + doc = documents.get(SearchFields.FILE_CONTENT_FIELD + file.getPath()); + } - //FileContent[] files = file.getChildren(); + // FileContent[] files = file.getChildren(); -// for (FileContent childFile : files) { -// // Document fileDoc = parentProcessor.process( -// // parentProcessor, documents, childFile, null, -// // parent); -// -// Document fileDoc = null; -// -// fileDoc = process(this, documents, childFile, null, parent); -// -// if (fileDoc == null) { -// continue; -// } -// -// fileDoc.add(new Field(SearchFields.PARENT_FIELD, parent, -// Field.Store.YES, Field.Index.ANALYZED)); -// -// } + // for (FileContent childFile : files) { + // // Document fileDoc = parentProcessor.process( + // // parentProcessor, documents, childFile, null, + // // parent); + // + // Document fileDoc = null; + // + // fileDoc = process(this, documents, childFile, null, parent); + // + // if (fileDoc == null) { + // continue; + // } + // + // fileDoc.add(new Field(SearchFields.PARENT_FIELD, parent, + // Field.Store.YES, Field.Index.ANALYZED)); + // + // } - return doc; + return doc; - } else { + } else { - for (DocumentProcessor processor : this) { - Document newDoc = processor.process(this, documents, file, - doc, parent); + for (DocumentProcessor processor : this) { + Document newDoc = processor.process(this, documents, file, doc, parent); - if (newDoc != null) { - return newDoc; - } + if (newDoc != null) { + return newDoc; + } - } + } - } + } - } + } - return doc; + return doc; - } + } - public Object getDocumentKey(Object object) { + public Object getDocumentKey(Object object) { - if (object instanceof FileContent) { - FileContent file = (FileContent) object; - String path = file.getPath(); + if (object instanceof FileContent) { + FileContent file = (FileContent)object; + String path = file.getPath(); - if (path != null && path.length() == 0) { - return null; - } + if (path != null && path.length() == 0) { + return null; + } - return SearchFields.FILE_CONTENT_FIELD + path; + return SearchFields.FILE_CONTENT_FIELD + path; - } + } - throw new IllegalArgumentException(); + throw new IllegalArgumentException(); - } + } } |