Example usage for org.springframework.data.gemfire GemfireTemplate put

List of usage examples for org.springframework.data.gemfire GemfireTemplate put

Introduction

In this page you can find the example usage for org.springframework.data.gemfire GemfireTemplate put.

Prototype

@Override
    public <K, V> V put(K key, V value) 

Source Link

Usage

From source file:demo.vmware.commands.CommandModifyStringAttribute.java

@Override
public CommandResult run(ConfigurableApplicationContext mainContext, List<String> parameters) {
    String regionName = parameters.get(0);
    String pk = parameters.get(1);
    String attributeName = parameters.get(2);
    String attributeValue = parameters.get(3);
    GemfireTemplate template = CommandRegionUtils.findTemplateForRegionName(mainContext, regionName);
    Object modelObject = template.get(pk);
    if (modelObject == null) {
        LOG.error("no object found in region " + regionName + " for key " + pk);
        return new CommandResult(null, " no object found in region " + regionName + " for key " + pk);
    } else {//from  w  ww.j  a  v  a  2  s.  co  m
        setValue(modelObject, attributeName, attributeValue);
        template.put(pk, modelObject);
        return new CommandResult(null, "Attribute " + attributeName + " on object with key " + pk
                + " in region " + regionName + " successfully set to " + attributeValue);
    }
}