You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by il...@apache.org on 2014/05/08 14:23:15 UTC
git commit: Adding search facilities + dedicated test
Repository: olingo-odata4
Updated Branches:
refs/heads/master 52c7cc2cc -> 56a5b08a7
Adding search facilities + dedicated test
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/56a5b08a
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/56a5b08a
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/56a5b08a
Branch: refs/heads/master
Commit: 56a5b08a782e3fd50c81ccd2be7af00feb227aa8
Parents: 52c7cc2
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Thu May 8 14:23:08 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Thu May 8 14:23:08 2014 +0200
----------------------------------------------------------------------
.../olingo/fit/v3/QueryOptionsTestITCase.java | 2 +-
.../olingo/fit/v4/QueryOptionsTestITCase.java | 19 ++++++--
.../olingo/client/api/uri/v4/SearchFactory.java | 31 +++++++++++++
.../olingo/client/api/uri/v4/URIBuilder.java | 9 ++++
.../olingo/client/api/uri/v4/URISearch.java | 32 ++++++++++++++
.../olingo/client/api/v4/ODataClient.java | 3 ++
.../client/core/uri/AbstractURIBuilder.java | 9 ++--
.../client/core/uri/v4/URIBuilderImpl.java | 6 +++
.../apache/olingo/client/core/v4/AndSearch.java | 42 ++++++++++++++++++
.../olingo/client/core/v4/LiteralSearch.java | 37 ++++++++++++++++
.../apache/olingo/client/core/v4/NotSearch.java | 35 +++++++++++++++
.../olingo/client/core/v4/ODataClientImpl.java | 8 ++++
.../apache/olingo/client/core/v4/OrSearch.java | 42 ++++++++++++++++++
.../client/core/v4/SearchFactoryImpl.java | 46 ++++++++++++++++++++
14 files changed, 313 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java
index 5b1f306..72ea453 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v3/QueryOptionsTestITCase.java
@@ -56,7 +56,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
/**
* Test <tt>$filter</tt> and <tt>orderby</tt>.
*
- * @see org.apache.olingo.client.core.v3.FilterFactoryTest for more tests.
+ * @see org.apache.olingo.fit.v3.FilterFactoryTestITCase for more tests.
*/
@Test
public void filterOrderby() throws EdmPrimitiveTypeException {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
index baa2bd4..7960376 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/QueryOptionsTestITCase.java
@@ -21,6 +21,7 @@ package org.apache.olingo.fit.v4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import java.util.ArrayList;
import java.util.Collections;
@@ -59,7 +60,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
/**
* Test <tt>$filter</tt> and <tt>$orderby</tt>.
*
- * @see org.apache.olingo.client.core.v3.FilterFactoryTest for more tests.
+ * @see org.apache.olingo.fit.v4.FilterFactoryTestITCase for more tests.
*/
@Test
public void filterOrderby() throws EdmPrimitiveTypeException {
@@ -171,7 +172,7 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
* Test <tt>$inlinecount</tt>.
*/
@Test
- public void inlinecount() {
+ public void count() {
final URIBuilder uriBuilder =
client.getURIBuilder(testStaticServiceRootURL).appendEntitySetSegment("Customers").count(true);
@@ -207,9 +208,19 @@ public class QueryOptionsTestITCase extends AbstractTestITCase {
expandWithSelect("Orders", "OrderID", "OrderDetails");
final ODataEntityRequest<ODataEntity> req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
- req.setFormat(ODataPubFormat.JSON_FULL_METADATA);
-
final ODataRetrieveResponse<ODataEntity> res = req.execute();
assertEquals(200, res.getStatusCode());
}
+
+ @Test
+ public void search() {
+ final URIBuilder builder = client.getURIBuilder(testStaticServiceRootURL).
+ appendEntitySetSegment("People").search(client.getSearchFactory().
+ or(client.getSearchFactory().literal("Bob"), client.getSearchFactory().literal("Jill")));
+ final ODataEntitySetRequest<ODataEntitySet> req =
+ client.getRetrieveRequestFactory().getEntitySetRequest(builder.build());
+ final ODataRetrieveResponse<ODataEntitySet> res = req.execute();
+ assertEquals(200, res.getStatusCode());
+ assertFalse(res.getBody().getEntities().isEmpty());
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/SearchFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/SearchFactory.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/SearchFactory.java
new file mode 100644
index 0000000..55c96a7
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/SearchFactory.java
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.uri.v4;
+
+public interface SearchFactory {
+
+ URISearch literal(Object value);
+
+ URISearch and(URISearch left, URISearch right);
+
+ URISearch or(URISearch left, URISearch right);
+
+ URISearch not(URISearch filter);
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
index a393ea4..aa60cce 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URIBuilder.java
@@ -102,6 +102,15 @@ public interface URIBuilder extends CommonURIBuilder<URIBuilder> {
/**
* Appends search query option.
*
+ * @param search search expression
+ * @return current URIBuilder instance
+ * @see org.apache.olingo.client.api.uri.QueryOption#SEARCH
+ */
+ URIBuilder search(URISearch search);
+
+ /**
+ * Appends search query option.
+ *
* @param expression search expression
* @return current URIBuilder instance
* @see org.apache.olingo.client.api.uri.QueryOption#SEARCH
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URISearch.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URISearch.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URISearch.java
new file mode 100644
index 0000000..2249498
--- /dev/null
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/uri/v4/URISearch.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.api.uri.v4;
+
+/**
+ * Interface for <tt>$search</tt>; obtain instances via <tt>SearchFactory</tt>.
+ *
+ * @see SearchFactory
+ */
+public interface URISearch {
+
+ /**
+ * @return String representation of this search.
+ */
+ String build();
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
----------------------------------------------------------------------
diff --git a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
index 411e1fc..0aefdc7 100644
--- a/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
+++ b/lib/client-api/src/main/java/org/apache/olingo/client/api/v4/ODataClient.java
@@ -29,6 +29,7 @@ import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.client.api.uri.v4.SearchFactory;
import org.apache.olingo.commons.api.domain.v4.ODataObjectFactory;
public interface ODataClient extends CommonODataClient<UpdateType> {
@@ -51,6 +52,8 @@ public interface ODataClient extends CommonODataClient<UpdateType> {
@Override
FilterFactory getFilterFactory();
+ SearchFactory getSearchFactory();
+
@Override
ODataObjectFactory getObjectFactory();
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
index 1029173..ac01632 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractURIBuilder.java
@@ -32,6 +32,7 @@ import org.apache.olingo.client.api.uri.CommonURIBuilder;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.api.uri.URIFilter;
+import org.apache.olingo.commons.api.Constants;
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -213,12 +214,14 @@ public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> impleme
@Override
public UB filter(final URIFilter filter) {
+ UB result;
try {
// decode in order to support @ in parameter aliases
- return addQueryOption(QueryOption.FILTER, URLDecoder.decode(filter.build(), "UTF-8"));
- } catch (UnsupportedEncodingException ex) {
- return addQueryOption(QueryOption.FILTER, filter.build());
+ result = filter(URLDecoder.decode(filter.build(), Constants.UTF8));
+ } catch (UnsupportedEncodingException e) {
+ result = filter(filter.build());
}
+ return result;
}
@Override
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
index cd32192..68e2f41 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/v4/URIBuilderImpl.java
@@ -25,6 +25,7 @@ import org.apache.commons.lang3.tuple.Pair;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.api.uri.SegmentType;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
+import org.apache.olingo.client.api.uri.v4.URISearch;
import org.apache.olingo.client.api.v4.Configuration;
import org.apache.olingo.client.core.uri.AbstractURIBuilder;
import org.apache.olingo.commons.api.edm.EdmEnumType;
@@ -121,6 +122,11 @@ public class URIBuilderImpl extends AbstractURIBuilder<URIBuilder> implements UR
}
@Override
+ public URIBuilder search(final URISearch search) {
+ return search(search.build());
+ }
+
+ @Override
public URIBuilder search(final String expression) {
return addQueryOption(QueryOption.SEARCH, expression);
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/AndSearch.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/AndSearch.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/AndSearch.java
new file mode 100644
index 0000000..1dc4e51
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/AndSearch.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.uri.v4.URISearch;
+
+public class AndSearch implements URISearch {
+
+ private final URISearch left;
+
+ private final URISearch right;
+
+ AndSearch(final URISearch left, final URISearch right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(" AND ").
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/LiteralSearch.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/LiteralSearch.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/LiteralSearch.java
new file mode 100644
index 0000000..dc5bb72
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/LiteralSearch.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.uri.v4.URISearch;
+import org.apache.olingo.client.core.uri.URIUtils;
+import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
+
+public class LiteralSearch implements URISearch {
+
+ private final Object value;
+
+ LiteralSearch(final Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public String build() {
+ return URIUtils.escape(ODataServiceVersion.V40, value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/NotSearch.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/NotSearch.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/NotSearch.java
new file mode 100644
index 0000000..39d0fe3
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/NotSearch.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.uri.v4.URISearch;
+
+public class NotSearch implements URISearch {
+
+ private final URISearch filter;
+
+ NotSearch(final URISearch left) {
+ this.filter = left;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder("NOT (").append(filter.build()).append(')').toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
index 58a46f5..cac3f12 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/ODataClientImpl.java
@@ -35,6 +35,7 @@ import org.apache.olingo.client.api.op.v4.ODataDeserializer;
import org.apache.olingo.client.api.op.v4.ODataReader;
import org.apache.olingo.client.api.uri.v4.URIBuilder;
import org.apache.olingo.client.api.uri.v4.FilterFactory;
+import org.apache.olingo.client.api.uri.v4.SearchFactory;
import org.apache.olingo.client.core.AbstractODataClient;
import org.apache.olingo.client.core.communication.header.ODataHeadersImpl;
import org.apache.olingo.client.core.communication.request.batch.v4.BatchRequestFactoryImpl;
@@ -61,6 +62,8 @@ public class ODataClientImpl extends AbstractODataClient<UpdateType> implements
private final FilterFactory filterFactory = new FilterFactoryImpl(getServiceVersion());
+ private final SearchFactory searchFactory = new SearchFactoryImpl();
+
private final ODataDeserializer deserializer = new ODataDeserializerImpl(getServiceVersion());
private final ODataSerializer serializer = new ODataSerializerImpl(getServiceVersion());
@@ -112,6 +115,11 @@ public class ODataClientImpl extends AbstractODataClient<UpdateType> implements
}
@Override
+ public SearchFactory getSearchFactory() {
+ return searchFactory;
+ }
+
+ @Override
public ODataDeserializer getDeserializer() {
return deserializer;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/OrSearch.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/OrSearch.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/OrSearch.java
new file mode 100644
index 0000000..862142c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/OrSearch.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.uri.v4.URISearch;
+
+public class OrSearch implements URISearch {
+
+ private final URISearch left;
+
+ private final URISearch right;
+
+ OrSearch(final URISearch left, final URISearch right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(" OR ").
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/56a5b08a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/SearchFactoryImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/SearchFactoryImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/SearchFactoryImpl.java
new file mode 100644
index 0000000..37adbda
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/v4/SearchFactoryImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.olingo.client.core.v4;
+
+import org.apache.olingo.client.api.uri.v4.SearchFactory;
+import org.apache.olingo.client.api.uri.v4.URISearch;
+
+public class SearchFactoryImpl implements SearchFactory {
+
+ @Override
+ public URISearch literal(final Object value) {
+ return new LiteralSearch(value);
+ }
+
+ @Override
+ public URISearch and(final URISearch left, final URISearch right) {
+ return new AndSearch(left, right);
+ }
+
+ @Override
+ public URISearch or(final URISearch left, final URISearch right) {
+ return new OrSearch(left, right);
+ }
+
+ @Override
+ public URISearch not(final URISearch filter) {
+ return new NotSearch(filter);
+ }
+
+}