Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
bef43a5
Adding entity for Gallery
hannah-em Nov 8, 2025
e61581e
Update Gallery.java
hannah-em Nov 8, 2025
f662e7f
pet class
zahrabuch Nov 9, 2025
116fca1
Create BrowseFilterController
hannah-em Nov 10, 2025
42196a0
Create BrowseFilterPresenter
hannah-em Nov 10, 2025
c02231c
Create BrowseFilterViewModel
hannah-em Nov 10, 2025
063c05d
Rename BrowseFilterController to BrowseFilterController.java
hannah-em Nov 10, 2025
ec763b7
Rename BrowseFilterPresenter to BrowseFilterPresenter.java
hannah-em Nov 10, 2025
0469ae4
Rename BrowseFilterViewModel to BrowseFilterViewModel.java
hannah-em Nov 10, 2025
50c2178
Create BrowseFilterInputBoundary.java
hannah-em Nov 10, 2025
c4d75e0
Create BrowseFilterInputData.java
hannah-em Nov 10, 2025
e335e4c
Create BrowseFilterInteractor.java
hannah-em Nov 10, 2025
b817b87
Create BrowseFilterOutputBoundary.java
hannah-em Nov 10, 2025
133c874
Create BrowseFilterOutputData.java
hannah-em Nov 10, 2025
6d70481
Create BrowseFilterView.java
hannah-em Nov 10, 2025
6780509
Finished application entity, might need to change pet field to id ins…
KaedeKagami86 Nov 11, 2025
dfaf15e
adding Administrator and Visitor entities and updating User entity to…
RebeccaHL Nov 11, 2025
5352c4d
Merge pull request #6 from hannah-em/hannah
zahrabuch Nov 11, 2025
2376faa
Merge pull request #7 from hannah-em/zahra
zahrabuch Nov 11, 2025
0fd59ba
Merge pull request #9 from hannah-em/rebecca
RebeccaHL Nov 11, 2025
0f41426
User entity
keikatee Nov 11, 2025
dffe6ef
pet class update to include setters and description attribute
zahrabuch Nov 11, 2025
11dea02
User entity
keikatee Nov 11, 2025
8b6917e
User entity
keikatee Nov 11, 2025
e427c78
User entity
keikatee Nov 11, 2025
2034c58
User entity
keikatee Nov 11, 2025
df10058
Merge branch 'main' of https://github.com/hannah-em/Pet-Adoption-Port…
KaedeKagami86 Nov 11, 2025
ccacbf9
Registration Use case
keikatee Nov 11, 2025
a466ff0
Create DatabaseConnection.java
hannah-em Nov 11, 2025
e990099
Create DatabasePetGateway.java
hannah-em Nov 11, 2025
8398490
Create PetAPIGatewayInterface
hannah-em Nov 11, 2025
49a2f59
Rename PetAPIGatewayInterface to PetAPIGatewayInterface.java
hannah-em Nov 11, 2025
7bd5dc7
Create PetfinderAPIGateway.java
hannah-em Nov 11, 2025
9109363
Create PetfinderAuthService.java
hannah-em Nov 11, 2025
9a41056
Create pets.db
hannah-em Nov 11, 2025
66878e7
Update pom.xml
hannah-em Nov 11, 2025
b906243
Create Pet.java
hannah-em Nov 11, 2025
0e18fd1
Update BrowseFilterController.java
hannah-em Nov 11, 2025
072658d
Update BrowseFilterPresenter.java
hannah-em Nov 11, 2025
e904e19
Update BrowseFilterViewModel.java
hannah-em Nov 11, 2025
f085051
Update BrowseFilterInputBoundary.java
hannah-em Nov 11, 2025
2786250
Update BrowseFilterInputData.java
hannah-em Nov 11, 2025
bd41956
Update BrowseFilterInteractor.java
hannah-em Nov 11, 2025
0036dd9
Update BrowseFilterOutputBoundary.java
hannah-em Nov 11, 2025
93d9970
Update BrowseFilterOutputData.java
hannah-em Nov 11, 2025
5bff234
Update BrowseFilterView.java
hannah-em Nov 11, 2025
439bdf4
Update Pet.java
hannah-em Nov 12, 2025
42f8aa6
Update BrowseFilterController.java
hannah-em Nov 12, 2025
bbffbf8
Update BrowseFilterPresenter.java
hannah-em Nov 12, 2025
f8df1b3
Update BrowseFilterViewModel.java
hannah-em Nov 12, 2025
e65f0a5
Update BrowseFilterInputBoundary.java
hannah-em Nov 12, 2025
3e6643c
Update BrowseFilterInputData.java
hannah-em Nov 12, 2025
9a6c27e
Update BrowseFilterInteractor.java
hannah-em Nov 12, 2025
3998487
Update BrowseFilterOutputBoundary.java
hannah-em Nov 12, 2025
fd62778
Update BrowseFilterOutputData.java
hannah-em Nov 12, 2025
dbb6b4b
Update BrowseFilterView.java
hannah-em Nov 12, 2025
77642f5
Update DatabaseConnection.java
hannah-em Nov 12, 2025
67a00e9
Update DatabasePetGateway.java
hannah-em Nov 12, 2025
c705151
Update PetAPIGatewayInterface.java
hannah-em Nov 12, 2025
8eeb443
Update PetfinderAPIGateway.java
hannah-em Nov 12, 2025
25b5870
Update PetfinderAuthService.java
hannah-em Nov 12, 2025
ed642a4
Update pom.xml
hannah-em Nov 12, 2025
427ac45
Create MainDatabase.java
hannah-em Nov 12, 2025
4f0e503
Update DatabasePetGateway.java
hannah-em Nov 12, 2025
2d95ac2
Modified sign up usecase and interface adaptor
keikatee Nov 12, 2025
cb39b5f
Merge branch 'main' into hannah
zahrabuch Nov 13, 2025
950d49e
Merge pull request #13 from hannah-em/hannah
zahrabuch Nov 15, 2025
0ef3e83
pet class updates
zahrabuch Nov 15, 2025
af19b92
Merge remote-tracking branch 'origin/main' into zahra
zahrabuch Nov 15, 2025
9a8a869
Merge pull request #10 from hannah-em/jenny
keikatee Nov 15, 2025
78b48ce
pet class updates
zahrabuch Nov 15, 2025
7ec944f
Merge pull request #14 from hannah-em/keito
zahrabuch Nov 15, 2025
1bb2c6a
Update DatabasePetGateway.java
hannah-em Nov 15, 2025
091ac00
submit application use case files
RebeccaHL Nov 15, 2025
4e59366
Merge remote-tracking branch 'origin/main' into zahra
zahrabuch Nov 15, 2025
ec6cebe
fixes on Application class
zahrabuch Nov 15, 2025
b41209f
Merge branch 'main' into rebecca
RebeccaHL Nov 15, 2025
4081327
edited interactor
zahrabuch Nov 16, 2025
5117244
submit view almost done
RebeccaHL Nov 16, 2025
47ab5b4
Modified logout system
keikatee Nov 17, 2025
fb5e5f5
interactor almost done
RebeccaHL Nov 17, 2025
7954dad
Merge branch 'main' of https://github.com/hannah-em/Pet-Adoption-Port…
KaedeKagami86 Nov 17, 2025
3328a93
Added ManageApplication package
KaedeKagami86 Nov 17, 2025
d1f5b6f
add pet gui
zahrabuch Nov 18, 2025
9fd996f
Deleted process(accept/reject) application use case for now, added da…
KaedeKagami86 Nov 18, 2025
50addb6
presenter, view, outputflow done
RebeccaHL Nov 18, 2025
5f13da3
Update BrowseFilterController.java
hannah-em Nov 18, 2025
6f33fcc
Update BrowseFilterPresenter.java
hannah-em Nov 18, 2025
5436982
Update BrowseFilterViewModel.java
hannah-em Nov 18, 2025
f14fe3d
Update BrowseFilterInputBoundary.java
hannah-em Nov 18, 2025
1fbb5c2
Update BrowseFilterInputData.java
hannah-em Nov 18, 2025
4463055
Update BrowseFilterInteractor.java
hannah-em Nov 18, 2025
cb0ecc3
Update BrowseFilterOutputBoundary.java
hannah-em Nov 18, 2025
bfd0b1d
Update BrowseFilterOutputData.java
hannah-em Nov 18, 2025
0a49f61
Update BrowseFilterView.java
hannah-em Nov 18, 2025
639b322
Merge pull request #17 from hannah-em/keito
keikatee Nov 18, 2025
69e8d96
Merge pull request #18 from hannah-em/hannah
keikatee Nov 18, 2025
a2c0145
small correction
RebeccaHL Nov 18, 2025
4e95a5f
update
RebeccaHL Nov 18, 2025
88854d7
Merge pull request #20 from hannah-em/rebecca
RebeccaHL Nov 18, 2025
f8359f1
Merge branch 'main' of https://github.com/hannah-em/Pet-Adoption-Port…
KaedeKagami86 Nov 18, 2025
0ed48b1
Fixed application bug, forgot to put output type for getPersonalInfor…
KaedeKagami86 Nov 18, 2025
8c91910
Fixed application entity bug and added database and interface adapter…
Jenny6182 Nov 18, 2025
588e815
user factory and related database implemented
RebeccaHL Nov 18, 2025
4516096
Merge branch 'main' into rebecca
RebeccaHL Nov 18, 2025
0f7c166
user factory updates
RebeccaHL Nov 18, 2025
3c02648
small correction
RebeccaHL Nov 18, 2025
84a7165
Changed application implementation to fit visitor implementation and …
KaedeKagami86 Nov 18, 2025
7ee1461
Update BrowseFilterViewModel.java
hannah-em Nov 18, 2025
c7f3845
add pet Completed!!!
zahrabuch Nov 18, 2025
030c531
Merge pull request #24 from hannah-em/jenny
zahrabuch Nov 18, 2025
af13426
Merge branch 'main' into zahra
zahrabuch Nov 18, 2025
56f28c8
Merge pull request #15 from hannah-em/database
keikatee Nov 19, 2025
ef3177f
Merge pull request #23 from hannah-em/rebecca
keikatee Nov 19, 2025
f61313b
Merge pull request #26 from hannah-em/zahra
keikatee Nov 19, 2025
a8236e5
temporary fix for manage application, use case part
KaedeKagami86 Nov 19, 2025
39da107
temporary fix for manage application db part
KaedeKagami86 Nov 19, 2025
72da282
Merge pull request #27 from hannah-em/jenny
hannah-em Nov 19, 2025
82b1400
Merge pull request #25 from hannah-em/browsefilter
RebeccaHL Nov 19, 2025
f2ed05c
Update BrowseFilterPresenter.java
hannah-em Nov 19, 2025
0486d3a
Update BrowseFilterViewModel.java
hannah-em Nov 19, 2025
dd67c9f
Update BrowseFilterView.java
hannah-em Nov 19, 2025
13c321e
Create BrowseFilterState.java
hannah-em Nov 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 22 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,52 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>edu.csc207</groupId>
<artifactId>ca-login-example</artifactId>
<groupId>org.example</groupId>
<artifactId>testingapi</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<!-- OkHttp for API calls -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>

<!-- org.json for JSON parsing -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20240303</version>
</dependency>

<!-- SQLite JDBC driver -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.45.2.0</version>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>15</source>
<target>15</target>
</configuration>
</plugin>
</plugins>
</build>


<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

</project>
53 changes: 53 additions & 0 deletions src/main/java/app/AddPetAppBuilder.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package app;

import data_access.InMemoryPetDataAccessObject;
import entity.PetFactory;
import interface_adapter.add_pet.AddPetController;
import interface_adapter.add_pet.AddPetPresenter;
import interface_adapter.add_pet.AddPetView;
import interface_adapter.add_pet.AddPetViewModel;
import use_case.add_pet.AddPetDataAccessInterface;
import use_case.add_pet.AddPetInputBoundary;
import use_case.add_pet.AddPetInteractor;
import use_case.add_pet.AddPetOutputBoundary;

import javax.swing.*;

public class AddPetAppBuilder {

private AddPetView addPetView;
private AddPetController addPetController;

public AddPetAppBuilder addAddPetView() {
this.addPetView = new AddPetView();
return this;
}

public AddPetAppBuilder addAddPetUseCase() {

AddPetDataAccessInterface petRepo = new InMemoryPetDataAccessObject();

AddPetViewModel addPetViewModel = new AddPetViewModel();
AddPetOutputBoundary presenter = new AddPetPresenter(addPetViewModel);

PetFactory petFactory = new PetFactory();

AddPetInputBoundary interactor =
new AddPetInteractor(petFactory, petRepo, presenter);

this.addPetController = new AddPetController(interactor);
this.addPetView.setViewModel(addPetViewModel);
this.addPetView.setAddPetController(addPetController);

return this;
}

public JFrame build() {
JFrame frame = new JFrame("Add Pet");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(addPetView);
return frame;
}
}


22 changes: 22 additions & 0 deletions src/main/java/app/AddPetMain.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package app;

import app.AddPetAppBuilder;

import javax.swing.*;

public class AddPetMain {
public static void main(String[] args) {

AddPetAppBuilder builder = new AddPetAppBuilder();

JFrame app = builder
.addAddPetView()
.addAddPetUseCase()
.build();

app.pack();
app.setLocationRelativeTo(null);
app.setVisible(true);
}
}

16 changes: 11 additions & 5 deletions src/main/java/app/AppBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import interface_adapter.login.LoginViewModel;
import interface_adapter.logout.LogoutController;
import interface_adapter.logout.LogoutPresenter;
import interface_adapter.manage_application.ManageApplicationViewModel;
import interface_adapter.signup.SignupController;
import interface_adapter.signup.SignupPresenter;
import interface_adapter.signup.SignupViewModel;
Expand All @@ -26,10 +27,7 @@
import use_case.signup.SignupInputBoundary;
import use_case.signup.SignupInteractor;
import use_case.signup.SignupOutputBoundary;
import view.LoggedInView;
import view.LoginView;
import view.SignupView;
import view.ViewManager;
import view.*;

import javax.swing.*;
import java.awt.*;
Expand All @@ -50,6 +48,8 @@ public class AppBuilder {
// DAO version using a shared external database
// final DBUserDataAccessObject userDataAccessObject = new DBUserDataAccessObject(userFactory);

private ManageApplicationView manageApplicationView;
private ManageApplicationViewModel manageApplicationViewModel;
private SignupView signupView;
private SignupViewModel signupViewModel;
private LoginViewModel loginViewModel;
Expand All @@ -61,6 +61,13 @@ public AppBuilder() {
cardPanel.setLayout(cardLayout);
}

public AppBuilder addManageApplicationView() {
manageApplicationViewModel = new ManageApplicationViewModel();
manageApplicationView = new ManageApplicationView(manageApplicationViewModel);
cardPanel.add(manageApplicationView, manageApplicationView.getViewName());
return this;
}

public AppBuilder addSignupView() {
signupViewModel = new SignupViewModel();
signupView = new SignupView(signupViewModel);
Expand Down Expand Up @@ -137,7 +144,6 @@ public JFrame build() {
application.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

application.add(cardPanel);

viewManagerModel.setState(signupView.getViewName());
viewManagerModel.firePropertyChange();

Expand Down
52 changes: 52 additions & 0 deletions src/main/java/app/MainDatabase.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
//Creating this file temporarily to put data in the database. Should be included with Main later on.

package app;

import data_access.*;
import java.sql.Connection;

public class MainDatabase {
public static void main(String[] args) throws Exception {
// Step 1: Connect to SQLite database
Connection conn = DatabaseConnection.connect();
DatabasePetGateway dbGateway = new DatabasePetGateway(conn);

// Step 2: Populate DB from API if empty
var existingPets = dbGateway.fetchPets("", "");
if (existingPets.isEmpty()) {
System.out.println("🐾 Database is empty — importing pets from API...");

String[] speciesList = {"dog", "cat", "rabbit", "bird", "horse"}; // Can add more types
int totalImported = 0;

for (String species : speciesList) {
// Get a new token for every API call (prevents "token expired" errors)
String token = PetfinderAuthService.getAccessToken();
PetfinderAPIGateway apiGateway = new PetfinderAPIGateway(token);

System.out.println("Fetching " + species + " from API...");
var pets = apiGateway.fetchPets(species, "");

if (pets.isEmpty()) {
System.out.println("⚠️ No pets fetched for " + species + " — check API or token");
} else {
for (var pet : pets) {
dbGateway.addPet(pet);
}
totalImported += pets.size();
System.out.println("Imported " + pets.size() + " " + species + "(s) into database!");
}
}

System.out.println("Total pets imported: " + totalImported);
}

// Step 3: Show how many pets are in the database
var allPets = dbGateway.fetchPets("", "");
System.out.println("Total pets in database: " + allPets.size());
for (var pet : allPets) {
System.out.println(pet.getType());
}

}
}
9 changes: 9 additions & 0 deletions src/main/java/data_access/ApplicationGatewayInterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package data_access;

import entity.Application;

import java.util.List;

public interface ApplicationGatewayInterface {
// Application fetchApplicationById(String applicationId);
}
5 changes: 5 additions & 0 deletions src/main/java/data_access/DBApplicationDataAccessObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package data_access;

public class DBApplicationDataAccessObject {

}
7 changes: 5 additions & 2 deletions src/main/java/data_access/DBUserDataAccessObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import use_case.login.LoginUserDataAccessInterface;
import use_case.logout.LogoutUserDataAccessInterface;
import use_case.signup.SignupUserDataAccessInterface;
import use_case.submit_application.SubmitUserDataAccessInterface;

import java.io.IOException;

Expand All @@ -18,7 +19,9 @@
public class DBUserDataAccessObject implements SignupUserDataAccessInterface,
LoginUserDataAccessInterface,
ChangePasswordUserDataAccessInterface,
LogoutUserDataAccessInterface {
LogoutUserDataAccessInterface,
SubmitUserDataAccessInterface {

private static final int SUCCESS_CODE = 200;
private static final String CONTENT_TYPE_LABEL = "Content-Type";
private static final String CONTENT_TYPE_JSON = "application/json";
Expand Down Expand Up @@ -52,7 +55,7 @@ public User get(String username) {
final String name = userJSONObject.getString(USERNAME);
final String password = userJSONObject.getString(PASSWORD);

return userFactory.create(name, password);
return userFactory.create("visitor", name, password);
}
else {
throw new RuntimeException(responseBody.getString(MESSAGE));
Expand Down
81 changes: 81 additions & 0 deletions src/main/java/data_access/DatabaseApplicationGateway.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package data_access;

import entity.Application;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class DatabaseApplicationGateway implements ApplicationGatewayInterface {
private final Connection conn;

public DatabaseApplicationGateway(Connection conn) {
this.conn = conn;
}

// @Override
// public Application fetchApplicationById(String applicationId) { // why does applicationID have to be a string not int?
// String sql = "SELECT * FROM pets WHERE id = ?";
// try (PreparedStatement stmt = conn.prepareStatement(sql)) { // here
// stmt.setString(1, applicationId);
// ResultSet rs = stmt.executeQuery();
// if (rs.next()) {
// return new Application(
//// rs.getString("id"),
//// rs.getString("application_id"), //TODO: make Application entity, pass in personal_info list, not separate fields!
// //List<String> personal_information = getPersonalInformation(user); ..... etc.
//// rs.getString("pet_id"),
//// rs.getString("legal_name"),
//// rs.getString("reason"),
// rs.getString("availability"),
// rs.getString("occupation"),
// rs.getString("age"),
// rs.getString("email"),
// rs.getString("phone"),
// rs.getString("previous_experience")
// );
// }
// } catch (SQLException e) {
// e.printStackTrace();
// }
// return null;
// }

public void addApplication(Application application) {
String sql = "INSERT OR REPLACE INTO applications (id, pet_id, legal_name, reason, availability, " +
"occupation, age, email, phone, previous_experience) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, application.getApplicationId());
stmt.setString(2, application.getPetId());
stmt.setString(3, application.getUser().getFirstName());
stmt.setString(4, application.getUser().getLastName());
stmt.setString(5, application.getReason());
stmt.setString(6, application.getAvailability());
stmt.setString(7, application.getUser().getOccupation());
stmt.setString(8, application.getUser().getAge());
stmt.setString(9, application.getUser().getEmail());
stmt.setString(10, application.getUser().getPhoneNum());
stmt.setString(11, application.getPreviousExperience());
stmt.executeUpdate();
System.out.println("✅ Added application to DB: " + application.getUser().getLastName() + " " + application.getUser().getLastName() + "'s application for"
+ application.getPetId() + "ID: " + application.getApplicationId());
} catch (SQLException e) {
e.printStackTrace();
}
}

public void deleteApplication(String id) {
String sql = "DELETE FROM applications WHERE id = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, id);
stmt.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
}


Loading