Package org.encuestame.persistence.domain.dashboard

Examples of org.encuestame.persistence.domain.dashboard.Dashboard


        final JSONObject gadget = (JSONObject) items.get(0);
        final String gadgetId = (String) gadget.get("id");
        //add gadgets to dashboard
        initService("/api/common/gadgets/add.json", MethodJson.GET);
        setParameter("gadgetId", gadgetId);
        final Dashboard db = createDashboard("dashboard 1", true, getSpringSecurityLoggedUserAccount());
        setParameter("boardId", db.getBoardId().toString());
        final JSONObject response2 = callJsonService();
        final JSONObject success2 = getSucess(response2);
        //System.out.println(success2);
        final JSONObject gadgetJson = (JSONObject) success2.get("gadget");
        Assert.assertEquals("1", gadgetJson.get("gadget_position").toString());
View Full Code Here


             bean.setDashboardName(boardName);
             bean.setDashboardDesc(boardDesc);
             bean.setFavorite(favorite);
             bean.setLayout(layout == null ? LayoutEnum.BB_BLOCK.toString() : layout);
             final Map<String, Object> jsonResponse = new HashMap<String, Object>();
             final Dashboard dashboard = getDashboardService().createDashboard(bean);
             jsonResponse.put("dashboard", ConvertDomainBean.convertDashboardDomaintoBean(dashboard));
             setItemResponse(jsonResponse);
         } catch (Exception e) {
              log.error(e);
              e.printStackTrace();
View Full Code Here

            @RequestBody DashboardBean bean,
            HttpServletRequest request,
            HttpServletResponse response){
         try {
             final Map<String, Object> jsonResponse = new HashMap<String, Object>();
             final Dashboard dashboard = getDashboardService().updateDashboard(bean);
             jsonResponse.put("dashboard", ConvertDomainBean.convertDashboardDomaintoBean(dashboard));
             setItemResponse(jsonResponse);
         } catch (Exception e) {
              log.error(e);
              e.printStackTrace();
View Full Code Here

     *
     * @param userAccount
     */
    private void createDefaultDashboard(final UserAccount userAccount) {
       //FUTURE: this code must be in higher level {reuse code}
        final Dashboard board = new Dashboard();
        board.setPageBoardName(EnMePlaceHolderConfigurer.getProperty("dashboard.default.name") == null ? "" : EnMePlaceHolderConfigurer.getProperty("dashboard.default.name"));
        board.setDescription(EnMePlaceHolderConfigurer.getProperty("dashboard.default.descr") == null ? "" : EnMePlaceHolderConfigurer.getProperty("dashboard.default.descr")) ;
        board.setUserBoard(userAccount);
        board.setPageLayout(LayoutEnum.AB_COLUMN_BLOCK);
        board.setFavorite(true);
        board.setSelectedByDefault(true);
        board.setBoardSequence(1);
        board.setFavoriteCounter(1);
        //FIXME: nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [org.encuestame.persistence.domain.dashboard.Dashboard]
        //getDashboardDao().saveOrUpdate(board);
    }
View Full Code Here

     * @throws ServletExceptionreateDashboardDefault(getSpringSecurityLoggedUserAccount())
     * @throws IOException
     */
    @Test
    public void testgetGadgets() throws ServletException, IOException{
        Dashboard dash = createDashboardDefault(getSpringSecurityLoggedUserAccount());
        createGadgetDefault(dash);
        createGadgetDefault(dash);
        initService("/api/common/gadgets/list.json", MethodJson.GET);
        setParameter("dashboardId", dash.getBoardId().toString());
        final JSONObject response2 = callJsonService();
        final JSONObject success2 = getSucess(response2);
        final JSONArray gadgets2 = (JSONArray) success2.get("gadgets");
        Assert.assertEquals(gadgets2.size(), 2);
    }
View Full Code Here

     * @throws IOException
     * @throws ServletException
     */
    @Test
    public void testAddGadgetOnDashboard() throws ServletException, IOException{
    final Dashboard myBoard = createDashboard("My Third board",
        Boolean.TRUE, getSpringSecurityLoggedUserAccount());
    final Gadget myGadget = createGadgetDefault(myBoard);
    initService("/api/common/stream/gadget.json", MethodJson.POST);
    setParameter("id", myBoard.getBoardId().toString());
    final JSONObject response = callJsonService();
    final JSONObject success = getSucess(response);
    final JSONObject gadget = (JSONObject) success.get("gadget");
    final String message = (String) gadget.get("gadget_name");
    Assert.assertEquals(message, "stream");
View Full Code Here

    }


    @Test
    public void testAddInvalidGadgetOnDashboard() throws ServletException, IOException{
    final Dashboard myBoard = createDashboard("My Third board",
        Boolean.TRUE, getSpringSecurityLoggedUserAccount());
    createGadgetDefault(myBoard);
    // invalid gadget
    initService("/api/common/notvalid/gadget.json", MethodJson.POST);
    setParameter("id", myBoard.getBoardId().toString());
    final JSONObject response_error = callJsonService();
    final JSONObject error = getErrors(response_error);
    final String message_error = (String) error.get("message");
    Assert.assertEquals(message_error, "gadget invalid");
    }
View Full Code Here

     * @throws ServletException
     * @throws IOException
     */
    @Test
    public void testMoveGadgetOnDashboard() throws ServletException, IOException{
        final Dashboard myBoard = createDashboard("My Surveys board", Boolean.TRUE, getSpringSecurityLoggedUserAccount());
        final Gadget myGadget = createGadgetDefault(myBoard);
        initService("/api/common/" + myGadget.getGadgetId().toString() + "/gadget.json", MethodJson.PUT);
        setParameter("position", "3" );
        setParameter("column""2");
        setParameter("dashboardId", myBoard.getBoardId().toString());
        final JSONObject response = callJsonService();
        assertSuccessResponse(response);
    }
View Full Code Here

     * @throws IOException
     * @throws ServletException
     */
    @Test
    public void testRemoveGadgetOnDashboard() throws ServletException, IOException{
        final Dashboard tpBoard = createDashboard("My TweetPoll board", Boolean.TRUE, getSpringSecurityLoggedUserAccount());
        final Gadget myGadget = createGadgetDefault(tpBoard);
        initService("/api/common/" + myGadget.getGadgetId().toString() + "/gadget.json", MethodJson.DELETE);
        //setParameter("gadgetId", myGadget.getGadgetId().toString() );
        setParameter("dashboardId", tpBoard.getBoardId().toString());
        final JSONObject response = callJsonService();
        assertSuccessResponse(response);
    }
View Full Code Here

     * @param favorite
     * @param userAcc
     * @return
     */
    public Dashboard createDashboard(final String boardName, final Boolean favorite, final UserAccount userAcc){
        final Dashboard board = new Dashboard();
        board.setPageBoardName(boardName);
          board.setDescription("");
          board.setFavorite(favorite);
          board.setFavoriteCounter(1);
          board.setPageLayout(LayoutEnum.BA_BLOCK_COLUMN);
          board.setBoardSequence(1);
          board.setUserBoard(userAcc);
          getDashboardDao().saveOrUpdate(board);
        return board;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.dashboard.Dashboard

Copyright © 2018 www.massapicom. 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.