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"); }
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); }
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(); }