Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor constants to interface in menu factories #7023

Merged
merged 23 commits into from
Jan 16, 2025

Conversation

pethers
Copy link
Member

@pethers pethers commented Jan 14, 2025

Move all constants to the MenuItemConstants interface and update subclasses to implement the interface.

  • Add MenuItemConstants interface in citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/MenuItemConstants.java to hold all constants.
  • Update CommitteeRankingMenuItemFactoryImpl to implement MenuItemConstants and remove constants from the class.
  • Update CountryMenuItemFactoryImpl to implement MenuItemConstants and remove constants from the class.
  • Update DocumentMenuItemFactoryImpl to implement MenuItemConstants and remove constants from the class.
  • Update GovernmentBodyMenuItemFactoryImpl to implement MenuItemConstants and remove constants from the class.

For more details, open the Copilot Workspace session.

Move all constants to the `MenuItemConstants` interface and update subclasses to implement the interface.

* Add `MenuItemConstants` interface in `citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/api/MenuItemConstants.java` to hold all constants.
* Update `CommitteeRankingMenuItemFactoryImpl` to implement `MenuItemConstants` and remove constants from the class.
* Update `CountryMenuItemFactoryImpl` to implement `MenuItemConstants` and remove constants from the class.
* Update `DocumentMenuItemFactoryImpl` to implement `MenuItemConstants` and remove constants from the class.
* Update `GovernmentBodyMenuItemFactoryImpl` to implement `MenuItemConstants` and remove constants from the class.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Hack23/cia?shareId=XXXX-XXXX-XXXX-XXXX).
Copy link

github-actions bot commented Jan 14, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 4215762.
Ensure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice.

OpenSSF Scorecard

PackageVersionScoreDetails
maven/io.smallrye:jandex 3.2.3 🟢 5.8
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 1Found 3/17 approved changesets -- score normalized to 1
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 9security policy file detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Branch-Protection🟢 8branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 100 existing vulnerabilities detected
maven/io.smallrye:jandex 🟢 5.8
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 1Found 3/17 approved changesets -- score normalized to 1
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 9security policy file detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Branch-Protection🟢 8branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 100 existing vulnerabilities detected
maven/io.smallrye:jandex 🟢 5.8
Details
CheckScoreReason
Maintained🟢 1030 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Code-Review⚠️ 1Found 3/17 approved changesets -- score normalized to 1
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 9security policy file detected
Packaging⚠️ -1packaging workflow not detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Branch-Protection🟢 8branch protection is not maximal on development and all release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
Vulnerabilities🟢 100 existing vulnerabilities detected

Scanned Files

  • parent-pom/pom.xml
  • service.data.impl/pom.xml
  • testfoundation/pom.xml

* **MenuItemConstants.java**
  - Add import for `ChartIndicators`
  - Prefix duplicate constant names with class names
  - Add missing symbols for `UserHomeMenuItemFactoryImpl`

* **CountryMenuItemFactoryImpl.java**
  - Update references to use constants from `MenuItemConstants`
  - Define missing symbols in `CountryMenuItemFactoryImpl`
…odyMenuItemFactoryImpl` and update references to use `MenuItemConstants`.

* Remove all constants from `CommitteeMenuItemFactoryImpl` and `GovernmentBodyMenuItemFactoryImpl`.
* Implement `MenuItemConstants` interface in `CommitteeMenuItemFactoryImpl`.
* Update references in `CommitteeMenuItemFactoryImpl` and `GovernmentBodyMenuItemFactoryImpl` to use constants from `MenuItemConstants`.
* Remove unused import in `UserHomeMenuItemFactoryImpl`.
… and `DocumentMenuItemFactoryImpl` to use `MenuItemConstants` interface

* **UserHomeMenuItemFactoryImpl**
  - Import `MenuItemConstants` interface
  - Update references to use constants from `MenuItemConstants`

* **CommitteeMenuItemFactoryImpl**
  - Import `MenuItemConstants` interface
  - Update references to use constants from `MenuItemConstants`

* **DocumentMenuItemFactoryImpl**
  - Import `MenuItemConstants` interface
  - Update references to use constants from `MenuItemConstants`
  - Remove all constants from `DocumentMenuItemFactoryImpl`

* **MenuItemConstants**
  - Add missing constants and commands
* Add constants for user events, roles, current members, member history, role ghant, documents, document history, ballots, ballot decision summary, decision summary, decision type daily summary, decision flow, country ranking, country overview, country indicators, country page visit history, by topic, data points, document details, document references, document decision, document attachments, government body ranking, government body overview, headcount, income, expenditure, ministry ranking, government bodies headcount, government bodies income, government bodies expenditure, and user home overview.
* Add corresponding descriptions for each constant.
* Add 'LIST' symbol in alphabetical order
* Add 'SEARCH' symbol in alphabetical order
…ses to use them

* **MenuItemConstants.java**
  - Add constants for menu items like `SWEDEN_DASHBOARD`, `COMMAND_COMMITTEE_RANKING_DATAGRID`, `COMMAND_DOCUMENTS`, etc.
  - Add descriptive text constants like `COMMITTEE_RANKING_TEXT`, `MINISTRIES_LEADER_SCOREBOARD`, etc.

* **AbstractMenuItemFactoryImpl.java**
  - Implement `MenuItemConstants` interface.
  - Remove local constants and use constants from `MenuItemConstants`.

* **ApplicationMenuItemFactoryImpl.java**
  - Implement `MenuItemConstants` interface.
  - Remove local constants and use constants from `MenuItemConstants`.
  - Update `createOverviewPage` method to use `SWEDEN_DASHBOARD` constant.
…Impl` class

* Remove constants from the class and use constants from `MenuItemConstants`
… class

* Remove constants from the class and use constants from `MenuItemConstants`
…ryImpl` and `PoliticianMenuItemFactoryImpl` classes

* Remove constants from `PartyRankingMenuItemFactoryImpl` and use constants from `MenuItemConstants`
* Remove constants from `PoliticianMenuItemFactoryImpl` and use constants from `MenuItemConstants`
…onstants`

* Replace hardcoded string "Useraccount" with `USERACCOUNT` constant
* Replace hardcoded string "User Home Overview" with `USER_HOME_OVERVIEW_TEXT` constant

Add `MenuItemConstants` interface with constants for menu items

* Define constants like `USERACCOUNT`, `USER_HOME_OVERVIEW_TEXT`, `COMMAND_APPLICATION_CONFIGURATION`, etc.
* Remove unused imports and redundant constants from the interface
* Organize constants into logical groups for better readability
* **Constants**: Add constants with unique names combining context and descriptive names.
* **Imports**: Add necessary imports for `PageModeMenuCommand`, `AdminViews`, `ApplicationPageMode`, `ChartIndicators`, `CommonsViews`, `DataSummaryPageMode`, `PageMode`, and `UserViews`.
* Add `HEADCOUNT` constant
* Add `COMMAND_GOVERNMENT_BODIES_HEADCOUNT` constant
* Add `COMMAND_GOVERNMENT_BODIES_INCOME` constant
* Add `COMMAND_GOVERNMENT_BODIES_EXPENDITURE` constant
* Add `GOVERNMENT_OUTCOME` constant
* Add `COMMAND_GOVERNMENT_OUTCOME` constant
* Add `GOVERNMENT_OUTCOME_DESCRIPTION` constant
* Add `GOVERNMENT_ROLES_CHART` constant
* Add `COMMAND_CHARTS_ALL_GOVERNMENT_ROLE_GANTT` constant
* Add `GOVERNMENT_ROLES_CHART_DESCRIPTION` constant
* Add `CURRENT_MINISTRIES_CURRENT_MEMBERS_TEXT` constant
* Add `COMMAND_CHARTS_CURRENT_MINISTRIES_BY_HEADCOUNT` constant
* Add `CURRENT_PARTIES_ACTIVE_IN_MINISTRIES_CURRENT_ASSIGNMENTS` constant
* Add `COMMAND_CHARTS_CURRENT_PARTIES_BY_HEADCOUNT` constant
* Add `ALL_PARTIES_TOTAL_DAYS_SERVED_IN_MINISTRIES` constant
* Add `COMMAND_CHARTS_ALLMINISTRIES_BY_TOTAL_DAYS` constant
* Add `ALL_MINISTRIES_TOTAL_MEMBERS` constant
* Add `COMMAND_CHARTS_ALL_MINISTRIES_BY_HEADCOUNT` constant
* Add `COMMAND_PAGEVISITHISTORY` constant
* Add `PARTY_WINNER` constant
* Add `COMMAND_CHARTS_PARTY_WINNER` constant
* Add `PARTY_WINNER_DESCRIPTION` constant
* Add `PARTY_GENDER` constant
* Add `COMMAND_CHARTS_PARTY_GENDER` constant
* Add `PARTY_GENDER_DESCRIPTION` constant
* Add `PARTY_AGE` constant
* Add `COMMAND_CHARTS_PARTY_AGE` constant
* Add `PARTY_AGE_DESCRIPTION` constant
* Add `RISK_SUMMARY` constant
* Add `COMMAND_RISK_SUMMARY` constant
* Add `RISK_SUMMARY_DESCRIPTION` constant
* Add `RULE_VIOLATIONS` constant
* Add `COMMAND_RULE_VIOLATION` constant
* Add `RULE_VIOLATIONS_DESCRIPTION` constant
* Add `DOCUMENT_ACTIVITY_BY_TYPE` constant
* Add `COMMAND_DOCUMENT_ACTIVITY` constant
* Add `DECISION_ACTIVITY_BY_TYPE` constant
* Add `COMMAND_DECISION_ACTIVITY` constant
* Add `DECISION_ACTIVITY_DESCRIPTION` constant
* Add `DECISION_FLOW` constant
* Add `COMMAND_CHARTS_DECISION_FLOW` constant
* Add `PARLIAMENT_RANKING_TEXT` constant
* Add `SWEDISH_PARLIAMENT_INDICATORS` constant
* Add `CURRENT_LEADERS` constant
* Add `CURRENT_LEADERS_DESCRIPTION` constant
* Add `LEADER_HISTORY` constant
* Add `LEADER_HISTORY_DESCRIPTION` constant
* Add `GOVERMENT_ROLES` constant
* Add `GOVERMENT_ROLES_DESCRIPTION` constant
* Add `COMMITTEE_ROLES` constant
* Add `COMMITTEE_ROLES_DESCRIPTION` constant
* Add constants for government bodies headcount, income, and expenditure
* Add constants for government outcome and its description
* Add constants for government roles chart and its description
* Add constants for current ministries and parties by headcount
* Add constants for all parties total days served in ministries
* Add constants for all ministries total members
* Add constants for party winner, gender, and age with their descriptions
* Add constants for risk summary and rule violations with their descriptions
* Add constants for document and decision activity by type with their descriptions
* Add constants for decision flow
* Add constants for parliament ranking and Swedish parliament indicators
* Add constants for current leaders and leader history with their descriptions
* Add constants for government and committee roles with their descriptions
…dConstants` instead of `MenuItemConstants`
…ry, decision, ministry, page visit, and admin functionalities
@pethers pethers merged commit 7fa1b30 into master Jan 16, 2025
7 checks passed
@pethers pethers deleted the pethers/refactor-constants branch January 16, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant