{
final String key = (String) parameters[0];
final RequestMeta meta = new RequestMeta ();
meta.setClientId (RiakRestOperationFactory.this.clientId);
meta.setAccept (Constants.CTYPE_ANY + ", " + Constants.CTYPE_MULTIPART_MIXED);
final FetchResponse res = RiakRestOperationFactory.this.riakcl.fetch (RiakRestOperationFactory.this.bucket, key, meta);
final RiakObject riakobj;
if (res.hasSiblings ()) {
RiakObject oldest = null;
long oldestMod = Long.MIN_VALUE;
for (final RiakObject sibling : res.getSiblings ()) {
final long siblingMod = sibling.getLastmodAsDate ().getTime ();
if (siblingMod >= oldestMod) {
oldest = sibling;
oldestMod = siblingMod;
}
}
riakobj = oldest;
} else if (res.hasObject ()) {
riakobj = res.getObject ();
} else {
riakobj = null;
}
if (riakobj != null) {
return riakobj.getValueAsBytes ();