当前位置: 首页>>代码示例>>Java>>正文


Java Value.getValue方法代码示例

本文整理汇总了Java中oracle.kv.Value.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java Value.getValue方法的具体用法?Java Value.getValue怎么用?Java Value.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oracle.kv.Value的用法示例。


在下文中一共展示了Value.getValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMoviesByName

import oracle.kv.Value; //导入方法依赖的package包/类
/**
 * Movie names are also indexed while inserting the movie data therefore
 * movie can be fetched my full movie name (case insensitive).
 * @param movieName
 * @return List of MovieTO
 */
public List<MovieTO> getMoviesByName(String movieName) {
    Key key = KeyUtil.getMovieNameKey(movieName, 0);
    List<MovieTO> movieTOList = new ArrayList<MovieTO>();
    MovieTO movieTO = null;
    KeyValueVersion keyValue = null;
    Value value = null;
    String movieIdStr = null;

    Iterator<KeyValueVersion> keyIter = super.getKVStore().multiGetIterator(Direction.FORWARD, 0,
            /*key*/key, null, null);
    while (keyIter.hasNext()) {
        keyValue = keyIter.next();
        value = keyValue.getValue();
        movieIdStr = new String(value.getValue());
        movieTO = getMovieById(movieIdStr);

        //add the movie to the list
        movieTOList.add(movieTO);
        //System.out.println(keyValue.getKey().getFullPath() + " \n" +  movieTO.getMovieJson() + "\n ");
    } //EOF while

    return movieTOList;
}
 
开发者ID:oracle,项目名称:big-data-lite,代码行数:30,代码来源:MovieDAO.java

示例2: getMovieCast

import oracle.kv.Value; //导入方法依赖的package包/类
public CastCrewTO getMovieCast(int movieId) {
    CastCrewTO castTO = null;
    if (movieId > -1) {
        Key key = this.getMovieCastKey(movieId);
        ValueVersion valueVersion = super.getKVStore().get(key);
        Value value = valueVersion.getValue();
        String castJsonTxt = new String(value.getValue());
        castTO = new CastCrewTO(castJsonTxt);
    }
    return castTO;
}
 
开发者ID:oracle,项目名称:big-data-lite,代码行数:12,代码来源:CastCrewDAO.java

示例3: showMovieValue

import oracle.kv.Value; //导入方法依赖的package包/类
/**
 * Displays information about a movie
 * @param movieName
 */
public void showMovieValue(String movieName) {
                
    KeyValueVersion keyValue = null;
    Value value = null;
    String movieIdStr = null;
    Key movieIdKey = null;
    MovieTO movieTO = null;
    
    // The DB has an index on Movie Name.  You will use this index to
    // retrieve the ID for the Movie Name.  Note, there may be multiple
    // movies with the same name
    Key movieNameKey = getMovieKey(movieName, KeyConstant.MOVIE_NAME_TABLE);

    // Find movie id's for this movie name
    Iterator<KeyValueVersion> keyIter = kvstore.multiGetIterator(
                              Direction.FORWARD, 0,
                              movieNameKey, null, null);
    
    // Are there any movies available?
    if (!keyIter.hasNext()) {
        System.out.println("Movie \"" + movieName + "\" not found.");
        System.out.println("");
        return;
    }

    String snippet="";
    
    System.out.println("Movie Information");
    System.out.println("--------------------");
    System.out.println("(Note:  there may be multiple movies w/the same name.)");
    System.out.println("");
    System.out.println("Movie Name Key    : " + movieNameKey.toString());

    // Will loop over all movies with the same name                
    while (keyIter.hasNext()) {
        keyValue = keyIter.next();
      
        // the value is the movie id
        value = keyValue.getValue();
        movieIdStr = new String(value.getValue());
    
        // get the movieid key for this movieid value
        movieIdKey = getMovieKey(movieIdStr, KeyConstant.MOVIE_TABLE);
        
        long start = Calendar.getInstance().getTimeInMillis();
        
        ValueVersion vv = kvstore.get(movieIdKey);
        
        long elapsed = Calendar.getInstance().getTimeInMillis() - start;
        
        // Get the information about the movie            
        movieTO = movieDAO.getMovieTO(vv.getValue());

        System.out.println("Movie Name Value  : " + movieIdStr);
        System.out.println("");
        System.out.println("Movie ID Key      : " + movieIdKey.toString());
        System.out.println("Movie ID Value    : " + movieTO.getMovieJsonTxt());    
        System.out.println();
        System.out.println("elapsed: " + elapsed + "ms");   
        System.out.println("");
        
        snippet = snippet + "  movieIdKey   = Key.fromString(\"" + movieIdKey.toString() + "\");\n";
        snippet = snippet + "  movieIdValue = kvstore.get(movieIdKey);\n";
       
        
    } //EOF while

    System.out.println("snippet:");
    System.out.println("  movieNameKey = Key.fromString(\"" + movieNameKey.toString() + "\");");            
    System.out.println("  movieNameVal = kvstore.get(movieNameKey);");                        
    System.out.println();
    System.out.println(snippet);                        
}
 
开发者ID:oracle,项目名称:big-data-lite,代码行数:78,代码来源:Demo.java


注:本文中的oracle.kv.Value.getValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。