Anonymous avatar Anonymous committed e02b1cc

ENCUESTAME-570. Remove excess parameters

Comments (0)

Files changed (6)

enme-business/src/main/java/org/encuestame/business/service/AbstractSurveyService.java

      * @param userId user Id.
      * @return list of Tweet polls bean
      */
-    public List<TweetPollBean> getTweetsPollsByUserId(final Long userId, final Integer start, final Integer max){
-        final List<TweetPoll> tweetPolls = getTweetPollDao().retrieveTweetsByUserId(userId, null, null);
+    public List<TweetPollBean> getTweetsPollsByUserId(final Long userId,
+			final Integer maxResults, final Integer start,
+			final Boolean isCompleted, final Boolean isScheduled,
+			final Boolean isPublished, final Boolean isFavourite,
+			final Integer period){
+        final List<TweetPoll> tweetPolls = getTweetPollDao().retrieveTweetsByUserId(userId, maxResults, start, isCompleted, isScheduled, isPublished, isFavourite, period);
         final List<TweetPollBean> tweetPollsBean = new ArrayList<TweetPollBean>();
         for (TweetPoll tweetPoll : tweetPolls) {
             final TweetPollBean unitTweetPoll = ConvertDomainBean.convertTweetPollToBean(tweetPoll);

enme-business/src/main/java/org/encuestame/business/service/TweetPollService.java

      * @return list of Tweet polls bean
      * @throws EnMeNoResultsFoundException
      */
-    public List<TweetPollBean> getTweetsPollsByUserName(final String username,
-            final Integer maxResults,
-            final Integer start, final HttpServletRequest httpServletRequest) throws EnMeNoResultsFoundException{
+	public List<TweetPollBean> getTweetsPollsByUserName(final String username,
+			final HttpServletRequest httpServletRequest,
+			final TweetPollSearchBean tpollSearch)
+			throws EnMeNoResultsFoundException {
         log.debug("tweetPoll username: "+username);
         final List<TweetPoll> tweetPolls = getTweetPollDao()
-                .retrieveTweetsByUserId(
-                        getUserAccountId(username),
-                        maxResults,
-                        start);
-         log.info("tweetPoll size: "+tweetPolls.size());
+				.retrieveTweetsByUserId(getUserAccountId(username),
+						tpollSearch.getMax(), tpollSearch.getStart(),
+						tpollSearch.getIsComplete(),
+						tpollSearch.getIsScheduled(),
+						tpollSearch.getIsPublished(),
+						tpollSearch.getIsFavourite(), tpollSearch.getPeriod());
+		log.info("tweetPoll size: " + tweetPolls.size());
         return this.setTweetPollListAnswers(tweetPolls, Boolean.TRUE, httpServletRequest);
     }
 
         final List<TweetPollBean> list = new ArrayList<TweetPollBean>();
         if (TypeSearch.KEYWORD.equals(tpollSearch.getTypeSearch())) {
             list.addAll(this.searchTweetsPollsByKeyWord(getUserPrincipalUsername(),
-            		tpollSearch.getKeyword(), tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest, tpollSearch));
+            		tpollSearch.getKeyword(), httpServletRequest, tpollSearch));
         } else if (TypeSearch.BYOWNER.equals(tpollSearch.getTypeSearch())) {
-			list.addAll(this.getTweetsPollsByUserId(
-					getUserAccountId(getUserPrincipalUsername()),
-					tpollSearch.getStart(), tpollSearch.getMax()));
-
+			list.addAll(this.getTweetsPollsByUserName(getUserPrincipalUsername(), httpServletRequest, tpollSearch));
         } else if (TypeSearch.ALL.equals(tpollSearch.getTypeSearch())) {
             //TODO: this method return only the tweetpoll by owner.
-            list.addAll(this.getTweetsPollsByUserName(
-                    getUserPrincipalUsername(), tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest));
+			list.addAll(this.getTweetsPollsByUserName(getUserPrincipalUsername(),
+							httpServletRequest, tpollSearch));
         } else if (TypeSearch.LASTDAY.equals(tpollSearch.getTypeSearch())) {
-            list.addAll(this.searchTweetsPollsToday(getUserPrincipalUsername(),
-            		tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest, tpollSearch));
+			list.addAll(this.searchTweetsPollsToday(getUserPrincipalUsername(),
+					httpServletRequest, tpollSearch));
         } else if (TypeSearch.LASTWEEK.equals(tpollSearch.getTypeSearch())) {
             list.addAll(this.searchTweetsPollsLastWeek(
-                    getUserPrincipalUsername(), tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest, tpollSearch));
+                    getUserPrincipalUsername(), httpServletRequest, tpollSearch));
         } else if (TypeSearch.FAVOURITES.equals(tpollSearch.getTypeSearch())) {
             list.addAll(this.searchTweetsPollFavourites(
-                    getUserPrincipalUsername(), tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest, tpollSearch));
+                    getUserPrincipalUsername(), httpServletRequest, tpollSearch));
         } else if (TypeSearch.SCHEDULED.equals(tpollSearch.getTypeSearch())) {
             list.addAll(this.searchTweetsPollScheduled(
-                    getUserPrincipalUsername(), tpollSearch.getMax(), tpollSearch.getStart(), httpServletRequest, tpollSearch));
+                    getUserPrincipalUsername(), httpServletRequest, tpollSearch));
         } else {
             log.error("filterTweetPollByItemsByType no type");
             throw new EnMeExpcetion("filterTweetPollByItemsByType no type");
     public List<TweetPollBean> searchTweetsPollsByKeyWord(
                                final String username,
                                final String keyword,
-                               final Integer maxResults,
-                               final Integer start,
                                final HttpServletRequest httpServletRequest,
                                final TweetPollSearchBean tpollSearch) throws EnMeExpcetion{
     	 log.info("search keyword tweetPoll  "+keyword);
             throw new EnMeExpcetion("keyword is missing");
          } else {
              //TODO: migrate search to Hibernate Search.
-             tweetPolls = getTweetPollDao().retrieveTweetsByQuestionName(keyword, getUserAccountId(username), maxResults,
- 					start, tpollSearch.getIsComplete(),
+             tweetPolls = getTweetPollDao().retrieveTweetsByQuestionName(keyword, getUserAccountId(username), tpollSearch.getMax(),
+            		 tpollSearch.getStart(), tpollSearch.getIsComplete(),
  					tpollSearch.getIsScheduled(),
  					tpollSearch.getIsFavourite(),
  					tpollSearch.getIsPublished(), tpollSearch.getPeriod());
 	 */
     public List<TweetPollBean> searchTweetsPollsToday(
             final String username,
-            final Integer maxResults,
-            final Integer start,
             final HttpServletRequest httpServletRequest, final TweetPollSearchBean tpollSearch) throws EnMeExpcetion{
     	List<TweetPoll> tpSocial = new ArrayList<TweetPoll>();
     	final List<TweetPoll> tpolls = getTweetPollDao().retrieveTweetPollToday(
-    					getAccount(username), maxResults,
-						start, tpollSearch.getIsComplete(),
+    					getAccount(username), tpollSearch.getMax(),
+    					tpollSearch.getStart(), tpollSearch.getIsComplete(),
 						tpollSearch.getIsScheduled(),
 						tpollSearch.getIsFavourite(),
 						tpollSearch.getIsPublished(), tpollSearch.getKeyword(), tpollSearch.getPeriod());
 	 * org.encuestame.utils.web.search.TweetPollSearchBean)
 	 */
 	public List<TweetPollBean> searchTweetsPollsLastWeek(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion {
 		List<TweetPoll> tpSocial = new ArrayList<TweetPoll>();
 		final List<TweetPoll> tpbeanlast = getTweetPollDao()
-				.retrieveTweetPollLastWeek(getAccount(username), maxResults,
-						start, tpollSearch.getIsComplete(),
+				.retrieveTweetPollLastWeek(getAccount(username), tpollSearch.getMax(),
+						tpollSearch.getStart(), tpollSearch.getIsComplete(),
 						tpollSearch.getIsScheduled(),
 						tpollSearch.getIsFavourite(),
 						tpollSearch.getIsPublished(), tpollSearch.getKeyword(),
 	 * org.encuestame.utils.web.search.TweetPollSearchBean)
 	 */
 	public List<TweetPollBean> searchTweetsPollFavourites(
-			final String username, final Integer maxResults,
-			final Integer start, final HttpServletRequest httpServletRequest,
+			final String username, final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion {
     	List<TweetPoll> tpSocial = new ArrayList<TweetPoll>();
     	final List<TweetPoll> favouriteTweetPolls = getTweetPollDao().retrieveFavouritesTweetPoll(
-				getAccount(username), maxResults,
-				start, tpollSearch.getIsComplete(),
+				getAccount(username), tpollSearch.getMax(),
+				tpollSearch.getStart(), tpollSearch.getIsComplete(),
 				tpollSearch.getIsScheduled(),
 				tpollSearch.getIsFavourite(),
 				tpollSearch.getIsPublished(), tpollSearch.getKeyword(), tpollSearch.getPeriod());
 	 * org.encuestame.utils.web.search.TweetPollSearchBean)
 	 */
 	public List<TweetPollBean> searchTweetsPollScheduled(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion {
 		List<TweetPoll> tpSocial = new ArrayList<TweetPoll>();
 		final List<TweetPoll> tpoll = getTweetPollDao()
 				.retrieveScheduledTweetPoll(getUserAccountId(username),
-						maxResults, start, tpollSearch.getIsComplete(),
+						tpollSearch.getMax(), tpollSearch.getStart(), tpollSearch.getIsComplete(),
 						tpollSearch.getIsScheduled(),
 						tpollSearch.getIsFavourite(),
 						tpollSearch.getIsPublished(), tpollSearch.getKeyword(),

enme-business/src/test/java/org/encuestame/test/business/service/TestTweetPollService.java

         createTweetPollPublicated(true, true, new Date(), this.userAccount, question1);
         createTweetPollPublicated(true, true, new Date(), this.userAccount, question2);
         final UserAccount secUser = createUserAccount("diana", this.user);
-        final List<TweetPollBean> tweetPollsByUser = this.tweetPollService.getTweetsPollsByUserName(
-                secUser.getUsername(), 5, 0, null);
+        final List<TweetPollBean> tweetPollsByUser = this.tweetPollService.getTweetsPollsByUserName(secUser.getUsername(), null, null);
+                //secUser.getUsername(), 5, 0, null);
         //assertEquals("Should be equals", 2 , tweetPollsByUser.size());
     }
 

enme-core/src/main/java/org/encuestame/core/service/imp/ITweetPollService.java

      * @throws EnMeExpcetion
      */
 	List<TweetPollBean> searchTweetsPollsByKeyWord(final String username,
-			final String keyword, final Integer maxResults,
-			final Integer start, final HttpServletRequest httpServletRequest,
+			final String keyword, final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch)
 			throws EnMeNoResultsFoundException, EnMeExpcetion;
 
     List<TweetPollResultsBean> getResultsByTweetPollId(final Long tweetPollId) throws EnMeNoResultsFoundException;
 
     /**
-     *
-     * @param username username
-     * @return
-     * @throws EnMeNoResultsFoundException
-     */
-    List<TweetPollBean> getTweetsPollsByUserName(final String username,
-            final Integer maxResults, final Integer start, final HttpServletRequest httpServletRequest) throws EnMeNoResultsFoundException;
-
+	 *
+	 * @param username
+	 *            username
+	 * @return
+	 * @throws EnMeNoResultsFoundException
+	 */
+	List<TweetPollBean> getTweetsPollsByUserName(final String username, final HttpServletRequest httpServletRequest,
+			final TweetPollSearchBean tpollSearch)
+			throws EnMeNoResultsFoundException;
 
 
     /**
      * @throws EnMeExpcetion
      */
 	List<TweetPollBean> searchTweetsPollScheduled(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion;
 
      * @throws EnMeExpcetion
      */
     List<TweetPollBean> searchTweetsPollFavourites(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion;
 
      * @throws EnMeExpcetion
      */
 	List<TweetPollBean> searchTweetsPollsLastWeek(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion;
 
      * @throws EnMeExpcetion
      */
     List<TweetPollBean> searchTweetsPollsToday(final String username,
-			final Integer maxResults, final Integer start,
 			final HttpServletRequest httpServletRequest,
 			final TweetPollSearchBean tpollSearch) throws EnMeExpcetion;
 

enme-persistence/enme-dao/src/main/java/org/encuestame/persistence/dao/ITweetPoll.java

      * @param userId userId
      * @return list of tweet pools.
      */
-     List<TweetPoll> retrieveTweetsByUserId(final Long userId,
-             final Integer maxResults,
-             final Integer start);
+	List<TweetPoll> retrieveTweetsByUserId(final Long userId,
+			final Integer maxResults, final Integer start,
+			final Boolean isCompleted, final Boolean isScheduled,
+			final Boolean isPublished, final Boolean isFavourite,
+			final Integer period);
 
      /**
       * Retrieve Tweets Poll Switch.

enme-persistence/enme-dao/src/main/java/org/encuestame/persistence/dao/imp/TweetPollDao.java

      * @return list of tweet pools.
      */
     @SuppressWarnings("unchecked")
-    public List<TweetPoll> retrieveTweetsByUserId(
-    		final Long userId,
-            final Integer maxResults,
-            final Integer start) {
+	public List<TweetPoll> retrieveTweetsByUserId(final Long userId,
+			final Integer maxResults, final Integer start,
+			final Boolean isCompleted, final Boolean isScheduled,
+			final Boolean isPublished, final Boolean isFavourite,
+			final Integer period) {
         final DetachedCriteria criteria = DetachedCriteria
                 .forClass(TweetPoll.class);
         criteria.createAlias("tweetOwner", "tweetOwner");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.