當前位置: 首頁>>代碼示例>>Java>>正文


Java IMap.values方法代碼示例

本文整理匯總了Java中com.hazelcast.core.IMap.values方法的典型用法代碼示例。如果您正苦於以下問題:Java IMap.values方法的具體用法?Java IMap.values怎麽用?Java IMap.values使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hazelcast.core.IMap的用法示例。


在下文中一共展示了IMap.values方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleRequest

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    IMap<String, RefreshToken> tokens = CacheStartupHookProvider.hz.getMap("tokens");
    Deque<String> userIdDeque = exchange.getQueryParameters().get("userId");
    String userId = userIdDeque == null? "%" : userIdDeque.getFirst() + "%";
    int page = Integer.valueOf(exchange.getQueryParameters().get("page").getFirst()) - 1;
    Deque<String> pageSizeDeque = exchange.getQueryParameters().get("pageSize");
    int pageSize = pageSizeDeque == null? 10 : Integer.valueOf(pageSizeDeque.getFirst());
    if(logger.isDebugEnabled()) logger.debug("userId = " + userId + " page = " + page + " pageSize = " + pageSize);
    LikePredicate likePredicate = new LikePredicate("userId", userId);

    PagingPredicate pagingPredicate = new PagingPredicate(likePredicate, new RefreshTokenComparator(), pageSize);
    pagingPredicate.setPage(page);
    Collection<RefreshToken> values = tokens.values(pagingPredicate);

    exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
    exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(values));
}
 
開發者ID:networknt,項目名稱:light-oauth2,代碼行數:19,代碼來源:Oauth2RefreshTokenGetHandler.java

示例2: handleRequest

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    IMap<String, User> users = CacheStartupHookProvider.hz.getMap("users");
    Deque<String> userIdDeque = exchange.getQueryParameters().get("userId");
    String userId = userIdDeque == null? "%" : userIdDeque.getFirst() + "%";
    int page = Integer.valueOf(exchange.getQueryParameters().get("page").getFirst()) - 1;
    Deque<String> pageSizeDeque = exchange.getQueryParameters().get("pageSize");
    int pageSize = pageSizeDeque == null? 10 : Integer.valueOf(pageSizeDeque.getFirst());

    LikePredicate likePredicate = new LikePredicate("userId", userId);

    PagingPredicate pagingPredicate = new PagingPredicate(likePredicate, new UserComparator(), pageSize);
    pagingPredicate.setPage(page);
    Collection<User> values = users.values(pagingPredicate);

    for (User value : values) {
        value.setPassword(null);
    }
    exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
    exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(values));
}
 
開發者ID:networknt,項目名稱:light-oauth2,代碼行數:23,代碼來源:Oauth2UserGetHandler.java

示例3: handleRequest

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    IMap<String, Service> services = CacheStartupHookProvider.hz.getMap("services");

    Deque<String> serviceIdDeque = exchange.getQueryParameters().get("serviceId");
    String serviceId = serviceIdDeque == null? "%" : serviceIdDeque.getFirst() + "%";
    int page = Integer.valueOf(exchange.getQueryParameters().get("page").getFirst()) - 1;
    Deque<String> pageSizeDeque = exchange.getQueryParameters().get("pageSize");
    int pageSize = pageSizeDeque == null? 10 : Integer.valueOf(pageSizeDeque.getFirst());

    LikePredicate likePredicate = new LikePredicate("serviceId", serviceId);

    PagingPredicate pagingPredicate = new PagingPredicate(likePredicate, new ServiceComparator(), pageSize);
    pagingPredicate.setPage(page);
    Collection<Service> values = services.values(pagingPredicate);

    exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
    exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(values));
}
 
開發者ID:networknt,項目名稱:light-oauth2,代碼行數:20,代碼來源:Oauth2ServiceGetHandler.java

示例4: handleRequest

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    IMap<String, Client> clients = CacheStartupHookProvider.hz.getMap("clients");
    Deque<String> clientNameDeque = exchange.getQueryParameters().get("clientName");
    String clientName = clientNameDeque == null? "%" : clientNameDeque.getFirst() + "%";
    int page = Integer.valueOf(exchange.getQueryParameters().get("page").getFirst()) - 1;
    Deque<String> pageSizeDeque = exchange.getQueryParameters().get("pageSize");
    int pageSize = pageSizeDeque == null? 10 : Integer.valueOf(pageSizeDeque.getFirst());

    LikePredicate likePredicate = new LikePredicate("clientName", clientName);

    PagingPredicate pagingPredicate = new PagingPredicate(likePredicate, new ClientComparator(), pageSize);
    pagingPredicate.setPage(page);
    Collection<Client> values = clients.values(pagingPredicate);

    List results = new ArrayList();
    for (Client value : values) {
        Client c = Client.copyClient(value);
        c.setClientSecret(null);
        results.add(c);
    }
    exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
    exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(results));
}
 
開發者ID:networknt,項目名稱:light-oauth2,代碼行數:25,代碼來源:Oauth2ClientGetHandler.java

示例5: getRandomRace

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
/**
 * Return a {@code Race} at random from the provided set
 * 
 * @param eventsByID
 * @return 
 */
public static Race getRandomRace(final IMap<Long, Event> eventsByID) {
    final List<Event> events = new ArrayList<>(eventsByID.values());
    final int rI = new Random().nextInt(events.size());
    final Event theDay = events.get(rI);
    final List<Race> races = theDay.getRaces();
    final int rR = new Random().nextInt(races.size());
    return races.get(rR);
}
 
開發者ID:hazelcast,項目名稱:betleopard,代碼行數:15,代碼來源:RandomSimulationUtils.java

示例6: getInventoryItems

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
public Iterable<InventoryItemListItem> getInventoryItems() {
    IMap<String, InventoryItemListItem> map = hazelcastInstance.getMap(INVENTORY_ITEMS_MAP);

    return map.values();
}
 
開發者ID:vgoldin,項目名稱:cqrs-eventsourcing-kafka,代碼行數:6,代碼來源:InventoryItemsQuery.java

示例7: findInventoryItemsByName

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
public Collection<InventoryItemListItem> findInventoryItemsByName(String name) {
    IMap<String, InventoryItemListItem> map = hazelcastInstance.getMap(INVENTORY_ITEMS_MAP);

    return map.values(Predicates.like("name", name));
}
 
開發者ID:vgoldin,項目名稱:cqrs-eventsourcing-kafka,代碼行數:6,代碼來源:InventoryItemsQuery.java

示例8: testUserCache

import com.hazelcast.core.IMap; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
@Test
public void testUserCache() {
    CacheStartupHookProvider start = new CacheStartupHookProvider();
    start.onStartup();

    final IMap<String, User> users = CacheStartupHookProvider.hz.getMap("users");

    User user = (User)users.get("admin");
    System.out.println("user = " + user);

    user.setUserType(User.UserTypeEnum.fromValue("customer"));

    users.put("admin", user);

    System.out.println("users size = " + users.size());

    // query email as it is indexed.
    String email = "adm%";
    Predicate predicate = new SqlPredicate(String.format("email like %s", email));
    Set<User> uSet = (Set<User>) users.values(predicate);

    System.out.println("uSet = " + uSet);

    users.delete("admin");

    System.out.println("users size = " + users.size());

    CacheShutdownHookProvider shutdown = new CacheShutdownHookProvider();
    shutdown.onShutdown();

}
 
開發者ID:networknt,項目名稱:light-oauth2,代碼行數:33,代碼來源:CacheStartupHookProviderTest.java


注:本文中的com.hazelcast.core.IMap.values方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。