-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into JAVA-S1050-Non-final-static-fields
Signed-off-by: Piyush Acharya <[email protected]>
- Loading branch information
Showing
14 changed files
with
160 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
package DNAnalyzer.adapter; | ||
|
||
/** | ||
* Controller for the analysis of DNA. | ||
*/ | ||
public class AnalyseController { | ||
|
||
} | ||
/** Controller for the analysis of DNA. */ | ||
public class AnalyseController {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
package DNAnalyzer.core; | ||
|
||
/** | ||
* Exception thrown when the API key is missing. | ||
*/ | ||
/** Exception thrown when the API key is missing. */ | ||
public class ApiKeyMissingException extends RuntimeException { | ||
|
||
/** | ||
* Constructor of ApiKeyMissingException. | ||
* @param message the message of the exception. | ||
*/ | ||
public ApiKeyMissingException(String message) { | ||
super(message); | ||
} | ||
/** | ||
* Constructor of ApiKeyMissingException. | ||
* | ||
* @param message the message of the exception. | ||
*/ | ||
public ApiKeyMissingException(String message) { | ||
super(message); | ||
} | ||
} |
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,31 +1,28 @@ | ||
package DNAnalyzer.core; | ||
|
||
|
||
import DNAnalyzer.core.port.in.GetApiKeyUseCase; | ||
import DNAnalyzer.core.port.in.SetApiKeyUseCase; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Service; | ||
|
||
/** | ||
* The purpose of this service is to handle all operations concerning the OpenAI API key. | ||
*/ | ||
/** The purpose of this service is to handle all operations concerning the OpenAI API key. */ | ||
@Service | ||
public class ApiKeyService implements GetApiKeyUseCase, SetApiKeyUseCase { | ||
|
||
@Value("${openai.api.key}") | ||
private String apiKey; | ||
@Value("${openai.api.key}") | ||
private String apiKey; | ||
|
||
@Override | ||
public String getApiKey() { | ||
if (apiKey == null) { | ||
throw new ApiKeyMissingException("No API-Key defined."); | ||
} | ||
return apiKey; | ||
@Override | ||
public String getApiKey() { | ||
if (apiKey == null) { | ||
throw new ApiKeyMissingException("No API-Key defined."); | ||
} | ||
return apiKey; | ||
} | ||
|
||
@Override | ||
public String setApiKey(String apiKey) { | ||
this.apiKey = apiKey; | ||
return this.apiKey; | ||
} | ||
@Override | ||
public String setApiKey(String apiKey) { | ||
this.apiKey = apiKey; | ||
return this.apiKey; | ||
} | ||
} |
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,7 +1,4 @@ | ||
package DNAnalyzer.core.port.in; | ||
|
||
/** | ||
* The request body holding the parameters for the analyze DNA use case. | ||
*/ | ||
public record AnalyzeDnaRequest() { | ||
} | ||
/** The request body holding the parameters for the analyze DNA use case. */ | ||
public record AnalyzeDnaRequest() {} |
17 changes: 8 additions & 9 deletions
17
src/main/java/DNAnalyzer/core/port/in/AnalyzeDnaUseCase.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,14 +1,13 @@ | ||
package DNAnalyzer.core.port.in; | ||
|
||
/** | ||
* Use case interface to analyze DNA. | ||
*/ | ||
/** Use case interface to analyze DNA. */ | ||
public interface AnalyzeDnaUseCase { | ||
|
||
/** | ||
* Analyze the DNA. | ||
* @param request the request to analyze the DNA | ||
* @return the result of the analysis | ||
*/ | ||
AnalyzeResult analyzeDna(AnalyzeDnaRequest request); | ||
/** | ||
* Analyze the DNA. | ||
* | ||
* @param request the request to analyze the DNA | ||
* @return the result of the analysis | ||
*/ | ||
AnalyzeResult analyzeDna(AnalyzeDnaRequest request); | ||
} |
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,7 +1,4 @@ | ||
package DNAnalyzer.core.port.in; | ||
|
||
/** | ||
* Result of an DNA analysis. | ||
*/ | ||
public class AnalyzeResult { | ||
} | ||
/** Result of an DNA analysis. */ | ||
public class AnalyzeResult {} |
15 changes: 7 additions & 8 deletions
15
src/main/java/DNAnalyzer/core/port/in/GetApiKeyUseCase.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,13 +1,12 @@ | ||
package DNAnalyzer.core.port.in; | ||
|
||
/** | ||
* Use case interface to get the API key. | ||
*/ | ||
/** Use case interface to get the API key. */ | ||
public interface GetApiKeyUseCase { | ||
|
||
/** | ||
* Use case to get the set API key. | ||
* @return the api key | ||
*/ | ||
String getApiKey(); | ||
/** | ||
* Use case to get the set API key. | ||
* | ||
* @return the api key | ||
*/ | ||
String getApiKey(); | ||
} |
17 changes: 8 additions & 9 deletions
17
src/main/java/DNAnalyzer/core/port/in/SetApiKeyUseCase.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,14 +1,13 @@ | ||
package DNAnalyzer.core.port.in; | ||
|
||
/** | ||
* Use case interface to set the API key. | ||
*/ | ||
/** Use case interface to set the API key. */ | ||
public interface SetApiKeyUseCase { | ||
|
||
/** | ||
* Set the API key for the OpenAI API. | ||
* @param apiKey the new API key. | ||
* @return the api key | ||
*/ | ||
String setApiKey(String apiKey); | ||
/** | ||
* Set the API key for the OpenAI API. | ||
* | ||
* @param apiKey the new API key. | ||
* @return the api key | ||
*/ | ||
String setApiKey(String apiKey); | ||
} |
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.