Package com.trifork.riak.RPB.RpbContent

Examples of com.trifork.riak.RPB.RpbContent.Builder


    public ByteString getValue(){
        return value;
    }

  RpbContent buildContent() {
    Builder b =
      RpbContent.newBuilder()
        .setValue(value);
   
    if (contentType != null) {
      b.setContentType(ByteString.copyFromUtf8(contentType));
    }
       
    if (charset != null) {
      b.setCharset(ByteString.copyFromUtf8(charset));
    }
       
    if (contentEncoding != null) {
      b.setContentEncoding(ByteString.copyFromUtf8(contentEncoding));
    }

    if (vtag != null) {
      b.setVtag(ByteString.copyFromUtf8(vtag));
    }
   
    if (links != null && links.size() != 0) {
      for (RiakLink l : links) {
        b.addLinks( l.build() );
      }
    }
   
    if (lastModified != null) {
      b.setLastMod(lastModified);
    }
   
    if (lastModifiedUsec != null) {
      b.setLastModUsecs(lastModifiedUsec);
    }
   
    if (userMeta != null && !userMeta.isEmpty()) {
      for (Map.Entry<String, String> ent : userMeta.entrySet()) {
        ByteString key = ByteString.copyFromUtf8(ent.getKey());
        com.trifork.riak.RPB.RpbPair.Builder pb = RPB.RpbPair.newBuilder().setKey(key);
        if (ent.getValue() != null) {
          pb.setValue(ByteString.copyFromUtf8(ent.getValue()));
        }
        b.addUsermeta(pb);
      }
    }
   
    return b.build();
  }
View Full Code Here

TOP

Related Classes of com.trifork.riak.RPB.RpbContent.Builder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.