Package javax.cache

Examples of javax.cache.Cache$EntryProcessor


  @SuppressWarnings("unchecked")
  public void setImage(Image image) {
    if (image != null) {
      try {
        CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
        Cache cache = cacheFactory.createCache(Collections.emptyMap());
        cache.put(value, image);
      } catch (CacheException e) {
        logger.error(e.getMessage(), e);
      }
    } else if (value != null) {
      image = findImage(value);
View Full Code Here


 
  public static Image findImage(String value) {
    if (value != null) {
      try {
        CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
        Cache cache = cacheFactory.createCache(Collections.emptyMap());
        return (Image) cache.get(value);
      } catch (CacheException e) {
        logger.error(e.getMessage(), e);
      }
    }
    return null;
View Full Code Here

    }
  }

  private void listeVolHistoric(HttpServletRequest request,HttpServletResponse response) throws IOException {
    try {
      Cache cache = DatacacheSingleton.getInstance();
   
      PreparedQuery preparedHistoricQuery = VolDAO.getSearchVol((String)cache.get("leavingFrom"),(String)cache.get("goingTo"),(Date)cache.get("departure"));
      JSONObject search = new JSONObject();
      search.put("leaving", (String)cache.get("leavingFrom"));
      search.put("going", (String)cache.get("goingTo"));
      search.put("time", new SimpleDateFormat("HH:mm").format((Date)cache.get("departure")));
      search.put("date", new SimpleDateFormat("yyyy-MM-dd").format((Date)cache.get("departure")));
      cache.clear();
      JSONArray volHistoricList = new JSONArray();
      volHistoricList.put(search);
      for(Entity result : preparedHistoricQuery.asIterable())
      {       
        JSONObject vol = new JSONObject();
View Full Code Here

    return datastore.put(newSearch);
  }

  public static void updateSearch(Key searchKey) throws EntityNotFoundException, CacheException {
    DatastoreService datastore = DatastoreSingleton.getInstance()
    Cache cache = DatacacheSingleton.getInstance();
    Entity search = datastore.get(searchKey);
    cache.put("departure", search.getProperty("departure"));
    cache.put("goingTo", search.getProperty("goingTo"));
    cache.put("leavingFrom", search.getProperty("leavingFrom"));
    search.setProperty("date", new Date());
    datastore.put(search);
  }
View Full Code Here

TOP

Related Classes of javax.cache.Cache$EntryProcessor

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.