mirror of
https://github.com/apache/olingo-odata4.git
synced 2025-03-06 00:29:05 +00:00
[OLINGO-575] Continue merging
This commit is contained in:
parent
4833b45c2f
commit
55c7d10737
@ -41,7 +41,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase {
|
||||
@Test
|
||||
public void oneLevelToEntity() throws Exception {
|
||||
final ODataRetrieveResponse<ODataEntity> response =
|
||||
client.getRetrieveRequestFactory().<ODataEntity> getEntityRequest(
|
||||
client.getRetrieveRequestFactory().getEntityRequest(
|
||||
client.newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
|
||||
.appendNavigationSegment("NavPropertyETTwoPrimOne").build())
|
||||
@ -59,7 +59,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase {
|
||||
@Test
|
||||
public void oneLevelToEntityWithKey() throws Exception {
|
||||
final ODataRetrieveResponse<ODataEntity> response =
|
||||
client.getRetrieveRequestFactory().<ODataEntity> getEntityRequest(
|
||||
client.getRetrieveRequestFactory().getEntityRequest(
|
||||
client.newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendEntitySetSegment("ESAllPrim").appendKeySegment(32767)
|
||||
.appendNavigationSegment("NavPropertyETTwoPrimMany").appendKeySegment(-365).build())
|
||||
@ -77,7 +77,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase {
|
||||
@Test
|
||||
public void twoLevelsToEntityWithKey() throws Exception {
|
||||
final ODataRetrieveResponse<ODataEntity> response =
|
||||
client.getRetrieveRequestFactory().<ODataEntity> getEntityRequest(
|
||||
client.getRetrieveRequestFactory().getEntityRequest(
|
||||
client.newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767)
|
||||
.appendNavigationSegment("NavPropertyETAllPrimOne")
|
||||
@ -96,7 +96,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase {
|
||||
@Test
|
||||
public void twoLevelsToEntitySet() throws Exception {
|
||||
final ODataRetrieveResponse<ODataEntitySet> response =
|
||||
client.getRetrieveRequestFactory().<ODataEntitySet> getEntitySetRequest(
|
||||
client.getRetrieveRequestFactory().getEntitySetRequest(
|
||||
client.newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendEntitySetSegment("ESTwoPrim").appendKeySegment(32767)
|
||||
.appendNavigationSegment("NavPropertyETAllPrimOne")
|
||||
@ -118,7 +118,7 @@ public final class NavigationITCase extends AbstractBaseTestITCase {
|
||||
@Test
|
||||
public void twoLevelsToProperty() throws Exception {
|
||||
final ODataRetrieveResponse<ODataProperty> response =
|
||||
client.getRetrieveRequestFactory().<ODataProperty> getPropertyRequest(
|
||||
client.getRetrieveRequestFactory().getPropertyRequest(
|
||||
client.newURIBuilder(TecSvcConst.BASE_URI)
|
||||
.appendEntitySetSegment("ESKeyNav").appendKeySegment(1)
|
||||
.appendNavigationSegment("NavPropertyETKeyNavOne")
|
||||
|
@ -24,12 +24,12 @@ import org.apache.olingo.client.api.communication.request.batch.CommonBatchReque
|
||||
import org.apache.olingo.client.api.communication.request.cud.CommonCUDRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.cud.CommonUpdateType;
|
||||
import org.apache.olingo.client.api.communication.request.invoke.InvokeRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
|
||||
import org.apache.olingo.client.api.serialization.ClientODataDeserializer;
|
||||
import org.apache.olingo.client.api.serialization.ODataBinder;
|
||||
import org.apache.olingo.client.api.serialization.ODataReader;
|
||||
import org.apache.olingo.client.api.serialization.ODataWriter;
|
||||
import org.apache.olingo.client.api.uri.CommonFilterFactory;
|
||||
import org.apache.olingo.client.api.uri.FilterFactory;
|
||||
import org.apache.olingo.client.api.uri.URIBuilder;
|
||||
import org.apache.olingo.commons.api.domain.ODataObjectFactory;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
@ -53,7 +53,7 @@ public interface CommonODataClient<UT extends CommonUpdateType> {
|
||||
|
||||
URIBuilder newURIBuilder(String serviceRoot);
|
||||
|
||||
CommonFilterFactory getFilterFactory();
|
||||
FilterFactory getFilterFactory();
|
||||
|
||||
ODataSerializer getSerializer(ODataFormat format);
|
||||
|
||||
@ -67,7 +67,7 @@ public interface CommonODataClient<UT extends CommonUpdateType> {
|
||||
|
||||
ODataObjectFactory getObjectFactory();
|
||||
|
||||
CommonRetrieveRequestFactory getRetrieveRequestFactory();
|
||||
RetrieveRequestFactory getRetrieveRequestFactory();
|
||||
|
||||
CommonCUDRequestFactory<UT> getCUDRequestFactory();
|
||||
|
||||
|
@ -1,142 +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.api.communication.request.retrieve;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.olingo.commons.api.domain.ODataEntity;
|
||||
import org.apache.olingo.commons.api.domain.ODataEntitySet;
|
||||
import org.apache.olingo.commons.api.domain.ODataProperty;
|
||||
|
||||
/**
|
||||
* OData request factory class.
|
||||
*/
|
||||
public interface CommonRetrieveRequestFactory {
|
||||
|
||||
/**
|
||||
* Gets a metadata request instance.
|
||||
* <br/>
|
||||
* Compared to {@link #getMetadataRequest(java.lang.String)}, this method returns a request instance for fetching
|
||||
* low-level metadata representation.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link XMLMetadataRequest} instance.
|
||||
*/
|
||||
XMLMetadataRequest getXMLMetadataRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a metadata request instance.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link EdmMetadataRequest} instance.
|
||||
*/
|
||||
EdmMetadataRequest getMetadataRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a service document request instance.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link ODataServiceDocumentRequest} instance.
|
||||
*/
|
||||
ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a set of one or more OData entities.
|
||||
*
|
||||
* @param <T> concrete ODataEntitySet implementation.
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntitySetRequest} instance.
|
||||
*/
|
||||
<T extends ODataEntitySet> ODataEntitySetRequest<T> getEntitySetRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a set of one or more OData entities.
|
||||
* <br/>
|
||||
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
|
||||
* the entire entity set.
|
||||
*
|
||||
* @param <ES> concreate ODataEntitySet implementation.
|
||||
* @param <E> concrete ODataEntity implementation.
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntitySetIteratorRequest} instance.
|
||||
*/
|
||||
<ES extends ODataEntitySet, E extends ODataEntity>
|
||||
ODataEntitySetIteratorRequest<ES, E> getEntitySetIteratorRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity.
|
||||
*
|
||||
* @param <T> concrete ODataEntity implementation.
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntityRequest} instance.
|
||||
*/
|
||||
<T extends ODataEntity> ODataEntityRequest<T> getEntityRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property.
|
||||
*
|
||||
* @param <T> concrete ODataProperty implementation.
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataPropertyRequest} instance.
|
||||
*/
|
||||
<T extends ODataProperty> ODataPropertyRequest<T> getPropertyRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property value.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataValueRequest} instance.
|
||||
*/
|
||||
ODataValueRequest getPropertyValueRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property value.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataValueRequest} instance.
|
||||
*/
|
||||
ODataValueRequest getValueRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a media stream.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataMediaRequest} instance.
|
||||
*/
|
||||
ODataMediaRequest getMediaRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a media entity.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataMediaRequest} instance.
|
||||
*/
|
||||
ODataMediaRequest getMediaEntityRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Implements a raw request request without specifying any return type.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataRawRequest} instance.
|
||||
*/
|
||||
ODataRawRequest getRawRequest(URI uri);
|
||||
}
|
@ -25,21 +25,114 @@ import org.apache.olingo.commons.api.domain.ODataEntitySet;
|
||||
import org.apache.olingo.commons.api.domain.ODataProperty;
|
||||
import org.apache.olingo.commons.api.domain.ODataSingleton;
|
||||
|
||||
public interface RetrieveRequestFactory extends CommonRetrieveRequestFactory {
|
||||
public interface RetrieveRequestFactory {
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Gets a metadata request instance.
|
||||
* <br/>
|
||||
* Compared to {@link #getMetadataRequest(java.lang.String)}, this method returns a request instance for fetching
|
||||
* low-level metadata representation.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link XMLMetadataRequest} instance.
|
||||
*/
|
||||
XMLMetadataRequest getXMLMetadataRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a metadata request instance.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link EdmMetadataRequest} instance.
|
||||
*/
|
||||
EdmMetadataRequest getMetadataRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a service document request instance.
|
||||
*
|
||||
* @param serviceRoot absolute URL (schema, host and port included) representing the location of the root of the data
|
||||
* service.
|
||||
* @return new {@link ODataServiceDocumentRequest} instance.
|
||||
*/
|
||||
ODataServiceDocumentRequest getServiceDocumentRequest(String serviceRoot);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a set of one or more OData entities.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntitySetRequest} instance.
|
||||
*/
|
||||
ODataEntitySetRequest<ODataEntitySet> getEntitySetRequest(URI uri);
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Gets a uri request returning a set of one or more OData entities.
|
||||
* <br/>
|
||||
* Returned request gives the possibility to consume entities iterating on them without parsing and loading in memory
|
||||
* the entire entity set.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntitySetIteratorRequest} instance.
|
||||
*/
|
||||
ODataEntitySetIteratorRequest<ODataEntitySet, ODataEntity> getEntitySetIteratorRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataEntityRequest} instance.
|
||||
*/
|
||||
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataPropertyRequest} instance.
|
||||
*/
|
||||
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property value.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataValueRequest} instance.
|
||||
*/
|
||||
ODataValueRequest getPropertyValueRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a single OData entity property value.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataValueRequest} instance.
|
||||
*/
|
||||
ODataValueRequest getValueRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a media stream.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataMediaRequest} instance.
|
||||
*/
|
||||
ODataMediaRequest getMediaRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Gets a uri request returning a media entity.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataMediaRequest} instance.
|
||||
*/
|
||||
ODataMediaRequest getMediaEntityRequest(URI uri);
|
||||
|
||||
/**
|
||||
* Implements a raw request request without specifying any return type.
|
||||
*
|
||||
* @param uri request URI.
|
||||
* @return new {@link ODataRawRequest} instance.
|
||||
*/
|
||||
ODataRawRequest getRawRequest(URI uri);
|
||||
|
||||
ODataEntityRequest<ODataSingleton> getSingletonRequest(URI uri);
|
||||
|
||||
@Override
|
||||
ODataEntityRequest<ODataEntity> getEntityRequest(URI uri);
|
||||
|
||||
@Override
|
||||
ODataPropertyRequest<ODataProperty> getPropertyRequest(URI uri);
|
||||
|
||||
ODataDeltaRequest getDeltaRequest(URI uri);
|
||||
}
|
||||
|
@ -1,83 +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.api.uri;
|
||||
|
||||
public interface CommonFilterArgFactory {
|
||||
|
||||
FilterArg _null();
|
||||
|
||||
FilterArg add(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg ceiling(FilterArg param);
|
||||
|
||||
FilterArg concat(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg day(FilterArg param);
|
||||
|
||||
FilterArg div(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg endswith(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg floor(FilterArg param);
|
||||
|
||||
FilterArg hour(FilterArg param);
|
||||
|
||||
FilterArg indexof(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg isof(FilterArg type);
|
||||
|
||||
FilterArg isof(FilterArg expression, FilterArg type);
|
||||
|
||||
FilterArg length(FilterArg param);
|
||||
|
||||
FilterArg literal(Object value);
|
||||
|
||||
FilterArg minute(FilterArg param);
|
||||
|
||||
FilterArg mod(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg month(FilterArg param);
|
||||
|
||||
FilterArg mul(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg property(String propertyPath);
|
||||
|
||||
FilterArg replace(FilterArg first, FilterArg second, FilterArg third);
|
||||
|
||||
FilterArg round(FilterArg param);
|
||||
|
||||
FilterArg second(FilterArg param);
|
||||
|
||||
FilterArg startswith(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg sub(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg substring(FilterArg arg, FilterArg pos);
|
||||
|
||||
FilterArg substring(FilterArg arg, FilterArg pos, FilterArg length);
|
||||
|
||||
FilterArg tolower(FilterArg param);
|
||||
|
||||
FilterArg toupper(FilterArg param);
|
||||
|
||||
FilterArg trim(FilterArg param);
|
||||
|
||||
FilterArg year(FilterArg param);
|
||||
|
||||
}
|
@ -1,59 +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.api.uri;
|
||||
|
||||
/**
|
||||
* OData filter factory.
|
||||
*/
|
||||
public interface CommonFilterFactory {
|
||||
|
||||
CommonFilterArgFactory getArgFactory();
|
||||
|
||||
URIFilter match(FilterArg arg);
|
||||
|
||||
URIFilter eq(String key, Object value);
|
||||
|
||||
URIFilter eq(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter ne(String key, Object value);
|
||||
|
||||
URIFilter ne(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter gt(String key, Object value);
|
||||
|
||||
URIFilter gt(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter ge(String key, Object value);
|
||||
|
||||
URIFilter ge(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter lt(String key, Object value);
|
||||
|
||||
URIFilter lt(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter le(String key, Object value);
|
||||
|
||||
URIFilter le(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter and(URIFilter left, URIFilter right);
|
||||
|
||||
URIFilter or(URIFilter left, URIFilter right);
|
||||
|
||||
URIFilter not(URIFilter filter);
|
||||
}
|
@ -19,8 +19,68 @@
|
||||
package org.apache.olingo.client.api.uri;
|
||||
|
||||
|
||||
public interface FilterArgFactory extends CommonFilterArgFactory {
|
||||
public interface FilterArgFactory {
|
||||
|
||||
FilterArg _null();
|
||||
|
||||
FilterArg add(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg ceiling(FilterArg param);
|
||||
|
||||
FilterArg concat(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg day(FilterArg param);
|
||||
|
||||
FilterArg div(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg endswith(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg floor(FilterArg param);
|
||||
|
||||
FilterArg hour(FilterArg param);
|
||||
|
||||
FilterArg indexof(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg isof(FilterArg type);
|
||||
|
||||
FilterArg isof(FilterArg expression, FilterArg type);
|
||||
|
||||
FilterArg length(FilterArg param);
|
||||
|
||||
FilterArg literal(Object value);
|
||||
|
||||
FilterArg minute(FilterArg param);
|
||||
|
||||
FilterArg mod(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg month(FilterArg param);
|
||||
|
||||
FilterArg mul(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg property(String propertyPath);
|
||||
|
||||
FilterArg replace(FilterArg first, FilterArg second, FilterArg third);
|
||||
|
||||
FilterArg round(FilterArg param);
|
||||
|
||||
FilterArg second(FilterArg param);
|
||||
|
||||
FilterArg startswith(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg sub(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg substring(FilterArg arg, FilterArg pos);
|
||||
|
||||
FilterArg substring(FilterArg arg, FilterArg pos, FilterArg length);
|
||||
|
||||
FilterArg tolower(FilterArg param);
|
||||
|
||||
FilterArg toupper(FilterArg param);
|
||||
|
||||
FilterArg trim(FilterArg param);
|
||||
|
||||
FilterArg year(FilterArg param);
|
||||
|
||||
FilterArg contains(FilterArg first, FilterArg second);
|
||||
|
||||
FilterArg fractionalseconds(FilterArg param);
|
||||
|
@ -20,11 +20,42 @@ package org.apache.olingo.client.api.uri;
|
||||
|
||||
import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||
|
||||
public interface FilterFactory extends CommonFilterFactory {
|
||||
public interface FilterFactory {
|
||||
|
||||
@Override
|
||||
FilterArgFactory getArgFactory();
|
||||
|
||||
URIFilter match(FilterArg arg);
|
||||
|
||||
URIFilter eq(String key, Object value);
|
||||
|
||||
URIFilter eq(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter ne(String key, Object value);
|
||||
|
||||
URIFilter ne(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter gt(String key, Object value);
|
||||
|
||||
URIFilter gt(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter ge(String key, Object value);
|
||||
|
||||
URIFilter ge(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter lt(String key, Object value);
|
||||
|
||||
URIFilter lt(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter le(String key, Object value);
|
||||
|
||||
URIFilter le(FilterArg left, FilterArg right);
|
||||
|
||||
URIFilter and(URIFilter left, URIFilter right);
|
||||
|
||||
URIFilter or(URIFilter left, URIFilter right);
|
||||
|
||||
URIFilter not(URIFilter filter);
|
||||
|
||||
URIFilter has(String key, EdmEnumType enumType, String memberName);
|
||||
|
||||
URIFilter has(FilterArg left, EdmEnumType enumType, String memberName);
|
||||
|
@ -1,79 +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.communication.request.retrieve;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.CommonODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.CommonRetrieveRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
|
||||
public abstract class AbstractRetrieveRequestFactory implements CommonRetrieveRequestFactory {
|
||||
|
||||
protected final CommonODataClient<?> client;
|
||||
|
||||
protected AbstractRetrieveRequestFactory(final CommonODataClient<?> client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataValueRequest getValueRequest(final URI uri) {
|
||||
return new ODataValueRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataValueRequest getPropertyValueRequest(final URI uri) {
|
||||
return getValueRequest(URIUtils.addValueSegment(uri));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataMediaRequest getMediaRequest(final URI uri) {
|
||||
return new ODataMediaRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataMediaRequest getMediaEntityRequest(final URI uri) {
|
||||
return getMediaRequest(URIUtils.addValueSegment(uri));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataRawRequest getRawRequest(final URI uri) {
|
||||
return new ODataRawRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmMetadataRequest getMetadataRequest(final String serviceRoot) {
|
||||
return new EdmMetadataRequestImpl(client, serviceRoot,
|
||||
client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) {
|
||||
return new ODataServiceDocumentRequestImpl(client,
|
||||
StringUtils.isNotBlank(serviceRoot) && serviceRoot.endsWith("/")
|
||||
? client.newURIBuilder(serviceRoot).build()
|
||||
: client.newURIBuilder(serviceRoot + "/").build());
|
||||
}
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
@ -20,30 +20,77 @@ package org.apache.olingo.client.core.communication.request.retrieve;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.olingo.client.api.ODataClient;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataDeltaRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetIteratorRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataEntitySetRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataMediaRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataPropertyRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataRawRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.ODataValueRequest;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.RetrieveRequestFactory;
|
||||
import org.apache.olingo.client.api.communication.request.retrieve.XMLMetadataRequest;
|
||||
import org.apache.olingo.client.core.uri.URIUtils;
|
||||
import org.apache.olingo.commons.api.domain.ODataEntity;
|
||||
import org.apache.olingo.commons.api.domain.ODataEntitySet;
|
||||
import org.apache.olingo.commons.api.domain.ODataProperty;
|
||||
import org.apache.olingo.commons.api.domain.ODataSingleton;
|
||||
|
||||
public class RetrieveRequestFactoryImpl extends AbstractRetrieveRequestFactory
|
||||
implements RetrieveRequestFactory {
|
||||
public class RetrieveRequestFactoryImpl implements RetrieveRequestFactory {
|
||||
|
||||
protected final ODataClient client;
|
||||
|
||||
public RetrieveRequestFactoryImpl(final ODataClient client) {
|
||||
super(client);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataValueRequest getValueRequest(final URI uri) {
|
||||
return new ODataValueRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataValueRequest getPropertyValueRequest(final URI uri) {
|
||||
return getValueRequest(URIUtils.addValueSegment(uri));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataMediaRequest getMediaRequest(final URI uri) {
|
||||
return new ODataMediaRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataMediaRequest getMediaEntityRequest(final URI uri) {
|
||||
return getMediaRequest(URIUtils.addValueSegment(uri));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataRawRequest getRawRequest(final URI uri) {
|
||||
return new ODataRawRequestImpl(client, uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EdmMetadataRequest getMetadataRequest(final String serviceRoot) {
|
||||
return new EdmMetadataRequestImpl(client, serviceRoot,
|
||||
client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ODataServiceDocumentRequest getServiceDocumentRequest(final String serviceRoot) {
|
||||
return new ODataServiceDocumentRequestImpl(client,
|
||||
StringUtils.isNotBlank(serviceRoot) && serviceRoot.endsWith("/")
|
||||
? client.newURIBuilder(serviceRoot).build()
|
||||
: client.newURIBuilder(serviceRoot + "/").build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLMetadataRequest getXMLMetadataRequest(final String serviceRoot) {
|
||||
return new XMLMetadataRequestImpl(((ODataClient) client),
|
||||
client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
||||
client.newURIBuilder(serviceRoot).appendMetadataSegment().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,185 +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.uri.CommonFilterArgFactory;
|
||||
import org.apache.olingo.client.api.uri.FilterArg;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
/**
|
||||
* OData filter arguments factory.
|
||||
*/
|
||||
public abstract class AbstractFilterArgFactory implements CommonFilterArgFactory {
|
||||
|
||||
private final ODataServiceVersion version;
|
||||
|
||||
public AbstractFilterArgFactory(final ODataServiceVersion version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@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(version, 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);
|
||||
}
|
||||
}
|
@ -1,113 +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.uri.CommonFilterFactory;
|
||||
import org.apache.olingo.client.api.uri.FilterArg;
|
||||
import org.apache.olingo.client.api.uri.URIFilter;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
public abstract class AbstractFilterFactory implements CommonFilterFactory {
|
||||
|
||||
protected final ODataServiceVersion version;
|
||||
|
||||
public AbstractFilterFactory(final ODataServiceVersion version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
@ -23,12 +23,165 @@ import org.apache.olingo.client.api.uri.FilterArgFactory;
|
||||
import org.apache.olingo.client.api.uri.URIFilter;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
public class FilterArgFactoryImpl extends AbstractFilterArgFactory implements FilterArgFactory {
|
||||
public class FilterArgFactoryImpl implements FilterArgFactory {
|
||||
|
||||
private final ODataServiceVersion version;
|
||||
|
||||
public FilterArgFactoryImpl(final ODataServiceVersion version) {
|
||||
super(version);
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
@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(version, 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterArg contains(final FilterArg first, final FilterArg second) {
|
||||
return new FilterFunction("contains", first, second);
|
||||
|
@ -25,12 +25,94 @@ import org.apache.olingo.client.api.uri.URIFilter;
|
||||
import org.apache.olingo.commons.api.edm.EdmEnumType;
|
||||
import org.apache.olingo.commons.api.edm.constants.ODataServiceVersion;
|
||||
|
||||
public class FilterFactoryImpl extends AbstractFilterFactory implements FilterFactory {
|
||||
public class FilterFactoryImpl implements FilterFactory {
|
||||
|
||||
private final ODataServiceVersion version;
|
||||
|
||||
public FilterFactoryImpl(ODataServiceVersion version) {
|
||||
super(version);
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilterArgFactory getArgFactory() {
|
||||
return new FilterArgFactoryImpl(version);
|
||||
|
Loading…
x
Reference in New Issue
Block a user