From 435f157ee43288f57cc080cf9b68a80d5131197c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?James=20Pether=20S=C3=B6rling?= Date: Mon, 27 Jan 2025 00:22:53 +0100 Subject: [PATCH] partyranking cleanup (#7110) --- .../PageCommandPartyRankingConstants.java | 62 ++++++++----------- .../impl/ApplicationMenuItemFactoryImpl.java | 7 ++- .../impl/PartyRankingMenuItemFactoryImpl.java | 4 +- .../party/pagemode/PartyViewConstants.java | 9 +++ ...artiesChartsPageModContentFactoryImpl.java | 7 +-- ...mitteeChartsPageModContentFactoryImpl.java | 7 +-- ...rnmentChartsPageModContentFactoryImpl.java | 7 +-- ...artiesChartsPageModContentFactoryImpl.java | 7 +-- ...erScoreboardPageModContentFactoryImpl.java | 7 +-- ...kingDataGridPageModContentFactoryImpl.java | 5 +- ...kingOverviewPageModContentFactoryImpl.java | 5 +- ...VisitHistoryPageModContentFactoryImpl.java | 5 +- .../pagemode/PartyRankingViewConstants.java | 9 +++ .../user/party/UserPartyTest.java | 4 +- 14 files changed, 68 insertions(+), 77 deletions(-) create mode 100644 citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/party/pagemode/PartyViewConstants.java create mode 100644 citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingViewConstants.java diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/pagecommands/PageCommandPartyRankingConstants.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/pagecommands/PageCommandPartyRankingConstants.java index 2838bb7070..368b1b37fa 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/pagecommands/PageCommandPartyRankingConstants.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/pagecommands/PageCommandPartyRankingConstants.java @@ -10,66 +10,56 @@ */ public interface PageCommandPartyRankingConstants { - /** The command parties link. */ - PageModeMenuCommand COMMAND_PARTIES_LINK = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.DATAGRID); - - /** The command party ranking all members. */ - PageModeMenuCommand COMMAND_PARTY_RANKING_ALL_MEMBERS = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, "allmembers"); - - /** The command party ranking current members. */ - PageModeMenuCommand COMMAND_PARTY_RANKING_CURRENT_MEMBERS = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, "currentmembers"); - /** The command charts current government parties. */ PageModeMenuCommand COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES = new PageModeMenuCommand( UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.CURRENTGOVERMENTPARTIES.toString()); - /** The command charts party winner. */ - PageModeMenuCommand COMMAND_CHARTS_PARTY_WINNER = new PageModeMenuCommand( + /** The command charts party age. */ + PageModeMenuCommand COMMAND_CHARTS_PARTY_AGE = new PageModeMenuCommand( UserViews.PARLIAMENT_RANKING_VIEW_NAME, - PageMode.CHARTS, ChartIndicators.PARTYWINNER.toString()); + PageMode.CHARTS, ChartIndicators.PARTYAGE.toString()); /** The command charts party gender. */ PageModeMenuCommand COMMAND_CHARTS_PARTY_GENDER = new PageModeMenuCommand( UserViews.PARLIAMENT_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.PARTYGENDER.toString()); - /** The command charts party age. */ - PageModeMenuCommand COMMAND_CHARTS_PARTY_AGE = new PageModeMenuCommand( + /** The command charts party winner. */ + PageModeMenuCommand COMMAND_CHARTS_PARTY_WINNER = new PageModeMenuCommand( UserViews.PARLIAMENT_RANKING_VIEW_NAME, - PageMode.CHARTS, ChartIndicators.PARTYAGE.toString()); + PageMode.CHARTS, ChartIndicators.PARTYWINNER.toString()); - /** The party ranking command pagevisit history. */ - PageModeMenuCommand PARTY_RANKING_COMMAND_PAGEVISIT_HISTORY = - new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.PAGEVISITHISTORY); + /** The command party leader scoreboard. */ + PageModeMenuCommand COMMAND_PARTY_LEADER_SCOREBOARD = new PageModeMenuCommand( + UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.CURRENTPARTYLEADERSCORECARD.toString()); - /** The command party ranking overview. */ - PageModeMenuCommand COMMAND_PARTY_RANKING_OVERVIEW = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.OVERVIEW); + /** The command party ranking charts all parties. */ + PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES = new PageModeMenuCommand( + UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.ALLPARTIES.toString()); + + /** The command party ranking charts current committees. */ + PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_COMMITTEES = new PageModeMenuCommand( + UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.CURRENTCOMMITTEES.toString()); + + /** The command party ranking charts current parties. */ + PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES = new PageModeMenuCommand( + UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.CURRENTPARTIES.toString()); /** The command party ranking datagrid. */ PageModeMenuCommand COMMAND_PARTY_RANKING_DATAGRID = new PageModeMenuCommand( UserViews.PARTY_RANKING_VIEW_NAME, PageMode.DATAGRID); - /** The command party leader scoreboard. */ - PageModeMenuCommand COMMAND_PARTY_LEADER_SCOREBOARD = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "PARTYLEADERSCOREBOARD"); + /** The command party ranking overview. */ + PageModeMenuCommand COMMAND_PARTY_RANKING_OVERVIEW = new PageModeMenuCommand( + UserViews.PARTY_RANKING_VIEW_NAME, PageMode.OVERVIEW); - /** The command party ranking charts current parties. */ - PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "CURRENT_PARTIES"); - /** The command party ranking charts all parties. */ - PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "ALL_PARTIES"); - /** The command charts current parties leader scoreboard. */ - PageModeMenuCommand COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD = new PageModeMenuCommand( - UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "CURRENT_PARTIES_LEADER_SCOREBOARD"); + /** The party ranking command pagevisit history. */ + PageModeMenuCommand PARTY_RANKING_COMMAND_PAGEVISIT_HISTORY = + new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.PAGEVISITHISTORY); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/ApplicationMenuItemFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/ApplicationMenuItemFactoryImpl.java index 50c912471c..b94bcaefa3 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/ApplicationMenuItemFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/ApplicationMenuItemFactoryImpl.java @@ -24,6 +24,7 @@ import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.PartyRankingMenuItemFactory; import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.PoliticianRankingMenuItemFactory; import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandMainViewConstants; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPoliticianConstants; import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandUserConstants; import com.hack23.cia.web.impl.ui.application.views.common.rows.RowUtil; @@ -90,7 +91,7 @@ public void addRankingMenu(final MenuBar menuBar) { rankingsMenuItem.addItem(MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY, PageCommandUserConstants.COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD); rankingsMenuItem.addItem(PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, - COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD); + COMMAND_PARTY_LEADER_SCOREBOARD); final MenuItem countryMenuItem = rankingsMenuItem.addItem(COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG, COMMAND_COUNTRY_RANKING_OVERVIEW); @@ -146,7 +147,7 @@ public MenuBar createMainPageMenuBar(final MenuBar menuBar) { @Override public void createOverviewPage(final VerticalLayout panelContent) { final ResponsiveRow grid = RowUtil.createGridLayout(panelContent); - createButtonLink(grid, SWEDEN_DASHBOARD, VaadinIcons.FLAG, COMMAND_DASHBOARDVIEW_OVERVIEW, "Visualize political activity in Sweden, present key performance indicators and metadata"); createButtonLink(grid, MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD, MINISTRIES_LEADER_SCOREBOARD_DESCRIPTION); createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); createButtonLink(grid, COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG, COMMAND_COUNTRY_RANKING_OVERVIEW, COUNTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRY_RANKING_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRY_RANKING_OVERVIEW, MINISTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRIES_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRIES_LINK, MINISTRIES_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODY_RANKING, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_OVERVIEW, GOVERNMENT_BODY_RANKING_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODIES, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_DATAGRID, GOVERNMENT_BODIES_DESCRIPTION); createButtonLink(grid, PARLIAMENT_RANKING_LINK_TEXT, VaadinIcons.INSTITUTION, COMMAND_PARLIAMENT_RANKING_OVERVIEW, PARLIAMENT_RANKING_DESCRIPTION); + createButtonLink(grid, SWEDEN_DASHBOARD, VaadinIcons.FLAG, COMMAND_DASHBOARDVIEW_OVERVIEW, "Visualize political activity in Sweden, present key performance indicators and metadata"); createButtonLink(grid, MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD, MINISTRIES_LEADER_SCOREBOARD_DESCRIPTION); createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_PARTY_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); createButtonLink(grid, COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG, COMMAND_COUNTRY_RANKING_OVERVIEW, COUNTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRY_RANKING_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRY_RANKING_OVERVIEW, MINISTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRIES_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRIES_LINK, MINISTRIES_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODY_RANKING, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_OVERVIEW, GOVERNMENT_BODY_RANKING_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODIES, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_DATAGRID, GOVERNMENT_BODIES_DESCRIPTION); createButtonLink(grid, PARLIAMENT_RANKING_LINK_TEXT, VaadinIcons.INSTITUTION, COMMAND_PARLIAMENT_RANKING_OVERVIEW, PARLIAMENT_RANKING_DESCRIPTION); createButtonLink(grid, COMMITTEE_RANKING_LINK_TEXT, VaadinIcons.GROUP, COMMAND_COMMITTEE_RANKING_OVERVIEW, COMMITTEE_RANKING_DESCRIPTION); createButtonLink(grid, COMMITTEES_LINK_TEXT, VaadinIcons.GROUP, @@ -155,7 +156,7 @@ public void createOverviewPage(final VerticalLayout panelContent) { createButtonLink(grid, PARTY_RANKING_LINK_TEXT, VaadinIcons.USERS, COMMAND_PARTY_RANKING_OVERVIEW, PARTY_RANKING_DESCRIPTION); createButtonLink(grid, PARTIES_LINK_TEXT, VaadinIcons.USERS, - COMMAND_PARTIES_LINK, + PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID, PARTIES_DESCRIPTION); createButtonLink(grid, POLITICIAN_RANKING_LINK_TEXT, VaadinIcons.USER, POLITICIAN_RANKING_COMMAND_DATAGRID, POLITICIAN_RANKING_DESCRIPTION); diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/PartyRankingMenuItemFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/PartyRankingMenuItemFactoryImpl.java index 64d8e35b74..618fbd9c3f 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/PartyRankingMenuItemFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/PartyRankingMenuItemFactoryImpl.java @@ -69,7 +69,7 @@ public void createOverviewPage(final VerticalLayout panelContent) { final ResponsiveRow grid = RowUtil.createGridLayout(panelContent); createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, - COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); + COMMAND_PARTY_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); createButtonLink(grid, TOTAL_MEMBERS, VaadinIcons.USERS, PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID, DESC_ALL_PARTIES_ROLES); @@ -125,7 +125,7 @@ public void createPartyRankingTopics(final MenuItem partynMenuItem) { partynMenuItem.addItem(OVERVIEW_TEXT, VaadinIcons.DASHBOARD, PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_OVERVIEW); partynMenuItem.addItem(PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, - COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD); + COMMAND_PARTY_LEADER_SCOREBOARD); // Total members using USERS icon for multiple people final MenuItem listItem = partynMenuItem.addItem(TOTAL_MEMBERS, VaadinIcons.USERS, PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID); diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/party/pagemode/PartyViewConstants.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/party/pagemode/PartyViewConstants.java new file mode 100644 index 0000000000..8af54ac87f --- /dev/null +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/party/pagemode/PartyViewConstants.java @@ -0,0 +1,9 @@ +package com.hack23.cia.web.impl.ui.application.views.user.party.pagemode; + +/** + * The Interface PartyViewConstants. + */ +public interface PartyViewConstants { + +} + diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingAllPartiesChartsPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingAllPartiesChartsPageModContentFactoryImpl.java index 085b2f1ae0..25572002c0 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingAllPartiesChartsPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingAllPartiesChartsPageModContentFactoryImpl.java @@ -18,7 +18,6 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -27,10 +26,9 @@ import com.hack23.cia.web.impl.ui.application.action.ViewAction; import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager; import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Layout; @@ -93,8 +91,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString()) - && parameters.contains(ChartIndicators.ALLPARTIES.toString()); + return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES.matches(page, parameters); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentCommitteeChartsPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentCommitteeChartsPageModContentFactoryImpl.java index 92f7f3d029..639da9d8da 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentCommitteeChartsPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentCommitteeChartsPageModContentFactoryImpl.java @@ -18,7 +18,6 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -27,10 +26,9 @@ import com.hack23.cia.web.impl.ui.application.action.ViewAction; import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager; import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Layout; @@ -92,8 +90,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString()) - && parameters.contains(ChartIndicators.CURRENTCOMMITTEES.toString()); + return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_CURRENT_COMMITTEES.matches(page, parameters); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentGovernmentChartsPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentGovernmentChartsPageModContentFactoryImpl.java index 71f39cbf3a..75554307d9 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentGovernmentChartsPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentGovernmentChartsPageModContentFactoryImpl.java @@ -18,7 +18,6 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -27,10 +26,9 @@ import com.hack23.cia.web.impl.ui.application.action.ViewAction; import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager; import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Layout; @@ -93,8 +91,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString()) - && parameters.contains(ChartIndicators.CURRENTGOVERMENTPARTIES.toString()); + return PageCommandPartyRankingConstants.COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES.matches(page, parameters); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesChartsPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesChartsPageModContentFactoryImpl.java index e46fadba5c..a871e4cd7a 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesChartsPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesChartsPageModContentFactoryImpl.java @@ -18,7 +18,6 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -27,10 +26,9 @@ import com.hack23.cia.web.impl.ui.application.action.ViewAction; import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager; import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.HorizontalLayout; import com.vaadin.ui.Layout; @@ -94,8 +92,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString()) - && parameters.contains(ChartIndicators.CURRENTPARTIES.toString()); + return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES.matches(page, parameters); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesLeaderScoreboardPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesLeaderScoreboardPageModContentFactoryImpl.java index 38cc0c024c..ab63f643b5 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesLeaderScoreboardPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingCurrentPartiesLeaderScoreboardPageModContentFactoryImpl.java @@ -22,7 +22,6 @@ import java.util.Map; import java.util.stream.Collectors; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -35,13 +34,12 @@ import com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualOutcomeSummary; import com.hack23.cia.service.external.esv.api.GovernmentBodyAnnualSummary; import com.hack23.cia.web.impl.ui.application.action.ViewAction; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.LeaderCardUtil; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.PartyLeaderUtil; import com.hack23.cia.web.impl.ui.application.views.common.rows.RowUtil; import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.jarektoro.responsivelayout.ResponsiveRow; import com.vaadin.ui.HorizontalLayout; @@ -162,8 +160,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina */ @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString()) - && parameters.contains(ChartIndicators.CURRENTPARTYLEADERSCORECARD.toString()); + return PageCommandPartyRankingConstants.COMMAND_PARTY_LEADER_SCOREBOARD.matches(page, parameters); } } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingDataGridPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingDataGridPageModContentFactoryImpl.java index d49d54c402..baeca2ce29 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingDataGridPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingDataGridPageModContentFactoryImpl.java @@ -18,7 +18,6 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Service; @@ -27,8 +26,8 @@ import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup; import com.hack23.cia.service.api.DataContainer; import com.hack23.cia.web.impl.ui.application.action.ViewAction; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener; import com.vaadin.ui.Layout; @@ -161,7 +160,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina */ @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters, PageMode.DATAGRID.toString()); + return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID.matches(page, parameters); } } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingOverviewPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingOverviewPageModContentFactoryImpl.java index f5a18992fb..93ac478c36 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingOverviewPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingOverviewPageModContentFactoryImpl.java @@ -18,14 +18,13 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Component; import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup; import com.hack23.cia.web.impl.ui.application.action.ViewAction; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.Layout; import com.vaadin.ui.MenuBar; @@ -71,7 +70,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && (StringUtils.isEmpty(parameters) || parameters.contains(PageMode.OVERVIEW.toString())); + return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_OVERVIEW.matches(page, parameters); } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingPageVisitHistoryPageModContentFactoryImpl.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingPageVisitHistoryPageModContentFactoryImpl.java index f4953f15ca..f8e7b94067 100644 --- a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingPageVisitHistoryPageModContentFactoryImpl.java +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingPageVisitHistoryPageModContentFactoryImpl.java @@ -18,14 +18,13 @@ */ package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; -import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.annotation.Secured; import org.springframework.stereotype.Component; import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup; import com.hack23.cia.web.impl.ui.application.action.ViewAction; +import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants; import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil; -import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode; import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews; import com.vaadin.ui.Layout; import com.vaadin.ui.MenuBar; @@ -72,7 +71,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina @Override public boolean matches(final String page, final String parameters) { - return NAME.equals(page) && StringUtils.contains(parameters,PageMode.PAGEVISITHISTORY.toString()); + return PageCommandPartyRankingConstants.PARTY_RANKING_COMMAND_PAGEVISIT_HISTORY.matches(page, parameters); } } diff --git a/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingViewConstants.java b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingViewConstants.java new file mode 100644 index 0000000000..3c89e0b5ac --- /dev/null +++ b/citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/user/partyranking/pagemode/PartyRankingViewConstants.java @@ -0,0 +1,9 @@ +package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode; + +/** + * The Interface PartyRankingViewConstants. + */ +public interface PartyRankingViewConstants { + +} + diff --git a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/user/party/UserPartyTest.java b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/user/party/UserPartyTest.java index aaf9c8ba11..6b0429c07e 100644 --- a/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/user/party/UserPartyTest.java +++ b/citizen-intelligence-agency/src/test/java/com/hack23/cia/systemintegrationtest/user/party/UserPartyTest.java @@ -90,11 +90,11 @@ public void verifyPartyAgePage() throws Exception { */ @Test(timeout = DEFAULT_TIMEOUT) public void verifyPartiesLinkPage() throws Exception { - pageVisit.visitDirectPage(PageCommandPartyRankingConstants.COMMAND_PARTIES_LINK); + pageVisit.visitDirectPage(PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID); pageVisit.verifyViewContent("All Parties Charts", "Party Performance", "Analyze the performance of all political parties using various charts."); - pageVisit.validatePage(PageCommandPartyRankingConstants.COMMAND_PARTIES_LINK); + pageVisit.validatePage(PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID); } /**