Пример #1
0
 static {
   DEMO = new EntityUser();
   // lets use one that at least looks a little more realistic:
   DEMO.setApiKey("register:15505124196:b1:2361498898283920755");
   DEMO.setUsername("demo");
   DEMO.setPassword("databusiscool");
 }
Пример #2
0
  public static void drawChart(String chartId, String encoded) {
    EntityUser user = Utility.getCurrentUser(session);
    List<ChartDbo> charts = user.getCharts();
    // special case for showing remote pages
    Map<String, String> variables = ChartUtil.decodeVariables(encoded);

    ChartDbo chart = new ChartDbo();
    chart.setChartId(chartId);
    chart.setEncodedVariables(encoded);
    String title = chart.getTitle();
    String url = chart.getLargeChartUrl();
    render(charts, variables, url, title, chartId, encoded);
  }
Пример #3
0
  public static void addChartToDashboard(String chartId, String encoded) {
    // make sure chart exists...
    ChartUtil.fetchChart(chartId);
    ChartDbo chart = new ChartDbo();
    chart.setChartId(chartId);
    chart.setEncodedVariables(encoded);
    // he could create multiples of the same chart so just timestamp it as he would not
    // be fast enough to create ones with an id clash...
    chart.setId(chartId + System.currentTimeMillis());

    EntityUser user = Utility.getCurrentUser(session);
    List<ChartDbo> charts = user.getCharts();
    charts.add(chart);
    NoSql.em().put(user);
    NoSql.em().flush();

    Settings.charts();
  }