Package com.google.code.greenwood.confluenceadvancedcodeblockplugin.xwork.actions

Source Code of com.google.code.greenwood.confluenceadvancedcodeblockplugin.xwork.actions.CacheRefreshAction

package com.google.code.greenwood.confluenceadvancedcodeblockplugin.xwork.actions;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.atlassian.cache.Cache;
import com.atlassian.cache.CacheManager;
import com.atlassian.confluence.core.ConfluenceActionSupport;
import com.atlassian.confluence.pages.AbstractPage;
import com.atlassian.confluence.pages.actions.PageAware;
import com.google.code.greenwood.confluenceadvancedcodeblockplugin.macro.BaseAdvancedCodeblockMacro;
import com.opensymphony.xwork.Action;

public class CacheRefreshAction extends ConfluenceActionSupport implements PageAware {
 
  /* Logging */
  private static final Logger log = LoggerFactory.getLogger(CacheRefreshAction.class);
 
  private static final long serialVersionUID = 8453122663507503589L;

  private String cachekey;
 
    private AbstractPage currentPage;
   
    private CacheManager cacheManager;
   

    @Override
    public String execute() throws Exception
    {
    Cache cache = cacheManager.getCache(BaseAdvancedCodeblockMacro.MACRO_CACHE_KEY);
    cache.remove(cachekey);
    log.info("remove cache key from macrocache: "+cachekey);

        return Action.SUCCESS;
    }

    @Override
    public AbstractPage getPage()
    {
        return currentPage;
    }

    @Override
    public void setPage(AbstractPage abstractPage)
    {
        currentPage = abstractPage;
    }

    @Override
    public boolean isPageRequired()
    {
        return true;
    }

    @Override
    public boolean isLatestVersionRequired()
    {
        return true;
    }

    @Override
    public boolean isViewPermissionRequired()
    {
        return true;
    }

  public void setCachekey(String cachekey) {
    this.cachekey = cachekey;
  }

  public void setCacheManager(CacheManager cacheManager) {
    this.cacheManager = cacheManager;
 
   
   

}
TOP

Related Classes of com.google.code.greenwood.confluenceadvancedcodeblockplugin.xwork.actions.CacheRefreshAction

TOP
Copyright © 2018 www.massapi.com. 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.