promise = Promise.promise();
+ postgresService.executePreparedQuery(
+ query,
+ params,
+ handler -> {
+ if (handler.failed()) {
+ LOGGER.error(
+ "isPolicyForIdExist fail, DB execution failed :: {}", handler.cause().getMessage());
+ promise.fail(
+ generateErrorResponse(
+ INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR.getDescription()));
+ } else {
+ JsonArray policy = handler.result().getJsonArray(RESULT);
+ boolean isPolicyNotPresent = policy.isEmpty();
+ if (isPolicyNotPresent) {
+ LOGGER.error("No matching policy");
+ promise.complete(new JsonObject());
+ } else {
+ LOGGER.debug("policy exists : {} ", handler.result().encode());
+ if (handler.result().getJsonArray(RESULT).size() > 1
+ && query.equals(CHECK_POLICY_FROM_ORDER_ID)) {
+ LOGGER.fatal(
+ "Fetched more than 1 policy for a single"
+ + " resource with a single orderId : {}",
+ orderId);
promise.fail(
- generateErrorResponse(
- INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR.getDescription()));
- }
- else
- {
- JsonArray policy = handler.result().getJsonArray(RESULT);
- boolean isPolicyNotPresent = policy.isEmpty();
- if (isPolicyNotPresent) {
- LOGGER.error("No matching policy");
- promise.complete(new JsonObject());
- } else {
- LOGGER.debug("policy exists : {} ", handler.result().encode());
- if(handler.result().getJsonArray(RESULT).size() > 1 && query.equals(CHECK_POLICY_FROM_ORDER_ID))
- {
- LOGGER.fatal("Fetched more than 1 policy for a single" +
- " resource with a single orderId : {}",orderId);
- promise.fail(
- generateErrorResponse(
- INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR.getDescription()));
- return;
- }
- JsonObject result = handler.result().getJsonArray(RESULT).getJsonObject(0);
- JsonObject constraints = result.getJsonObject("constraints");
- String policyId = result.getString("_id");
- JsonObject response =
- new JsonObject().put("constraints", constraints).put("id", policyId);
- promise.complete(response);
- }
+ generateErrorResponse(
+ INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR.getDescription()));
+ return;
+ }
+ JsonObject result = handler.result().getJsonArray(RESULT).getJsonObject(0);
+ JsonObject constraints = result.getJsonObject("constraints");
+ String policyId = result.getString("_id");
+ JsonObject response =
+ new JsonObject().put("constraints", constraints).put("id", policyId);
+ promise.complete(response);
}
+ }
});
return promise.future();
@@ -146,13 +138,11 @@ public String generateErrorResponse(HttpStatusCode httpStatusCode, String errorM
.encode();
}
- private String getOrderId() {
- return this.orderId;
- }
- private void setOrderId(String orderId)
- {
- this.orderId = orderId;
- }
-
+ private String getOrderId() {
+ return this.orderId;
+ }
+ private void setOrderId(String orderId) {
+ this.orderId = orderId;
+ }
}
diff --git a/src/main/java/iudx/data/marketplace/policies/util/Constants.java b/src/main/java/iudx/data/marketplace/policies/util/Constants.java
index 2382b5cb..cc3244f1 100644
--- a/src/main/java/iudx/data/marketplace/policies/util/Constants.java
+++ b/src/main/java/iudx/data/marketplace/policies/util/Constants.java
@@ -1,76 +1,76 @@
package iudx.data.marketplace.policies.util;
public class Constants {
- public static final String CHECK_EXISTING_POLICY =
- "SELECT _id,constraints FROM policy "
- + "WHERE resource_id =$1::UUID AND provider_id = $2::UUID AND status = $3::policy_status"
- + " AND consumer_email_id = $4::text AND expiry_at > now()";
+ public static final String CHECK_EXISTING_POLICY =
+ "SELECT _id,constraints FROM policy "
+ + "WHERE resource_id =$1::UUID AND provider_id = $2::UUID AND status = $3::policy_status"
+ + " AND consumer_email_id = $4::text AND expiry_at > now()";
- public static final String CHECK_POLICY_FROM_ORDER_ID =
- " SELECT _id,constraints FROM policy " +
- " WHERE resource_id =$1::UUID " +
- " AND provider_id = $2::UUID AND status = $3::policy_status " +
- " AND consumer_email_id = $4::text " +
- " AND expiry_at > now() " +
- " AND invoice_id = ( SELECT I._id FROM invoice AS I WHERE I.order_id = $5::text)";
+ public static final String CHECK_POLICY_FROM_ORDER_ID =
+ " SELECT _id,constraints FROM policy "
+ + " WHERE resource_id =$1::UUID "
+ + " AND provider_id = $2::UUID AND status = $3::policy_status "
+ + " AND consumer_email_id = $4::text "
+ + " AND expiry_at > now() "
+ + " AND invoice_id = ( SELECT I._id FROM invoice AS I WHERE I.order_id = $5::text)";
- public static final String CREATE_POLICY_QUERY =
- "INSERT INTO public.policy( " +
- " _id, resource_id, invoice_id, constraints, provider_id, consumer_email_id, expiry_at, " +
- " status, product_variant_id) " +
- " VALUES ('$1', '$2', '$3', '$4'::JSON, '$5', '$6', '$7', '$8', '$9') RETURNING _id;";
+ public static final String CREATE_POLICY_QUERY =
+ "INSERT INTO public.policy( "
+ + " _id, resource_id, invoice_id, constraints, provider_id, consumer_email_id, expiry_at, "
+ + " status, product_variant_id) "
+ + " VALUES ('$1', '$2', '$3', '$4'::JSON, '$5', '$6', '$7', '$8', '$9') RETURNING _id;";
- public static final String GET_POLICY_4_PROVIDER_QUERY =
- "SELECT P._id AS \"policyId\", P.resource_id AS \"resourceId\",\n"
- + "RE.resource_server AS \"resourceServerUrl\",\n"
- + "P.invoice_id AS \"purchaseId\",\n"
- + "RE.resource_name AS \"resourceName\",\n"
- + "P.product_variant_id AS \"productVariantId\",\n"
- + "RE.accesspolicy AS \"accessPolicy\",\n"
- + "P.consumer_email_id AS \"consumerEmailId\",\n"
- + "U.first_name AS \"consumerFirstName\",\n"
- + "U.last_name AS \"consumerLastName\", U._id AS \"consumerId\",\n"
- + "P.status AS \"status\", P.expiry_at AS \"expiryAt\",\n"
- + "P.constraints AS \"constraints\" "
- + " ,P.modified_at AS \"updatedAt\" "
- + " ,P.created_at AS \"createdAt\" "
- + " FROM policy AS P \n"
- + "LEFT JOIN user_table AS U\n"
- + "ON P.consumer_email_id = U.email_id \n"
- + "INNER JOIN resource_entity AS RE\n"
- + "ON RE._id = P.resource_id\n"
- + "AND P.provider_id = $1::uuid \n"
- + "AND RE.resource_server = $2 "
- + " ORDER BY P.modified_at DESC";
- public static final String GET_POLICY_4_CONSUMER_QUERY =
- "SELECT P._id AS \"policyId\", P.resource_id AS \"resourceId\",\n"
- + "RE.resource_server AS \"resourceServerUrl\",\n"
- + "P.invoice_id AS \"purchaseId\",\n"
- + "RE.resource_name AS \"resourceName\",\n"
- + "P.product_variant_id AS \"productVariantId\",\n"
- + "RE.accesspolicy AS \"accessPolicy\",\n"
- + "P.provider_id AS \"providerId\", U.first_name AS \"providerFirstName\",\n"
- + "U.last_name AS \"providerLastName\", U.email_id AS \"providerEmailId\",\n"
- + "P.status as \"status\", P.expiry_at AS \"expiryAt\",\n"
- + "P.constraints AS \"constraints\" \n"
- + " ,P.modified_at AS \"updatedAt\" "
- + " ,P.created_at AS \"createdAt\" "
- + "FROM policy AS P \n"
- + "INNER JOIN user_table AS U\n"
- + "ON P.provider_id = U._id \n"
- + "INNER JOIN resource_entity AS RE\n"
- + "ON RE._id = P.resource_id\n"
- + "AND P.consumer_email_id = $1 \n"
- + "AND RE.resource_server = $2 "
- + " ORDER BY P.modified_at DESC";
- public static final String DELETE_POLICY_QUERY =
- "UPDATE policy SET status='DELETED' "
- + "WHERE _id = $1::uuid AND expiry_at > NOW() RETURNING _id";
- public static final String CHECK_IF_POLICY_PRESENT_QUERY =
- "SELECT p.provider_id, p.status, r.resource_server"
- + " FROM policy p"
- + " INNER JOIN resource_entity r ON p.resource_id = r._id"
- + " WHERE p._id = $1;";
+ public static final String GET_POLICY_4_PROVIDER_QUERY =
+ "SELECT P._id AS \"policyId\", P.resource_id AS \"resourceId\",\n"
+ + "RE.resource_server AS \"resourceServerUrl\",\n"
+ + "P.invoice_id AS \"purchaseId\",\n"
+ + "RE.resource_name AS \"resourceName\",\n"
+ + "P.product_variant_id AS \"productVariantId\",\n"
+ + "RE.accesspolicy AS \"accessPolicy\",\n"
+ + "P.consumer_email_id AS \"consumerEmailId\",\n"
+ + "U.first_name AS \"consumerFirstName\",\n"
+ + "U.last_name AS \"consumerLastName\", U._id AS \"consumerId\",\n"
+ + "P.status AS \"status\", P.expiry_at AS \"expiryAt\",\n"
+ + "P.constraints AS \"constraints\" "
+ + " ,P.modified_at AS \"updatedAt\" "
+ + " ,P.created_at AS \"createdAt\" "
+ + " FROM policy AS P \n"
+ + "LEFT JOIN user_table AS U\n"
+ + "ON P.consumer_email_id = U.email_id \n"
+ + "INNER JOIN resource_entity AS RE\n"
+ + "ON RE._id = P.resource_id\n"
+ + "AND P.provider_id = $1::uuid \n"
+ + "AND RE.resource_server = $2 "
+ + " ORDER BY P.modified_at DESC";
+ public static final String GET_POLICY_4_CONSUMER_QUERY =
+ "SELECT P._id AS \"policyId\", P.resource_id AS \"resourceId\",\n"
+ + "RE.resource_server AS \"resourceServerUrl\",\n"
+ + "P.invoice_id AS \"purchaseId\",\n"
+ + "RE.resource_name AS \"resourceName\",\n"
+ + "P.product_variant_id AS \"productVariantId\",\n"
+ + "RE.accesspolicy AS \"accessPolicy\",\n"
+ + "P.provider_id AS \"providerId\", U.first_name AS \"providerFirstName\",\n"
+ + "U.last_name AS \"providerLastName\", U.email_id AS \"providerEmailId\",\n"
+ + "P.status as \"status\", P.expiry_at AS \"expiryAt\",\n"
+ + "P.constraints AS \"constraints\" \n"
+ + " ,P.modified_at AS \"updatedAt\" "
+ + " ,P.created_at AS \"createdAt\" "
+ + "FROM policy AS P \n"
+ + "INNER JOIN user_table AS U\n"
+ + "ON P.provider_id = U._id \n"
+ + "INNER JOIN resource_entity AS RE\n"
+ + "ON RE._id = P.resource_id\n"
+ + "AND P.consumer_email_id = $1 \n"
+ + "AND RE.resource_server = $2 "
+ + " ORDER BY P.modified_at DESC";
+ public static final String DELETE_POLICY_QUERY =
+ "UPDATE policy SET status='DELETED' "
+ + "WHERE _id = $1::uuid AND expiry_at > NOW() RETURNING _id";
+ public static final String CHECK_IF_POLICY_PRESENT_QUERY =
+ "SELECT p.provider_id, p.status, r.resource_server"
+ + " FROM policy p"
+ + " INNER JOIN resource_entity r ON p.resource_id = r._id"
+ + " WHERE p._id = $1;";
public static final String GET_REQUIRED_INFO_QUERY =
"SELECT DISTINCT I._id AS \"invoiceId\", I.product_variant_id AS \"productVariantId\", I.expiry, "
@@ -88,17 +88,16 @@ public class Constants {
+ " WHERE payment_status = 'SUCCEEDED' "
+ " AND order_id = '$1';";
- public static final String FETCH_PRODUCT_VARIANT =
- " SELECT \"resourceServerUrl\", \"resources\" "
- + "FROM product_variant_view "
- + "WHERE \"productVariantId\" = '$1' "
- + "AND \"productVariantStatus\" = 'ACTIVE'";
+ public static final String FETCH_PRODUCT_VARIANT =
+ " SELECT \"resourceServerUrl\", \"resources\" "
+ + "FROM product_variant_view "
+ + "WHERE \"productVariantId\" = '$1' "
+ + "AND \"productVariantStatus\" = 'ACTIVE'";
-
- public static final String FETCH_POLICY =
- " SELECT DISTINCT resource_id AS \"resources\" FROM policy "
- + "WHERE resource_id = ANY($1) "
- + "AND status = 'ACTIVE' "
- + " AND consumer_email_id = $2"
- + " AND expiry_at > NOW(); ";
-}
\ No newline at end of file
+ public static final String FETCH_POLICY =
+ " SELECT DISTINCT resource_id AS \"resources\" FROM policy "
+ + "WHERE resource_id = ANY($1) "
+ + "AND status = 'ACTIVE' "
+ + " AND consumer_email_id = $2"
+ + " AND expiry_at > NOW(); ";
+}
diff --git a/src/main/java/iudx/data/marketplace/policies/util/Status.java b/src/main/java/iudx/data/marketplace/policies/util/Status.java
index 3a34c53e..7a39cadd 100644
--- a/src/main/java/iudx/data/marketplace/policies/util/Status.java
+++ b/src/main/java/iudx/data/marketplace/policies/util/Status.java
@@ -1,5 +1,6 @@
package iudx.data.marketplace.policies.util;
+
public enum Status {
- ACTIVE,
- DELETED;
+ ACTIVE,
+ DELETED;
}
diff --git a/src/main/java/iudx/data/marketplace/postgres/PostgresService.java b/src/main/java/iudx/data/marketplace/postgres/PostgresService.java
index 15667a15..addec458 100644
--- a/src/main/java/iudx/data/marketplace/postgres/PostgresService.java
+++ b/src/main/java/iudx/data/marketplace/postgres/PostgresService.java
@@ -8,16 +8,15 @@
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.json.JsonObject;
-
import java.util.List;
/**
- * The Postgres Service
+ * The Postgres Service
*
- * Postgres Service
+ * Postgres Service
*
- * The Postgres Service in the IUDX Data Marketplace defines the operations to be performed
- * on the marketplace database
+ * The Postgres Service in the IUDX Data Marketplace defines the operations to be performed on
+ * the marketplace database
*
* @see io.vertx.codegen.annotations.ProxyGen
* @see io.vertx.codegen.annotations.VertxGen
@@ -28,6 +27,18 @@
@ProxyGen
public interface PostgresService {
+ /**
+ * The createProxy helps the code generation blocks to generate proxy code.
+ *
+ * @param vertx which is the vertx instance
+ * @param address which is the proxy address
+ * @return PostgresServiceVertxRBProxy which is a service proxy
+ */
+ @GenIgnore
+ static PostgresService createProxy(Vertx vertx, String address) {
+ return new PostgresServiceVertxEBProxy(vertx, address);
+ }
+
/**
* The executeQuery implements single query operations with the database.
*
@@ -49,7 +60,8 @@ public interface PostgresService {
PostgresService executeCountQuery(final String query, Handler> handler);
/**
- * The executePreparedQuery implements a single query operation with configurable queryParams on the database.
+ * The executePreparedQuery implements a single query operation with configurable queryParams on
+ * the database.
*
* @param query which is a String
* @param queryparams which is a JsonObject
@@ -61,26 +73,18 @@ PostgresService executePreparedQuery(
final String query, final JsonObject queryparams, Handler> handler);
/**
- * The executeTransaction implements a transaction operation(with multiple queries) on the database.
+ * The executeTransaction implements a transaction operation(with multiple queries) on the
+ * database.
*
* @param queries which is a List of String
* @param handler which is a Request Handler
* @return PostgresService which ia a service
*/
@Fluent
- PostgresService executeTransaction(final List queries, Handler> handler);
-
- /**
- * The createProxy helps the code generation blocks to generate proxy code.
- * @param vertx which is the vertx instance
- * @param address which is the proxy address
- * @return PostgresServiceVertxRBProxy which is a service proxy
- */
- @GenIgnore
- static PostgresService createProxy(Vertx vertx, String address) {
- return new PostgresServiceVertxEBProxy(vertx, address);
- }
+ PostgresService executeTransaction(
+ final List queries, Handler> handler);
@Fluent
- PostgresService checkPolicy(final String query,final JsonObject param, Handler> handler);
+ PostgresService checkPolicy(
+ final String query, final JsonObject param, Handler> handler);
}
diff --git a/src/main/java/iudx/data/marketplace/postgres/PostgresServiceImpl.java b/src/main/java/iudx/data/marketplace/postgres/PostgresServiceImpl.java
index ef2a7345..12f0a2fc 100644
--- a/src/main/java/iudx/data/marketplace/postgres/PostgresServiceImpl.java
+++ b/src/main/java/iudx/data/marketplace/postgres/PostgresServiceImpl.java
@@ -1,5 +1,8 @@
package iudx.data.marketplace.postgres;
+import static iudx.data.marketplace.apiserver.util.Constants.RESULTS;
+import static iudx.data.marketplace.apiserver.util.Constants.STATUS_CODE;
+
import io.vertx.core.*;
import io.vertx.core.AsyncResult;
import io.vertx.core.Future;
@@ -14,28 +17,58 @@
import iudx.data.marketplace.common.HttpStatusCode;
import iudx.data.marketplace.common.RespBuilder;
import iudx.data.marketplace.common.ResponseUrn;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collector;
import java.util.stream.Collectors;
-
-import static iudx.data.marketplace.apiserver.util.Constants.RESULTS;
-import static iudx.data.marketplace.apiserver.util.Constants.STATUS_CODE;
-
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class PostgresServiceImpl implements PostgresService {
private static final Logger LOGGER = LogManager.getLogger(PostgresServiceImpl.class);
private final PgPool client;
+
public PostgresServiceImpl(final PgPool pgclient) {
this.client = pgclient;
}
+ private static Future executeBatch(
+ SqlConnection conn, ConcurrentLinkedQueue statements) {
+ try {
+ var statement = statements.poll();
+ if (statement == null) {
+ return Future.succeededFuture();
+ }
+ Promise promise = Promise.promise();
+
+ Collector> rowCollector =
+ Collectors.mapping(row -> row.toJson(), Collectors.toList());
+ conn.query(statement)
+ .collecting(rowCollector)
+ .execute()
+ .map(rows -> rows.value())
+ .onSuccess(
+ successHandler -> {
+ executeBatch(conn, statements)
+ .onComplete(
+ h -> {
+ promise.complete();
+ });
+ })
+ .onFailure(
+ failureHandler -> {
+ LOGGER.debug("Failure : {}", failureHandler.getMessage());
+ LOGGER.error("Fail db");
+ promise.fail(failureHandler);
+ });
+ return promise.future();
+ } catch (Throwable t) {
+ return Future.failedFuture(t);
+ }
+ }
@Override
public PostgresService executeQuery(
@@ -61,8 +94,8 @@ public PostgresService executeQuery(
})
.onFailure(
failureHandler -> {
- LOGGER.debug("Failure : {}",failureHandler.getMessage() );
- String response =
+ LOGGER.debug("Failure : {}", failureHandler.getMessage());
+ String response =
new RespBuilder()
.withType(ResponseUrn.DB_ERROR_URN.getUrn())
.withTitle(ResponseUrn.DB_ERROR_URN.getMessage())
@@ -86,8 +119,8 @@ public PostgresService executeCountQuery(
})
.onFailure(
failureHandler -> {
- LOGGER.debug("Failure : {}",failureHandler.getMessage() );
- String response =
+ LOGGER.debug("Failure : {}", failureHandler.getMessage());
+ String response =
new RespBuilder()
.withType(ResponseUrn.DB_ERROR_URN.getUrn())
.withTitle(ResponseUrn.DB_ERROR_URN.getMessage())
@@ -98,39 +131,6 @@ public PostgresService executeCountQuery(
return this;
}
- private static Future executeBatch(
- SqlConnection conn, ConcurrentLinkedQueue statements) {
- try {
- var statement = statements.poll();
- if (statement == null) {
- return Future.succeededFuture();
- }
- Promise promise = Promise.promise();
-
- Collector> rowCollector =
- Collectors.mapping(row -> row.toJson(), Collectors.toList());
- conn.query(statement)
- .collecting(rowCollector)
- .execute()
- .map(rows -> rows.value())
- .onSuccess(
- successHandler -> {
- executeBatch(conn, statements).onComplete(h -> {
- promise.complete();
- });
- })
- .onFailure(
- failureHandler -> {
- LOGGER.debug("Failure : {}",failureHandler.getMessage() );
- LOGGER.error("Fail db");
- promise.fail(failureHandler);
- });
- return promise.future();
- } catch (Throwable t) {
- return Future.failedFuture(t);
- }
- }
-
@Override
public PostgresService executeTransaction(
final List queries, Handler> handler) {
@@ -139,8 +139,7 @@ public PostgresService executeTransaction(
.withTransaction(
connection -> {
ConcurrentLinkedQueue statements = new ConcurrentLinkedQueue<>(queries);
- Future eB = executeBatch(connection, statements);
- return eB;
+ return executeBatch(connection, statements);
})
.onComplete(
completeHandler -> {
@@ -154,8 +153,8 @@ public PostgresService executeTransaction(
handler.handle(Future.succeededFuture(responseJson));
} else {
LOGGER.debug("transaction failed");
- LOGGER.debug("Failure : {}",completeHandler.cause().getMessage());
- String response =
+ LOGGER.debug("Failure : {}", completeHandler.cause().getMessage());
+ String response =
new RespBuilder()
.withType(ResponseUrn.DB_ERROR_URN.getUrn())
.withTitle(ResponseUrn.DB_ERROR_URN.getMessage())
@@ -202,7 +201,7 @@ public PostgresService executePreparedQuery(
})
.onFailure(
failureHandler -> {
- LOGGER.debug("Failure : {}",failureHandler.getMessage());
+ LOGGER.debug("Failure : {}", failureHandler.getMessage());
String response =
new RespBuilder()
.withType(ResponseUrn.DB_ERROR_URN.getUrn())
@@ -224,10 +223,10 @@ public PostgresService checkPolicy(
LOGGER.debug("query params : " + queryParams.encode());
// Tuple tuple = Tuple.of(resourceIds,consumerEmailId);
- UUID[] ids = resourceIds.stream().map(e -> UUID.fromString(e.toString())).toArray(UUID[]::new);
+ UUID[] ids = resourceIds.stream().map(e -> UUID.fromString(e.toString())).toArray(UUID[]::new);
Tuple tuple = Tuple.of(ids, consumerEmailId);
- Collector> rowCollector =
+ Collector> rowCollector =
Collectors.mapping(row -> row.toJson(), Collectors.toList());
client
@@ -243,8 +242,11 @@ public PostgresService checkPolicy(
LOGGER.debug("response from DB from fetch policy : {}", successHandler);
if (successHandler.isEmpty()) {
LOGGER.error("Empty from DB while fetching policy related info");
- JsonObject response = new JsonObject()
- .put(RESULTS, new RespBuilder()
+ JsonObject response =
+ new JsonObject()
+ .put(
+ RESULTS,
+ new RespBuilder()
.withType(HttpStatusCode.NO_CONTENT.getValue())
.withTitle(HttpStatusCode.NO_CONTENT.getUrn())
.getJsonResponse());
@@ -253,10 +255,13 @@ public PostgresService checkPolicy(
response.put(STATUS_CODE, HttpStatusCode.NO_CONTENT.getValue())));
} else {
- List resourceId = successHandler.stream().map(e -> e.getString("resources")).collect(Collectors.toList());
+ List resourceId =
+ successHandler.stream()
+ .map(e -> e.getString("resources"))
+ .collect(Collectors.toList());
LOGGER.info(
"Policy exists for the resource IDs : {} present in the product variant",
- resourceId);
+ resourceId);
JsonObject responseJson =
new JsonObject()
.put(
@@ -264,8 +269,9 @@ public PostgresService checkPolicy(
new RespBuilder()
.withType(ResponseUrn.SUCCESS_URN.getUrn())
.withTitle(ResponseUrn.SUCCESS_URN.getMessage())
- .withDetail("Policy exists for the resource ID(s) : " +
- resourceId
+ .withDetail(
+ "Policy exists for the resource ID(s) : "
+ + resourceId
+ " from the product variant")
.getJsonResponse())
.put(STATUS_CODE, HttpStatusCode.SUCCESS.getValue());
diff --git a/src/main/java/iudx/data/marketplace/postgres/PostgresVerticle.java b/src/main/java/iudx/data/marketplace/postgres/PostgresVerticle.java
index 77cc2504..2c84ea1d 100644
--- a/src/main/java/iudx/data/marketplace/postgres/PostgresVerticle.java
+++ b/src/main/java/iudx/data/marketplace/postgres/PostgresVerticle.java
@@ -1,5 +1,7 @@
package iudx.data.marketplace.postgres;
+import static iudx.data.marketplace.common.Constants.POSTGRES_SERVICE_ADDRESS;
+
import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.json.JsonObject;
@@ -10,8 +12,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import static iudx.data.marketplace.common.Constants.POSTGRES_SERVICE_ADDRESS;
-
public class PostgresVerticle extends AbstractVerticle {
private static final Logger LOGGER = LogManager.getLogger(PostgresVerticle.class);
private MessageConsumer consumer;
@@ -21,7 +21,7 @@ public class PostgresVerticle extends AbstractVerticle {
private PoolOptions poolOptions;
private PgPool pool;
- private String databaseIP;
+ private String databaseIp;
private int databasePort;
private String databaseName;
private String databaseUserName;
@@ -33,7 +33,7 @@ public class PostgresVerticle extends AbstractVerticle {
@Override
public void start() throws Exception {
- databaseIP = config().getString("databaseIP");
+ databaseIp = config().getString("databaseIP");
databasePort = config().getInteger("databasePort");
databaseName = config().getString("databaseName");
databaseUserName = config().getString("databaseUserName");
@@ -43,7 +43,7 @@ public void start() throws Exception {
this.connectOptions =
new PgConnectOptions()
.setPort(databasePort)
- .setHost(databaseIP)
+ .setHost(databaseIp)
.setDatabase(databaseName)
.setUser(databaseUserName)
.setPassword(databasePassword)
diff --git a/src/main/java/iudx/data/marketplace/postgres/package-info.java b/src/main/java/iudx/data/marketplace/postgres/package-info.java
index 411dd09c..b44b8964 100644
--- a/src/main/java/iudx/data/marketplace/postgres/package-info.java
+++ b/src/main/java/iudx/data/marketplace/postgres/package-info.java
@@ -1,5 +1,6 @@
-@ModuleGen(groupPackage = "iudx.data.marketplace.postgres",
- name="iudx-data-marketplace-postgres-service")
+@ModuleGen(
+ groupPackage = "iudx.data.marketplace.postgres",
+ name = "iudx-data-marketplace-postgres-service")
package iudx.data.marketplace.postgres;
-import io.vertx.codegen.annotations.ModuleGen;
\ No newline at end of file
+import io.vertx.codegen.annotations.ModuleGen;
diff --git a/src/main/java/iudx/data/marketplace/product/ProductService.java b/src/main/java/iudx/data/marketplace/product/ProductService.java
index 6401480d..bbe044f2 100644
--- a/src/main/java/iudx/data/marketplace/product/ProductService.java
+++ b/src/main/java/iudx/data/marketplace/product/ProductService.java
@@ -10,7 +10,8 @@
import io.vertx.core.json.JsonObject;
import iudx.data.marketplace.policies.User;
-@VertxGen @ProxyGen
+@VertxGen
+@ProxyGen
public interface ProductService {
/**
@@ -25,7 +26,6 @@ static ProductService createProxy(Vertx vertx, String address) {
return new ProductServiceVertxEBProxy(vertx, address);
}
-
/**
* The createProduct method implements the creation of a product on the IUDX data marketplace.
*
@@ -34,7 +34,8 @@ static ProductService createProxy(Vertx vertx, String address) {
* @return ProductService which is a service
*/
@Fluent
- ProductService createProduct(User user, JsonObject request, Handler> handler);
+ ProductService createProduct(
+ User user, JsonObject request, Handler> handler);
/**
* The deleteProduct method implements the soft delete of a product on the IUDX data marketplace.
@@ -44,7 +45,8 @@ static ProductService createProxy(Vertx vertx, String address) {
* @return ProductService which is a service
*/
@Fluent
- ProductService deleteProduct(User user, JsonObject request, Handler> handler);
+ ProductService deleteProduct(
+ User user, JsonObject request, Handler