-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
provide database connection for all gateway
- Loading branch information
Showing
9 changed files
with
119 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package gateway; | ||
|
||
public class DatabaseConnection { | ||
} |
2 changes: 1 addition & 1 deletion
2
...java/questiongateway/QuestionGateway.java → src/main/java/gateway/QuestionGateway.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,4 +1,4 @@ | ||
package questiongateway; | ||
package gateway; | ||
|
||
import questionentities.Post; | ||
import questionentities.Question; | ||
|
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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package gateway; | ||
|
||
import questionentities.Post; | ||
import questionentities.Question; | ||
|
||
import java.util.List; | ||
|
||
public class QuestionRepo implements QuestionGateway{ | ||
DatabaseConnection databaseConnection; | ||
|
||
public QuestionRepo(DatabaseConnection databaseConnection) { | ||
this.databaseConnection = databaseConnection; | ||
} | ||
|
||
@Override | ||
public void saveQuestion(Question question) { | ||
|
||
} | ||
|
||
@Override | ||
public Question getQuestion(int questionId) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Question> getAllQuestion() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Question> getNotTakenQuestion() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Question> getNotClosedQuestion() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void updateIsTaken(int questionId, boolean iaTaken) { | ||
|
||
} | ||
|
||
@Override | ||
public void updateTakenByAttorney(int questionId, boolean attorneyId) { | ||
|
||
} | ||
|
||
@Override | ||
public void updateIsClose(int questionId, boolean isClose) { | ||
|
||
} | ||
|
||
@Override | ||
public void updateRating(int questionId, int rating) { | ||
|
||
} | ||
|
||
@Override | ||
public void updatePosts(int questionId, Post post) { | ||
|
||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package gateway; | ||
|
||
public class UserGatewayFactory { | ||
final DatabaseConnection databaseConnection; | ||
|
||
public UserGatewayFactory(DatabaseConnection databaseConnection) { | ||
this.databaseConnection = databaseConnection; | ||
} | ||
|
||
public UserGateway createUserGateway(int userId) { | ||
UserGateway userGateway; | ||
|
||
if (isClient(userId)) { | ||
userGateway = new ClientRepository(databaseConnection); | ||
} else { | ||
userGateway = new AttorneyRepository(databaseConnection); | ||
} | ||
return userGateway; | ||
} | ||
|
||
// TODO: implement this method | ||
private static boolean isClient(int userId) { | ||
return false; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.