Skip to content

Commit

Permalink
Updated HmHApplication
Browse files Browse the repository at this point in the history
Commented out APIScraper and swapped it with FullCharityScrape.
  • Loading branch information
roaraf committed Apr 18, 2026
1 parent 408e8fa commit cee59c5
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
import javafx.stage.Stage;
import ntnu.systemutvikling.team6.database.DatabaseConnection;
import ntnu.systemutvikling.team6.database.DatabaseSetup;
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.FullCharityScrape;
import ntnu.systemutvikling.team6.service.APIToDatabaseService;

public class HmHApplication extends Application {
Expand Down Expand Up @@ -49,16 +48,24 @@ public void init() {
/* Test and get data from Innsamlingkontrollen API */
try {
HttpClient https = HttpClient.newHttpClient();
APICharityScraper scraper = new APICharityScraper(https);
// APICharityScraper scraper = new APICharityScraper(https);
FullCharityScrape scraper = new FullCharityScrape();

DatabaseConnection conn = new DatabaseConnection();
APIToDatabaseService db = new APIToDatabaseService(conn);

if (scraper.checkConnection()) {
if (scraper.getAPIScraper().checkConnection()) {
/*
if (scraper.checkConnection()) {
CharityRegistry charityRegistry = scraper.parseJSON(scraper.getJSONData());
for (Charity charity : charityRegistry.getAllCharities()) {
System.out.println(charity.getName());
}
*/

// Comment out the two below to use already generated database.
CharityRegistry charityRegistry = scraper.getAPIAndURLCharityData();

db.addAPIDataToTable(charityRegistry.getAllCharities());
}
} catch (Exception e) {
Expand Down

0 comments on commit cee59c5

Please sign in to comment.