diff --git a/src/main/java/gov/nist/oar/distrib/service/rpa/HttpURLConnectionRPARequestHandlerService.java b/src/main/java/gov/nist/oar/distrib/service/rpa/HttpURLConnectionRPARequestHandlerService.java index 1ba31865..a3e3c53c 100644 --- a/src/main/java/gov/nist/oar/distrib/service/rpa/HttpURLConnectionRPARequestHandlerService.java +++ b/src/main/java/gov/nist/oar/distrib/service/rpa/HttpURLConnectionRPARequestHandlerService.java @@ -3,15 +3,10 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import gov.nist.oar.distrib.service.RPACachingService; -import gov.nist.oar.distrib.service.rpa.exceptions.InvalidRecaptchaException; import gov.nist.oar.distrib.service.rpa.exceptions.InvalidRequestException; -import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaClientException; -import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaServerException; -import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaVerificationFailedException; import gov.nist.oar.distrib.service.rpa.exceptions.RecordNotFoundException; import gov.nist.oar.distrib.service.rpa.exceptions.RequestProcessingException; import gov.nist.oar.distrib.service.rpa.model.JWTToken; -import gov.nist.oar.distrib.service.rpa.model.RecaptchaResponse; import gov.nist.oar.distrib.service.rpa.model.Record; import gov.nist.oar.distrib.service.rpa.model.RecordStatus; import gov.nist.oar.distrib.service.rpa.model.RecordWrapper; @@ -45,10 +40,14 @@ /** - * An implementation of the RPARequestHandlerService that uses HttpURLConnection to send HTTP requests and - * receives responses from the Salesforce service. + * An implementation of the {@link RPARequestHandler} interface that uses HttpURLConnection + * to send HTTP requests and receive responses from the Salesforce service. This class serves + * as a bridge between the application and Salesforce, acting as the data source for managing + * records. Through this service, records can be created, retrieved, and updated directly in + * Salesforce, using the platform's API for record management. + * */ -public class HttpURLConnectionRPARequestHandlerService implements IRPARequestHandler { +public class HttpURLConnectionRPARequestHandlerService implements RPARequestHandler { private final static Logger LOGGER = LoggerFactory.getLogger(HttpURLConnectionRPARequestHandlerService.class); diff --git a/src/main/java/gov/nist/oar/distrib/service/rpa/IRPARequestHandler.java b/src/main/java/gov/nist/oar/distrib/service/rpa/RPARequestHandler.java similarity index 87% rename from src/main/java/gov/nist/oar/distrib/service/rpa/IRPARequestHandler.java rename to src/main/java/gov/nist/oar/distrib/service/rpa/RPARequestHandler.java index 7029b560..ac647073 100644 --- a/src/main/java/gov/nist/oar/distrib/service/rpa/IRPARequestHandler.java +++ b/src/main/java/gov/nist/oar/distrib/service/rpa/RPARequestHandler.java @@ -9,9 +9,11 @@ import gov.nist.oar.distrib.service.rpa.model.UserInfoWrapper; /** - * An interface for handling requests to manage records. + * An interface for handling requests to manage records. This includes operations + * such as creating, retrieving, and updating records. Implementations of this interface + * are responsible for the interaction with a data source to perform these operations. */ -public interface IRPARequestHandler { +public interface RPARequestHandler { /** * Updates the status of a record by ID. diff --git a/src/main/java/gov/nist/oar/distrib/web/RPARequestHandlerController.java b/src/main/java/gov/nist/oar/distrib/web/RPARequestHandlerController.java index 44bd6022..7e3e5f57 100644 --- a/src/main/java/gov/nist/oar/distrib/web/RPARequestHandlerController.java +++ b/src/main/java/gov/nist/oar/distrib/web/RPARequestHandlerController.java @@ -1,7 +1,7 @@ package gov.nist.oar.distrib.web; import gov.nist.oar.distrib.service.RPACachingService; -import gov.nist.oar.distrib.service.rpa.IRPARequestHandler; +import gov.nist.oar.distrib.service.rpa.RPARequestHandler; import gov.nist.oar.distrib.service.rpa.exceptions.InvalidRequestException; import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaClientException; import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaServerException; @@ -62,7 +62,7 @@ public class RPARequestHandlerController { /** * The primary service for handling RPA requests. */ - IRPARequestHandler service = null; + RPARequestHandler service = null; /** * The sanitizer for incoming requests. @@ -114,7 +114,7 @@ public RPARequestHandlerController(RPAServiceProvider rpaServiceProvider, RPACachingService cachingService) { if (cachingService != null && rpaServiceProvider != null) - this.service = rpaServiceProvider.getIRPARequestHandler(cachingService); + this.service = rpaServiceProvider.getRPARequestHandler(cachingService); this.requestSanitizer = new RequestSanitizer(); this.configuration = rpaServiceProvider.getRpaConfiguration(); this.jwtTokenValidator = new JwtTokenValidator(this.configuration); diff --git a/src/main/java/gov/nist/oar/distrib/web/RPAServiceProvider.java b/src/main/java/gov/nist/oar/distrib/web/RPAServiceProvider.java index e7abd7f1..fb3300b4 100644 --- a/src/main/java/gov/nist/oar/distrib/web/RPAServiceProvider.java +++ b/src/main/java/gov/nist/oar/distrib/web/RPAServiceProvider.java @@ -2,7 +2,7 @@ import gov.nist.oar.distrib.service.RPACachingService; import gov.nist.oar.distrib.service.rpa.HttpURLConnectionRPARequestHandlerService; -import gov.nist.oar.distrib.service.rpa.IRPARequestHandler; +import gov.nist.oar.distrib.service.rpa.RPARequestHandler; public class RPAServiceProvider { RPAConfiguration rpaConfiguration; @@ -11,11 +11,11 @@ public RPAServiceProvider(RPAConfiguration rpaConfiguration) { this.rpaConfiguration = rpaConfiguration; } - public IRPARequestHandler getIRPARequestHandler(RPACachingService rpaCachingService) { + public RPARequestHandler getRPARequestHandler(RPACachingService rpaCachingService) { return this.getHttpURLConnectionRPARequestHandler(rpaCachingService); } - private IRPARequestHandler getHttpURLConnectionRPARequestHandler(RPACachingService rpaCachingService) { + private RPARequestHandler getHttpURLConnectionRPARequestHandler(RPACachingService rpaCachingService) { return new HttpURLConnectionRPARequestHandlerService(this.rpaConfiguration, rpaCachingService); } diff --git a/src/test/java/gov/nist/oar/distrib/web/RPARequestHandlerControllerTest.java b/src/test/java/gov/nist/oar/distrib/web/RPARequestHandlerControllerTest.java index 5b5a14e5..5e8e1f6f 100644 --- a/src/test/java/gov/nist/oar/distrib/web/RPARequestHandlerControllerTest.java +++ b/src/test/java/gov/nist/oar/distrib/web/RPARequestHandlerControllerTest.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import gov.nist.oar.distrib.service.RPACachingService; -import gov.nist.oar.distrib.service.rpa.IRPARequestHandler; +import gov.nist.oar.distrib.service.rpa.RPARequestHandler; import gov.nist.oar.distrib.service.rpa.RecaptchaHelper; import gov.nist.oar.distrib.service.rpa.exceptions.InvalidRequestException; import gov.nist.oar.distrib.service.rpa.exceptions.RecaptchaVerificationFailedException; @@ -51,7 +51,7 @@ @RunWith(MockitoJUnitRunner.class) public class RPARequestHandlerControllerTest { @Mock - private IRPARequestHandler service; + private RPARequestHandler service; @Mock RPAServiceProvider mockRPAServiceProvider; @@ -79,7 +79,7 @@ public class RPARequestHandlerControllerTest { @Before public void setup() { MockitoAnnotations.initMocks(this); - when(mockRPAServiceProvider.getIRPARequestHandler(mockRPACachingService)).thenReturn(service); + when(mockRPAServiceProvider.getRPARequestHandler(mockRPACachingService)).thenReturn(service); // create a test instance of the RPARequestHandlerController class controller = new RPARequestHandlerController(mockRPAServiceProvider, mockRPACachingService); controller.setRequestSanitizer(mockRequestSanitizer);