Package com.basho.riak.client.api.convert.Converter

Examples of com.basho.riak.client.api.convert.Converter.OrmExtracted


        else
        {
            converter = ConverterFactory.getInstance().getConverter(typeReference);
        }
       
        final OrmExtracted orm = converter.fromDomain(value, namespace, key);
       
        // If there's no vector clock in the object, use one possibly given via
        // the builder.
        if (orm.getRiakObject().getVClock() == null)
        {
            orm.getRiakObject().setVClock(vclock);
        }
       
        RiakFuture<StoreOperation.Response, Location> coreFuture =
            cluster.execute(buildCoreOperation(orm));
       
        CoreFutureAdapter<Response, Location, StoreOperation.Response, Location> future =
            new CoreFutureAdapter<Response, Location, StoreOperation.Response, Location>(coreFuture)
            {
                @Override
                protected Response convertResponse(StoreOperation.Response coreResponse)
                {
                    Namespace ns = orm.getNamespace();
                    BinaryValue key = orm.getKey();
                    if (coreResponse.hasGeneratedKey())
                    {
                        key = coreResponse.getGeneratedKey();
                    }
                   
View Full Code Here


        pojo.vclock = vclock;
        pojo.contentType = RiakObject.DEFAULT_CONTENT_TYPE;
           
        JSONConverter<EmptyPojoWithRiakFields> jc =
            new JSONConverter<EmptyPojoWithRiakFields>(new TypeReference<EmptyPojoWithRiakFields>(){});
        OrmExtracted orm = jc.fromDomain(pojo, null, null);
       
        RiakObject riakObject = orm.getRiakObject();
        riakObject.setLastModified(123);
        riakObject.setVTag("vtag");
       
        Location loc = new Location(orm.getNamespace(), orm.getKey());
        EmptyPojoWithRiakFields convertedPojo = jc.toDomain(riakObject, loc);
       
        assertEquals(pojo.key, convertedPojo.key);
        assertEquals(pojo.bucketName, convertedPojo.bucketName);
        assertEquals(pojo.bucketType, convertedPojo.bucketType);
View Full Code Here

        Pojo pojo = new Pojo();
        pojo.foo = "foo_value";
        pojo.bar = "bar_value";
       
       
        OrmExtracted orm = converter.fromDomain(pojo , null, null);
        RiakObject ro = orm.getRiakObject();
       
        assertNotNull(ro.getValue());
       
        Namespace ns = new Namespace(Namespace.DEFAULT_BUCKET_TYPE, "bucket");
        Pojo pojo2 = converter.toDomain(ro, new Location(ns, "key"));
View Full Code Here

        RiakObject o = new RiakObject();
       
        RiakObject o2 = converter.toDomain(o, null);
        assertEquals(o, o2);
       
        OrmExtracted orm = converter.fromDomain(o, null, null);
        assertEquals(o, orm.getRiakObject());
       
       
    }
View Full Code Here

        else
        {
            converter = ConverterFactory.getInstance().getConverter(typeReference);
        }
       
        final OrmExtracted orm = converter.fromDomain(value, namespace, key);
       
        // If there's no vector clock in the object, use one possibly given via
        // the builder.
        if (orm.getRiakObject().getVClock() == null)
        {
            orm.getRiakObject().setVClock(vclock);
        }
       
        RiakFuture<StoreOperation.Response, Location> coreFuture =
            cluster.execute(buildCoreOperation(orm));
       
        CoreFutureAdapter<Response, Location, StoreOperation.Response, Location> future =
            new CoreFutureAdapter<Response, Location, StoreOperation.Response, Location>(coreFuture)
            {
                @Override
                protected Response convertResponse(StoreOperation.Response coreResponse)
                {
                    Namespace ns = orm.getNamespace();
                    BinaryValue key = orm.getKey();
                    if (coreResponse.hasGeneratedKey())
                    {
                        key = coreResponse.getGeneratedKey();
                    }
                   
View Full Code Here

TOP

Related Classes of com.basho.riak.client.api.convert.Converter.OrmExtracted

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.