-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maven: maven fmt:format method, also deleted databaseManagerTest
- Loading branch information
AdrianBalunan
committed
Apr 13, 2026
1 parent
ff29284
commit d400748
Showing
16 changed files
with
76 additions
and
237 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
3 changes: 1 addition & 2 deletions
3
...application/src/main/java/ntnu/systemutvikling/team6/models/registry/CharityRegistry.java
This file contains 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
3 changes: 1 addition & 2 deletions
3
...pplication/src/main/java/ntnu/systemutvikling/team6/models/registry/DonationRegistry.java
This file contains 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
67 changes: 35 additions & 32 deletions
67
...mehelpapplication/src/main/java/ntnu/systemutvikling/team6/scraper/FullCharityScrape.java
This file contains 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,49 @@ | ||
| package ntnu.systemutvikling.team6.scraper; | ||
|
|
||
| import java.io.IOException; | ||
| import java.net.URISyntaxException; | ||
| import java.net.http.HttpClient; | ||
| import ntnu.systemutvikling.team6.models.Charity; | ||
| import ntnu.systemutvikling.team6.models.registry.CharityRegistry; | ||
| import ntnu.systemutvikling.team6.scraper.scraperComponents.APICharityScraper; | ||
| import ntnu.systemutvikling.team6.scraper.scraperComponents.URLCharityScraper; | ||
|
|
||
| import java.io.IOException; | ||
| import java.net.URISyntaxException; | ||
| import java.net.http.HttpClient; | ||
|
|
||
| public class FullCharityScrape { | ||
| private APICharityScraper apiScraper; | ||
| private APICharityScraper apiScraper; | ||
|
|
||
| public FullCharityScrape() throws URISyntaxException { | ||
| HttpClient https = HttpClient.newHttpClient(); | ||
| this.apiScraper = new APICharityScraper(https); | ||
| } | ||
| public FullCharityScrape() throws URISyntaxException { | ||
| HttpClient https = HttpClient.newHttpClient(); | ||
| this.apiScraper = new APICharityScraper(https); | ||
| } | ||
|
|
||
| public CharityRegistry getAPIAndURLCharityData() throws IOException, InterruptedException { | ||
| CharityRegistry charityRegistry = null; | ||
| if (apiScraper.checkConnection()) { | ||
| charityRegistry = apiScraper.parseJSON(apiScraper.getJSONData()); | ||
| for (Charity charity : charityRegistry.getAllCharities()) { | ||
| System.out.println(charity.getName()); | ||
| } | ||
| // Scrapes description, logo, categories, and key values from IK | ||
| int charityCounter = 0; | ||
| for (Charity charity : charityRegistry.getAllCharities()) { | ||
| charityCounter++; | ||
| public CharityRegistry getAPIAndURLCharityData() throws IOException, InterruptedException { | ||
| CharityRegistry charityRegistry = null; | ||
| if (apiScraper.checkConnection()) { | ||
| charityRegistry = apiScraper.parseJSON(apiScraper.getJSONData()); | ||
| for (Charity charity : charityRegistry.getAllCharities()) { | ||
| System.out.println(charity.getName()); | ||
| } | ||
| // Scrapes description, logo, categories, and key values from IK | ||
| int charityCounter = 0; | ||
| for (Charity charity : charityRegistry.getAllCharities()) { | ||
| charityCounter++; | ||
|
|
||
| System.out.println("Scraping charity vanity details: " + charityCounter + " of " + charityRegistry.getAllCharities().size()); | ||
| URLCharityScraper urlScraper = new URLCharityScraper(charity.getURL()); | ||
| urlScraper.scrapeCharityPage(); | ||
| System.out.println( | ||
| "Scraping charity vanity details: " | ||
| + charityCounter | ||
| + " of " | ||
| + charityRegistry.getAllCharities().size()); | ||
| URLCharityScraper urlScraper = new URLCharityScraper(charity.getURL()); | ||
| urlScraper.scrapeCharityPage(); | ||
|
|
||
| charity.setDescription(urlScraper.getDescription()); | ||
| charity.setCategory(urlScraper.getCategories()); | ||
| charity.setLogoURL(urlScraper.getLogoURL()); | ||
| charity.setKeyValues(urlScraper.getKeyValues()); | ||
| byte[] logoBlob = LogoDownloader.downloadImageAsBlob(charity.getLogoURL()); | ||
| charity.setLogoBlob(logoBlob); | ||
| } | ||
| } | ||
| return charityRegistry; | ||
| charity.setDescription(urlScraper.getDescription()); | ||
| charity.setCategory(urlScraper.getCategories()); | ||
| charity.setLogoURL(urlScraper.getLogoURL()); | ||
| charity.setKeyValues(urlScraper.getKeyValues()); | ||
| byte[] logoBlob = LogoDownloader.downloadImageAsBlob(charity.getLogoURL()); | ||
| charity.setLogoBlob(logoBlob); | ||
| } | ||
| } | ||
| return charityRegistry; | ||
| } | ||
| } |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.