r3136 - in branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui: . actions actions/admin actions/json actions/user
Author: tchemit Date: 2012-02-22 13:08:44 +0100 (Wed, 22 Feb 2012) New Revision: 3136 Url: http://chorem.org/repositories/revision/pollen/3136 Log: reformat use favoritService instead of Userservice when possible Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManagePolls.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteListPollAccounts.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenApplicationContext.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -37,7 +37,7 @@ protected PollenConfiguration configuration; protected TopiaContext rootContext; - + protected URL applicationUrl; public PollenConfiguration getConfiguration() { Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/PollenUIUtils.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -56,14 +56,14 @@ // get port String port; if ("http".equalsIgnoreCase(request.getScheme()) && request.getServerPort() != 80 || - "https".equalsIgnoreCase(request.getScheme()) && request.getServerPort() != 443) { + "https".equalsIgnoreCase(request.getScheme()) && request.getServerPort() != 443) { port = ":" + request.getServerPort(); } else { port = ""; } String applicationBase = request.getScheme() + "://" + request.getServerName() + - port + request.getContextPath(); + port + request.getContextPath(); try { return new URL(applicationBase); } catch (MalformedURLException e) { Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/PollenActionSupport.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -30,9 +30,9 @@ import org.apache.struts2.ServletActionContext; import org.apache.struts2.StrutsStatics; import org.chorem.pollen.PollenConfiguration; +import org.chorem.pollen.services.DefaultPollenServiceContext; import org.chorem.pollen.services.PollenService; import org.chorem.pollen.services.PollenServiceContext; -import org.chorem.pollen.services.DefaultPollenServiceContext; import org.chorem.pollen.services.PollenServiceFactory; import org.chorem.pollen.ui.PollenApplicationContext; import org.chorem.pollen.ui.PollenSession; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManagePolls.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManagePolls.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/admin/ManagePolls.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -26,7 +26,6 @@ import org.chorem.pollen.ui.actions.PollenActionSupport; /** - * * @author tchemit <chemit@codelutin.com> * @since 1.2.6 */ Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/AbstractJSONPaginedAction.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -26,8 +26,8 @@ import org.apache.commons.lang3.StringUtils; import org.apache.struts2.json.JSONException; import org.apache.struts2.json.JSONUtil; -import org.chorem.pollen.services.PollenPagerBean; import org.chorem.pollen.ui.actions.PollenActionSupport; +import org.nuiton.web.struts2.FilterPagerUtil; /** * Abstract JSON action with pagination support. @@ -47,7 +47,8 @@ public abstract Integer getRecords(); - protected PollenPagerBean pager = new PollenPagerBean(); + protected FilterPagerUtil.FilterPagerBean pager = + FilterPagerUtil.newFilterPagerBean(); protected String filters; Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteList.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteList.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -25,7 +25,7 @@ import com.google.common.collect.Maps; import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.services.impl.FavoriteService; import org.chorem.pollen.ui.actions.PollenActionSupport; import java.util.Map; @@ -59,10 +59,10 @@ @Override public String execute() throws Exception { - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); PersonList personList = - userService.getEntityById(PersonList.class, favoriteListId); + service.getEntityById(PersonList.class, favoriteListId); favoriteList = Maps.newHashMap(); favoriteList.put("id", personList.getTopiaId()); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteListPollAccounts.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteListPollAccounts.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteListPollAccounts.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -26,7 +26,7 @@ import org.chorem.pollen.business.persistence.PersonList; import org.chorem.pollen.business.persistence.PollAccount; import org.chorem.pollen.entities.PollenBinderHelper; -import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.services.impl.FavoriteService; import org.nuiton.util.beans.Binder; import java.util.List; @@ -81,12 +81,12 @@ @Override public String execute() throws Exception { - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); PersonList favoriteList = - userService.getEntityById(PersonList.class, favoriteListId); + service.getEntityById(PersonList.class, favoriteListId); - List<PollAccount> allPollAccounts = userService.getFavoriteListUsers( + List<PollAccount> allPollAccounts = service.getFavoriteListUsers( favoriteList, pager); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/json/GetFavoriteLists.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -25,7 +25,7 @@ import com.google.common.collect.Maps; import org.chorem.pollen.business.persistence.PersonList; -import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.services.impl.FavoriteService; import java.util.List; import java.util.Map; @@ -69,9 +69,9 @@ @Override public String execute() throws Exception { - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); - List<PersonList> allFavoriteLists = userService.getFavoriteLists( + List<PersonList> allFavoriteLists = service.getFavoriteLists( getPollenSession().getUserAccount(), pager); Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteList.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -30,7 +30,7 @@ import org.chorem.pollen.services.exceptions.FavoriteListNotFoundException; import org.chorem.pollen.services.exceptions.FavoriteListNotOwnedByUserException; import org.chorem.pollen.services.exceptions.ParticipantAlreadyFoundInListException; -import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.services.impl.FavoriteService; import org.chorem.pollen.ui.actions.PollenActionSupport; /** @@ -93,10 +93,10 @@ Preconditions.checkNotNull(favoriteListId); - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); try { - favoriteList = userService.getFavoriteList( + favoriteList = service.getFavoriteList( getPollenSession().getUserAccount(), favoriteListId); } catch (FavoriteListNotFoundException e) { addActionError(_("pollen.error.favoriteList.not.found")); @@ -112,12 +112,11 @@ String result = INPUT; + FavoriteService service = newService(FavoriteService.class); - UserService userService = newService(UserService.class); - try { - userService.addPollAccountToFavoriteList(favoriteList, pollAccount); + service.addPollAccountToFavoriteList(favoriteList, pollAccount); getTransaction().commitTransaction(); addActionMessage( @@ -141,12 +140,11 @@ String result = INPUT; + FavoriteService service = newService(FavoriteService.class); - UserService userService = newService(UserService.class); - try { - userService.editPollAccountToFavoriteList(favoriteList, pollAccount); + service.editPollAccountToFavoriteList(favoriteList, pollAccount); getTransaction().commitTransaction(); addActionMessage( @@ -169,9 +167,9 @@ Preconditions.checkNotNull(pollAccount); Preconditions.checkNotNull(pollAccount.getTopiaId()); - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); - userService.removePollAccountToFavoriteList(favoriteList, pollAccount); + service.removePollAccountToFavoriteList(favoriteList, pollAccount); getTransaction().commitTransaction(); addActionMessage( @@ -186,8 +184,8 @@ protected PollAccount getPollAccount() { if (pollAccount == null) { - UserService userService = newService(UserService.class); - pollAccount = userService.newPollAccountForFavoriteList(); + FavoriteService service = newService(FavoriteService.class); + pollAccount = service.newPollAccountForFavoriteList(); } return pollAccount; } Modified: branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java =================================================================== --- branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java 2012-02-22 12:07:31 UTC (rev 3135) +++ branches/pollen-1.2.6-struts2/pollen-ui-struts2/src/main/java/org/chorem/pollen/ui/actions/user/ManageFavoriteLists.java 2012-02-22 12:08:44 UTC (rev 3136) @@ -26,7 +26,7 @@ import com.google.common.base.Preconditions; import org.chorem.pollen.business.persistence.PersonList; import org.chorem.pollen.services.exceptions.FavoriteListAlreadyExistException; -import org.chorem.pollen.services.impl.UserService; +import org.chorem.pollen.services.impl.FavoriteService; import org.chorem.pollen.ui.actions.PollenActionSupport; import java.io.File; @@ -100,10 +100,10 @@ Preconditions.checkNotNull(favoriteList.getName()); String result = INPUT; - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); try { - userService.createFavoriteList(getPollenSession().getUserAccount(), - favoriteList.getName()); + service.createFavoriteList(getPollenSession().getUserAccount(), + favoriteList.getName()); getTransaction().commitTransaction(); addActionMessage(_("pollen.information.favoriteList.created", @@ -122,10 +122,10 @@ Preconditions.checkNotNull(favoriteList); - UserService userService = newService(UserService.class); + FavoriteService service = newService(FavoriteService.class); - PersonList deletedFavoritedList = userService.deleteFavoriteList(getPollenSession().getUserAccount(), - favoriteList); + PersonList deletedFavoritedList = service.deleteFavoriteList(getPollenSession().getUserAccount(), + favoriteList); getTransaction().commitTransaction(); addActionMessage(_("pollen.information.favoriteList.deleted", @@ -137,7 +137,7 @@ protected PersonList getFavoriteList() { if (favoriteList == null) { - favoriteList = newService(UserService.class).newFavoriteList(); + favoriteList = newService(FavoriteService.class).newFavoriteList(); } return favoriteList; }
participants (1)
-
tchemit@users.chorem.org