예제 #1
0
/**
 * DevTopInfoBar @Author Bo Gao [elivoa|gmail.com], Oct 27, 2011 At KEG
 *
 * <p>TODO Move to Admin Page
 */
@Import(stylesheet = {"context:res/css/page/dev_top_info_bar.css"})
public class DevTopInfoBar {

  @SessionState @Property private TopInfotipsData data;

  @Property
  private PerformanceTimeCount performanceTimeCounter = PerformanceTimeCount.getInstance();

  @AfterRender
  void reset() {
    data.clear();
  }
}
예제 #2
0
/** AdminIndex @Author Bo Gao [elivoa|gmail.com], Jul 31, 2011 At KEG */
@RequireLogin(admin = true)
public class AdminIndex {

  @SessionState @Property private TopInfotipsData data;

  @SuppressWarnings("unused")
  @Property
  private PerformanceTimeCount performanceTimeCounter = PerformanceTimeCount.getInstance();

  @AfterRender
  void reset() {
    data.clear();
  }

  @Cached
  public long getUserCount() {
    return commonDao.total(User.class);
  }

  @Cached
  public long getBindUserCount() {
    return commonDao.total(User2Author.class);
  }

  public double getBindPercentage() {
    return new Long(getBindUserCount()).doubleValue() / getUserCount() * 100;
  }

  @Cached
  public long getPublicationCount() {
    return commonDao.total(Publication.class);
  }

  @Cached
  public long getAuthorCount() {
    return commonDao.total(RealPerson.class);
  }

  @Cached
  public long getJconfCount() {
    return commonDao.total(Jconf.class);
  }

  public DecimalFormat getCurrencyFormat() {
    return new DecimalFormat("0.00");
  }

  @Cached
  public PubSubStat getNotificationStat() {
    PubSubStat stat = PubSubStat.getInstance();
    return stat;
  }

  @Property String _topic;

  /*
   * Events
   */
  Object onRefreshJPACache() {
    em.refresh(User.class);
    em.refresh(Jconf.class);
    return this;
  }

  /*
   * Services
   */
  @Inject private CommonDAO commonDao;

  @Inject private EntityManager em;
}