Last active
February 3, 2020 10:13
-
-
Save krfong916/2e2d8e45cde94654d4fd70e72fbc1562 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class GetReportsByOrganizationUseCase { | |
| private int userOrganization; | |
| private int requestedOrganization; | |
| private ArrayList<Reports> result = new ArrayList<>(); | |
| constructor(userOrganization, requestedOrganization) { | |
| this.userOrganization = userOrganization; | |
| this.requestedOrganization = requestedOrganization; | |
| } | |
| public void getReportsByOrganizationUseCase() { | |
| try { | |
| if (sameOrganization(userOrganization, requestedOrganization)) { | |
| result = getAllReportsByOrganization(requestedOrganization); | |
| } else { | |
| result = getPublicReportsByOrganization(requestedOrganization); | |
| } | |
| return result; | |
| } catch () { | |
| throw new Exception(); | |
| } | |
| } | |
| } | |
| // Usage | |
| // ... | |
| // UseCase useCaseInstance = new GetReportsByOrganizationUseCase(userOrganization, requestedOrganization); | |
| // reportsByOrganization = useCaseInstance.getReportsByOrganizationUseCase(); | |
| // reports = reports.createDomainObject(reportsByOrganization) | |
| // return reports; | |
| // ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment