You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by sk...@apache.org on 2014/04/01 11:00:16 UTC
[04/52] [abbrv] Consistently using package name to differentiate V3
and V4
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
deleted file mode 100644
index 778458f..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3ReaderImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.core.ODataV3ClientImpl;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.commons.api.edm.Edm;
-
-public class ODataV3ReaderImpl extends AbstractODataReader {
-
- private static final long serialVersionUID = -2481293269536406956L;
-
- public ODataV3ReaderImpl(final ODataV3ClientImpl client) {
- super(client);
- }
-
- @Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataV3ClientImpl) client).getBinder().getODataServiceDocument(
- ((ODataV3ClientImpl) client).getDeserializer().toServiceDocument(input, format));
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
deleted file mode 100644
index 366f458..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV3SerializerImpl.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.op.impl;
-
-import org.apache.olingo.client.api.ODataClient;
-
-public class ODataV3SerializerImpl extends AbstractODataSerializer {
-
- private static final long serialVersionUID = -8861908250297989806L;
-
- public ODataV3SerializerImpl(final ODataClient client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
deleted file mode 100644
index 36006b5..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4BinderImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.op.impl;
-
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.data.ServiceDocumentItem;
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.core.ODataV4ClientImpl;
-import org.apache.olingo.client.api.utils.URIUtils;
-
-public class ODataV4BinderImpl extends AbstractODataBinder {
-
- private static final long serialVersionUID = -6371110655960799393L;
-
- public ODataV4BinderImpl(final ODataV4ClientImpl client) {
- super(client);
- }
-
- @Override
- public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
- final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
-
- serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
- serviceDocument.setMetadataETag(resource.getMetadataETag());
-
- for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
- serviceDocument.getFunctionImports().put(functionImport.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
- }
- for (ServiceDocumentItem singleton : resource.getSingletons()) {
- serviceDocument.getSingletons().put(singleton.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
- }
- for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
- serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
- URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
- }
-
- return serviceDocument;
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
deleted file mode 100644
index d3affea..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4DeserializerImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.ODataClient;
-import org.apache.olingo.client.api.data.ServiceDocument;
-import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.api.op.ODataV4Deserializer;
-import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
-import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
-import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
-import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
-
-public class ODataV4DeserializerImpl extends AbstractODataDeserializer implements ODataV4Deserializer {
-
- private static final long serialVersionUID = 8593081342440470415L;
-
- public ODataV4DeserializerImpl(final ODataClient client) {
- super(client);
- }
-
- @Override
- public XMLMetadata toMetadata(final InputStream input) {
- try {
- return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
- } catch (Exception e) {
- throw new IllegalArgumentException("Could not parse as Edmx document", e);
- }
- }
-
- @Override
- public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
- return format == ODataFormat.XML
- ? xml(input, XMLServiceDocumentImpl.class)
- : json(input, JSONServiceDocumentImpl.class);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
deleted file mode 100644
index f704eee..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4ReaderImpl.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.op.impl;
-
-import java.io.InputStream;
-
-import org.apache.olingo.client.api.domain.ODataServiceDocument;
-import org.apache.olingo.client.api.format.ODataFormat;
-import org.apache.olingo.client.core.ODataV4ClientImpl;
-import org.apache.olingo.client.core.edm.EdmClientImpl;
-import org.apache.olingo.commons.api.edm.Edm;
-
-public class ODataV4ReaderImpl extends AbstractODataReader {
-
- private static final long serialVersionUID = -2481293269536406956L;
-
- public ODataV4ReaderImpl(final ODataV4ClientImpl client) {
- super(client);
- }
-
- @Override
- public Edm readMetadata(final InputStream input) {
- return new EdmClientImpl(client.getDeserializer().toMetadata(input));
- }
-
- @Override
- public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
- return ((ODataV4ClientImpl) client).getBinder().getODataServiceDocument(
- ((ODataV4ClientImpl) client).getDeserializer().toServiceDocument(input, format));
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
deleted file mode 100644
index 9e971b4..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataV4SerializerImpl.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.op.impl;
-
-import org.apache.olingo.client.api.ODataClient;
-
-public class ODataV4SerializerImpl extends AbstractODataSerializer {
-
- private static final long serialVersionUID = 7587265188399685309L;
-
- public ODataV4SerializerImpl(final ODataClient client) {
- super(client);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
index 40bd2fb..5e95f2b 100644
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/ODataWriterImpl.java
@@ -24,7 +24,7 @@ import java.io.InputStream;
import java.util.Collection;
import java.util.Collections;
import org.apache.commons.io.IOUtils;
-import org.apache.olingo.client.api.ODataClient;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.domain.ODataEntity;
import org.apache.olingo.client.api.domain.ODataLink;
import org.apache.olingo.client.api.domain.ODataProperty;
@@ -36,9 +36,9 @@ public class ODataWriterImpl implements ODataWriter {
private static final long serialVersionUID = 3265794768412314485L;
- protected final ODataClient client;
+ protected final CommonODataClient client;
- public ODataWriterImpl(final ODataClient client) {
+ public ODataWriterImpl(final CommonODataClient client) {
this.client = client;
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.java
new file mode 100644
index 0000000..f5e5710
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataBinderImpl.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.op.impl.v3;
+
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.op.v3.ODataBinder;
+import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+import org.apache.olingo.client.core.v3.ODataClientImpl;
+
+public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
+
+ private static final long serialVersionUID = 8970843539708952308L;
+
+ public ODataBinderImpl(final ODataClientImpl client) {
+ super(client);
+ }
+
+ @Override
+ public ODataLinkCollection getLinkCollection(final LinkCollection linkCollection) {
+ final ODataLinkCollection collection = new ODataLinkCollection(linkCollection.getNext());
+ collection.setLinks(linkCollection.getLinks());
+ return collection;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
new file mode 100644
index 0000000..ea28958
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataDeserializerImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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.op.impl.v3;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.v3.LinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v3.ODataDeserializer;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.data.v3.JSONLinkCollectionImpl;
+import org.apache.olingo.client.core.data.v3.XMLLinkCollectionImpl;
+import org.apache.olingo.client.core.data.v3.JSONServiceDocumentImpl;
+import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
+import org.apache.olingo.client.core.edm.xml.v3.EdmxImpl;
+import org.apache.olingo.client.core.edm.xml.v3.XMLMetadataImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
+
+ private static final long serialVersionUID = -8221085862548914611L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public XMLMetadataImpl toMetadata(final InputStream input) {
+ try {
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+ @Override
+ public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? xml(input, XMLServiceDocumentImpl.class)
+ : json(input, JSONServiceDocumentImpl.class);
+ }
+
+ @Override
+ public LinkCollection toLinkCollection(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? atom(input, XMLLinkCollectionImpl.class)
+ : json(input, JSONLinkCollectionImpl.class);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
new file mode 100644
index 0000000..54e4ad0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataReaderImpl.java
@@ -0,0 +1,66 @@
+/*
+ * 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.op.impl.v3;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.domain.v3.ODataLinkCollection;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v3.ODataReader;
+import org.apache.olingo.client.api.v3.ODataClient;
+import org.apache.olingo.client.core.v3.ODataClientImpl;
+import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.commons.api.edm.Edm;
+
+public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ }
+
+ @Override
+ public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+ return ((ODataClientImpl) client).getBinder().getODataServiceDocument(
+ ((ODataClientImpl) client).getDeserializer().toServiceDocument(input, format));
+ }
+
+ @Override
+ public ODataLinkCollection readLinks(final InputStream input, final ODataFormat format) {
+ return ((ODataClient) client).getBinder().getLinkCollection(
+ ((ODataClient) client).getDeserializer().toLinkCollection(input, format));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public <T> T read(final InputStream src, final String format, final Class<T> reference) {
+ return (ODataLinkCollection.class.isAssignableFrom(reference)
+ ? (T) readLinks(src, ODataFormat.fromString(format))
+ : super.read(src, format, reference));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.java
new file mode 100644
index 0000000..5ad5cda
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v3/ODataSerializerImpl.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.core.op.impl.v3;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = -8861908250297989806L;
+
+ public ODataSerializerImpl(final CommonODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
new file mode 100644
index 0000000..8812129
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataBinderImpl.java
@@ -0,0 +1,59 @@
+/*
+ * 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.op.impl.v4;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.data.ServiceDocumentItem;
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.op.v4.ODataBinder;
+import org.apache.olingo.client.api.utils.URIUtils;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataBinder;
+
+public class ODataBinderImpl extends AbstractODataBinder implements ODataBinder {
+
+ private static final long serialVersionUID = -6371110655960799393L;
+
+ public ODataBinderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public ODataServiceDocument getODataServiceDocument(final ServiceDocument resource) {
+ final ODataServiceDocument serviceDocument = super.getODataServiceDocument(resource);
+
+ serviceDocument.setMetadataContext(URIUtils.getURI(resource.getBaseURI(), resource.getMetadataContext()));
+ serviceDocument.setMetadataETag(resource.getMetadataETag());
+
+ for (ServiceDocumentItem functionImport : resource.getFunctionImports()) {
+ serviceDocument.getFunctionImports().put(functionImport.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), functionImport.getHref()));
+ }
+ for (ServiceDocumentItem singleton : resource.getSingletons()) {
+ serviceDocument.getSingletons().put(singleton.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), singleton.getHref()));
+ }
+ for (ServiceDocumentItem sdoc : resource.getRelatedServiceDocuments()) {
+ serviceDocument.getRelatedServiceDocuments().put(sdoc.getTitle(),
+ URIUtils.getURI(resource.getBaseURI(), sdoc.getHref()));
+ }
+
+ return serviceDocument;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
new file mode 100644
index 0000000..d947539
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataDeserializerImpl.java
@@ -0,0 +1,58 @@
+/*
+ * 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.op.impl.v4;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.data.ServiceDocument;
+import org.apache.olingo.client.api.edm.xml.v4.XMLMetadata;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v4.ODataDeserializer;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.data.v4.JSONServiceDocumentImpl;
+import org.apache.olingo.client.core.data.v4.XMLServiceDocumentImpl;
+import org.apache.olingo.client.core.edm.xml.v4.EdmxImpl;
+import org.apache.olingo.client.core.edm.xml.v4.XMLMetadataImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataDeserializer;
+
+public class ODataDeserializerImpl extends AbstractODataDeserializer implements ODataDeserializer {
+
+ private static final long serialVersionUID = 8593081342440470415L;
+
+ public ODataDeserializerImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public XMLMetadata toMetadata(final InputStream input) {
+ try {
+ return new XMLMetadataImpl(getXmlMapper().readValue(input, EdmxImpl.class));
+ } catch (Exception e) {
+ throw new IllegalArgumentException("Could not parse as Edmx document", e);
+ }
+ }
+
+ @Override
+ public ServiceDocument toServiceDocument(final InputStream input, final ODataFormat format) {
+ return format == ODataFormat.XML
+ ? xml(input, XMLServiceDocumentImpl.class)
+ : json(input, JSONServiceDocumentImpl.class);
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
new file mode 100644
index 0000000..5a64d63
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataReaderImpl.java
@@ -0,0 +1,49 @@
+/*
+ * 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.op.impl.v4;
+
+import java.io.InputStream;
+
+import org.apache.olingo.client.api.domain.ODataServiceDocument;
+import org.apache.olingo.client.api.format.ODataFormat;
+import org.apache.olingo.client.api.op.v4.ODataReader;
+import org.apache.olingo.client.api.v4.ODataClient;
+import org.apache.olingo.client.core.edm.EdmClientImpl;
+import org.apache.olingo.client.core.op.impl.AbstractODataReader;
+import org.apache.olingo.commons.api.edm.Edm;
+
+public class ODataReaderImpl extends AbstractODataReader implements ODataReader {
+
+ private static final long serialVersionUID = -2481293269536406956L;
+
+ public ODataReaderImpl(final ODataClient client) {
+ super(client);
+ }
+
+ @Override
+ public Edm readMetadata(final InputStream input) {
+ return new EdmClientImpl(client.getDeserializer().toMetadata(input));
+ }
+
+ @Override
+ public ODataServiceDocument readServiceDocument(final InputStream input, final ODataFormat format) {
+ return ((ODataClient) client).getBinder().getODataServiceDocument(
+ ((ODataClient) client).getDeserializer().toServiceDocument(input, format));
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.java
new file mode 100644
index 0000000..97557a1
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/op/impl/v4/ODataSerializerImpl.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.core.op.impl.v4;
+
+import org.apache.olingo.client.api.CommonODataClient;
+import org.apache.olingo.client.core.op.impl.AbstractODataSerializer;
+
+public class ODataSerializerImpl extends AbstractODataSerializer {
+
+ private static final long serialVersionUID = 7587265188399685309L;
+
+ public ODataSerializerImpl(final CommonODataClient client) {
+ super(client);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
new file mode 100644
index 0000000..f0cc105
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractComparingFilter.java
@@ -0,0 +1,45 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+abstract class AbstractComparingFilter implements URIFilter {
+
+ private final FilterArg left;
+
+ private final FilterArg right;
+
+ AbstractComparingFilter(final FilterArg left, final FilterArg right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ protected abstract String getOp();
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(left.build()).
+ append(' ').append(getOp()).append(' ').
+ append(right.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
new file mode 100644
index 0000000..47100e8
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterArgFactory.java
@@ -0,0 +1,178 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterArgFactory;
+
+/**
+ * OData filter arguments factory.
+ */
+public abstract class AbstractFilterArgFactory implements CommonFilterArgFactory {
+
+ @Override
+ public FilterArg _null() {
+ return new FilterConst("null");
+ }
+
+ @Override
+ public FilterArg property(final String propertyPath) {
+ return new FilterProperty(propertyPath);
+ }
+
+ @Override
+ public FilterArg literal(final Object value) {
+ return new FilterLiteral(value);
+ }
+
+ @Override
+ public FilterArg add(final FilterArg first, final FilterArg second) {
+ return new FilterOp("add", first, second);
+ }
+
+ @Override
+ public FilterArg sub(final FilterArg first, final FilterArg second) {
+ return new FilterOp("add", first, second);
+ }
+
+ @Override
+ public FilterArg mul(final FilterArg first, final FilterArg second) {
+ return new FilterOp("mul", first, second);
+ }
+
+ @Override
+ public FilterArg div(final FilterArg first, final FilterArg second) {
+ return new FilterOp("div", first, second);
+ }
+
+ @Override
+ public FilterArg mod(final FilterArg first, final FilterArg second) {
+ return new FilterOp("mod", first, second);
+ }
+
+ @Override
+ public FilterArg endswith(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("endswith", first, second);
+ }
+
+ @Override
+ public FilterArg startswith(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("startswith", first, second);
+ }
+
+ @Override
+ public FilterArg length(final FilterArg param) {
+ return new FilterFunction("length", param);
+ }
+
+ @Override
+ public FilterArg indexof(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("indexof", first, second);
+ }
+
+ @Override
+ public FilterArg replace(final FilterArg first, final FilterArg second, final FilterArg third) {
+ return new FilterFunction("replace", first, second, third);
+ }
+
+ @Override
+ public FilterArg substring(final FilterArg arg, final FilterArg pos) {
+ return new FilterFunction("substring", arg, pos);
+ }
+
+ @Override
+ public FilterArg substring(final FilterArg arg, final FilterArg pos, final FilterArg length) {
+ return new FilterFunction("substring", arg, pos, length);
+ }
+
+ @Override
+ public FilterArg tolower(final FilterArg param) {
+ return new FilterFunction("tolower", param);
+ }
+
+ @Override
+ public FilterArg toupper(final FilterArg param) {
+ return new FilterFunction("toupper", param);
+ }
+
+ @Override
+ public FilterArg trim(final FilterArg param) {
+ return new FilterFunction("trim", param);
+ }
+
+ @Override
+ public FilterArg concat(final FilterArg first, final FilterArg second) {
+ return new FilterFunction("concat", first, second);
+ }
+
+ @Override
+ public FilterArg day(final FilterArg param) {
+ return new FilterFunction("day", param);
+ }
+
+ @Override
+ public FilterArg hour(final FilterArg param) {
+ return new FilterFunction("hour", param);
+ }
+
+ @Override
+ public FilterArg minute(final FilterArg param) {
+ return new FilterFunction("minute", param);
+ }
+
+ @Override
+ public FilterArg month(final FilterArg param) {
+ return new FilterFunction("month", param);
+ }
+
+ @Override
+ public FilterArg second(final FilterArg param) {
+ return new FilterFunction("second", param);
+ }
+
+ @Override
+ public FilterArg year(final FilterArg param) {
+ return new FilterFunction("year", param);
+ }
+
+ @Override
+ public FilterArg round(final FilterArg param) {
+ return new FilterFunction("round", param);
+ }
+
+ @Override
+ public FilterArg floor(final FilterArg param) {
+ return new FilterFunction("floor", param);
+ }
+
+ @Override
+ public FilterArg ceiling(final FilterArg param) {
+ return new FilterFunction("ceiling", param);
+ }
+
+ @Override
+ public FilterArg isof(final FilterArg type) {
+ return new FilterFunction("isof", type);
+ }
+
+ @Override
+ public FilterArg isof(final FilterArg expression, final FilterArg type) {
+ return new FilterFunction("isof", expression, type);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java
new file mode 100644
index 0000000..eb6067e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AbstractFilterFactory.java
@@ -0,0 +1,108 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.CommonFilterFactory;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public abstract class AbstractFilterFactory implements CommonFilterFactory {
+
+ private static final long serialVersionUID = -6141317149802621836L;
+
+ @Override
+ public URIFilter match(final FilterArg arg) {
+ return new MatchFilter(arg);
+ }
+
+ @Override
+ public URIFilter eq(final String key, final Object value) {
+ return new EqFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter eq(final FilterArg left, final FilterArg right) {
+ return new EqFilter(left, right);
+ }
+
+ @Override
+ public URIFilter ne(final String key, final Object value) {
+ return new NeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter ne(final FilterArg left, final FilterArg right) {
+ return new NeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter gt(final String key, final Object value) {
+ return new GtFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter gt(final FilterArg left, final FilterArg right) {
+ return new GtFilter(left, right);
+ }
+
+ @Override
+ public URIFilter ge(final String key, final Object value) {
+ return new GeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter ge(final FilterArg left, final FilterArg right) {
+ return new GeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter lt(final String key, final Object value) {
+ return new LtFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter lt(final FilterArg left, final FilterArg right) {
+ return new LtFilter(left, right);
+ }
+
+ @Override
+ public URIFilter le(final String key, final Object value) {
+ return new LeFilter(getArgFactory().property(key), getArgFactory().literal(value));
+ }
+
+ @Override
+ public URIFilter le(final FilterArg left, final FilterArg right) {
+ return new LeFilter(left, right);
+ }
+
+ @Override
+ public URIFilter and(final URIFilter left, final URIFilter right) {
+ return new AndFilter(left, right);
+ }
+
+ @Override
+ public URIFilter or(final URIFilter left, final URIFilter right) {
+ return new OrFilter(left, right);
+ }
+
+ @Override
+ public URIFilter not(final URIFilter filter) {
+ return new NotFilter(filter);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/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 8cc35cb..14f2704 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
@@ -29,19 +29,19 @@ import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.olingo.client.api.uri.QueryOption;
import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.URIBuilder;
-import org.apache.olingo.client.api.uri.filter.URIFilter;
+import org.apache.olingo.client.api.uri.CommonURIBuilder;
+import org.apache.olingo.client.api.uri.URIFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractURIBuilder<UB extends URIBuilder<?>> implements URIBuilder<UB> {
+public abstract class AbstractURIBuilder<UB extends CommonURIBuilder<?>> implements CommonURIBuilder<UB> {
private static final long serialVersionUID = -3267515371720408124L;
/**
* Logger.
*/
- protected static final Logger LOG = LoggerFactory.getLogger(URIBuilder.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(CommonURIBuilder.class);
protected static class Segment {
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.java
new file mode 100644
index 0000000..07136e0
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/AndFilter.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.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class AndFilter implements URIFilter {
+
+ private final URIFilter left;
+
+ private final URIFilter right;
+
+ public AndFilter(final URIFilter left, final URIFilter 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/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java
new file mode 100644
index 0000000..43225c6
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/EqFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class EqFilter extends AbstractComparingFilter {
+
+ EqFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "eq";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java
new file mode 100644
index 0000000..650855b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterConst.java
@@ -0,0 +1,40 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+/**
+ * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see org.apache.olingo.client.api.uri.filter.FilterArgFactory
+ */
+public class FilterConst implements FilterArg {
+
+ private final String value;
+
+ FilterConst(final String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String build() {
+ return value;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java
new file mode 100644
index 0000000..3360d4a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterFunction.java
@@ -0,0 +1,48 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.commons.lang3.StringUtils;
+
+public class FilterFunction implements FilterArg {
+
+ private final String function;
+
+ private final FilterArg[] params;
+
+ public FilterFunction(final String function, final FilterArg... params) {
+ this.function = function;
+ this.params = params;
+ }
+
+ @Override
+ public String build() {
+ final String[] strParams = params == null || params.length == 0 ? new String[0] : new String[params.length];
+ for (int i = 0; i < strParams.length; i++) {
+ strParams[i] = params[i].build();
+ }
+
+ return new StringBuilder(function).
+ append('(').
+ append(strParams.length == 0 ? StringUtils.EMPTY : StringUtils.join(strParams, ',')).
+ append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.java
new file mode 100644
index 0000000..f99ea4e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLambda.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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class FilterLambda implements FilterArg {
+
+ private final FilterArg collection;
+
+ private final String operator;
+
+ private final URIFilter expression;
+
+ public FilterLambda(final FilterArg collection, final String operator, final URIFilter expression) {
+ this.collection = collection;
+ this.operator = operator;
+ this.expression = expression;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder(collection.build()).
+ append('/').
+ append(operator).
+ append(expression.build()).
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
new file mode 100644
index 0000000..c7e2d6a
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterLiteral.java
@@ -0,0 +1,41 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.utils.URIUtils;
+
+/**
+ * Filter value literals; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see FilterArgFactory
+ */
+public class FilterLiteral implements FilterArg {
+
+ private final Object value;
+
+ FilterLiteral(final Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public String build() {
+ return URIUtils.escape(value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
new file mode 100644
index 0000000..f4deac9
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterOp.java
@@ -0,0 +1,45 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class FilterOp implements FilterArg {
+
+ private final String op;
+
+ private final FilterArg first;
+
+ private final FilterArg second;
+
+ FilterOp(final String op, final FilterArg first, final FilterArg second) {
+ this.op = op;
+ this.first = first;
+ this.second = second;
+ }
+
+ @Override
+ public String build() {
+ return new StringBuilder().
+ append('(').append(first.build()).
+ append(' ').append(op).append(' ').
+ append(second.build()).append(')').
+ toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java
new file mode 100644
index 0000000..5f2fd4e
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/FilterProperty.java
@@ -0,0 +1,40 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+/**
+ * Filter property path; obtain instances via <tt>FilterArgFactory</tt>.
+ *
+ * @see FilterArgFactory
+ */
+public class FilterProperty implements FilterArg {
+
+ private final String propertyPath;
+
+ public FilterProperty(final String value) {
+ this.propertyPath = value;
+ }
+
+ @Override
+ public String build() {
+ return propertyPath;
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java
new file mode 100644
index 0000000..829cd4d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GeFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class GeFilter extends AbstractComparingFilter {
+
+ GeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "ge";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java
new file mode 100644
index 0000000..c9d8311
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/GtFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class GtFilter extends AbstractComparingFilter {
+
+ GtFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "gt";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java
new file mode 100644
index 0000000..067ec6d
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/HasFilter.java
@@ -0,0 +1,34 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class HasFilter extends AbstractComparingFilter {
+
+ public HasFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "has";
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java
new file mode 100644
index 0000000..cd28f98
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LeFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class LeFilter extends AbstractComparingFilter {
+
+ LeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "le";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java
new file mode 100644
index 0000000..96d3ec5
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/LtFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class LtFilter extends AbstractComparingFilter {
+
+ LtFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "lt";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java
new file mode 100644
index 0000000..3634e22
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/MatchFilter.java
@@ -0,0 +1,36 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class MatchFilter implements URIFilter {
+
+ private final FilterArg arg;
+
+ MatchFilter(final FilterArg arg) {
+ this.arg = arg;
+ }
+
+ @Override
+ public String build() {
+ return arg.build();
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java
new file mode 100644
index 0000000..045940c
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NeFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.uri;
+
+import org.apache.olingo.client.api.uri.FilterArg;
+
+public class NeFilter extends AbstractComparingFilter {
+
+ NeFilter(final FilterArg left, final FilterArg right) {
+ super(left, right);
+ }
+
+ @Override
+ protected String getOp() {
+ return "ne";
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.java
new file mode 100644
index 0000000..afa304b
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/NotFilter.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.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class NotFilter implements URIFilter {
+
+ private final URIFilter filter;
+
+ public NotFilter(final URIFilter 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/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.java
new file mode 100644
index 0000000..f81ce87
--- /dev/null
+++ b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/OrFilter.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.uri;
+
+import org.apache.olingo.client.api.uri.URIFilter;
+
+public class OrFilter implements URIFilter {
+
+ private final URIFilter left;
+
+ private final URIFilter right;
+
+ public OrFilter(final URIFilter left, final URIFilter 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/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
deleted file mode 100644
index 3f61660..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V3URIBuilderImpl.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.uri;
-
-import org.apache.olingo.client.api.utils.URIUtils;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.V3Configuration;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.V3URIBuilder;
-
-public class V3URIBuilderImpl extends AbstractURIBuilder<V3URIBuilder> implements V3URIBuilder {
-
- private static final long serialVersionUID = -3506851722447870532L;
-
- private final V3Configuration configuration;
-
- public V3URIBuilderImpl(final V3Configuration configuration, final String serviceRoot) {
- super(serviceRoot);
- this.configuration = configuration;
- }
-
- @Override
- protected V3URIBuilder getThis() {
- return this;
- }
-
- @Override
- protected char getBoundOperationSeparator() {
- return '/';
- }
-
- @Override
- protected char getDerivedEntityTypeSeparator() {
- return '/';
- }
-
- @Override
- public V3URIBuilder appendLinksSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.LINKS, SegmentType.LINKS.getValue()));
- segments.add(new Segment(SegmentType.ENTITYSET, segmentValue));
-
- return getThis();
- }
-
- @Override
- protected String noKeysWrapper() {
- return StringUtils.EMPTY;
- }
-
- @Override
- public V3URIBuilder appendKeySegment(final Object val) {
- if (configuration.isKeyAsSegment()) {
- final String segValue = URIUtils.escape(val);
- segments.add(new Segment(SegmentType.KEY_AS_SEGMENT, segValue));
- } else {
- super.appendKeySegment(val);
- }
-
- return getThis();
- }
-
- @Override
- public V3URIBuilder appendKeySegment(final Map<String, Object> segmentValues) {
- if (!configuration.isKeyAsSegment()) {
- super.appendKeySegment(segmentValues);
- }
-
- return getThis();
- }
-
- @Override
- public V3URIBuilder inlineCount(final InlineCount inlineCount) {
- return addQueryOption(QueryOption.INLINECOUNT, inlineCount.name());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/bab03624/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
----------------------------------------------------------------------
diff --git a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java b/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
deleted file mode 100644
index d24df81..0000000
--- a/lib/client-core/src/main/java/org/apache/olingo/client/core/uri/V4URIBuilderImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.uri;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.olingo.client.api.uri.QueryOption;
-import org.apache.olingo.client.api.uri.SegmentType;
-import org.apache.olingo.client.api.uri.V4URIBuilder;
-
-public class V4URIBuilderImpl extends AbstractURIBuilder<V4URIBuilder> implements V4URIBuilder {
-
- private static final long serialVersionUID = -3506851722447870532L;
-
- public V4URIBuilderImpl(final String serviceRoot) {
- super(serviceRoot);
- }
-
- @Override
- protected V4URIBuilder getThis() {
- return this;
- }
-
- @Override
- protected String noKeysWrapper() {
- return "()";
- }
-
- @Override
- protected char getBoundOperationSeparator() {
- return '.';
- }
-
- @Override
- protected char getDerivedEntityTypeSeparator() {
- return '.';
- }
-
- @Override
- public V4URIBuilder appendSingletonSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.SINGLETON, segmentValue));
- return getThis();
- }
-
- @Override
- public V4URIBuilder appendEntityIdSegment(final String segmentValue) {
- segments.add(new Segment(SegmentType.ENTITY, null));
- return addQueryOption(QueryOption.ID, segmentValue);
- }
-
- @Override
- public V4URIBuilder appendRefSegment() {
- segments.add(new Segment(SegmentType.REF, SegmentType.REF.getValue()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder appendCrossjoinSegment(final String... segmentValues) {
- StringBuilder segValue = new StringBuilder(SegmentType.CROSS_JOIN.getValue()).
- append('(').append(StringUtils.join(segmentValues, ",")).append(')');
- segments.add(new Segment(SegmentType.CROSS_JOIN, segValue.toString()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder count(final boolean value) {
- return addQueryOption(QueryOption.COUNT, Boolean.toString(value));
- }
-
- @Override
- public V4URIBuilder appendAllSegment() {
- segments.add(new Segment(SegmentType.ALL, SegmentType.ALL.getValue()));
- return getThis();
- }
-
- @Override
- public V4URIBuilder id(final String idValue) {
- return addQueryOption(QueryOption.ID, idValue);
- }
-
- @Override
- public V4URIBuilder search(final String expression) {
- return addQueryOption(QueryOption.SEARCH, expression);
- }
-
-}