All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.olingo.odata2.api.processor.ODataRequest Maven / Gradle / Ivy

There is a newer version: 1.40.11
Show newest version
/*******************************************************************************
 * 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.odata2.api.processor;

import java.io.InputStream;
import java.util.List;
import java.util.Locale;
import java.util.Map;

import org.apache.olingo.odata2.api.commons.ODataHttpMethod;
import org.apache.olingo.odata2.api.rt.RuntimeDelegate;
import org.apache.olingo.odata2.api.uri.PathInfo;

/**
 * 
 *  
 */
public abstract class ODataRequest {

  public abstract String getRequestHeaderValue(String name);

  public abstract Map> getRequestHeaders();

  public abstract InputStream getBody();

  public abstract PathInfo getPathInfo();

  public abstract ODataHttpMethod getMethod();

  public abstract String getHttpMethod();

  public abstract List getAcceptableLanguages();

  public abstract String getContentType();

  public abstract List getAcceptHeaders();

  public abstract Map getQueryParameters();
  
  public abstract Map> getAllQueryParameters();
  
  public static ODataRequestBuilder requestHeaders(final Map> headers) {
    return newBuilder().requestHeaders(headers);
  }

  public static ODataRequestBuilder body(final InputStream body) {
    return newBuilder().body(body);
  }

  public static ODataRequestBuilder pathInfo(final PathInfo pathInfo) {
    return newBuilder().pathInfo(pathInfo);
  }

  public static ODataRequestBuilder method(final ODataHttpMethod method) {
    return newBuilder().method(method);
  }

  public static ODataRequestBuilder acceptableLanguages(final List acceptableLanguages) {
    return newBuilder().acceptableLanguages(acceptableLanguages);
  }

  public static ODataRequestBuilder contentType(final String contentType) {
    return newBuilder().contentType(contentType);
  }

  public static ODataRequestBuilder acceptHeaders(final List acceptHeaders) {
    return newBuilder().acceptHeaders(acceptHeaders);
  }

  public static ODataRequestBuilder queryParameters(final Map queryParameters) {
    return newBuilder().queryParameters(queryParameters);
  }
  
  public static ODataRequestBuilder allQueryParameters(final Map> allQueryParameters) {
    return newBuilder().allQueryParameters(allQueryParameters);
  }
  
  public static ODataRequestBuilder fromRequest(final ODataRequest request) {
    return newBuilder().fromRequest(request);
  }

  /**
   * @return returns a new builder object
   */
  public static ODataRequestBuilder newBuilder() {
    return ODataRequestBuilder.newInstance();
  }

  public static abstract class ODataRequestBuilder {

    protected ODataRequestBuilder() {}

    private static ODataRequestBuilder newInstance() {
      return RuntimeDelegate.createODataRequestBuilder();
    }

    public abstract ODataRequest build();

    public abstract ODataRequestBuilder requestHeaders(Map> headers);

    public abstract ODataRequestBuilder httpMethod(String httpMethod);

    public abstract ODataRequestBuilder body(InputStream body);

    public abstract ODataRequestBuilder pathInfo(PathInfo pathInfo);

    public abstract ODataRequestBuilder method(ODataHttpMethod method);

    public abstract ODataRequestBuilder acceptableLanguages(List acceptableLanguages);

    public abstract ODataRequestBuilder contentType(String contentType);

    public abstract ODataRequestBuilder acceptHeaders(List acceptHeaders);

    public abstract ODataRequestBuilder queryParameters(Map queryParameters);
    
    public abstract ODataRequestBuilder allQueryParameters(Map> queryParameters);
    
    public abstract ODataRequestBuilder fromRequest(ODataRequest request);

  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy