Example usage for org.springframework.data.redis.core BoundHashOperations entries

List of usage examples for org.springframework.data.redis.core BoundHashOperations entries

Introduction

In this page you can find the example usage for org.springframework.data.redis.core BoundHashOperations entries.

Prototype

@Nullable
Map<HK, HV> entries();

Source Link

Document

Get entire hash at the bound key.

Usage

From source file:com.greenline.guahao.biz.manager.cache.hrs.DepartmentCacheManager.java

/**
 * ?/*from www  . java2 s .c o m*/
 * 
 * @param id
 * @return
 */
public HospitalDepartmentDO getHospitalDept(String id) {
    if (StringUtils.isEmpty(id)) {
        return null;
    }
    BoundHashOperations<String, String, String> rmap = hdept(id);
    Map<String, String> data = rmap.entries();

    HospitalDepartmentDO hdept = new HospitalDepartmentDO();

    hdept.setId(data.get("id"));
    if (StringUtils.isEmpty(hdept.getId())) {
        return null;
    }
    hdept.setName(data.get("name"));
    hdept.setDescription(data.get("description"));
    hdept.setCategory(data.get("category"));
    hdept.setDeptId(data.get("deptId"));
    hdept.setRule(data.get("rule"));
    hdept.setHospitalId(data.get("hospitalId"));
    String profitType = data.get("profitType");
    hdept.setProfitType(profitType == null ? 1 : Integer.valueOf(profitType));
    return hdept;
}

From source file:org.shareok.data.redis.server.RepoServerDaoImpl.java

@Override
public Map<String, String> getServerNameIdList() {

    Map<String, String> serverList = new HashMap<>();
    BoundHashOperations<String, String, String> serverOps = redisTemplate
            .boundHashOps(ShareokdataManager.getRedisServerNameIdMatchingTable());
    if (null != serverOps) {
        Map map = serverOps.entries();
        Iterator it = map.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry pair = (Map.Entry) it.next();
            serverList.put((String) pair.getKey(), (String) pair.getValue());
            it.remove();/* w w  w. java2s. c o  m*/
        }
    }
    return serverList;
}