diff options
author | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-17 06:24:15 +0000 |
---|---|---|
committer | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-08-17 06:24:15 +0000 |
commit | 53c043ac18ca8dd9d7f823bf7a399058c305003d (patch) | |
tree | 5b8184792065accca1e5a68092d0960db455cda6 /branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java | |
parent | a4f020f2df42181bf54587acddb3b748ff5f698f (diff) |
committing domain-search changes from patch tuscany_2552_phillipe_ramalho_08_16_2009.patch
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@804871 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java | 136 |
1 files changed, 69 insertions, 67 deletions
diff --git a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java index 62f2b59db2..07002daa8d 100644 --- a/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java +++ b/branches/sca-java-1.x/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/CompositeDocumentProcessor.java @@ -32,95 +32,97 @@ import org.apache.tuscany.sca.domain.search.DocumentProcessor; */ public class CompositeDocumentProcessor implements DocumentProcessor { - 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 Composite) { - Composite composite = (Composite) object; - QName name = composite.getName(); - String uri = (name == null ? "" : name.getNamespaceURI() + ';' + name.getLocalPart()); - - if (uri.length() == 0) { - uri = null; - - } else if (doc == null) { - doc = documents.get(uri); - } - - if (uri != null) { - parent += DomainPathAnalyzer.PATH_SEPARATOR + SearchFields.COMPOSITE_FIELD + DomainPathAnalyzer.TYPE_SEPARATOR + uri; - } - - for (Component component : composite.getComponents()) { - - Document componentDoc = parentProcessor.process(parentProcessor, - documents, component, null, parent); + if (object instanceof Composite) { + Composite composite = (Composite)object; + QName name = composite.getName(); + String uri = (name == null ? "" : name.getNamespaceURI() + ';' + name.getLocalPart()); - if (uri != null) { + if (uri.length() == 0) { + uri = null; - componentDoc.add(new Field(SearchFields.PARENT_FIELD, parent, - Field.Store.YES, Field.Index.ANALYZED)); + } else if (doc == null) { + doc = documents.get(uri); + } - } + if (uri != null) { + parent += + DomainPathAnalyzer.PATH_SEPARATOR + SearchFields.COMPOSITE_FIELD + + DomainPathAnalyzer.TYPE_SEPARATOR + + uri; + } - } + for (Component component : composite.getComponents()) { - if (uri != null) { + Document componentDoc = parentProcessor.process(parentProcessor, documents, component, null, parent); - doc.add(new Field(SearchFields.COMPOSITE_FIELD, uri, - Field.Store.YES, Field.Index.ANALYZED)); + if (uri != null) { - } + componentDoc + .add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED)); - for (Composite include : composite.getIncludes()) { - Document compositeDoc = parentProcessor.process(parentProcessor, - documents, include, null, parent); + } - if (uri != null) { + } - compositeDoc.add(new Field(SearchFields.INCLUDEDBY_FIELD, - uri, Field.Store.YES, Field.Index.ANALYZED)); + if (uri != null) { - } + doc.add(new Field(SearchFields.COMPOSITE_FIELD, uri, Field.Store.YES, Field.Index.ANALYZED)); - } + } - for (Component component : composite.getComponents()) { - Document componentDoc = parentProcessor.process(parentProcessor, - documents, component, null, parent); + for (Composite include : composite.getIncludes()) { + Document compositeDoc = parentProcessor.process(parentProcessor, documents, include, null, parent); - if (uri != null) { + if (uri != null) { - componentDoc.add(new Field(SearchFields.PARENT_FIELD, parent, - Field.Store.YES, Field.Index.ANALYZED)); + compositeDoc.add(new Field(SearchFields.INCLUDEDBY_FIELD, uri, Field.Store.YES, + Field.Index.ANALYZED)); - } + } - } + } - return doc == null ? FAKE_DOCUMENT : doc; + for (Component component : composite.getComponents()) { + Document componentDoc = parentProcessor.process(parentProcessor, documents, component, null, parent); - } + if (uri != null) { - throw new IllegalArgumentException(); + componentDoc + .add(new Field(SearchFields.PARENT_FIELD, parent, Field.Store.YES, Field.Index.ANALYZED)); - } + } - public Object getDocumentKey(Object object) { - - if (object instanceof Composite) { - Composite composite = (Composite) object; - String uri = composite.getURI(); - QName name = composite.getName(); + } + + return doc == null ? FAKE_DOCUMENT : doc; + + } + + throw new IllegalArgumentException(); + + } + + public Object getDocumentKey(Object object) { + + if (object instanceof Composite) { + Composite composite = (Composite)object; + String uri = composite.getURI(); + QName name = composite.getName(); + + uri = (uri == null ? "" : uri) + (name == null ? "" : name.toString()); + + return uri.length() == 0 ? null : uri; + + } + + throw new IllegalArgumentException(); + + } - uri = (uri == null ? "" : uri) + (name == null ? "" : name.toString()); - - return uri.length() == 0 ? null : uri; - - } - - throw new IllegalArgumentException(); - - } - } |