Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Licensed to the Apache Software Foundation (ASF) under one
0003  * or more contributor license agreements.  See the NOTICE file
0004  * distributed with this work for additional information
0005  * regarding copyright ownership.  The ASF licenses this file
0006  * to you under the Apache License, Version 2.0 (the
0007  * "License"); you may not use this file except in compliance
0008  * with the License.  You may obtain a copy of the License at
0009  *
0010  *     http://www.apache.org/licenses/LICENSE-2.0
0011  *
0012  * Unless required by applicable law or agreed to in writing, software
0013  * distributed under the License is distributed on an "AS IS" BASIS,
0014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0015  * See the License for the specific language governing permissions and
0016  * limitations under the License.
0017  */
0018 
0019 package org.apache.hive.service.cli;
0020 
0021 import org.apache.hive.service.cli.thrift.TFetchOrientation;
0022 
0023 /**
0024  * FetchOrientation.
0025  *
0026  */
0027 public enum FetchOrientation {
0028   FETCH_NEXT(TFetchOrientation.FETCH_NEXT),
0029   FETCH_PRIOR(TFetchOrientation.FETCH_PRIOR),
0030   FETCH_RELATIVE(TFetchOrientation.FETCH_RELATIVE),
0031   FETCH_ABSOLUTE(TFetchOrientation.FETCH_ABSOLUTE),
0032   FETCH_FIRST(TFetchOrientation.FETCH_FIRST),
0033   FETCH_LAST(TFetchOrientation.FETCH_LAST);
0034 
0035   private TFetchOrientation tFetchOrientation;
0036 
0037   FetchOrientation(TFetchOrientation tFetchOrientation) {
0038     this.tFetchOrientation = tFetchOrientation;
0039   }
0040 
0041   public static FetchOrientation getFetchOrientation(TFetchOrientation tFetchOrientation) {
0042     for (FetchOrientation fetchOrientation : values()) {
0043       if (tFetchOrientation.equals(fetchOrientation.toTFetchOrientation())) {
0044         return fetchOrientation;
0045       }
0046     }
0047     // TODO: Should this really default to FETCH_NEXT?
0048     return FETCH_NEXT;
0049   }
0050 
0051   public TFetchOrientation toTFetchOrientation() {
0052     return tFetchOrientation;
0053   }
0054 }