Commits

Anonymous committed 84f1044

Progress in ENCUESTAME-267

Comments (0)

Files changed (7)

encuestame-persistence/src/main/java/org/encuestame/persistence/dao/IDashboardDao.java

+/*
+ ************************************************************************************
+ * Copyright (C) 2001-2011 encuestame: system online surveys Copyright (C) 2009
+ * encuestame Development Team.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+package org.encuestame.persistence.dao;
+
+/**
+ * Dashboard Interface.
+ * @author Morales,Diana Paola paolaATencuestame.org
+ * @since July 27, 2011
+ */
+public interface IDashboardDao extends IBaseDao {
+
+}

encuestame-persistence/src/main/java/org/encuestame/persistence/dao/imp/DashboardDao.java

+/*
+ ************************************************************************************
+ * Copyright (C) 2001-2011 encuestame: system online surveys Copyright (C) 2009
+ * encuestame Development Team.
+ * Licensed under the Apache Software License version 2.0
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to  in writing,  software  distributed
+ * under the License is distributed  on  an  "AS IS"  BASIS,  WITHOUT  WARRANTIES  OR
+ * CONDITIONS OF ANY KIND, either  express  or  implied.  See  the  License  for  the
+ * specific language governing permissions and limitations under the License.
+ ************************************************************************************
+ */
+package org.encuestame.persistence.dao.imp;
+
+import org.encuestame.persistence.dao.IDashboardDao;
+
+/**
+ * Dashboard Dao.
+ * @author Morales,Diana Paola paolaATencuestame.org
+ * @since July 27, 2011
+ */
+public class DashboardDao extends AbstractHibernateDaoSupport implements IDashboardDao {
+
+}

encuestame-persistence/src/main/java/org/encuestame/persistence/domain/dashboard/Gadget.java

     @Id
     @GeneratedValue(strategy = GenerationType.AUTO)
     @Column(name = "gadgetId", unique = true, nullable = true)
-    public Long getWidgetId() {
+    public Long getGadgetId() {
         return gadgetId;
     }
 
     /**
     * @return the widgetName
     */
-    @Column(name = "widgetName", nullable = false)
+    @Column(name = "gadgetName", nullable = false)
     public String getGadgetName() {
         return gadgetName;
     }
     /**
     * @return the widgetType
     */
+    @Column(name = "gadgetType", nullable = false)
     public String getGadgetType() {
         return gadgetType;
     }

encuestame-persistence/src/main/java/org/encuestame/persistence/domain/dashboard/GadgetProperties.java

     /**
     * @return the widget
     */
-
+    @ManyToOne()
     public Gadget getWidget() {
         return gadget;
     }

encuestame-persistence/src/test/java/org/encuestame/test/config/AbstractBase.java

 import org.apache.commons.lang.math.RandomUtils;
 import org.encuestame.persistence.dao.IAccountDao;
 import org.encuestame.persistence.dao.IClientDao;
+import org.encuestame.persistence.dao.IDashboardDao;
 import org.encuestame.persistence.dao.IEmail;
 import org.encuestame.persistence.dao.IFrontEndDao;
 import org.encuestame.persistence.dao.IGeoPoint;
 import org.encuestame.persistence.dao.ISurveyFormatDao;
 import org.encuestame.persistence.dao.ITweetPoll;
 import org.encuestame.persistence.dao.imp.ClientDao;
+import org.encuestame.persistence.dao.imp.DashboardDao;
 import org.encuestame.persistence.dao.imp.EmailDao;
 import org.encuestame.persistence.dao.imp.FrontEndDao;
 import org.encuestame.persistence.dao.imp.PollDao;
 import org.encuestame.persistence.domain.Project;
 import org.encuestame.persistence.domain.Project.Priority;
 import org.encuestame.persistence.domain.Status;
+import org.encuestame.persistence.domain.dashboard.Dashboard;
+import org.encuestame.persistence.domain.dashboard.Gadget;
 import org.encuestame.persistence.domain.notifications.Notification;
 import org.encuestame.persistence.domain.notifications.NotificationEnum;
 import org.encuestame.persistence.domain.question.Question;
     @Autowired
     private IFrontEndDao frontEndDao;
 
+    /** {@link DashboardDao} **/
+    @Autowired
+    private IDashboardDao dashboardDao;
+
     /**
      * Get Property.
      * @param property
         return createSecondaryUserGroup(name, name.replace(" ", "")+"."+RandomStringUtils.randomNumeric(6)+"@users.com", secUser, group);
     }
 
+    /**
+     * Create gadget default.
+     * @return
+     */
+    public Gadget createGadgetDefault(){
+        return this.createGadget("default", "defaultType");
+    }
 
+    /**
+     * Create gadget.
+     * @param name
+     * @param type
+     * @return
+     */
+    public Gadget createGadget(final String name, final String type){
+        final Gadget gadget = new Gadget();
+        gadget.setGadgetName(name);
+        gadget.setGadgetType(type);
+        return gadget;
+    }
+
+    /**
+     * Create dashboard.
+     * @param boardName
+     * @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("AAA");
+          board.setBoardSequence(1);
+          board.setUserBoard(userAcc);
+        return board;
+    }
+
+    /**
+     * Create dashboard default.
+     * @param userAcc
+     * @return
+     */
+    public Dashboard createDashboardDefault(final UserAccount userAcc){
+        return this.createDashboard("Board default", Boolean.TRUE, userAcc);
+    }
 
     /**
      * Create Secondary User.
        getHashTagDao().saveOrUpdate(tagHits);
        return tagHits;
     }
+
+    /**
+    * @return the dashboardDao
+    */
+    public IDashboardDao getDashboardDao() {
+        return dashboardDao;
+    }
+
+    /**
+    * @param dashboardDao the dashboardDao to set
+    */
+    public void setDashboardDao(final IDashboardDao dashboardDao) {
+        this.dashboardDao = dashboardDao;
+    }
 }

encuestame-persistence/src/test/java/org/encuestame/test/persistence/domain/TestHibernateDomains.java

 import java.util.Date;
 
 import org.apache.commons.lang.RandomStringUtils;
+import org.encuestame.persistence.dao.IDashboardDao;
 import org.encuestame.persistence.domain.GeoPointType;
 import org.encuestame.persistence.domain.Client;
 import org.encuestame.persistence.domain.EmailList;
 import org.encuestame.persistence.domain.HashTagHits;
 import org.encuestame.persistence.domain.Project;
 import org.encuestame.persistence.domain.Status;
+import org.encuestame.persistence.domain.dashboard.Dashboard;
+import org.encuestame.persistence.domain.dashboard.Gadget;
 import org.encuestame.persistence.domain.question.CatQuestionCategory;
 import org.encuestame.persistence.domain.question.Question;
 import org.encuestame.persistence.domain.question.QuestionAnswer;
         assertNotNull(tag.getHashTagId());
      }
 
-     /** HashTag domain. **/
+     /** HashTag hits domain. **/
      @Test
      public void testHashTagHits(){
         final Date hitDate = new Date();
         getHashTagDao().saveOrUpdate(tagHits);
         assertNotNull(tagHits.getHashTagId());
      }
+
+     /** Dashboard domain. **/
+     public void testDashboard(){
+        final Dashboard board = new Dashboard();
+        board.setPageBoardName("");
+        board.setDescription("");
+        board.setFavorite(Boolean.TRUE);
+        board.setFavoriteCounter(1);
+        board.setPageLayout("AAA");
+        board.setBoardSequence(1);
+        board.setUserBoard(createUserAccount("juan carlos", createAccount()));
+        board.getWidgetDashboard().add(createGadgetDefault());
+        getDashboardDao().saveOrUpdate(board);
+      }
+
+     /** Gadget domain **/
+     public void testGadget(){
+        final Gadget gadget = new Gadget();
+        gadget.setGadgetName("Notifications");
+        gadget.setGadgetType("Poll");
+        getDashboardDao().saveOrUpdate(gadget);
+     }
 }

encuestame-war/src/main/webapp/WEB-INF/spring/encuestame-hibernate-context.xml

                 <value>org.encuestame.persistence.domain.Attachment</value>
                 <value>org.encuestame.persistence.domain.HashTagHits</value>
                 <value>org.encuestame.persistence.domain.dashboard.Dashboard</value>
-                <value>org.encuestame.persistence.domain.dashboard.Widget</value>
-                <value>org.encuestame.persistence.domain.dashboard.WidgetProperties</value>
+                <value>org.encuestame.persistence.domain.dashboard.Gadget</value>
+                <value>org.encuestame.persistence.domain.dashboard.GadgetProperties</value>
             </list>
         </property>
         <property name="hibernateProperties">