예제 #1
0
  @PostConstruct
  public void cacheCodeList() {

    System.out.println("################################################");

    this.codeCache.put(new Element("codeList", codeService.cacheCodeData()));
    this.codeCache.put(new Element("productList", codeService.cacheAllProductData()));

    System.out.println("             Completed common code cache!              ");
    System.out.println("             Completed product code cache!              ");

    System.out.println("################################################");
  }
예제 #2
0
  public void reCacheCode(String cacheName) {

    System.out.println("################################################");
    if (cacheName == null || "all".equals(cacheName)) {
      this.codeCache.put(new Element("codeList", codeService.cacheCodeData()));
      this.codeCache.put(new Element("productList", codeService.cacheAllProductData()));
      System.out.println("             Completed common code cache!              ");
    } else if ("codeList".equals(cacheName)) {
      this.codeCache.put(new Element("codeList", codeService.cacheCodeData()));
      System.out.println("             Completed common code & product code cache!");
    } else if ("productList".equals(cacheName)) {
      this.codeCache.put(new Element("productList", codeService.cacheAllProductData()));
      System.out.println("             Completed product code cache!              ");
    }
    System.out.println("################################################");
  }
예제 #3
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  public List<LookupCode> appendCache(String cacheName, LookupCode lookupCode) {
    String lang = lookupCode.getLanguage();
    lookupCode.setLanguage("ALL");

    Cache cache = cacheManager.getCache("codeCache");
    Element element = cache.get(cacheName);
    Map<String, List<LookupCode>> map = (Map<String, List<LookupCode>>) element.getValue();
    List<LookupCode> lookupCodes = codeService.getCodeList(lookupCode);
    map.put(lookupCode.getCodeGroup(), lookupCodes);

    this.codeCache.put(new Element("codeList", map));
    lookupCode.setLanguage(lang);
    return lookupCodes;
  }
예제 #4
0
  /** {@inheritDoc} */
  @SuppressWarnings("unchecked")
  @Override
  public void removeCache(String cacheName, LookupCode lookupCode) {

    Cache cache = cacheManager.getCache("codeCache");
    Element element = cache.get("codeList");
    Map<String, List<LookupCode>> map = (Map<String, List<LookupCode>>) element.getValue();
    List<LookupCode> lookupCodes = codeService.getCodeList(lookupCode);
    if (lookupCodes.size() == 0) {
      map.remove(lookupCode.getCodeGroup());
    } else {
      map.put(lookupCode.getCodeGroup(), lookupCodes);
    }

    this.codeCache.put(new Element("codeList", map));
  }