From 406291e9a4499707164ae8d76f908e5159cfce81 Mon Sep 17 00:00:00 2001 From: "shiva.bhalla" Date: Fri, 26 Apr 2019 15:28:00 +0530 Subject: [PATCH] gcs refactor --- .maven.xml | 43 +- converter-api/pom.xml | 241 +++++----- .../net/media/api/ConverterApplication.java | 4 +- .../media/api/models/Request2xPayload.java | 20 +- .../api/models/RequestResponse3xPayload.java | 19 +- .../media/api/models/Response2xPayload.java | 19 +- .../media/api/servlets/ConverterServlet.java | 32 +- converter-core/pom.xml | 446 +++++++++--------- .../main/java/net/media/config/Config.java | 52 +- .../java/net/media/config/ConfigSupport.java | 14 +- .../BannerToDisplayPlacementConverter.java | 21 +- .../BidRequestToRequestConverter.java | 16 +- .../ContentToContentConverter.java | 21 +- .../DeviceToDeviceConverter.java | 8 +- .../GeoToGeoConverter.java | 8 +- .../ImpToItemConverter.java | 21 +- .../VideoToVideoPlacementConverter.java | 8 +- .../BannerToDisplayPlacementConverter.java | 8 +- .../BidRequestToRequestConverter.java | 14 +- .../DeviceToDeviceConverter.java | 8 +- .../ImpToItemConverter.java | 21 +- .../VideoToVideoPlacementConverter.java | 8 +- .../AppToAppConverter.java | 15 +- .../AssetToAssetFormatConverter.java | 50 +- .../AudioToAudioPlacementConverter.java | 17 +- .../BannerToCompanionConverter.java | 4 +- .../BannerToDisplayPlacementConverter.java | 23 +- .../BidRequestToContextConverter.java | 11 +- .../BidRequestToOpenRtbConverter.java | 9 +- .../BidRequestToOpenRtbWrapperConverter.java | 12 +- .../BidRequestToRequestConverter.java | 33 +- .../BidRequestToRestrictionsConverter.java | 27 +- .../ContentToContentConverter.java | 21 +- .../DataToDataConverter.java | 7 +- .../DealToDealConverter.java | 5 +- .../DeviceToDeviceConverter.java | 17 +- .../GeoToGeoConverter.java | 9 +- .../ImpToItemConverter.java | 45 +- .../MetricToMetricConverter.java | 8 +- ...iveRequestBodyToNativeFormatConverter.java | 16 +- .../NativeToDisplayPlacementConverter.java | 28 +- .../ProducerToProducerConverter.java | 15 +- .../PublisherToPublisherConverter.java | 11 +- .../RegsToRegsConverter.java | 11 +- .../SegmentToSegmentConverter.java | 8 +- .../SiteToSiteConverter.java | 15 +- .../SourceToSourceConverter.java | 21 +- .../UserToUserConverter.java | 11 +- .../VideoToVideoPlacementConverter.java | 10 +- .../ContentToContentConverter.java | 13 +- .../DeviceToDeviceConverter.java | 13 +- .../DisplayPlacementToBannerConverter.java | 13 +- .../GeoToGeoConverter.java | 13 +- .../ItemToImpConverter.java | 13 +- .../RequestToBidRequestConverter.java | 13 +- .../VideoPlacementToVideoConverter.java | 13 +- .../DeviceToDeviceConverter.java | 13 +- .../DisplayPlacementToBannerConverter.java | 13 +- .../ItemToImpConverter.java | 13 +- .../RequestToBidRequestConverter.java | 13 +- .../VideoPlacementToVideoConverter.java | 13 +- .../AppToAppConverter.java | 17 +- .../AssetFormatToAssetConverter.java | 37 +- .../AudioPlacementToAudioConverter.java | 15 +- .../CompanionToBannerConverter.java | 15 +- .../ContentToContentConverter.java | 13 +- .../DataToDataConverter.java | 7 +- .../DealToDealConverter.java | 5 +- .../DeviceToDeviceConverter.java | 24 +- .../DisplayPlacementToBannerConverter.java | 23 +- .../DisplayPlacementToNativeConverter.java | 17 +- .../GeoToGeoConverter.java | 11 +- .../ItemToImpConverter.java | 49 +- .../MetricToMetricConverter.java | 5 +- ...iveFormatToNativeRequestBodyConverter.java | 6 +- .../OpenRtbToBidRequestConverter.java | 7 +- .../OpenRtbWrapperToBidRequestConverter.java | 12 +- .../ProducerToProducerConverter.java | 13 +- .../PublisherToPublisherConverter.java | 17 +- .../RegsToRegsConverter.java | 17 +- .../RequestToBidRequestConverter.java | 63 ++- .../RequestToUserConverter.java | 1 + .../SegmentToSegmentConverter.java | 8 +- .../SiteToSiteConverter.java | 17 +- .../SourceToSourceConverter.java | 33 +- .../UserToUserConverter.java | 13 +- .../VideoPlacementToVideoConverter.java | 11 +- .../Bid23ToBid30Converter.java | 8 +- .../Bid24ToBid30Converter.java | 8 +- .../Asset25ToAsset30Converter.java | 47 +- .../Bid25ToBid30Converter.java | 27 +- .../Bid25ToMediaConverter.java | 4 +- .../BidResponseToOpenRtbConverter.java | 4 +- .../BidResponseToOpenRtbWrapperConverter.java | 11 +- .../BidResponseToResponseConverter.java | 13 +- .../BidToAdConverter.java | 28 +- .../BidToAudioConverter.java | 19 +- .../BidToAuditConverter.java | 13 +- .../BidToDisplayConverter.java | 53 ++- .../BidToVideoConverter.java | 20 +- .../LinkToLinkAssetConverter.java | 4 +- .../Native25ToNative30Converter.java | 22 +- .../SeatBid25ToSeatBid30Converter.java | 17 +- .../Bid30ToBid23Converter.java | 13 +- .../Bid30ToBid24Converter.java | 13 +- .../AdToBidConverter.java | 24 +- .../Asset30ToAsset25Converter.java | 58 ++- .../AudioToBidConverter.java | 26 +- .../Bid30ToBid25Converter.java | 11 +- .../DisplayToBidConverter.java | 32 +- .../LinkAssetToLinkConverter.java | 12 +- .../MediatoBidConverter.java | 12 +- .../Native30ToNative10Converter.java | 24 +- ...OpenRtbResponseToBidResponseConverter.java | 23 +- .../OpenRtbWrapperToBidResponseConverter.java | 12 +- .../SeatBid30ToSeatBid25Converter.java | 21 +- .../VideoToBidConverter.java | 26 +- .../java/net/media/driver/Conversion.java | 19 +- .../driver/Convert23To30RequestManager.java | 20 +- .../driver/Convert23To30ResponseManager.java | 4 +- .../driver/Convert24To30RequestManager.java | 16 +- .../driver/Convert24To30ResponseManager.java | 4 +- .../driver/Convert25To30RequestManager.java | 45 +- .../driver/Convert25To30ResponseManager.java | 34 +- .../driver/Convert30To23RequestManager.java | 20 +- .../driver/Convert30To23ResponseManager.java | 4 +- .../driver/Convert30To24RequestManager.java | 16 +- .../driver/Convert30To24ResponseManager.java | 4 +- .../driver/Convert30To25RequestManager.java | 41 +- .../driver/Convert30To25ResponseManager.java | 30 +- .../net/media/driver/ConverterManager.java | 9 +- .../net/media/driver/OpenRtbConverter.java | 37 +- .../src/main/java/net/media/enums/AdType.java | 8 +- .../java/net/media/enums/OpenRtbVersion.java | 4 +- .../net/media/template/EncodeTemplate.java | 5 +- .../java/net/media/template/MacroMapper.java | 51 +- .../net/media/template/MacroProcessor.java | 11 +- .../net/media/template/SimpleTemplate.java | 13 +- .../net/media/template/StaticEncoder.java | 5 +- .../java/net/media/template/Template.java | 25 +- .../media/template/UrlEncodedTemplate.java | 12 +- .../CollectionToCollectionConverter.java | 8 +- .../java/net/media/utils/CollectionUtils.java | 9 +- .../media/utils/JacksonObjectMapperUtils.java | 11 +- .../main/java/net/media/utils/MapUtils.java | 6 +- .../src/main/java/net/media/utils/OsMap.java | 1 + .../main/java/net/media/utils/Provider.java | 11 +- .../validator/CheckAtLeastOneNotNull.java | 13 +- .../validator/CheckAtMostOneNotNull.java | 13 +- .../validator/CheckExactlyOneNotNull.java | 13 +- .../validator/ValidatorErrorHandler.java | 1 + .../media/utils/validator/ValidatorUtils.java | 15 +- .../src/test/java/net.media/Case.java | 5 +- .../test/java/net.media/ConverterTest.java | 16 +- .../src/test/java/net.media/ORTBTester.java | 11 +- .../test/java/net.media/OutputTestPojo.java | 5 +- .../src/test/java/net.media/Test.java | 4 +- .../java/net.media/TestCaseGenerator.java | 8 +- .../src/test/java/net.media/TestOutput.java | 5 +- .../src/test/java/net.media/TestPojo.java | 7 +- pom.xml | 347 +++++++------- 161 files changed, 2218 insertions(+), 1456 deletions(-) diff --git a/.maven.xml b/.maven.xml index 7cf8c6ba..04e59001 100644 --- a/.maven.xml +++ b/.maven.xml @@ -14,27 +14,28 @@ ~ limitations under the License. --> - - - - - ossrh - ${env.SONATYPE_USERNAME} - ${env.SONATYPE_PASSWORD} - - + + + + ossrh + ${env.SONATYPE_USERNAME} + ${env.SONATYPE_PASSWORD} + + - - - ossrh - - true - - - ${env.GPG_EXECUTABLE} - ${env.GPG_PASSPHRASE} - - - + + + ossrh + + true + + + ${env.GPG_EXECUTABLE} + ${env.GPG_PASSPHRASE} + + + \ No newline at end of file diff --git a/converter-api/pom.xml b/converter-api/pom.xml index 52b204a1..7f78b1c9 100644 --- a/converter-api/pom.xml +++ b/converter-api/pom.xml @@ -15,134 +15,137 @@ ~ limitations under the License. --> - - 4.0.0 + + 4.0.0 - - net.media - openrtb3-converter - 1.0.4-SNAPSHOT - + + net.media + openrtb3-converter + 1.0.4-SNAPSHOT + - openrtb3-converter-api - openrtb3-converter-api - Servlet spec based API to test openrtb 3.0 transformation logic - https://github.com/media-net/openrtb3-converter/tree/master/converter-api + openrtb3-converter-api + openrtb3-converter-api + Servlet spec based API to test openrtb 3.0 transformation logic + https://github.com/media-net/openrtb3-converter/tree/master/converter-api - - ${project.artifactId}##${project.version} - - - org.apache.maven.plugins - maven-shade-plugin - 2.1 - - - package - - shade - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - net.media.api.ConverterApplication - - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - - woff - woff2 - ttf - eot - otf - svg - ico - - - + + ${project.artifactId}##${project.version} + + + org.apache.maven.plugins + maven-shade-plugin + 2.1 + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + net.media.api.ConverterApplication + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + woff + woff2 + ttf + eot + otf + svg + ico + + + - - - - src/main/resources - true - - *.* - - - - + + + + src/main/resources + true + + *.* + + + + - jar + jar - + - - com.google.inject - guice - ${guice.version} - + + com.google.inject + guice + ${guice.version} + - - net.media - openrtb3-converter-core - 1.0.4-SNAPSHOT - - - org.apache.tomcat.embed - tomcat-embed-core - ${tomcat.version} - - - org.apache.tomcat.embed - tomcat-embed-logging-juli - ${tomcat.version} - + + net.media + openrtb3-converter-core + 1.0.4-SNAPSHOT + + + org.apache.tomcat.embed + tomcat-embed-core + ${tomcat.version} + + + org.apache.tomcat.embed + tomcat-embed-logging-juli + ${tomcat.version} + - - - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j.version} - - - - org.apache.logging.log4j - log4j-api - ${log4j.version} - - - org.apache.logging.log4j - log4j-core - ${log4j.version} - - - org.apache.logging.log4j - log4j-web - ${log4j.version} - runtime - - + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j.version} + + + + org.apache.logging.log4j + log4j-api + ${log4j.version} + + + org.apache.logging.log4j + log4j-core + ${log4j.version} + + + org.apache.logging.log4j + log4j-web + ${log4j.version} + runtime + + \ No newline at end of file diff --git a/converter-api/src/main/java/net/media/api/ConverterApplication.java b/converter-api/src/main/java/net/media/api/ConverterApplication.java index f5d24ac4..6b7fed5a 100644 --- a/converter-api/src/main/java/net/media/api/ConverterApplication.java +++ b/converter-api/src/main/java/net/media/api/ConverterApplication.java @@ -16,14 +16,12 @@ package net.media.api; +import java.io.File; import net.media.api.servlets.ConverterServlet; import org.apache.catalina.Context; import org.apache.catalina.LifecycleException; import org.apache.catalina.startup.Tomcat; -import javax.servlet.ServletException; -import java.io.File; - public class ConverterApplication { private static void registerServletAndMapping(Context ctx) { diff --git a/converter-api/src/main/java/net/media/api/models/Request2xPayload.java b/converter-api/src/main/java/net/media/api/models/Request2xPayload.java index f9bf6cb2..c455b396 100644 --- a/converter-api/src/main/java/net/media/api/models/Request2xPayload.java +++ b/converter-api/src/main/java/net/media/api/models/Request2xPayload.java @@ -20,10 +20,12 @@ import net.media.openrtb25.request.BidRequest2_X; public class Request2xPayload { + private BidRequest2_X bidRequest; private Config config; - public Request2xPayload() {} + public Request2xPayload() { + } public BidRequest2_X getBidRequest() { return this.bidRequest; @@ -42,15 +44,23 @@ public void setConfig(Config config) { } public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof Request2xPayload)) return false; + if (o == this) { + return true; + } + if (!(o instanceof Request2xPayload)) { + return false; + } final Request2xPayload other = (Request2xPayload) o; - if (!other.canEqual(this)) return false; + if (!other.canEqual(this)) { + return false; + } final Object this$bidRequest = this.getBidRequest(); final Object other$bidRequest = other.getBidRequest(); if (this$bidRequest == null ? other$bidRequest != null - : !this$bidRequest.equals(other$bidRequest)) return false; + : !this$bidRequest.equals(other$bidRequest)) { + return false; + } final Object this$config = this.getConfig(); final Object other$config = other.getConfig(); return this$config == null ? other$config == null : this$config.equals(other$config); diff --git a/converter-api/src/main/java/net/media/api/models/RequestResponse3xPayload.java b/converter-api/src/main/java/net/media/api/models/RequestResponse3xPayload.java index b141f675..e4229bea 100644 --- a/converter-api/src/main/java/net/media/api/models/RequestResponse3xPayload.java +++ b/converter-api/src/main/java/net/media/api/models/RequestResponse3xPayload.java @@ -20,10 +20,12 @@ import net.media.openrtb3.OpenRTBWrapper3_X; public class RequestResponse3xPayload { + private OpenRTBWrapper3_X openRTB; private Config config; - public RequestResponse3xPayload() {} + public RequestResponse3xPayload() { + } public OpenRTBWrapper3_X getOpenRTB() { return this.openRTB; @@ -42,14 +44,21 @@ public void setConfig(Config config) { } public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof RequestResponse3xPayload)) return false; + if (o == this) { + return true; + } + if (!(o instanceof RequestResponse3xPayload)) { + return false; + } final RequestResponse3xPayload other = (RequestResponse3xPayload) o; - if (!other.canEqual(this)) return false; + if (!other.canEqual(this)) { + return false; + } final Object this$openRTB = this.getOpenRTB(); final Object other$openRTB = other.getOpenRTB(); - if (this$openRTB == null ? other$openRTB != null : !this$openRTB.equals(other$openRTB)) + if (this$openRTB == null ? other$openRTB != null : !this$openRTB.equals(other$openRTB)) { return false; + } final Object this$config = this.getConfig(); final Object other$config = other.getConfig(); return this$config == null ? other$config == null : this$config.equals(other$config); diff --git a/converter-api/src/main/java/net/media/api/models/Response2xPayload.java b/converter-api/src/main/java/net/media/api/models/Response2xPayload.java index b84f9590..048b45b1 100644 --- a/converter-api/src/main/java/net/media/api/models/Response2xPayload.java +++ b/converter-api/src/main/java/net/media/api/models/Response2xPayload.java @@ -20,10 +20,12 @@ import net.media.openrtb25.response.BidResponse2_X; public class Response2xPayload { + private BidResponse2_X response; private Config config; - public Response2xPayload() {} + public Response2xPayload() { + } public BidResponse2_X getResponse() { return this.response; @@ -42,14 +44,21 @@ public void setConfig(Config config) { } public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof Response2xPayload)) return false; + if (o == this) { + return true; + } + if (!(o instanceof Response2xPayload)) { + return false; + } final Response2xPayload other = (Response2xPayload) o; - if (!other.canEqual(this)) return false; + if (!other.canEqual(this)) { + return false; + } final Object this$response = this.getResponse(); final Object other$response = other.getResponse(); - if (this$response == null ? other$response != null : !this$response.equals(other$response)) + if (this$response == null ? other$response != null : !this$response.equals(other$response)) { return false; + } final Object this$config = this.getConfig(); final Object other$config = other.getConfig(); return this$config == null ? other$config == null : this$config.equals(other$config); diff --git a/converter-api/src/main/java/net/media/api/servlets/ConverterServlet.java b/converter-api/src/main/java/net/media/api/servlets/ConverterServlet.java index d6952758..63aaebd1 100644 --- a/converter-api/src/main/java/net/media/api/servlets/ConverterServlet.java +++ b/converter-api/src/main/java/net/media/api/servlets/ConverterServlet.java @@ -16,9 +16,20 @@ package net.media.api.servlets; +import static java.util.Objects.isNull; + import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; import com.google.inject.Inject; +import java.io.IOException; +import java.util.Map; +import java.util.Objects; +import java.util.function.BiConsumer; +import javax.naming.ConfigurationException; +import javax.servlet.ServletConfig; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import net.media.api.models.Request2xPayload; import net.media.api.models.RequestResponse3xPayload; import net.media.api.models.Response2xPayload; @@ -29,22 +40,8 @@ import net.media.openrtb25.response.BidResponse2_X; import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.JacksonObjectMapperUtils; - import org.slf4j.Logger; -import javax.naming.ConfigurationException; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.Map; -import java.util.Objects; -import java.util.function.BiConsumer; - -import static java.util.Objects.isNull; - public class ConverterServlet extends HttpServlet { private static final Logger log = org.slf4j.LoggerFactory.getLogger(ConverterServlet.class); @@ -54,7 +51,8 @@ public class ConverterServlet extends HttpServlet { private static final String THREEXTOTHREEX = "3xTo2x"; private static final String TYPE = "type"; private static final String CONVERSIONTYPE = "conversiontype"; - @Inject private OpenRtbConverter openRtbConverter; + @Inject + private OpenRtbConverter openRtbConverter; private Table> queryActionMap; private BiConsumer get2xto3xRequest = (request, response) -> { @@ -176,7 +174,9 @@ private BiConsumer getQueryValues( String conversionType = getParamValue(CONVERSIONTYPE, query); if (Objects.isNull(type) || Objects.isNull(conversionType) - || !queryActionMap.contains(type, conversionType)) return illegalAction; + || !queryActionMap.contains(type, conversionType)) { + return illegalAction; + } return queryActionMap.get(type, conversionType); } } diff --git a/converter-core/pom.xml b/converter-core/pom.xml index dd424740..0a41de6a 100644 --- a/converter-core/pom.xml +++ b/converter-core/pom.xml @@ -15,244 +15,248 @@ ~ limitations under the License. --> - - 4.0.0 + + 4.0.0 - - net.media - openrtb3-converter - 1.0.4-SNAPSHOT - + + net.media + openrtb3-converter + 1.0.4-SNAPSHOT + - openrtb3-converter-core - openrtb3-converter-core - Core library offering transformation support between requests and responses of various OpenRTB versions: 2.3, 2.4, 2.5 and 3.0 - https://github.com/media-net/openrtb3-converter/tree/master/converter-core + openrtb3-converter-core + openrtb3-converter-core + Core library offering transformation support between requests and responses of + various OpenRTB versions: 2.3, 2.4, 2.5 and 3.0 + + https://github.com/media-net/openrtb3-converter/tree/master/converter-core - - ${project.artifactId}##${project.version} - - - org.apache.tomcat.maven - tomcat7-maven-plugin - 2.2 - - - pl.project13.maven - git-commit-id-plugin - 2.1.1 - - - process-resources - get-the-git-infos - - revision - - - + + ${project.artifactId}##${project.version} + + + org.apache.tomcat.maven + tomcat7-maven-plugin + 2.2 + + + pl.project13.maven + git-commit-id-plugin + 2.1.1 + + + process-resources + get-the-git-infos + + revision + + + - - ${project.basedir}/.git - git - dd.MM.yyyy '@' HH:mm:ss z - true - true - ./target/classes/git.properties - - 10 - - false - false - -dirty - true - false - - + + ${project.basedir}/.git + git + dd.MM.yyyy '@' HH:mm:ss z + true + true + ./target/classes/git.properties + + 10 + + false + false + -dirty + true + false + + - - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - org.apache.maven.plugins - maven-shade-plugin - 2.1 - - - package - - shade - - - - - *:* - - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - - - - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - - woff - woff2 - ttf - eot - otf - svg - ico - - - + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + org.apache.maven.plugins + maven-shade-plugin + 2.1 + + + package + + shade + + + + + *:* + + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + woff + woff2 + ttf + eot + otf + svg + ico + + + - - - - src/main/resources - true - - *.* - - - - + + + + src/main/resources + true + + *.* + + + + - jar + jar - + - - - org.apache.commons - commons-lang3 - 3.8.1 - + + + org.apache.commons + commons-lang3 + 3.8.1 + - - com.googlecode.json-simple - json-simple - 1.1.1 - + + com.googlecode.json-simple + json-simple + 1.1.1 + - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - + + com.fasterxml.jackson.core + jackson-databind + ${jackson.version} + - - com.google.guava - guava - ${guava.version} - + + com.google.guava + guava + ${guava.version} + - - com.fasterxml.jackson.dataformat - jackson-dataformat-csv - ${jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-guava - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jdk8 - ${jackson.version} - - - com.fasterxml.jackson.module - jackson-module-parameter-names - ${jackson.version} - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - ${jackson.version} - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-guava + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jdk8 + ${jackson.version} + + + com.fasterxml.jackson.module + jackson-module-parameter-names + ${jackson.version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson.version} + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + - - - javax.validation - validation-api - 2.0.1.Final - + + + javax.validation + validation-api + 2.0.1.Final + - - com.google.collections - google-collections - 1.0 - + + com.google.collections + google-collections + 1.0 + - - - commons-beanutils - commons-beanutils - 1.9.3 - - - org.hibernate - hibernate-validator - 6.0.5.Final - + + + commons-beanutils + commons-beanutils + 1.9.3 + + + org.hibernate + hibernate-validator + 6.0.5.Final + - - org.glassfish.web - javax.el - 2.2.4 - - - javax.el - javax.el-api - 3.0.0 - - - junit - junit - 4.12 - test - - - net.media - openrtb-model - 1.1 - - - org.skyscreamer - jsonassert - 1.2.3 - test - + + org.glassfish.web + javax.el + 2.2.4 + + + javax.el + javax.el-api + 3.0.0 + + + junit + junit + 4.12 + test + + + net.media + openrtb-model + 1.1 + + + org.skyscreamer + jsonassert + 1.2.3 + test + - + diff --git a/converter-core/src/main/java/net/media/config/Config.java b/converter-core/src/main/java/net/media/config/Config.java index de7c2ce3..dd765dea 100644 --- a/converter-core/src/main/java/net/media/config/Config.java +++ b/converter-core/src/main/java/net/media/config/Config.java @@ -16,8 +16,8 @@ package net.media.config; -import net.media.enums.AdType; -import net.media.enums.OpenRtbVersion; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; import java.io.File; import java.io.IOException; @@ -25,9 +25,8 @@ import java.io.Reader; import java.net.URL; import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; +import net.media.enums.AdType; +import net.media.enums.OpenRtbVersion; /** * Provides a handle to read configuration from several data formats. @@ -81,10 +80,14 @@ public class Config { */ private Map adTypeMapping; - /** Whether to clone object references or not while conversion. Only used for collections. */ + /** + * Whether to clone object references or not while conversion. Only used for collections. + */ private Boolean disableCloning; - /** Determines whether the input request or response needs to be v alidated or not. */ + /** + * Determines whether the input request or response needs to be v alidated or not. + */ private Boolean validate; /** @@ -108,7 +111,8 @@ public Config(Config oldConfig) { } } - public Config() {} + public Config() { + } /** * Creates config object from JSON string. @@ -363,26 +367,40 @@ protected boolean canEqual(Object other) { @Override public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof Config)) return false; + if (this == o) { + return true; + } + if (!(o instanceof Config)) { + return false; + } Config config = (Config) o; if (getNativeRequestAsString() != null ? !getNativeRequestAsString().equals(config.getNativeRequestAsString()) - : config.getNativeRequestAsString() != null) return false; + : config.getNativeRequestAsString() != null) { + return false; + } if (getNativeResponseAsString() != null ? !getNativeResponseAsString().equals(config.getNativeResponseAsString()) - : config.getNativeResponseAsString() != null) return false; + : config.getNativeResponseAsString() != null) { + return false; + } if (adTypeMapping != null ? !adTypeMapping.equals(config.adTypeMapping) - : config.adTypeMapping != null) return false; + : config.adTypeMapping != null) { + return false; + } if (getDisableCloning() != null ? !getDisableCloning().equals(config.getDisableCloning()) - : config.getDisableCloning() != null) return false; + : config.getDisableCloning() != null) { + return false; + } if (getValidate() != null ? !getValidate().equals(config.getValidate()) - : config.getValidate() != null) return false; + : config.getValidate() != null) { + return false; + } return getOpenRtbVersion2_XVersion() == config.getOpenRtbVersion2_XVersion(); } @@ -398,8 +416,8 @@ public int hashCode() { result = 31 * result + (getOpenRtbVersion2_XVersion() != null - ? getOpenRtbVersion2_XVersion().hashCode() - : 0); + ? getOpenRtbVersion2_XVersion().hashCode() + : 0); return result; } diff --git a/converter-core/src/main/java/net/media/config/ConfigSupport.java b/converter-core/src/main/java/net/media/config/ConfigSupport.java index 71e125b3..93ac9b48 100644 --- a/converter-core/src/main/java/net/media/config/ConfigSupport.java +++ b/converter-core/src/main/java/net/media/config/ConfigSupport.java @@ -26,14 +26,15 @@ import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; - import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.Reader; import java.net.URL; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class ConfigSupport { private ObjectMapper jsonMapper = createMapper(null, null); @@ -42,7 +43,7 @@ public class ConfigSupport { public T fromJSON(String content, Class configType) throws IOException { return jsonMapper.readValue(content, configType); } - + public T fromJSON(File file, Class configType) throws IOException { return fromJSON(file, configType, null); } @@ -116,10 +117,13 @@ private ObjectMapper createMapper(JsonFactory mapping, ClassLoader classLoader) } @JsonFilter("classFilter") - public static class ClassMixIn {} + public static class ClassMixIn { + + } public static class ConfigMixIn { - @JsonProperty String bannerTemplate; + @JsonProperty + String bannerTemplate; } } diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/BannerToDisplayPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/BannerToDisplayPlacementConverter.java index f6de7d8e..41b33024 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/BannerToDisplayPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/BannerToDisplayPlacementConverter.java @@ -16,7 +16,10 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Banner; @@ -26,16 +29,15 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class BannerToDisplayPlacementConverter extends net.media.converters.request25toRequest30.BannerToDisplayPlacementConverter { - private static final JavaType javaTypeForFormatCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Format.class); + private static final JavaType javaTypeForFormatCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Format.class); public void enhance( Banner banner, DisplayPlacement displayPlacement, Config config, Provider converterProvider) @@ -50,8 +52,9 @@ public void enhance( } if (banner.getExt().containsKey(CommonConstants.FORMAT)) { try { - banner.setFormat(JacksonObjectMapperUtils.getMapper().convertValue(banner.getExt().get(CommonConstants.FORMAT), - javaTypeForFormatCollection)); + banner.setFormat(JacksonObjectMapperUtils.getMapper() + .convertValue(banner.getExt().get(CommonConstants.FORMAT), + javaTypeForFormatCollection)); } catch (Exception e) { throw new OpenRtbConverterException( "Error in setting banner.format from banner.ext" + ".format", e); diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/BidRequestToRequestConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/BidRequestToRequestConverter.java index 2bc8e9f2..876e52ad 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/BidRequestToRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/BidRequestToRequestConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.BidRequest2_X; @@ -25,11 +28,9 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class BidRequestToRequestConverter extends net.media.converters.request25toRequest30.BidRequestToRequestConverter { @@ -60,8 +61,9 @@ public void enhance( } if (source.getExt().containsKey(CommonConstants.SOURCE)) { try { - source.setSource(JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.SOURCE), Source - .class)); + source.setSource(JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.SOURCE), Source + .class)); } catch (Exception e) { throw new OpenRtbConverterException( "Error in setting source from bidRequest.ext.source", e); diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/ContentToContentConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/ContentToContentConverter.java index e7b45a3e..ba6a25cd 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/ContentToContentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/ContentToContentConverter.java @@ -16,7 +16,10 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Content; @@ -25,16 +28,15 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ContentToContentConverter extends net.media.converters.request25toRequest30.ContentToContentConverter { - private static final JavaType javaTypeForDataCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Data.class); + private static final JavaType javaTypeForDataCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Data.class); public void enhance( Content source, net.media.openrtb3.Content target, Config config, Provider converterProvider) @@ -85,8 +87,9 @@ public void enhance( } if (source.getExt().containsKey(CommonConstants.DATA)) { try { - source.setData(JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.DATA), - javaTypeForDataCollection)); + source.setData(JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.DATA), + javaTypeForDataCollection)); } catch (Exception e) { throw new OpenRtbConverterException("Error in setting data from content.ext.data", e); } diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/DeviceToDeviceConverter.java index 0004c3cd..57a5ac84 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/DeviceToDeviceConverter.java @@ -16,15 +16,17 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Device; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DeviceToDeviceConverter extends net.media.converters.request25toRequest30.DeviceToDeviceConverter { diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/GeoToGeoConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/GeoToGeoConverter.java index 90d8c4c8..4c47c1fa 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/GeoToGeoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/GeoToGeoConverter.java @@ -16,15 +16,17 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Geo; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class GeoToGeoConverter extends net.media.converters.request25toRequest30.GeoToGeoConverter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/ImpToItemConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/ImpToItemConverter.java index 556ef19f..58bfbb6a 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/ImpToItemConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/ImpToItemConverter.java @@ -16,7 +16,10 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Imp; @@ -26,16 +29,15 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ImpToItemConverter extends net.media.converters.request25toRequest30.ImpToItemConverter { - private static final JavaType javaTypeForMetricCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Metric.class); + private static final JavaType javaTypeForMetricCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Metric.class); public void enhance(Imp imp, Item item, Config config, Provider converterProvider) throws OpenRtbConverterException { @@ -45,8 +47,9 @@ public void enhance(Imp imp, Item item, Config config, Provider converterProvide if (nonNull(imp.getExt())) { if (imp.getExt().containsKey(CommonConstants.METRIC)) { try { - imp.setMetric(JacksonObjectMapperUtils.getMapper().convertValue(imp.getExt().get(CommonConstants.METRIC), - javaTypeForMetricCollection)); + imp.setMetric(JacksonObjectMapperUtils.getMapper() + .convertValue(imp.getExt().get(CommonConstants.METRIC), + javaTypeForMetricCollection)); } catch (Exception e) { throw new OpenRtbConverterException("Error in setting metric from imp.ext.accuracy", e); } diff --git a/converter-core/src/main/java/net/media/converters/request23toRequest30/VideoToVideoPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request23toRequest30/VideoToVideoPlacementConverter.java index a7a79016..a2b46096 100644 --- a/converter-core/src/main/java/net/media/converters/request23toRequest30/VideoToVideoPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request23toRequest30/VideoToVideoPlacementConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request23toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Video; @@ -23,9 +25,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class VideoToVideoPlacementConverter extends net.media.converters.request25toRequest30.VideoToVideoPlacementConverter { diff --git a/converter-core/src/main/java/net/media/converters/request24toRequest30/BannerToDisplayPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request24toRequest30/BannerToDisplayPlacementConverter.java index a3797b64..4117d087 100644 --- a/converter-core/src/main/java/net/media/converters/request24toRequest30/BannerToDisplayPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request24toRequest30/BannerToDisplayPlacementConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request24toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Banner; @@ -24,9 +26,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class BannerToDisplayPlacementConverter extends net.media.converters.request25toRequest30.BannerToDisplayPlacementConverter { diff --git a/converter-core/src/main/java/net/media/converters/request24toRequest30/BidRequestToRequestConverter.java b/converter-core/src/main/java/net/media/converters/request24toRequest30/BidRequestToRequestConverter.java index b0fbb926..bc140d01 100644 --- a/converter-core/src/main/java/net/media/converters/request24toRequest30/BidRequestToRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request24toRequest30/BidRequestToRequestConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request24toRequest30; +import static java.util.Objects.nonNull; + +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.BidRequest2_X; @@ -25,11 +28,9 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 02/04/19. */ +/** + * Created by rajat.go on 02/04/19. + */ public class BidRequestToRequestConverter extends net.media.converters.request25toRequest30.BidRequestToRequestConverter { @@ -61,7 +62,8 @@ public void enhance( if (source.getExt().containsKey(CommonConstants.SOURCE)) { try { Source source1 = - JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.SOURCE), Source.class); + JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.SOURCE), Source.class); source.setSource(source1); } catch (Exception e) { throw new OpenRtbConverterException( diff --git a/converter-core/src/main/java/net/media/converters/request24toRequest30/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request24toRequest30/DeviceToDeviceConverter.java index fadfd6bc..c6453889 100644 --- a/converter-core/src/main/java/net/media/converters/request24toRequest30/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request24toRequest30/DeviceToDeviceConverter.java @@ -16,15 +16,17 @@ package net.media.converters.request24toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Device; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DeviceToDeviceConverter extends net.media.converters.request25toRequest30.DeviceToDeviceConverter { diff --git a/converter-core/src/main/java/net/media/converters/request24toRequest30/ImpToItemConverter.java b/converter-core/src/main/java/net/media/converters/request24toRequest30/ImpToItemConverter.java index bc209ece..c48e27e3 100644 --- a/converter-core/src/main/java/net/media/converters/request24toRequest30/ImpToItemConverter.java +++ b/converter-core/src/main/java/net/media/converters/request24toRequest30/ImpToItemConverter.java @@ -16,7 +16,10 @@ package net.media.converters.request24toRequest30; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.Collection; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Imp; @@ -26,16 +29,15 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.Collection; - -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ImpToItemConverter extends net.media.converters.request25toRequest30.ImpToItemConverter { - private static final JavaType javaTypeForMetricCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Metric.class); + private static final JavaType javaTypeForMetricCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Metric.class); public void enhance(Imp imp, Item item, Config config, Provider converterProvider) throws OpenRtbConverterException { @@ -45,8 +47,9 @@ public void enhance(Imp imp, Item item, Config config, Provider converterProvide if (nonNull(imp.getExt())) { if (imp.getExt().containsKey(CommonConstants.METRIC)) { try { - imp.setMetric(JacksonObjectMapperUtils.getMapper().convertValue(imp.getExt().get(CommonConstants.METRIC), - javaTypeForMetricCollection)); + imp.setMetric(JacksonObjectMapperUtils.getMapper() + .convertValue(imp.getExt().get(CommonConstants.METRIC), + javaTypeForMetricCollection)); } catch (Exception e) { throw new OpenRtbConverterException("Error in setting metric from imp.ext.metric", e); } diff --git a/converter-core/src/main/java/net/media/converters/request24toRequest30/VideoToVideoPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request24toRequest30/VideoToVideoPlacementConverter.java index 8a654e60..a4010c3c 100644 --- a/converter-core/src/main/java/net/media/converters/request24toRequest30/VideoToVideoPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request24toRequest30/VideoToVideoPlacementConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request24toRequest30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Video; @@ -23,9 +25,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class VideoToVideoPlacementConverter extends net.media.converters.request25toRequest30.VideoToVideoPlacementConverter { diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/AppToAppConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/AppToAppConverter.java index bd628d01..56792cae 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/AppToAppConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/AppToAppConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,10 +31,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class AppToAppConverter implements Converter { @Override @@ -52,7 +51,9 @@ public net.media.openrtb3.App map(App source, Config config, Provider converterP public void enhance( App source, net.media.openrtb3.App target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setPrivpolicy(source.getPrivacypolicy()); target.setSectcat(CollectionUtils.copyCollection(source.getSectioncat(), config)); Converter publisherPublisherConverter = @@ -78,7 +79,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CATTAX)) { target.setCattax((Integer) source.getExt().get(CommonConstants.CATTAX)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/AssetToAssetFormatConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/AssetToAssetFormatConverter.java index f2b86f70..c18e810f 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/AssetToAssetFormatConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/AssetToAssetFormatConverter.java @@ -16,33 +16,43 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Asset; import net.media.openrtb25.request.Banner; -import net.media.openrtb25.request.*; -import net.media.openrtb3.*; +import net.media.openrtb25.request.NativeData; +import net.media.openrtb25.request.NativeImage; +import net.media.openrtb25.request.NativeTitle; +import net.media.openrtb25.request.NativeVideo; +import net.media.openrtb3.AssetFormat; +import net.media.openrtb3.Companion; +import net.media.openrtb3.DataAssetFormat; +import net.media.openrtb3.ImageAssetFormat; +import net.media.openrtb3.TitleAssetFormat; +import net.media.openrtb3.VideoPlacement; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import static java.util.Objects.isNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class AssetToAssetFormatConverter implements Converter { private static final JavaType javaTypeForBannerCollection = - JacksonObjectMapperUtils.getMapper().getTypeFactory().constructCollectionType(Collection.class, Banner.class); + JacksonObjectMapperUtils.getMapper().getTypeFactory() + .constructCollectionType(Collection.class, Banner.class); @Override public AssetFormat map(Asset asset, Config config, Provider converterProvider) @@ -74,7 +84,8 @@ public void enhance( try { if (assetFormat.getExt().containsKey(CommonConstants.CLICKBROWSER)) { - assetFormat.getVideo().setClktype((Integer) assetFormat.getExt().get(CommonConstants.CLICKBROWSER)); + assetFormat.getVideo() + .setClktype((Integer) assetFormat.getExt().get(CommonConstants.CLICKBROWSER)); assetFormat.getExt().remove(CommonConstants.CLICKBROWSER); } } catch (Exception e) { @@ -197,7 +208,8 @@ private VideoPlacement nativeVideoToVideoPlacement(NativeVideo nativeVideo, Conf videoPlacement.getExt().remove(CommonConstants.SKIPMIN); } if (nativeVideo.getExt().containsKey(CommonConstants.SKIPAFTER)) { - videoPlacement.setSkipafter((Integer) nativeVideo.getExt().get(CommonConstants.SKIPAFTER)); + videoPlacement + .setSkipafter((Integer) nativeVideo.getExt().get(CommonConstants.SKIPAFTER)); videoPlacement.getExt().remove(CommonConstants.SKIPAFTER); } if (nativeVideo.getExt().containsKey(CommonConstants.PLAYBACKMETHOD)) { @@ -234,7 +246,8 @@ private VideoPlacement nativeVideoToVideoPlacement(NativeVideo nativeVideo, Conf videoPlacement.getExt().remove(CommonConstants.MAXBITRATE); } if (nativeVideo.getExt().containsKey(CommonConstants.DELIVERY)) { - videoPlacement.setDelivery((List) nativeVideo.getExt().get(CommonConstants.DELIVERY)); + videoPlacement + .setDelivery((List) nativeVideo.getExt().get(CommonConstants.DELIVERY)); videoPlacement.getExt().remove(CommonConstants.DELIVERY); } if (nativeVideo.getExt().containsKey(CommonConstants.MAXSEQ)) { @@ -246,16 +259,19 @@ private VideoPlacement nativeVideoToVideoPlacement(NativeVideo nativeVideo, Conf videoPlacement.getExt().remove(CommonConstants.LINEARITY); } if (nativeVideo.getExt().containsKey(CommonConstants.BOXINGALLOWED)) { - videoPlacement.setBoxing((Integer) nativeVideo.getExt().get(CommonConstants.BOXINGALLOWED)); + videoPlacement + .setBoxing((Integer) nativeVideo.getExt().get(CommonConstants.BOXINGALLOWED)); videoPlacement.getExt().remove(CommonConstants.BOXINGALLOWED); } if (nativeVideo.getExt().containsKey(CommonConstants.PLAYBACKEND)) { - videoPlacement.setPlayend((Integer) nativeVideo.getExt().get(CommonConstants.PLAYBACKEND)); + videoPlacement + .setPlayend((Integer) nativeVideo.getExt().get(CommonConstants.PLAYBACKEND)); videoPlacement.getExt().remove(CommonConstants.PLAYBACKEND); } if (nativeVideo.getExt().containsKey(CommonConstants.COMPANIONTYPE)) { - videoPlacement.setComptype((List) nativeVideo.getExt().get(CommonConstants.COMPANIONTYPE)); + videoPlacement + .setComptype((List) nativeVideo.getExt().get(CommonConstants.COMPANIONTYPE)); videoPlacement.getExt().remove(CommonConstants.COMPANIONTYPE); } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/AudioToAudioPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/AudioToAudioPlacementConverter.java index 80d5524b..51bd1022 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/AudioToAudioPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/AudioToAudioPlacementConverter.java @@ -16,6 +16,12 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,14 +35,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class AudioToAudioPlacementConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToCompanionConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToCompanionConverter.java index 11e40fc8..d7979069 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToCompanionConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToCompanionConverter.java @@ -26,7 +26,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class BannerToCompanionConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToDisplayPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToDisplayPlacementConverter.java index 8f0174ba..b9ab56d1 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToDisplayPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BannerToDisplayPlacementConverter.java @@ -16,6 +16,14 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -28,12 +36,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.*; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class BannerToDisplayPlacementConverter implements Converter { @Override @@ -81,7 +86,7 @@ public void enhance( if (bannerExt.containsKey(CommonConstants.CTYPE)) { displayPlacement.setCtype( CollectionUtils.copyCollection((Collection) bannerExt.get(CommonConstants - .CTYPE), config)); + .CTYPE), config)); displayPlacement.getExt().remove(CommonConstants.CTYPE); } if (bannerExt.containsKey(CommonConstants.PTYPE)) { @@ -176,7 +181,9 @@ private DisplayFormat map(Format format, Config config) { displayFormat.setWratio(format.getWratio()); displayFormat.setHratio(format.getHratio()); if (nonNull(format.getWmin())) { - if (displayFormat.getExt() == null) displayFormat.setExt(new HashMap<>()); + if (displayFormat.getExt() == null) { + displayFormat.setExt(new HashMap<>()); + } displayFormat.getExt().put(CommonConstants.WMIN, format.getWmin()); } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToContextConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToContextConverter.java index 2730b243..09d7fdfa 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToContextConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToContextConverter.java @@ -20,7 +20,12 @@ import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; -import net.media.openrtb25.request.*; +import net.media.openrtb25.request.App; +import net.media.openrtb25.request.BidRequest2_X; +import net.media.openrtb25.request.Device; +import net.media.openrtb25.request.Regs; +import net.media.openrtb25.request.Site; +import net.media.openrtb25.request.User; import net.media.openrtb3.Context; import net.media.openrtb3.Restrictions; import net.media.utils.Provider; @@ -45,7 +50,9 @@ public Context map(BidRequest2_X source, Config config, Provider converterProvid public void enhance( BidRequest2_X source, Context target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter regsRegsConverter = converterProvider.fetch(new Conversion<>(Regs.class, net.media.openrtb3.Regs.class)); Converter siteSiteConverter = diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbConverter.java index dd1ccd89..a0f4c34c 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,10 +27,11 @@ import net.media.openrtb3.Request; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class BidRequestToOpenRtbConverter implements Converter { + @Override public OpenRTB3_X map(BidRequest2_X source, Config config, Provider converterProvider) throws OpenRtbConverterException { diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbWrapperConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbWrapperConverter.java index 7c347c3d..57a93797 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbWrapperConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToOpenRtbWrapperConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,11 +27,12 @@ import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by shiva.b on 10/04/19. */ +/** + * Created by shiva.b on 10/04/19. + */ public class BidRequestToOpenRtbWrapperConverter implements Converter { + @Override public OpenRTBWrapper3_X map(BidRequest2_X source, Config config, Provider converterProvider) throws OpenRtbConverterException { @@ -46,5 +49,6 @@ public OpenRTBWrapper3_X map(BidRequest2_X source, Config config, Provider conve @Override public void enhance( - BidRequest2_X source, OpenRTBWrapper3_X target, Config config, Provider converterProvider) {} + BidRequest2_X source, OpenRTBWrapper3_X target, Config config, Provider converterProvider) { + } } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRequestConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRequestConverter.java index 47aa3791..915626d7 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRequestConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -24,17 +26,21 @@ import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Source; import net.media.openrtb25.request.User; -import net.media.openrtb3.*; +import net.media.openrtb3.Context; +import net.media.openrtb3.Dooh; +import net.media.openrtb3.Item; +import net.media.openrtb3.Placement; +import net.media.openrtb3.Request; +import net.media.openrtb3.Spec; import net.media.utils.CollectionToCollectionConverter; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class BidRequestToRequestConverter implements Converter { private String bidRequestUserCustomdata(BidRequest2_X bidRequest) { @@ -114,19 +120,26 @@ public void enhance( target.setWseat(0); target.setSeat(CollectionUtils.copyCollection(source.getBseat(), config)); } - if (target.getExt() == null) return; + if (target.getExt() == null) { + return; + } if (target.getExt().containsKey(CommonConstants.CATTAX)) { target.getExt().remove(CommonConstants.CATTAX); } if (target.getExt().containsKey(CommonConstants.RESTRICTIONS)) { target.getExt().remove(CommonConstants.RESTRICTIONS); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } if (source.getExt().containsKey(CommonConstants.DOOH)) { - if (target.getContext() == null) target.setContext(new Context()); + if (target.getContext() == null) { + target.setContext(new Context()); + } try { - target.getContext().setDooh(JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.DOOH), - Dooh.class)); + target.getContext().setDooh(JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.DOOH), + Dooh.class)); target.getExt().remove(CommonConstants.DOOH); } catch (ClassCastException e) { throw new OpenRtbConverterException("error while typecasting ext for BidRequest2_X", e); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRestrictionsConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRestrictionsConverter.java index 96646dd9..d6acea11 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRestrictionsConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/BidRequestToRestrictionsConverter.java @@ -16,6 +16,11 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -26,12 +31,6 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.Collection; -import java.util.HashSet; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class BidRequestToRestrictionsConverter implements Converter { @Override @@ -52,12 +51,18 @@ public Restrictions map(BidRequest2_X source, Config config, Provider converterP public void enhance( BidRequest2_X source, Restrictions target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setBapp(CollectionUtils.copyCollection(source.getBapp(), config)); target.setBcat(CollectionUtils.copyCollection(source.getBcat(), config)); target.setBadv(CollectionUtils.copyCollection(source.getBadv(), config)); - if (source.getImp() == null) return; - if (source.getImp().size() == 0) return; + if (source.getImp() == null) { + return; + } + if (source.getImp().size() == 0) { + return; + } Collection battr = new HashSet<>(); for (Imp imp : source.getImp()) { if (imp.getBanner() != null && imp.getBanner().getBattr() != null) { @@ -73,7 +78,9 @@ public void enhance( if (battr.size() > 0) { target.setBattr(CollectionUtils.copyCollection(battr, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CATTAX)) { target.setCattax((Integer) source.getExt().get(CommonConstants.CATTAX)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/ContentToContentConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/ContentToContentConverter.java index a3a9f49b..5e40186a 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/ContentToContentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/ContentToContentConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,11 +33,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class ContentToContentConverter implements Converter { @Override @@ -54,7 +53,9 @@ public net.media.openrtb3.Content map(Content source, Config config, Provider co public void enhance( Content source, net.media.openrtb3.Content target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter producerProducerConverter = converterProvider.fetch( new Conversion<>(Producer.class, net.media.openrtb3.Producer.class)); @@ -93,7 +94,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CATTAX)) { target.setCattax((Integer) source.getExt().get(CommonConstants.CATTAX)); @@ -105,7 +108,9 @@ public void enhance( throw new OpenRtbConverterException("error while typecasting ext for Content", e); } if (source.getVideoquality() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.VIDEOQUALITY, source.getVideoquality()); } } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/DataToDataConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/DataToDataConverter.java index 5608080d..0afa6faa 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/DataToDataConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/DataToDataConverter.java @@ -16,6 +16,7 @@ package net.media.converters.request25toRequest30; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -26,8 +27,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class DataToDataConverter implements Converter { @Override @@ -48,7 +47,9 @@ public net.media.openrtb3.Data map(Data source, Config config, Provider converte public void enhance( Data source, net.media.openrtb3.Data target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter segmentSegmentConverter = converterProvider.fetch( new Conversion<>(net.media.openrtb25.request.Segment.class, Segment.class)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/DealToDealConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/DealToDealConverter.java index 71fd4f29..beebd95e 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/DealToDealConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/DealToDealConverter.java @@ -23,8 +23,11 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class DealToDealConverter implements Converter { + @Override public net.media.openrtb3.Deal map(Deal deal, Config config, Provider converterProvider) { if (deal == null) { diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/DeviceToDeviceConverter.java index 569cbb37..84d05820 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/DeviceToDeviceConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -27,9 +29,6 @@ import net.media.utils.OsMap; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class DeviceToDeviceConverter implements Converter { @Override @@ -50,7 +49,9 @@ public net.media.openrtb3.Device map(Device source, Config config, Provider conv public void enhance( Device source, net.media.openrtb3.Device target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter geoToGeoConverter = converterProvider.fetch(new Conversion<>(Geo.class, net.media.openrtb3.Geo.class)); target.setContype(source.getConnectiontype()); @@ -85,10 +86,14 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getFlashver() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.FLASHVER, source.getFlashver()); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.XFF)) { target.setXff((String) source.getExt().get(CommonConstants.XFF)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/GeoToGeoConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/GeoToGeoConverter.java index 23d5e904..4809f131 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/GeoToGeoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/GeoToGeoConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,9 +26,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class GeoToGeoConverter implements Converter { @Override @@ -47,7 +46,9 @@ public net.media.openrtb3.Geo map(Geo source, Config config, Provider converterP public void enhance( Geo source, net.media.openrtb3.Geo target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setIpserv(source.getIpservice()); target.setAccur(source.getAccuracy()); target.setType(source.getType()); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/ImpToItemConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/ImpToItemConverter.java index 00f78d51..c24fa006 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/ImpToItemConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/ImpToItemConverter.java @@ -16,7 +16,14 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -24,32 +31,32 @@ import net.media.openrtb25.request.Audio; import net.media.openrtb25.request.Banner; import net.media.openrtb25.request.Deal; -import net.media.openrtb25.request.*; +import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Metric; import net.media.openrtb25.request.Native; +import net.media.openrtb25.request.Pmp; import net.media.openrtb25.request.Video; -import net.media.openrtb3.*; +import net.media.openrtb3.AudioPlacement; +import net.media.openrtb3.DisplayPlacement; +import net.media.openrtb3.EventSpec; +import net.media.openrtb3.Item; +import net.media.openrtb3.Placement; +import net.media.openrtb3.Spec; +import net.media.openrtb3.VideoPlacement; import net.media.utils.CollectionToCollectionConverter; import net.media.utils.CollectionUtils; import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class ImpToItemConverter implements Converter { - private static final JavaType javaTypeForEventSpecCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, EventSpec.class); + private static final JavaType javaTypeForEventSpecCollection = JacksonObjectMapperUtils + .getMapper().getTypeFactory() + .constructCollectionType(Collection.class, EventSpec.class); @Override public Item map(Imp imp, Config config, Provider converterProvider) @@ -166,8 +173,9 @@ private void impToPlacement1( displayPlacement.setAmpren((Integer) imp.getExt().get("ampren")); } if (imp.getExt().containsKey("event")) { - displayPlacement.setEvent(JacksonObjectMapperUtils.getMapper().convertValue(imp.getExt().get("event"), - javaTypeForEventSpecCollection)); + displayPlacement + .setEvent(JacksonObjectMapperUtils.getMapper().convertValue(imp.getExt().get("event"), + javaTypeForEventSpecCollection)); } } } catch (ClassCastException e) { @@ -181,7 +189,8 @@ private void impToPlacement1( mappingTarget.setDisplay(displayPlacement); if (nonNull(mappingTarget.getDisplay())) { mappingTarget.getDisplay().setClktype(imp.getClickbrowser()); - mappingTarget.getDisplay().setIfrbust(CollectionUtils.copyCollection(imp.getIframebuster(), config)); + mappingTarget.getDisplay() + .setIfrbust(CollectionUtils.copyCollection(imp.getIframebuster(), config)); mappingTarget.getDisplay().setInstl(imp.getInstl()); } } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/MetricToMetricConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/MetricToMetricConverter.java index 04d058b4..e4d7ac34 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/MetricToMetricConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/MetricToMetricConverter.java @@ -16,15 +16,17 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb25.request.Metric; import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class MetricToMetricConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeRequestBodyToNativeFormatConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeRequestBodyToNativeFormatConverter.java index 160db318..cd35fa82 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeRequestBodyToNativeFormatConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeRequestBodyToNativeFormatConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,12 +33,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class NativeRequestBodyToNativeFormatConverter implements Converter { @@ -65,7 +66,8 @@ public void enhance( if (isNull(nativeFormat.getExt())) { nativeFormat.setExt(new HashMap<>()); } - nativeFormat.getExt().put(CommonConstants.CONTEXTSUBTYPE, nativeRequestBody.getContextsubtype()); + nativeFormat.getExt() + .put(CommonConstants.CONTEXTSUBTYPE, nativeRequestBody.getContextsubtype()); } if (nonNull(nativeRequestBody.getAdunit())) { if (isNull(nativeFormat.getExt())) { diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeToDisplayPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeToDisplayPlacementConverter.java index f52a935e..91db7779 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeToDisplayPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/NativeToDisplayPlacementConverter.java @@ -16,6 +16,12 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,14 +36,9 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class NativeToDisplayPlacementConverter implements Converter { @Override @@ -68,14 +69,16 @@ public void enhance( String nativeRequestString = (String) nat.getRequest(); try { nativeRequest = - JacksonObjectMapperUtils.getMapper().readValue(nativeRequestString, NativeRequest.class); + JacksonObjectMapperUtils.getMapper() + .readValue(nativeRequestString, NativeRequest.class); } catch (IOException e) { throw new OpenRtbConverterException(e); } } else { try { nativeRequest = - JacksonObjectMapperUtils.getMapper().convertValue(nat.getRequest(), NativeRequest.class); + JacksonObjectMapperUtils.getMapper() + .convertValue(nat.getRequest(), NativeRequest.class); } catch (IllegalArgumentException e) { throw new OpenRtbConverterException(e); } @@ -96,8 +99,9 @@ public void enhance( if (nonNull(nat.getExt())) { if (nat.getExt().containsKey(CommonConstants.CTYPE)) { try { - displayPlacement.setCtype(CollectionUtils.copyCollection((Collection) nat.getExt().get - (CommonConstants.CTYPE), config)); + displayPlacement + .setCtype(CollectionUtils.copyCollection((Collection) nat.getExt().get + (CommonConstants.CTYPE), config)); } catch (ClassCastException e) { throw new OpenRtbConverterException("error while typecasting ext for Native", e); } diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/ProducerToProducerConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/ProducerToProducerConverter.java index 1a5abe2c..8eb281de 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/ProducerToProducerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/ProducerToProducerConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -25,10 +28,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class ProducerToProducerConverter implements Converter { @@ -53,7 +52,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setDomain(source.getDomain()); @@ -62,7 +63,9 @@ public void enhance( if (map != null) { target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CATTAX)) { target.setCattax((Integer) source.getExt().get(CommonConstants.CATTAX)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/PublisherToPublisherConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/PublisherToPublisherConverter.java index 66c50562..548e107f 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/PublisherToPublisherConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/PublisherToPublisherConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb25.request.Publisher; @@ -24,10 +27,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class PublisherToPublisherConverter implements Converter { @@ -51,7 +50,9 @@ public void enhance( net.media.openrtb3.Publisher target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setDomain(source.getDomain()); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/RegsToRegsConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/RegsToRegsConverter.java index 992c892f..bc3dc72a 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/RegsToRegsConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/RegsToRegsConverter.java @@ -16,6 +16,7 @@ package net.media.converters.request25toRequest30; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,8 +25,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class RegsToRegsConverter implements Converter { @Override @@ -46,13 +45,17 @@ public net.media.openrtb3.Regs map(Regs source, Config config, Provider converte public void enhance( Regs source, net.media.openrtb3.Regs target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setCoppa(source.getCoppa()); Map map = source.getExt(); if (map != null) { target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.GDPR)) { target.setGdpr((Integer) source.getExt().get(CommonConstants.GDPR)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/SegmentToSegmentConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/SegmentToSegmentConverter.java index 43d58412..8868df69 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/SegmentToSegmentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/SegmentToSegmentConverter.java @@ -16,15 +16,15 @@ package net.media.converters.request25toRequest30; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb25.request.Segment; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class SegmentToSegmentConverter implements Converter { + @Override public net.media.openrtb3.Segment map(Segment source, Config config, Provider converterProvider) { if (source == null) { @@ -44,7 +44,9 @@ public void enhance( net.media.openrtb3.Segment target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setValue(source.getValue()); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/SiteToSiteConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/SiteToSiteConverter.java index 381dc85f..4381f421 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/SiteToSiteConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/SiteToSiteConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request25toRequest30; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,10 +31,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - public class SiteToSiteConverter implements Converter { @Override @@ -52,7 +51,9 @@ public net.media.openrtb3.Site map(Site source, Config config, Provider converte public void enhance( Site source, net.media.openrtb3.Site target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter publisherPublisherConverter = converterProvider.fetch( new Conversion<>(Publisher.class, net.media.openrtb3.Publisher.class)); @@ -79,7 +80,9 @@ public void enhance( if (map != null) { target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CATTAX)) { target.setCattax((Integer) source.getExt().get(CommonConstants.CATTAX)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/SourceToSourceConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/SourceToSourceConverter.java index 75b38462..722f7908 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/SourceToSourceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/SourceToSourceConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request25toRequest30; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,10 +26,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class SourceToSourceConverter implements Converter { @Override @@ -48,7 +49,9 @@ public net.media.openrtb3.Source map(Source source, Config config, Provider conv public void enhance( Source source, net.media.openrtb3.Source target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setTid(source.getTid()); target.setPchain(source.getPchain()); Map map = source.getExt(); @@ -56,10 +59,14 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getFd() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.FD, source.getFd()); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { target.setTs((Integer) source.getExt().get(CommonConstants.TS)); target.setDs((String) source.getExt().get(CommonConstants.DS)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/UserToUserConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/UserToUserConverter.java index 11795169..d2770075 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/UserToUserConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/UserToUserConverter.java @@ -16,6 +16,7 @@ package net.media.converters.request25toRequest30; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,8 +29,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class UserToUserConverter implements Converter { @Override @@ -50,7 +49,9 @@ public net.media.openrtb3.User map(User source, Config config, Provider converte public void enhance( User source, net.media.openrtb3.User target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter geoToGeoConverter = converterProvider.fetch(new Conversion<>(Geo.class, net.media.openrtb3.Geo.class)); Converter dataDataConverter = @@ -68,7 +69,9 @@ public void enhance( if (map != null) { target.setExt(MapUtils.copyMap(map, config)); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } try { if (source.getExt().containsKey(CommonConstants.CONSENT)) { target.setConsent((String) source.getExt().get(CommonConstants.CONSENT)); diff --git a/converter-core/src/main/java/net/media/converters/request25toRequest30/VideoToVideoPlacementConverter.java b/converter-core/src/main/java/net/media/converters/request25toRequest30/VideoToVideoPlacementConverter.java index 6380d9c1..18d9b26f 100644 --- a/converter-core/src/main/java/net/media/converters/request25toRequest30/VideoToVideoPlacementConverter.java +++ b/converter-core/src/main/java/net/media/converters/request25toRequest30/VideoToVideoPlacementConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request25toRequest30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,10 +33,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/01/19. */ +/** + * Created by rajat.go on 03/01/19. + */ public class VideoToVideoPlacementConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/ContentToContentConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/ContentToContentConverter.java index 493b45a0..d27a32b4 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/ContentToContentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/ContentToContentConverter.java @@ -16,18 +16,19 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb3.Content; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ContentToContentConverter extends net.media.converters.request30toRequest25.ContentToContentConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/DeviceToDeviceConverter.java index 545d18d6..f6d9d394 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/DeviceToDeviceConverter.java @@ -16,18 +16,19 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb3.Device; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DeviceToDeviceConverter extends net.media.converters.request30toRequest25.DeviceToDeviceConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/DisplayPlacementToBannerConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/DisplayPlacementToBannerConverter.java index ea262926..4e9559e5 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/DisplayPlacementToBannerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/DisplayPlacementToBannerConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Banner; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DisplayPlacementToBannerConverter extends net.media.converters.request30toRequest25.DisplayPlacementToBannerConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/GeoToGeoConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/GeoToGeoConverter.java index 01778b6d..9cbf4019 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/GeoToGeoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/GeoToGeoConverter.java @@ -16,18 +16,19 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb3.Geo; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class GeoToGeoConverter extends net.media.converters.request30toRequest25.GeoToGeoConverter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/ItemToImpConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/ItemToImpConverter.java index cbe79a82..f9faef13 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/ItemToImpConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/ItemToImpConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Imp; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ItemToImpConverter extends net.media.converters.request30toRequest25.ItemToImpConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/RequestToBidRequestConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/RequestToBidRequestConverter.java index f23f0dbd..7073cc9f 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/RequestToBidRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/RequestToBidRequestConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.BidRequest2_X; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class RequestToBidRequestConverter extends net.media.converters.request30toRequest25.RequestToBidRequestConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest23/VideoPlacementToVideoConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest23/VideoPlacementToVideoConverter.java index 4c6c9334..e6f1795f 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest23/VideoPlacementToVideoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest23/VideoPlacementToVideoConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Video; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class VideoPlacementToVideoConverter extends net.media.converters.request30toRequest25.VideoPlacementToVideoConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest24/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest24/DeviceToDeviceConverter.java index 2821d9c4..78b16550 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest24/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest24/DeviceToDeviceConverter.java @@ -16,18 +16,19 @@ package net.media.converters.request30toRequest24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb3.Device; import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DeviceToDeviceConverter extends net.media.converters.request30toRequest25.DeviceToDeviceConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest24/DisplayPlacementToBannerConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest24/DisplayPlacementToBannerConverter.java index e5be03ec..843652dc 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest24/DisplayPlacementToBannerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest24/DisplayPlacementToBannerConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Banner; @@ -24,12 +28,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class DisplayPlacementToBannerConverter extends net.media.converters.request30toRequest25.DisplayPlacementToBannerConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest24/ItemToImpConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest24/ItemToImpConverter.java index de998be5..2d30a1af 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest24/ItemToImpConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest24/ItemToImpConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Imp; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class ItemToImpConverter extends net.media.converters.request30toRequest25.ItemToImpConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest24/RequestToBidRequestConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest24/RequestToBidRequestConverter.java index 96c4502b..40c16760 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest24/RequestToBidRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest24/RequestToBidRequestConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.BidRequest2_X; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class RequestToBidRequestConverter extends net.media.converters.request30toRequest25.RequestToBidRequestConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest24/VideoPlacementToVideoConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest24/VideoPlacementToVideoConverter.java index a76c1adb..d47b7a50 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest24/VideoPlacementToVideoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest24/VideoPlacementToVideoConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Video; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class VideoPlacementToVideoConverter extends net.media.converters.request30toRequest25.VideoPlacementToVideoConverter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/AppToAppConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/AppToAppConverter.java index 61d5279e..f5d2f736 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/AppToAppConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/AppToAppConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,9 +30,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class AppToAppConverter implements Converter { @Override @@ -51,7 +50,9 @@ public net.media.openrtb25.request.App map(App source, Config config, Provider c public void enhance( App source, net.media.openrtb25.request.App target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setSectioncat(CollectionUtils.copyCollection(source.getSectcat(), config)); target.setPrivacypolicy(source.getPrivpolicy()); Converter publisherPublisherConverter = @@ -78,11 +79,15 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getCattax() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CATTAX, source.getCattax()); } if (source.getStoreid() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.STOREID, source.getStoreid()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/AssetFormatToAssetConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/AssetFormatToAssetConverter.java index 8a2fcf5f..65272f21 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/AssetFormatToAssetConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/AssetFormatToAssetConverter.java @@ -16,24 +16,37 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.request.Asset; import net.media.openrtb25.request.Banner; -import net.media.openrtb25.request.*; -import net.media.openrtb3.*; +import net.media.openrtb25.request.NativeData; +import net.media.openrtb25.request.NativeImage; +import net.media.openrtb25.request.NativeTitle; +import net.media.openrtb25.request.NativeVideo; +import net.media.openrtb3.AssetFormat; +import net.media.openrtb3.Companion; +import net.media.openrtb3.DataAssetFormat; +import net.media.openrtb3.ImageAssetFormat; +import net.media.openrtb3.TitleAssetFormat; +import net.media.openrtb3.VideoPlacement; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.*; - -import static java.util.Objects.isNull; - -/** Created by rajat.go on 04/01/19. */ +/** + * Created by rajat.go on 04/01/19. + */ public class AssetFormatToAssetConverter implements Converter { @Override @@ -119,11 +132,15 @@ private NativeImage imageAssetFormatToNativeImage( } try { if (imageAssetFormat.getHratio() != null) { - if (nativeImage.getExt() == null) nativeImage.setExt(new HashMap<>()); + if (nativeImage.getExt() == null) { + nativeImage.setExt(new HashMap<>()); + } nativeImage.getExt().put(CommonConstants.HRATIO, imageAssetFormat.getHratio()); } if (imageAssetFormat.getWratio() != null) { - if (nativeImage.getExt() == null) nativeImage.setExt(new HashMap<>()); + if (nativeImage.getExt() == null) { + nativeImage.setExt(new HashMap<>()); + } nativeImage.getExt().put(CommonConstants.WRATIO, imageAssetFormat.getWratio()); } } catch (ClassCastException e) { @@ -153,7 +170,7 @@ private NativeVideo videoAssetFormatToVideoImage(VideoPlacement videoPlacement, nativeVideo.getExt().put(CommonConstants.SKIPMIN, videoPlacement.getSkipmin()); nativeVideo.getExt().put(CommonConstants.SKIPAFTER, videoPlacement.getSkipafter()); nativeVideo.getExt().put(CommonConstants.PLAYBACKMETHOD, Collections.singletonList - (videoPlacement.getPlaymethod())); + (videoPlacement.getPlaymethod())); nativeVideo.getExt().put(CommonConstants.PLAYBACKEND, videoPlacement.getPlayend()); nativeVideo.getExt().put(CommonConstants.API, videoPlacement.getApi()); nativeVideo.getExt().put(CommonConstants.W, videoPlacement.getW()); diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/AudioPlacementToAudioConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/AudioPlacementToAudioConverter.java index bfdee68f..65098a53 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/AudioPlacementToAudioConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/AudioPlacementToAudioConverter.java @@ -16,6 +16,13 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,14 +36,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class AudioPlacementToAudioConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/CompanionToBannerConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/CompanionToBannerConverter.java index 39e566a0..3b0679de 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/CompanionToBannerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/CompanionToBannerConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -26,11 +30,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class CompanionToBannerConverter implements Converter { @Override @@ -58,8 +57,9 @@ public void enhance(Companion companion, Banner banner, Config config, Provider banner.setId(companion.getId()); Map map = companion.getExt(); if (map != null) { - if (banner.getExt() == null) banner.setExt(MapUtils.copyMap(map, config)); - else + if (banner.getExt() == null) { + banner.setExt(MapUtils.copyMap(map, config)); + } else { try { Map copyMap = MapUtils.copyMap(map, config); if (nonNull(copyMap)) { @@ -68,6 +68,7 @@ public void enhance(Companion companion, Banner banner, Config config, Provider } catch (Exception e) { throw new OpenRtbConverterException("companion to banner conversion failed ", e); } + } } } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/ContentToContentConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/ContentToContentConverter.java index 5063c6f7..95d6e163 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/ContentToContentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/ContentToContentConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,9 +31,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class ContentToContentConverter implements Converter { @@ -56,7 +55,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter producerProducerConverter = converterProvider.fetch( new Conversion<>(Producer.class, net.media.openrtb25.request.Producer.class)); @@ -95,7 +96,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getCattax() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CATTAX, source.getCattax()); } if (source.getExt() != null) { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/DataToDataConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/DataToDataConverter.java index c77c39e0..12b198db 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/DataToDataConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/DataToDataConverter.java @@ -16,6 +16,7 @@ package net.media.converters.request30toRequest25; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -26,8 +27,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class DataToDataConverter implements Converter { @Override @@ -52,7 +51,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (target == null || source == null) return; + if (target == null || source == null) { + return; + } Converter segmentSegmentConverter = converterProvider.fetch( new Conversion<>(Segment.class, net.media.openrtb25.request.Segment.class)); diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/DealToDealConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/DealToDealConverter.java index a2f24e16..e872ae1f 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/DealToDealConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/DealToDealConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb3.Deal; @@ -23,9 +25,8 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; - public class DealToDealConverter implements Converter { + @Override public net.media.openrtb25.request.Deal map( Deal deal, Config config, Provider converterProvider) { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/DeviceToDeviceConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/DeviceToDeviceConverter.java index 46539975..d7cea077 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/DeviceToDeviceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/DeviceToDeviceConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -27,9 +29,6 @@ import net.media.utils.OsMap; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class DeviceToDeviceConverter implements Converter { @@ -54,7 +53,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter geoGeoConverter = converterProvider.fetch(new Conversion<>(Geo.class, net.media.openrtb25.request.Geo.class)); target.setLanguage(source.getLang()); @@ -69,8 +70,9 @@ public void enhance( target.setIp(source.getIp()); target.setIpv6(source.getIpv6()); if (source.getOs() != null) { - if (OsMap.osMap.inverse().containsKey(source.getOs())) + if (OsMap.osMap.inverse().containsKey(source.getOs())) { target.setOs(OsMap.osMap.inverse().get(source.getOs())); + } } target.setMake(source.getMake()); target.setModel(source.getModel()); @@ -98,15 +100,21 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getXff() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.XFF, source.getXff()); } if (source.getIptr() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.IPTR, source.getIptr()); } if (source.getMccmncsim() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.MCCMNCSIM, source.getMccmncsim()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToBannerConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToBannerConverter.java index 64d36d2d..75c85447 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToBannerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToBannerConverter.java @@ -16,6 +16,13 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -28,14 +35,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class DisplayPlacementToBannerConverter implements Converter { @Override @@ -64,8 +63,9 @@ public void enhance( if (nonNull(displayPlacement.getDisplayfmt())) { for (DisplayFormat displayFormat : displayPlacement.getDisplayfmt()) { if (!CollectionUtils.isEmpty(displayFormat.getExpdir())) { - Collection formatExpdir = CollectionUtils.copyCollection(displayFormat.getExpdir(), - config); + Collection formatExpdir = CollectionUtils + .copyCollection(displayFormat.getExpdir(), + config); if (isNull(banner.getExpdir())) { banner.setExpdir(formatExpdir); } else { @@ -92,7 +92,8 @@ public void enhance( banner.setExt(MapUtils.copyMap(map, config)); if (map.containsKey(CommonConstants.BTYPE)) { try { - banner.setBtype(CollectionUtils.copyCollection((Collection) map.get(CommonConstants.BTYPE), config)); + banner.setBtype(CollectionUtils + .copyCollection((Collection) map.get(CommonConstants.BTYPE), config)); banner.getExt().remove(CommonConstants.BTYPE); } catch (ClassCastException e) { throw new OpenRtbConverterException( diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToNativeConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToNativeConverter.java index b8cee26a..da906532 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToNativeConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/DisplayPlacementToNativeConverter.java @@ -16,7 +16,11 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.core.JsonProcessingException; +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -31,11 +35,6 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class DisplayPlacementToNativeConverter implements Converter { @Override @@ -100,11 +99,15 @@ public void enhance( } try { if (displayPlacement.getPriv() != null) { - if (nat.getExt() == null) nat.setExt(new HashMap<>()); + if (nat.getExt() == null) { + nat.setExt(new HashMap<>()); + } nat.getExt().put(CommonConstants.PRIV, displayPlacement.getPriv()); } if (displayPlacement.getCtype() != null) { - if (nat.getExt() == null) nat.setExt(new HashMap<>()); + if (nat.getExt() == null) { + nat.setExt(new HashMap<>()); + } nat.getExt().put(CommonConstants.CTYPE, displayPlacement.getCtype()); } } catch (ClassCastException e) { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/GeoToGeoConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/GeoToGeoConverter.java index 2b5f95af..abaf0282 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/GeoToGeoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/GeoToGeoConverter.java @@ -16,6 +16,7 @@ package net.media.converters.request30toRequest25; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,8 +25,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class GeoToGeoConverter implements Converter { @Override @@ -46,7 +45,9 @@ public net.media.openrtb25.request.Geo map(Geo source, Config config, Provider c public void enhance( Geo source, net.media.openrtb25.request.Geo target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setIpservice(source.getIpserv()); target.setAccuracy(source.getAccur()); target.setType(source.getType()); @@ -60,7 +61,9 @@ public void enhance( target.setUtcoffset(source.getUtcoffset()); target.setLastfix(source.getLastfix()); Map map = source.getExt(); - if (map == null) return; + if (map == null) { + return; + } if (source.getExt().containsKey(CommonConstants.REGIONFIPS_104)) { try { target.setRegionfips104((String) source.getExt().get(CommonConstants.REGIONFIPS_104)); diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/ItemToImpConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/ItemToImpConverter.java index 1b422b4a..cf8afa93 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/ItemToImpConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/ItemToImpConverter.java @@ -16,6 +16,13 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -23,25 +30,23 @@ import net.media.openrtb25.request.Audio; import net.media.openrtb25.request.Banner; import net.media.openrtb25.request.Deal; -import net.media.openrtb25.request.*; +import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Metric; import net.media.openrtb25.request.Native; +import net.media.openrtb25.request.Pmp; import net.media.openrtb25.request.Video; -import net.media.openrtb3.*; +import net.media.openrtb3.AudioPlacement; +import net.media.openrtb3.DisplayPlacement; +import net.media.openrtb3.Item; +import net.media.openrtb3.Placement; +import net.media.openrtb3.Spec; +import net.media.openrtb3.VideoPlacement; import net.media.utils.CollectionToCollectionConverter; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class ItemToImpConverter implements Converter { @Override @@ -341,20 +346,28 @@ private void fillExtMap(Item item, Imp imp, Config config) { if (isNull(imp.getExt())) { imp.setExt(new HashMap<>()); } - if (item.getSpec().getPlacement().getSsai() != null) + if (item.getSpec().getPlacement().getSsai() != null) { imp.getExt().put(CommonConstants.SSAI, item.getSpec().getPlacement().getSsai()); - if (item.getSpec().getPlacement().getReward() != null) + } + if (item.getSpec().getPlacement().getReward() != null) { imp.getExt().put(CommonConstants.REWARD, item.getSpec().getPlacement().getReward()); - if (item.getSpec().getPlacement().getAdmx() != null) + } + if (item.getSpec().getPlacement().getAdmx() != null) { imp.getExt().put(CommonConstants.ADMX, item.getSpec().getPlacement().getAdmx()); - if (item.getSpec().getPlacement().getCurlx() != null) + } + if (item.getSpec().getPlacement().getCurlx() != null) { imp.getExt().put(CommonConstants.CURLX, item.getSpec().getPlacement().getCurlx()); + } } if (nonNull(item.getSpec().getPlacement().getDisplay())) { - if (item.getSpec().getPlacement().getDisplay().getAmpren() != null) - imp.getExt().put(CommonConstants.AMPREN, item.getSpec().getPlacement().getDisplay().getAmpren()); - if (item.getSpec().getPlacement().getDisplay().getEvent() != null) - imp.getExt().put(CommonConstants.EVENT, item.getSpec().getPlacement().getDisplay().getEvent()); + if (item.getSpec().getPlacement().getDisplay().getAmpren() != null) { + imp.getExt() + .put(CommonConstants.AMPREN, item.getSpec().getPlacement().getDisplay().getAmpren()); + } + if (item.getSpec().getPlacement().getDisplay().getEvent() != null) { + imp.getExt() + .put(CommonConstants.EVENT, item.getSpec().getPlacement().getDisplay().getEvent()); + } } } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/MetricToMetricConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/MetricToMetricConverter.java index 082da04f..c62ad036 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/MetricToMetricConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/MetricToMetricConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,10 +25,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; - public class MetricToMetricConverter implements Converter { + @Override public net.media.openrtb25.request.Metric map( Metric metric, Config config, Provider converterProvider) throws OpenRtbConverterException { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/NativeFormatToNativeRequestBodyConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/NativeFormatToNativeRequestBodyConverter.java index 46215162..aaacfa8d 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/NativeFormatToNativeRequestBodyConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/NativeFormatToNativeRequestBodyConverter.java @@ -16,6 +16,9 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -29,9 +32,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class NativeFormatToNativeRequestBodyConverter implements Converter { diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbToBidRequestConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbToBidRequestConverter.java index be4a48b7..6b42a514 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbToBidRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbToBidRequestConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,8 +27,6 @@ import net.media.openrtb3.Request; import net.media.utils.Provider; -import static java.util.Objects.isNull; - public class OpenRtbToBidRequestConverter implements Converter { @Override @@ -45,5 +45,6 @@ public BidRequest2_X map(OpenRTB3_X source, Config config, Provider converterPro @Override public void enhance( - OpenRTB3_X source, BidRequest2_X target, Config config, Provider converterProvider) {} + OpenRTB3_X source, BidRequest2_X target, Config config, Provider converterProvider) { + } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbWrapperToBidRequestConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbWrapperToBidRequestConverter.java index 0cdefc23..2c4ab926 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbWrapperToBidRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/OpenRtbWrapperToBidRequestConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,11 +27,12 @@ import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by shiva.b on 10/04/19. */ +/** + * Created by shiva.b on 10/04/19. + */ public class OpenRtbWrapperToBidRequestConverter implements Converter { + @Override public BidRequest2_X map(OpenRTBWrapper3_X source, Config config, Provider converterProvider) throws OpenRtbConverterException { @@ -46,5 +49,6 @@ public BidRequest2_X map(OpenRTBWrapper3_X source, Config config, Provider conve @Override public void enhance( - OpenRTBWrapper3_X source, BidRequest2_X target, Config config, Provider converterProvider) {} + OpenRTBWrapper3_X source, BidRequest2_X target, Config config, Provider converterProvider) { + } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/ProducerToProducerConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/ProducerToProducerConverter.java index 88b01188..f0ae7129 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/ProducerToProducerConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/ProducerToProducerConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb3.Producer; @@ -24,9 +26,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class ProducerToProducerConverter implements Converter { @@ -50,7 +49,9 @@ public void enhance( net.media.openrtb25.request.Producer target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setCat(CollectionUtils.copyCollection(source.getCat(), config)); @@ -60,7 +61,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getCattax() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CATTAX, source.getCattax()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/PublisherToPublisherConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/PublisherToPublisherConverter.java index 4da50175..7f9e38b5 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/PublisherToPublisherConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/PublisherToPublisherConverter.java @@ -16,6 +16,10 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.nonNull; + +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb3.Publisher; @@ -24,11 +28,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.nonNull; - public class PublisherToPublisherConverter implements Converter { @@ -52,7 +51,9 @@ public void enhance( net.media.openrtb25.request.Publisher target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setCat(CollectionUtils.copyCollection(source.getCat(), config)); @@ -62,7 +63,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (nonNull(source.getCattax())) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CATTAX, source.getCattax()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/RegsToRegsConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/RegsToRegsConverter.java index 0f905f12..5b727fb4 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/RegsToRegsConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/RegsToRegsConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb3.Regs; @@ -23,9 +25,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class RegsToRegsConverter implements Converter { @Override @@ -48,14 +47,20 @@ public void enhance( net.media.openrtb25.request.Regs target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setCoppa(source.getCoppa()); Map map = source.getExt(); if (map != null) { target.setExt(MapUtils.copyMap(map, config)); } - if (source.getGdpr() == null) return; - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (source.getGdpr() == null) { + return; + } + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.GDPR, source.getGdpr()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToBidRequestConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToBidRequestConverter.java index de47d961..74ee9020 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToBidRequestConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToBidRequestConverter.java @@ -16,6 +16,12 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.nonNull; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -23,20 +29,20 @@ import net.media.openrtb25.request.BidRequest2_X; import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.User; -import net.media.openrtb3.*; +import net.media.openrtb3.App; +import net.media.openrtb3.Device; +import net.media.openrtb3.Item; +import net.media.openrtb3.Regs; +import net.media.openrtb3.Request; +import net.media.openrtb3.Restrictions; +import net.media.openrtb3.Site; +import net.media.openrtb3.Source; import net.media.utils.CollectionToCollectionConverter; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; - -import static java.util.Objects.nonNull; - public class RequestToBidRequestConverter implements Converter { @Override @@ -57,7 +63,9 @@ public BidRequest2_X map(Request source, Config config, Provider converterProvid public void enhance( Request source, BidRequest2_X target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter userUserConverter = converterProvider.fetch(new Conversion<>(net.media.openrtb3.User.class, User.class)); @@ -119,18 +127,25 @@ public void enhance( if (source.getContext().getRestrictions() != null) { target.setBapp( - CollectionUtils.copyCollection(source.getContext().getRestrictions().getBapp(), config)); + CollectionUtils + .copyCollection(source.getContext().getRestrictions().getBapp(), config)); target.setBcat( - CollectionUtils.copyCollection(source.getContext().getRestrictions().getBcat(), config)); + CollectionUtils + .copyCollection(source.getContext().getRestrictions().getBcat(), config)); target.setBadv( - CollectionUtils.copyCollection(source.getContext().getRestrictions().getBadv(), config)); + CollectionUtils + .copyCollection(source.getContext().getRestrictions().getBadv(), config)); if (source.getContext().getRestrictions().getCattax() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put("cattax", source.getContext().getRestrictions().getCattax()); } if (source.getContext().getRestrictions().getExt() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } Restrictions restrictions = new Restrictions(); restrictions.setCattax(null); restrictions.setExt(source.getContext().getRestrictions().getExt()); @@ -219,20 +234,28 @@ public void enhance( if (target.getImp() != null) { for (Imp imp : target.getImp()) { - if (imp.getBanner() != null) + if (imp.getBanner() != null) { imp.getBanner().setBattr(source.getContext().getRestrictions().getBattr()); - if (imp.getVideo() != null) + } + if (imp.getVideo() != null) { imp.getVideo().setBattr(source.getContext().getRestrictions().getBattr()); - if (imp.getNat() != null) + } + if (imp.getNat() != null) { imp.getNat().setBattr(source.getContext().getRestrictions().getBattr()); - if (imp.getAudio() != null) + } + if (imp.getAudio() != null) { imp.getAudio().setBattr(source.getContext().getRestrictions().getBattr()); + } } } - if (source.getContext().getDooh() == null) return; + if (source.getContext().getDooh() == null) { + return; + } - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.DOOH, source.getContext().getDooh()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToUserConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToUserConverter.java index 8d34e2a4..0a5f8e57 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToUserConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/RequestToUserConverter.java @@ -23,6 +23,7 @@ import net.media.utils.Provider; public class RequestToUserConverter implements Converter { + @Override public User map(Request source, Config config, Provider converterProvider) { return null; diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/SegmentToSegmentConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/SegmentToSegmentConverter.java index daa71e39..b505160d 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/SegmentToSegmentConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/SegmentToSegmentConverter.java @@ -16,16 +16,16 @@ package net.media.converters.request30toRequest25; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.openrtb3.Segment; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Map; - public class SegmentToSegmentConverter implements Converter { + @Override public net.media.openrtb25.request.Segment map( Segment source, Config config, Provider converterProvider) { @@ -46,7 +46,9 @@ public void enhance( net.media.openrtb25.request.Segment target, Config config, Provider converterProvider) { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setId(source.getId()); target.setName(source.getName()); target.setValue(source.getValue()); diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/SiteToSiteConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/SiteToSiteConverter.java index 7dcc1299..3fb4ccd7 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/SiteToSiteConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/SiteToSiteConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,9 +30,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class SiteToSiteConverter implements Converter { @Override @@ -54,7 +53,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter publisherPublisherConverter = converterProvider.fetch( new Conversion<>(Publisher.class, net.media.openrtb25.request.Publisher.class)); @@ -83,11 +84,15 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getCattax() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CATTAX, source.getCattax()); } if (source.getAmp() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.AMP, source.getAmp()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/SourceToSourceConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/SourceToSourceConverter.java index ece428a4..7fc00e65 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/SourceToSourceConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/SourceToSourceConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,9 +26,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class SourceToSourceConverter implements Converter { @@ -51,7 +50,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } target.setTid(source.getTid()); target.setPchain(source.getPchain()); Map map = source.getExt(); @@ -59,27 +60,39 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getTs() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.TS, source.getTs()); } if (source.getDs() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.DS, source.getDs()); } if (source.getDsmap() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.DSMAP, source.getDsmap()); } if (source.getCert() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CERT, source.getCert()); } if (source.getDigest() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.DIGEST, source.getDigest()); } - if (source.getExt() == null) return; + if (source.getExt() == null) { + return; + } if (source.getExt().containsKey(CommonConstants.FD)) { try { target.setFd((Integer) source.getExt().get(CommonConstants.FD)); diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/UserToUserConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/UserToUserConverter.java index 8a36683b..f17a43e7 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/UserToUserConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/UserToUserConverter.java @@ -16,6 +16,8 @@ package net.media.converters.request30toRequest25; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,9 +30,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - public class UserToUserConverter implements Converter { @Override @@ -54,7 +53,9 @@ public void enhance( Config config, Provider converterProvider) throws OpenRtbConverterException { - if (source == null || target == null) return; + if (source == null || target == null) { + return; + } Converter geoGeoConverter = converterProvider.fetch(new Conversion<>(Geo.class, net.media.openrtb25.request.Geo.class)); Converter dataDataConverter = @@ -74,7 +75,9 @@ public void enhance( target.setExt(MapUtils.copyMap(map, config)); } if (source.getConsent() != null) { - if (target.getExt() == null) target.setExt(new HashMap<>()); + if (target.getExt() == null) { + target.setExt(new HashMap<>()); + } target.getExt().put(CommonConstants.CONSENT, source.getConsent()); } } diff --git a/converter-core/src/main/java/net/media/converters/request30toRequest25/VideoPlacementToVideoConverter.java b/converter-core/src/main/java/net/media/converters/request30toRequest25/VideoPlacementToVideoConverter.java index f9a43cca..17fc8092 100644 --- a/converter-core/src/main/java/net/media/converters/request30toRequest25/VideoPlacementToVideoConverter.java +++ b/converter-core/src/main/java/net/media/converters/request30toRequest25/VideoPlacementToVideoConverter.java @@ -16,6 +16,11 @@ package net.media.converters.request30toRequest25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.Collections; +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,12 +35,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Collections; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class VideoPlacementToVideoConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response23toResponse30/Bid23ToBid30Converter.java b/converter-core/src/main/java/net/media/converters/response23toResponse30/Bid23ToBid30Converter.java index ccfa7ad0..d4fbdb57 100644 --- a/converter-core/src/main/java/net/media/converters/response23toResponse30/Bid23ToBid30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response23toResponse30/Bid23ToBid30Converter.java @@ -16,6 +16,8 @@ package net.media.converters.response23toResponse30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.converters.response25toresponse30.Bid25ToBid30Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,9 +25,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class Bid23ToBid30Converter extends Bid25ToBid30Converter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/response24toResponse30/Bid24ToBid30Converter.java b/converter-core/src/main/java/net/media/converters/response24toResponse30/Bid24ToBid30Converter.java index 0d62498c..431ac1e8 100644 --- a/converter-core/src/main/java/net/media/converters/response24toResponse30/Bid24ToBid30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response24toResponse30/Bid24ToBid30Converter.java @@ -16,6 +16,8 @@ package net.media.converters.response24toResponse30; +import static java.util.Objects.nonNull; + import net.media.config.Config; import net.media.converters.response25toresponse30.Bid25ToBid30Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,9 +25,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class Bid24ToBid30Converter extends Bid25ToBid30Converter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/Asset25ToAsset30Converter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/Asset25ToAsset30Converter.java index 83963ce5..bf2dda7e 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/Asset25ToAsset30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/Asset25ToAsset30Converter.java @@ -16,24 +16,35 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; -import net.media.openrtb25.response.nativeresponse.*; -import net.media.openrtb3.*; +import net.media.openrtb25.response.nativeresponse.AssetResponse; +import net.media.openrtb25.response.nativeresponse.Link; +import net.media.openrtb25.response.nativeresponse.NativeData; +import net.media.openrtb25.response.nativeresponse.NativeImage; +import net.media.openrtb25.response.nativeresponse.NativeTitle; +import net.media.openrtb25.response.nativeresponse.NativeVideo; +import net.media.openrtb3.Asset; +import net.media.openrtb3.DataAsset; +import net.media.openrtb3.ImageAsset; +import net.media.openrtb3.LinkAsset; +import net.media.openrtb3.TitleAsset; +import net.media.openrtb3.VideoAsset; import net.media.utils.CommonConstants; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class Asset25ToAsset30Converter implements Converter { @Override @@ -67,7 +78,9 @@ public void enhance(AssetResponse source, Asset target, Config config, Provider private DataAsset nativeDataToData(NativeData nativeData, Config config) throws OpenRtbConverterException { - if (isNull(nativeData)) return null; + if (isNull(nativeData)) { + return null; + } DataAsset dataAsset = new DataAsset(); dataAsset.setExt(MapUtils.copyMap(nativeData.getExt(), config)); List value = new ArrayList<>(); @@ -87,7 +100,9 @@ private DataAsset nativeDataToData(NativeData nativeData, Config config) } catch (Exception e) { throw new OpenRtbConverterException("error while typecasting ext for nativeData", e); } - if (isNull(dataAsset.getExt())) dataAsset.setExt(new HashMap<>()); + if (isNull(dataAsset.getExt())) { + dataAsset.setExt(new HashMap<>()); + } dataAsset.getExt().put(CommonConstants.LABEL, nativeData.getLabel()); return dataAsset; } @@ -117,7 +132,9 @@ private ImageAsset nativeImageToImageAsset(NativeImage nativeImage, Config confi private TitleAsset nativeTittleToTittleAsset(NativeTitle nativeTitle, Config config) throws OpenRtbConverterException { - if (isNull(nativeTitle)) return null; + if (isNull(nativeTitle)) { + return null; + } TitleAsset titleAsset = new TitleAsset(); titleAsset.setExt(MapUtils.copyMap(nativeTitle.getExt(), config)); titleAsset.setText(nativeTitle.getText()); @@ -136,7 +153,9 @@ private TitleAsset nativeTittleToTittleAsset(NativeTitle nativeTitle, Config con private VideoAsset nativeVideoToVideoAsset(NativeVideo nativeVideo, Config config) throws OpenRtbConverterException { - if (isNull(nativeVideo)) return null; + if (isNull(nativeVideo)) { + return null; + } VideoAsset videoAsset = new VideoAsset(); videoAsset.setAdm(nativeVideo.getVasttag()); videoAsset.setExt(MapUtils.copyMap(nativeVideo.getExt(), config)); diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToBid30Converter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToBid30Converter.java index c71518d3..3d459714 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToBid30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToBid30Converter.java @@ -16,7 +16,13 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,18 +36,14 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class Bid25ToBid30Converter implements Converter { - private static final JavaType javaTypeForMacroCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Macro.class); + private static final JavaType javaTypeForMacroCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Macro.class); @Override public net.media.openrtb3.Bid map(Bid source, Config config, Provider converterProvider) @@ -81,8 +83,9 @@ public void enhance( if (nonNull(source.getExt())) { if (source.getExt().containsKey(CommonConstants.MACRO)) { try { - Collection macros = JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.MACRO), - javaTypeForMacroCollection); + Collection macros = JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.MACRO), + javaTypeForMacroCollection); target.setMacro(macros); } catch (Exception e) { throw new OpenRtbConverterException("Error in setting bid.macro from bid.ext.macro", e); diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToMediaConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToMediaConverter.java index 4d8493d1..86cd457a 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToMediaConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/Bid25ToMediaConverter.java @@ -25,7 +25,9 @@ import net.media.openrtb3.Media; import net.media.utils.Provider; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class Bid25ToMediaConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbConverter.java index ba5d9740..676d553c 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbConverter.java @@ -25,7 +25,9 @@ import net.media.openrtb3.Response; import net.media.utils.Provider; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidResponseToOpenRtbConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbWrapperConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbWrapperConverter.java index 3169c43b..07bde541 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbWrapperConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToOpenRtbWrapperConverter.java @@ -16,6 +16,8 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,9 +27,9 @@ import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by shiva.b on 10/04/19. */ +/** + * Created by shiva.b on 10/04/19. + */ public class BidResponseToOpenRtbWrapperConverter implements Converter { @@ -47,5 +49,6 @@ public OpenRTBWrapper3_X map(BidResponse2_X source, Config config, Provider conv @Override public void enhance( - BidResponse2_X source, OpenRTBWrapper3_X target, Config config, Provider converterProvider) {} + BidResponse2_X source, OpenRTBWrapper3_X target, Config config, Provider converterProvider) { + } } diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToResponseConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToResponseConverter.java index e6bd998a..7800c598 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToResponseConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidResponseToResponseConverter.java @@ -16,6 +16,10 @@ package net.media.converters.response25toresponse30; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -27,12 +31,9 @@ import net.media.utils.CollectionUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidResponseToResponseConverter implements Converter { /** diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAdConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAdConverter.java index ba431622..3eb7df24 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAdConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAdConverter.java @@ -16,26 +16,31 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; import net.media.openrtb25.response.Bid; -import net.media.openrtb3.*; +import net.media.openrtb3.Ad; +import net.media.openrtb3.Audio; +import net.media.openrtb3.Audit; +import net.media.openrtb3.Display; +import net.media.openrtb3.Video; import net.media.utils.CollectionUtils; import net.media.utils.CommonConstants; import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static net.media.utils.CommonConstants.DEFAULT_CATTAX_TWODOTX; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidToAdConverter implements Converter { @Override @@ -90,7 +95,8 @@ public void enhance(Bid source, Ad target, Config config, Provider converterProv } if (source.getExt().containsKey(CommonConstants.AUDIT)) { - target.setAudit(JacksonObjectMapperUtils.getMapper().convertValue(source.getExt().get(CommonConstants.AUDIT), Audit.class)); + target.setAudit(JacksonObjectMapperUtils.getMapper() + .convertValue(source.getExt().get(CommonConstants.AUDIT), Audit.class)); source.getExt().remove(CommonConstants.AUDIT); } } diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAudioConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAudioConverter.java index 284fa750..926b70d1 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAudioConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAudioConverter.java @@ -16,6 +16,13 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,15 +31,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidToAudioConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAuditConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAuditConverter.java index 9433943d..4bb69bc6 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAuditConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToAuditConverter.java @@ -16,6 +16,10 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; + +import java.util.Collection; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -25,12 +29,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.Collection; -import java.util.Map; - -import static java.util.Objects.isNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidToAuditConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToDisplayConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToDisplayConverter.java index 7cc2258b..9f67fa03 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToDisplayConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToDisplayConverter.java @@ -16,7 +16,14 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.nonNull; + import com.fasterxml.jackson.databind.JavaType; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -32,19 +39,14 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Map; - -import static java.util.Objects.nonNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidToDisplayConverter implements Converter { - private static final JavaType javaTypeForEventCollection = JacksonObjectMapperUtils.getMapper().getTypeFactory() - .constructCollectionType(Collection.class, Event.class); + private static final JavaType javaTypeForEventCollection = JacksonObjectMapperUtils.getMapper() + .getTypeFactory() + .constructCollectionType(Collection.class, Event.class); @Override public Display map(Bid source, Config config, Provider converterProvider) @@ -83,10 +85,14 @@ public void enhance(Bid source, Display target, Config config, Provider converte if (source.getAdm() instanceof String) { try { NativeResponse nativeResponse = - JacksonObjectMapperUtils.getMapper().readValue((String) source.getAdm(), NativeResponse.class); + JacksonObjectMapperUtils.getMapper() + .readValue((String) source.getAdm(), NativeResponse.class); Native _native = converter.map(nativeResponse, config, converterProvider); - if (config.getNativeResponseAsString()) target.setAdm(_native); - else target.set_native(_native); + if (config.getNativeResponseAsString()) { + target.setAdm(_native); + } else { + target.set_native(_native); + } } catch (IOException e) { throw new OpenRtbConverterException( "error while deserializing native response object", e); @@ -95,11 +101,15 @@ public void enhance(Bid source, Display target, Config config, Provider converte try { Native _native = converter.map( - JacksonObjectMapperUtils.getMapper().convertValue(source.getAdm(), NativeResponse.class), + JacksonObjectMapperUtils.getMapper() + .convertValue(source.getAdm(), NativeResponse.class), config, converterProvider); - if (config.getNativeResponseAsString()) target.setAdm(_native); - else target.set_native(_native); + if (config.getNativeResponseAsString()) { + target.setAdm(_native); + } else { + target.set_native(_native); + } } catch (Exception e) { throw new OpenRtbConverterException("error while casting adm to native response", e); } @@ -119,14 +129,16 @@ public void enhance(Bid source, Display target, Config config, Provider converte if (config.getAdType(source.getId()) == AdType.BANNER) { if (ext.containsKey(CommonConstants.BANNER)) { - target.setBanner(JacksonObjectMapperUtils.getMapper().convertValue(ext.get(CommonConstants.BANNER), Banner.class)); + target.setBanner(JacksonObjectMapperUtils.getMapper() + .convertValue(ext.get(CommonConstants.BANNER), Banner.class)); source.getExt().remove(CommonConstants.BANNER); } } else if (config.getAdType(source.getId()) == AdType.NATIVE) { if (ext.containsKey(CommonConstants.NATIVE)) { Native _native; try { - _native = JacksonObjectMapperUtils.getMapper().convertValue(ext.get(CommonConstants.NATIVE), Native.class); + _native = JacksonObjectMapperUtils.getMapper() + .convertValue(ext.get(CommonConstants.NATIVE), Native.class); target.set_native(_native); } catch (Exception e) { throw new OpenRtbConverterException( @@ -137,7 +149,8 @@ public void enhance(Bid source, Display target, Config config, Provider converte } try { target.setEvent( - JacksonObjectMapperUtils.getMapper().convertValue(ext.get(CommonConstants.EVENT), javaTypeForEventCollection)); + JacksonObjectMapperUtils.getMapper() + .convertValue(ext.get(CommonConstants.EVENT), javaTypeForEventCollection)); } catch (IllegalArgumentException e) { throw new OpenRtbConverterException( "error while setting display.event from bid.ext" + ".event", e); diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToVideoConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToVideoConverter.java index 800907f2..ffdc9bd6 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToVideoConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/BidToVideoConverter.java @@ -16,6 +16,12 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,14 +30,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import static java.util.Objects.nonNull; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class BidToVideoConverter implements Converter { @Override @@ -68,8 +69,7 @@ public void enhance(Bid source, Video target, Config config, Provider converterP source.getExt().remove(CommonConstants.DUR); target.setMime((Collection) ext.get(CommonConstants.MIME)); source.getExt().remove(CommonConstants.MIME); - } - catch (Exception e) { + } catch (Exception e) { throw new OpenRtbConverterException("error while type casting bid.ext content", e); } } diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/LinkToLinkAssetConverter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/LinkToLinkAssetConverter.java index 8ed4ebbb..3c07e269 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/LinkToLinkAssetConverter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/LinkToLinkAssetConverter.java @@ -23,7 +23,9 @@ import net.media.openrtb3.LinkAsset; import net.media.utils.Provider; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class LinkToLinkAssetConverter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/Native25ToNative30Converter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/Native25ToNative30Converter.java index dba24657..0c009d41 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/Native25ToNative30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/Native25ToNative30Converter.java @@ -16,6 +16,13 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,15 +37,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static org.apache.commons.collections.CollectionUtils.isEmpty; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class Native25ToNative30Converter implements Converter { @Override @@ -64,7 +65,8 @@ public void enhance( target.setExt(new HashMap<>()); } target.getExt().put(CommonConstants.JS_TRACKER, source.getNativeResponseBody().getJstracker()); - target.getExt().put(CommonConstants.IMP_TRACKERS, source.getNativeResponseBody().getImptrackers()); + target.getExt() + .put(CommonConstants.IMP_TRACKERS, source.getNativeResponseBody().getImptrackers()); Converter linkLinkAssetConverter = converterProvider.fetch(new Conversion<>(Link.class, LinkAsset.class)); Converter assetResponseAssetConverter = diff --git a/converter-core/src/main/java/net/media/converters/response25toresponse30/SeatBid25ToSeatBid30Converter.java b/converter-core/src/main/java/net/media/converters/response25toresponse30/SeatBid25ToSeatBid30Converter.java index f8659cc8..5311a12b 100644 --- a/converter-core/src/main/java/net/media/converters/response25toresponse30/SeatBid25ToSeatBid30Converter.java +++ b/converter-core/src/main/java/net/media/converters/response25toresponse30/SeatBid25ToSeatBid30Converter.java @@ -16,6 +16,12 @@ package net.media.converters.response25toresponse30; +import static java.util.Objects.nonNull; +import static org.apache.commons.collections.CollectionUtils.isEmpty; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -26,14 +32,9 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static java.util.Objects.nonNull; -import static org.apache.commons.collections.CollectionUtils.isEmpty; - -/** @author shiva.b */ +/** + * @author shiva.b + */ public class SeatBid25ToSeatBid30Converter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response30toResponse23/Bid30ToBid23Converter.java b/converter-core/src/main/java/net/media/converters/response30toResponse23/Bid30ToBid23Converter.java index adda22b5..0b6012ba 100644 --- a/converter-core/src/main/java/net/media/converters/response30toResponse23/Bid30ToBid23Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toResponse23/Bid30ToBid23Converter.java @@ -16,6 +16,10 @@ package net.media.converters.response30toResponse23; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.response30toresponse25.Bid30ToBid25Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class Bid30ToBid23Converter extends Bid30ToBid25Converter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/response30toResponse24/Bid30ToBid24Converter.java b/converter-core/src/main/java/net/media/converters/response30toResponse24/Bid30ToBid24Converter.java index acb339e8..a76fa13b 100644 --- a/converter-core/src/main/java/net/media/converters/response30toResponse24/Bid30ToBid24Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toResponse24/Bid30ToBid24Converter.java @@ -16,6 +16,10 @@ package net.media.converters.response30toResponse24; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.response30toresponse25.Bid30ToBid25Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,12 +27,9 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public class Bid30ToBid24Converter extends Bid30ToBid25Converter { public void enhance( diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/AdToBidConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/AdToBidConverter.java index 9028ca2e..fe87ac8b 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/AdToBidConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/AdToBidConverter.java @@ -16,6 +16,10 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,16 +34,13 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class AdToBidConverter implements Converter { public Bid map(Ad source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } Bid bid = new Bid(); enhance(source, bid, config, converterProvider); return bid; @@ -47,7 +48,9 @@ public Bid map(Ad source, Config config, Provider converterProvider) public void enhance(Ad source, Bid target, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } Converter displayBidConverter = converterProvider.fetch(new Conversion<>(Display.class, Bid.class)); Converter videoBidConverter = @@ -58,14 +61,17 @@ public void enhance(Ad source, Bid target, Config config, Provider converterProv target.setCrid(source.getId()); target.setAdomain(CollectionUtils.copyCollection(source.getAdomain(), config)); - if (nonNull(source.getBundle()) && source.getBundle().size() > 0) + if (nonNull(source.getBundle()) && source.getBundle().size() > 0) { target.setBundle(source.getBundle().iterator().next()); + } target.setIurl(source.getIurl()); target.setCat(CollectionUtils.copyCollection(source.getCat(), config)); target.setAttr(CollectionUtils.copyCollection(source.getAttr(), config)); target.setLanguage(source.getLang()); - if (isNull(target.getExt())) target.setExt(new HashMap<>()); + if (isNull(target.getExt())) { + target.setExt(new HashMap<>()); + } if (nonNull(source.getExt())) { target.getExt().putAll(source.getExt()); } diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/Asset30ToAsset25Converter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/Asset30ToAsset25Converter.java index 21a0ba70..848d514d 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/Asset30ToAsset25Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/Asset30ToAsset25Converter.java @@ -16,26 +16,37 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; import net.media.exceptions.OpenRtbConverterException; -import net.media.openrtb25.response.nativeresponse.*; -import net.media.openrtb3.*; +import net.media.openrtb25.response.nativeresponse.AssetResponse; +import net.media.openrtb25.response.nativeresponse.Link; +import net.media.openrtb25.response.nativeresponse.NativeData; +import net.media.openrtb25.response.nativeresponse.NativeImage; +import net.media.openrtb25.response.nativeresponse.NativeTitle; +import net.media.openrtb25.response.nativeresponse.NativeVideo; +import net.media.openrtb3.Asset; +import net.media.openrtb3.DataAsset; +import net.media.openrtb3.ImageAsset; +import net.media.openrtb3.LinkAsset; +import net.media.openrtb3.TitleAsset; +import net.media.openrtb3.VideoAsset; import net.media.utils.CommonConstants; import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class Asset30ToAsset25Converter implements Converter { public AssetResponse map(Asset source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } AssetResponse assetResponse = new AssetResponse(); enhance(source, assetResponse, config, converterProvider); return assetResponse; @@ -47,7 +58,9 @@ public void enhance(Asset source, AssetResponse target, Config config, Provider Converter linkAssetLinkConverter = converterProvider.fetch(new Conversion<>(LinkAsset.class, Link.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } target.setData(dataTonativeData(source.getData(), config)); target.setId(source.getId()); @@ -60,35 +73,46 @@ public void enhance(Asset source, AssetResponse target, Config config, Provider } private NativeData dataTonativeData(DataAsset data, Config config) { - if (isNull(data)) return null; + if (isNull(data)) { + return null; + } NativeData nativeData = new NativeData(); nativeData.setExt(MapUtils.copyMap(data.getExt(), config)); if (nonNull(data.getExt())) { nativeData.setLabel((String) data.getExt().get(CommonConstants.LABEL)); nativeData.getExt().remove(CommonConstants.LABEL); } - if (isNull(nativeData.getExt())) nativeData.setExt(new HashMap<>()); + if (isNull(nativeData.getExt())) { + nativeData.setExt(new HashMap<>()); + } nativeData.getExt().put(CommonConstants.TYPE, data.getType()); nativeData.getExt().put(CommonConstants.LEN, data.getLen()); - if (nonNull(data.getValue()) && data.getValue().size() > 0) + if (nonNull(data.getValue()) && data.getValue().size() > 0) { nativeData.setValue(data.getValue().iterator().next()); + } return nativeData; } private NativeImage imageAssetToNativeImage(ImageAsset imageAsset, Config config) { - if (isNull(imageAsset)) return null; + if (isNull(imageAsset)) { + return null; + } NativeImage nativeImage = new NativeImage(); nativeImage.setExt(MapUtils.copyMap(imageAsset.getExt(), config)); nativeImage.setH(imageAsset.getH()); nativeImage.setW(imageAsset.getW()); nativeImage.setUrl(imageAsset.getUrl()); - if (isNull(nativeImage.getExt())) nativeImage.setExt(new HashMap<>()); + if (isNull(nativeImage.getExt())) { + nativeImage.setExt(new HashMap<>()); + } nativeImage.getExt().put(CommonConstants.TYPE, imageAsset.getType()); return nativeImage; } private NativeVideo videoAssetToNativeVideo(VideoAsset videoAsset, Config config) { - if (isNull(videoAsset)) return null; + if (isNull(videoAsset)) { + return null; + } NativeVideo nativeVideo = new NativeVideo(); nativeVideo.setExt(MapUtils.copyMap(videoAsset.getExt(), config)); nativeVideo.setVasttag(videoAsset.getAdm()); @@ -100,7 +124,9 @@ private NativeVideo videoAssetToNativeVideo(VideoAsset videoAsset, Config config } private NativeTitle tittleAssetToNativeTittle(TitleAsset titleAsset, Config config) { - if (isNull(titleAsset)) return null; + if (isNull(titleAsset)) { + return null; + } NativeTitle nativeTitle = new NativeTitle(); nativeTitle.setExt(MapUtils.copyMap(titleAsset.getExt(), config)); nativeTitle.setText(titleAsset.getText()); diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/AudioToBidConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/AudioToBidConverter.java index 805931aa..1da0b0ad 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/AudioToBidConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/AudioToBidConverter.java @@ -16,6 +16,11 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static org.apache.commons.lang3.StringUtils.isEmpty; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,28 +29,27 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; - public class AudioToBidConverter implements Converter { public Bid map(Audio source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } Bid bid = new Bid(); enhance(source, bid, config, converterProvider); return bid; } public void enhance(Audio source, Bid target, Config config, Provider converterProvider) { - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } target.setAdm(source.getAdm()); - if (nonNull(source.getApi()) && source.getApi().size() > 0) + if (nonNull(source.getApi()) && source.getApi().size() > 0) { target.setApi(source.getApi().iterator().next()); + } if (isNull(target.getExt())) { target.setExt(new HashMap<>()); } @@ -56,6 +60,8 @@ public void enhance(Audio source, Bid target, Config config, Provider converterP target.setNurl(source.getCurl()); } target.getExt().put(CommonConstants.MIME, source.getMime()); - if (nonNull(source.getExt())) target.getExt().putAll(source.getExt()); + if (nonNull(source.getExt())) { + target.getExt().putAll(source.getExt()); + } } } diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/Bid30ToBid25Converter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/Bid30ToBid25Converter.java index c94a15be..abeddc02 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/Bid30ToBid25Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/Bid30ToBid25Converter.java @@ -16,6 +16,11 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.HashMap; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -27,12 +32,6 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class Bid30ToBid25Converter implements Converter { @Override diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/DisplayToBidConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/DisplayToBidConverter.java index 2f2c4b3b..f5e72441 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/DisplayToBidConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/DisplayToBidConverter.java @@ -16,7 +16,13 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static org.apache.commons.lang3.StringUtils.isEmpty; + import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,18 +36,13 @@ import net.media.utils.JacksonObjectMapperUtils; import net.media.utils.Provider; -import java.io.IOException; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; - public class DisplayToBidConverter implements Converter { public Bid map(Display source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } Bid bid = new Bid(); enhance(source, bid, config, converterProvider); return bid; @@ -52,15 +53,18 @@ public void enhance(Display source, Bid target, Config config, Provider converte Converter nativeBidConverter = converterProvider.fetch(new Conversion<>(Native.class, NativeResponse.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } ObjectMapper mapper = JacksonObjectMapperUtils.getMapper(); target.setH(source.getH()); target.setW(source.getW()); target.setWratio(source.getWratio()); target.setHratio(source.getHratio()); - if (nonNull(source.getApi()) && source.getApi().size() > 0) + if (nonNull(source.getApi()) && source.getApi().size() > 0) { target.setApi(source.getApi().iterator().next()); + } if (isNull(target.getExt())) { target.setExt(new HashMap<>()); } @@ -73,7 +77,9 @@ public void enhance(Display source, Bid target, Config config, Provider converte } target.getExt().put(CommonConstants.EVENT, source.getEvent()); target.getExt().put(CommonConstants.MIME, source.getMime()); - if (nonNull(source.getExt())) target.getExt().putAll(source.getExt()); + if (nonNull(source.getExt())) { + target.getExt().putAll(source.getExt()); + } if (config.getAdType(target.getId()) == AdType.NATIVE) { target.getExt().put(CommonConstants.NATIVE, source.get_native()); @@ -87,7 +93,9 @@ public void enhance(Display source, Bid target, Config config, Provider converte throw new OpenRtbConverterException( "error occured while serializing native response", e); } - } else target.setAdm(_native); + } else { + target.setAdm(_native); + } } else if (nonNull(source.getAdm())) { try { Native native3; diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/LinkAssetToLinkConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/LinkAssetToLinkConverter.java index dfeea654..cfde0eb2 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/LinkAssetToLinkConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/LinkAssetToLinkConverter.java @@ -16,6 +16,8 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,20 +26,22 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import static java.util.Objects.isNull; - public class LinkAssetToLinkConverter implements Converter { public Link map(LinkAsset source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } Link link = new Link(); enhance(source, link, config, converterProvider); return link; } public void enhance(LinkAsset source, Link target, Config config, Provider converterProvider) { - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } target.setUrl(source.getUrl()); target.setFallback(source.getUrlfb()); diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/MediatoBidConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/MediatoBidConverter.java index 57098a44..91e75461 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/MediatoBidConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/MediatoBidConverter.java @@ -16,6 +16,8 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,13 +27,13 @@ import net.media.openrtb3.Media; import net.media.utils.Provider; -import static java.util.Objects.isNull; - public class MediatoBidConverter implements Converter { public Bid map(Media source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source)) return null; + if (isNull(source)) { + return null; + } Bid bid = new Bid(); enhance(source, bid, config, converterProvider); return bid; @@ -41,7 +43,9 @@ public void enhance(Media source, Bid target, Config config, Provider converterP throws OpenRtbConverterException { Converter adBidConverter = converterProvider.fetch(new Conversion<>(Ad.class, Bid.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } adBidConverter.enhance(source.getAd(), target, config, converterProvider); } } diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/Native30ToNative10Converter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/Native30ToNative10Converter.java index 0e4a44cd..b2bd668c 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/Native30ToNative10Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/Native30ToNative10Converter.java @@ -16,6 +16,12 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -30,18 +36,13 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class Native30ToNative10Converter implements Converter { public NativeResponse map(Native source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } NativeResponse nativeResponse = new NativeResponse(); NativeResponseBody nativeResponseBody = new NativeResponseBody(); nativeResponse.setNativeResponseBody(nativeResponseBody); @@ -58,7 +59,9 @@ public void enhance( Converter linkAssetLinkConverter = converterProvider.fetch(new Conversion<>(LinkAsset.class, Link.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } NativeResponseBody nativeResponseBody = target.getNativeResponseBody(); List assetResponseList = new ArrayList<>(); @@ -75,7 +78,8 @@ public void enhance( if (nonNull(source.getExt())) { nativeResponseBody.setJstracker((String) source.getExt().get(CommonConstants.JS_TRACKER)); nativeResponseBody.getExt().remove(CommonConstants.JS_TRACKER); - nativeResponseBody.setImptrackers((Collection) source.getExt().get(CommonConstants.IMP_TRACKERS)); + nativeResponseBody + .setImptrackers((Collection) source.getExt().get(CommonConstants.IMP_TRACKERS)); nativeResponseBody.getExt().remove(CommonConstants.IMP_TRACKERS); } } catch (Exception e) { diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbResponseToBidResponseConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbResponseToBidResponseConverter.java index d04be51e..647200c2 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbResponseToBidResponseConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbResponseToBidResponseConverter.java @@ -16,6 +16,11 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.List; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -28,19 +33,15 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.List; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class OpenRtbResponseToBidResponseConverter implements Converter { @Override public BidResponse2_X map(OpenRTB3_X source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } BidResponse2_X bidResponse = new BidResponse2_X(); enhance(source, bidResponse, config, converterProvider); return bidResponse; @@ -53,9 +54,13 @@ public void enhance( Converter seatBid30ToSeatBid25Converter = converterProvider.fetch(new Conversion<>(Seatbid.class, SeatBid.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } Response response = source.getResponse(); - if (response == null) return; + if (response == null) { + return; + } target.setId(response.getId()); List seatBidList = new ArrayList<>(); diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbWrapperToBidResponseConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbWrapperToBidResponseConverter.java index d667b915..5089f4ba 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbWrapperToBidResponseConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/OpenRtbWrapperToBidResponseConverter.java @@ -16,6 +16,8 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; + import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -25,11 +27,12 @@ import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.Provider; -import static java.util.Objects.isNull; - -/** Created by shiva.b on 10/04/19. */ +/** + * Created by shiva.b on 10/04/19. + */ public class OpenRtbWrapperToBidResponseConverter implements Converter { + @Override public BidResponse2_X map(OpenRTBWrapper3_X source, Config config, Provider converterProvider) throws OpenRtbConverterException { @@ -46,5 +49,6 @@ public BidResponse2_X map(OpenRTBWrapper3_X source, Config config, Provider conv @Override public void enhance( - OpenRTBWrapper3_X source, BidResponse2_X target, Config config, Provider converterProvider) {} + OpenRTBWrapper3_X source, BidResponse2_X target, Config config, Provider converterProvider) { + } } diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/SeatBid30ToSeatBid25Converter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/SeatBid30ToSeatBid25Converter.java index 6122afc8..39a6fb90 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/SeatBid30ToSeatBid25Converter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/SeatBid30ToSeatBid25Converter.java @@ -16,6 +16,12 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.driver.Conversion; @@ -26,19 +32,14 @@ import net.media.utils.MapUtils; import net.media.utils.Provider; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - public class SeatBid30ToSeatBid25Converter implements Converter { @Override public SeatBid map(Seatbid source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } SeatBid seatBid = new SeatBid(); enhance(source, seatBid, config, converterProvider); return seatBid; @@ -50,7 +51,9 @@ public void enhance(Seatbid source, SeatBid target, Config config, Provider conv Converter bidBidConverter = converterProvider.fetch(new Conversion<>(net.media.openrtb3.Bid.class, Bid.class)); - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } Map map = source.getExt(); if (map != null) { diff --git a/converter-core/src/main/java/net/media/converters/response30toresponse25/VideoToBidConverter.java b/converter-core/src/main/java/net/media/converters/response30toresponse25/VideoToBidConverter.java index 0689887a..6f06e6f1 100644 --- a/converter-core/src/main/java/net/media/converters/response30toresponse25/VideoToBidConverter.java +++ b/converter-core/src/main/java/net/media/converters/response30toresponse25/VideoToBidConverter.java @@ -16,6 +16,11 @@ package net.media.converters.response30toresponse25; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; +import static org.apache.commons.lang3.StringUtils.isEmpty; + +import java.util.HashMap; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -24,28 +29,27 @@ import net.media.utils.CommonConstants; import net.media.utils.Provider; -import java.util.HashMap; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; -import static org.apache.commons.lang3.StringUtils.isEmpty; - public class VideoToBidConverter implements Converter { public Bid map(Video source, Config config, Provider converterProvider) throws OpenRtbConverterException { - if (isNull(source) || isNull(config)) return null; + if (isNull(source) || isNull(config)) { + return null; + } Bid bid = new Bid(); enhance(source, bid, config, converterProvider); return bid; } public void enhance(Video source, Bid target, Config config, Provider converterProvider) { - if (isNull(source) || isNull(target) || isNull(config)) return; + if (isNull(source) || isNull(target) || isNull(config)) { + return; + } target.setAdm(source.getAdm()); - if (nonNull(source.getApi()) && source.getApi().size() > 0) + if (nonNull(source.getApi()) && source.getApi().size() > 0) { target.setApi(source.getApi().iterator().next()); + } if (isNull(target.getExt())) { target.setExt(new HashMap<>()); } @@ -56,6 +60,8 @@ public void enhance(Video source, Bid target, Config config, Provider converterP target.setNurl(source.getCurl()); } target.getExt().put(CommonConstants.MIME, source.getMime()); - if (nonNull(source.getExt())) target.getExt().putAll(source.getExt()); + if (nonNull(source.getExt())) { + target.getExt().putAll(source.getExt()); + } } } diff --git a/converter-core/src/main/java/net/media/driver/Conversion.java b/converter-core/src/main/java/net/media/driver/Conversion.java index 0a8b26ed..7e87a285 100644 --- a/converter-core/src/main/java/net/media/driver/Conversion.java +++ b/converter-core/src/main/java/net/media/driver/Conversion.java @@ -16,7 +16,9 @@ package net.media.driver; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class Conversion { private Class source; @@ -46,14 +48,21 @@ public void setTarget(Class target) { } public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof Conversion)) return false; + if (o == this) { + return true; + } + if (!(o instanceof Conversion)) { + return false; + } final Conversion other = (Conversion) o; - if (!other.canEqual(this)) return false; + if (!other.canEqual(this)) { + return false; + } final Object this$source = this.getSource(); final Object other$source = other.getSource(); - if (this$source == null ? other$source != null : !this$source.equals(other$source)) + if (this$source == null ? other$source != null : !this$source.equals(other$source)) { return false; + } final Object this$target = this.getTarget(); final Object other$target = other.getTarget(); return this$target == null ? other$target == null : this$target.equals(other$target); diff --git a/converter-core/src/main/java/net/media/driver/Convert23To30RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert23To30RequestManager.java index 133d757c..c42a9a8f 100644 --- a/converter-core/src/main/java/net/media/driver/Convert23To30RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert23To30RequestManager.java @@ -16,15 +16,29 @@ package net.media.driver; -import net.media.converters.request23toRequest30.*; -import net.media.openrtb25.request.*; +import net.media.converters.request23toRequest30.BannerToDisplayPlacementConverter; +import net.media.converters.request23toRequest30.BidRequestToRequestConverter; +import net.media.converters.request23toRequest30.ContentToContentConverter; +import net.media.converters.request23toRequest30.DeviceToDeviceConverter; +import net.media.converters.request23toRequest30.GeoToGeoConverter; +import net.media.converters.request23toRequest30.ImpToItemConverter; +import net.media.converters.request23toRequest30.VideoToVideoPlacementConverter; +import net.media.openrtb25.request.Banner; +import net.media.openrtb25.request.BidRequest2_X; +import net.media.openrtb25.request.Content; +import net.media.openrtb25.request.Device; +import net.media.openrtb25.request.Geo; +import net.media.openrtb25.request.Imp; +import net.media.openrtb25.request.Video; import net.media.openrtb3.DisplayPlacement; import net.media.openrtb3.Item; import net.media.openrtb3.Request; import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert23To30RequestManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert23To30ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert23To30ResponseManager.java index 3ab8cf6c..7607882d 100644 --- a/converter-core/src/main/java/net/media/driver/Convert23To30ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert23To30ResponseManager.java @@ -20,7 +20,9 @@ import net.media.openrtb25.response.Bid; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert23To30ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert24To30RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert24To30RequestManager.java index 9c16b71f..727f2e54 100644 --- a/converter-core/src/main/java/net/media/driver/Convert24To30RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert24To30RequestManager.java @@ -16,15 +16,25 @@ package net.media.driver; -import net.media.converters.request24toRequest30.*; -import net.media.openrtb25.request.*; +import net.media.converters.request24toRequest30.BannerToDisplayPlacementConverter; +import net.media.converters.request24toRequest30.BidRequestToRequestConverter; +import net.media.converters.request24toRequest30.DeviceToDeviceConverter; +import net.media.converters.request24toRequest30.ImpToItemConverter; +import net.media.converters.request24toRequest30.VideoToVideoPlacementConverter; +import net.media.openrtb25.request.Banner; +import net.media.openrtb25.request.BidRequest2_X; +import net.media.openrtb25.request.Device; +import net.media.openrtb25.request.Imp; +import net.media.openrtb25.request.Video; import net.media.openrtb3.DisplayPlacement; import net.media.openrtb3.Item; import net.media.openrtb3.Request; import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert24To30RequestManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert24To30ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert24To30ResponseManager.java index 8be8814f..0f166ba5 100644 --- a/converter-core/src/main/java/net/media/driver/Convert24To30ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert24To30ResponseManager.java @@ -20,7 +20,9 @@ import net.media.openrtb25.response.Bid; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert24To30ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert25To30RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert25To30RequestManager.java index a30b2e42..ec55a92b 100644 --- a/converter-core/src/main/java/net/media/driver/Convert25To30RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert25To30RequestManager.java @@ -16,28 +16,67 @@ package net.media.driver; -import net.media.converters.request25toRequest30.*; +import net.media.converters.request25toRequest30.AppToAppConverter; +import net.media.converters.request25toRequest30.AssetToAssetFormatConverter; +import net.media.converters.request25toRequest30.AudioToAudioPlacementConverter; +import net.media.converters.request25toRequest30.BannerToCompanionConverter; +import net.media.converters.request25toRequest30.BannerToDisplayPlacementConverter; +import net.media.converters.request25toRequest30.BidRequestToContextConverter; +import net.media.converters.request25toRequest30.BidRequestToOpenRtbConverter; +import net.media.converters.request25toRequest30.BidRequestToOpenRtbWrapperConverter; +import net.media.converters.request25toRequest30.BidRequestToRequestConverter; +import net.media.converters.request25toRequest30.BidRequestToRestrictionsConverter; +import net.media.converters.request25toRequest30.ContentToContentConverter; +import net.media.converters.request25toRequest30.DataToDataConverter; +import net.media.converters.request25toRequest30.DealToDealConverter; +import net.media.converters.request25toRequest30.DeviceToDeviceConverter; +import net.media.converters.request25toRequest30.GeoToGeoConverter; +import net.media.converters.request25toRequest30.ImpToItemConverter; +import net.media.converters.request25toRequest30.MetricToMetricConverter; +import net.media.converters.request25toRequest30.NativeRequestBodyToNativeFormatConverter; +import net.media.converters.request25toRequest30.NativeToDisplayPlacementConverter; +import net.media.converters.request25toRequest30.ProducerToProducerConverter; +import net.media.converters.request25toRequest30.PublisherToPublisherConverter; +import net.media.converters.request25toRequest30.RegsToRegsConverter; +import net.media.converters.request25toRequest30.SegmentToSegmentConverter; +import net.media.converters.request25toRequest30.SiteToSiteConverter; +import net.media.converters.request25toRequest30.SourceToSourceConverter; +import net.media.converters.request25toRequest30.UserToUserConverter; +import net.media.converters.request25toRequest30.VideoToVideoPlacementConverter; import net.media.openrtb25.request.Asset; import net.media.openrtb25.request.Audio; import net.media.openrtb25.request.Banner; -import net.media.openrtb25.request.*; +import net.media.openrtb25.request.BidRequest2_X; import net.media.openrtb25.request.Deal; +import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Metric; import net.media.openrtb25.request.Native; +import net.media.openrtb25.request.NativeRequestBody; import net.media.openrtb25.request.Producer; import net.media.openrtb25.request.Publisher; import net.media.openrtb25.request.Source; import net.media.openrtb25.request.Video; import net.media.openrtb3.App; -import net.media.openrtb3.*; +import net.media.openrtb3.AssetFormat; +import net.media.openrtb3.AudioPlacement; +import net.media.openrtb3.Companion; import net.media.openrtb3.Content; +import net.media.openrtb3.Context; import net.media.openrtb3.Data; import net.media.openrtb3.Device; +import net.media.openrtb3.DisplayPlacement; import net.media.openrtb3.Geo; +import net.media.openrtb3.Item; +import net.media.openrtb3.NativeFormat; +import net.media.openrtb3.OpenRTB3_X; +import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.openrtb3.Regs; +import net.media.openrtb3.Request; +import net.media.openrtb3.Restrictions; import net.media.openrtb3.Segment; import net.media.openrtb3.Site; import net.media.openrtb3.User; +import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; @SuppressWarnings("unchecked") diff --git a/converter-core/src/main/java/net/media/driver/Convert25To30ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert25To30ResponseManager.java index f31897c5..d7f2f5db 100644 --- a/converter-core/src/main/java/net/media/driver/Convert25To30ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert25To30ResponseManager.java @@ -16,16 +16,44 @@ package net.media.driver; -import net.media.converters.response25toresponse30.*; +import net.media.converters.response25toresponse30.Asset25ToAsset30Converter; +import net.media.converters.response25toresponse30.Bid25ToBid30Converter; +import net.media.converters.response25toresponse30.Bid25ToMediaConverter; +import net.media.converters.response25toresponse30.BidResponseToOpenRtbConverter; +import net.media.converters.response25toresponse30.BidResponseToOpenRtbWrapperConverter; +import net.media.converters.response25toresponse30.BidResponseToResponseConverter; +import net.media.converters.response25toresponse30.BidToAdConverter; +import net.media.converters.response25toresponse30.BidToAudioConverter; +import net.media.converters.response25toresponse30.BidToAuditConverter; +import net.media.converters.response25toresponse30.BidToDisplayConverter; +import net.media.converters.response25toresponse30.BidToVideoConverter; +import net.media.converters.response25toresponse30.LinkToLinkAssetConverter; +import net.media.converters.response25toresponse30.Native25ToNative30Converter; +import net.media.converters.response25toresponse30.SeatBid25ToSeatBid30Converter; import net.media.openrtb25.response.BidResponse2_X; import net.media.openrtb25.response.SeatBid; import net.media.openrtb25.response.nativeresponse.AssetResponse; import net.media.openrtb25.response.nativeresponse.Link; import net.media.openrtb25.response.nativeresponse.NativeResponse; -import net.media.openrtb3.*; +import net.media.openrtb3.Ad; +import net.media.openrtb3.Asset; +import net.media.openrtb3.Audio; +import net.media.openrtb3.Audit; +import net.media.openrtb3.Bid; +import net.media.openrtb3.Display; +import net.media.openrtb3.LinkAsset; +import net.media.openrtb3.Media; +import net.media.openrtb3.Native; +import net.media.openrtb3.OpenRTB3_X; +import net.media.openrtb3.OpenRTBWrapper3_X; +import net.media.openrtb3.Response; +import net.media.openrtb3.Seatbid; +import net.media.openrtb3.Video; import net.media.utils.Provider; -/** Created by shiva.b on 28/03/19. */ +/** + * Created by shiva.b on 28/03/19. + */ @SuppressWarnings("unchecked") public class Convert25To30ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert30To23RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert30To23RequestManager.java index 43748bd4..19af81e2 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To23RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To23RequestManager.java @@ -16,15 +16,29 @@ package net.media.driver; -import net.media.converters.request30toRequest23.*; +import net.media.converters.request30toRequest23.ContentToContentConverter; +import net.media.converters.request30toRequest23.DeviceToDeviceConverter; +import net.media.converters.request30toRequest23.DisplayPlacementToBannerConverter; +import net.media.converters.request30toRequest23.GeoToGeoConverter; +import net.media.converters.request30toRequest23.ItemToImpConverter; +import net.media.converters.request30toRequest23.RequestToBidRequestConverter; +import net.media.converters.request30toRequest23.VideoPlacementToVideoConverter; import net.media.openrtb25.request.Banner; import net.media.openrtb25.request.BidRequest2_X; import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Video; -import net.media.openrtb3.*; +import net.media.openrtb3.Content; +import net.media.openrtb3.Device; +import net.media.openrtb3.DisplayPlacement; +import net.media.openrtb3.Geo; +import net.media.openrtb3.Item; +import net.media.openrtb3.Request; +import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert30To23RequestManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert30To23ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert30To23ResponseManager.java index 7155721b..b98cbc0a 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To23ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To23ResponseManager.java @@ -20,7 +20,9 @@ import net.media.openrtb3.Bid; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert30To23ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert30To24RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert30To24RequestManager.java index ce166e61..f55e5b63 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To24RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To24RequestManager.java @@ -16,15 +16,25 @@ package net.media.driver; -import net.media.converters.request30toRequest24.*; +import net.media.converters.request30toRequest24.DeviceToDeviceConverter; +import net.media.converters.request30toRequest24.DisplayPlacementToBannerConverter; +import net.media.converters.request30toRequest24.ItemToImpConverter; +import net.media.converters.request30toRequest24.RequestToBidRequestConverter; +import net.media.converters.request30toRequest24.VideoPlacementToVideoConverter; import net.media.openrtb25.request.Banner; import net.media.openrtb25.request.BidRequest2_X; import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Video; -import net.media.openrtb3.*; +import net.media.openrtb3.Device; +import net.media.openrtb3.DisplayPlacement; +import net.media.openrtb3.Item; +import net.media.openrtb3.Request; +import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert30To24RequestManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert30To24ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert30To24ResponseManager.java index b1760185..0dc22078 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To24ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To24ResponseManager.java @@ -20,7 +20,9 @@ import net.media.openrtb3.Bid; import net.media.utils.Provider; -/** Created by rajat.go on 04/04/19. */ +/** + * Created by rajat.go on 04/04/19. + */ @SuppressWarnings("unchecked") public class Convert30To24ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/Convert30To25RequestManager.java b/converter-core/src/main/java/net/media/driver/Convert30To25RequestManager.java index 4a6ecb0c..15730321 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To25RequestManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To25RequestManager.java @@ -16,28 +16,63 @@ package net.media.driver; -import net.media.converters.request30toRequest25.*; +import net.media.converters.request30toRequest25.AppToAppConverter; +import net.media.converters.request30toRequest25.AssetFormatToAssetConverter; +import net.media.converters.request30toRequest25.AudioPlacementToAudioConverter; +import net.media.converters.request30toRequest25.CompanionToBannerConverter; +import net.media.converters.request30toRequest25.ContentToContentConverter; +import net.media.converters.request30toRequest25.DataToDataConverter; +import net.media.converters.request30toRequest25.DealToDealConverter; +import net.media.converters.request30toRequest25.DeviceToDeviceConverter; +import net.media.converters.request30toRequest25.DisplayPlacementToBannerConverter; +import net.media.converters.request30toRequest25.DisplayPlacementToNativeConverter; +import net.media.converters.request30toRequest25.GeoToGeoConverter; +import net.media.converters.request30toRequest25.ItemToImpConverter; +import net.media.converters.request30toRequest25.NativeFormatToNativeRequestBodyConverter; +import net.media.converters.request30toRequest25.OpenRtbToBidRequestConverter; +import net.media.converters.request30toRequest25.OpenRtbWrapperToBidRequestConverter; +import net.media.converters.request30toRequest25.ProducerToProducerConverter; +import net.media.converters.request30toRequest25.PublisherToPublisherConverter; +import net.media.converters.request30toRequest25.RegsToRegsConverter; +import net.media.converters.request30toRequest25.RequestToBidRequestConverter; +import net.media.converters.request30toRequest25.RequestToUserConverter; +import net.media.converters.request30toRequest25.SegmentToSegmentConverter; +import net.media.converters.request30toRequest25.SiteToSiteConverter; +import net.media.converters.request30toRequest25.SourceToSourceConverter; +import net.media.converters.request30toRequest25.UserToUserConverter; +import net.media.converters.request30toRequest25.VideoPlacementToVideoConverter; import net.media.openrtb25.request.Asset; import net.media.openrtb25.request.Audio; import net.media.openrtb25.request.Banner; -import net.media.openrtb25.request.*; +import net.media.openrtb25.request.BidRequest2_X; +import net.media.openrtb25.request.Imp; import net.media.openrtb25.request.Native; +import net.media.openrtb25.request.NativeRequestBody; import net.media.openrtb25.request.Video; import net.media.openrtb3.App; -import net.media.openrtb3.*; +import net.media.openrtb3.AssetFormat; +import net.media.openrtb3.AudioPlacement; +import net.media.openrtb3.Companion; import net.media.openrtb3.Content; import net.media.openrtb3.Data; import net.media.openrtb3.Deal; import net.media.openrtb3.Device; +import net.media.openrtb3.DisplayPlacement; import net.media.openrtb3.Geo; +import net.media.openrtb3.Item; import net.media.openrtb3.Metric; +import net.media.openrtb3.NativeFormat; +import net.media.openrtb3.OpenRTB3_X; +import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.openrtb3.Producer; import net.media.openrtb3.Publisher; import net.media.openrtb3.Regs; +import net.media.openrtb3.Request; import net.media.openrtb3.Segment; import net.media.openrtb3.Site; import net.media.openrtb3.Source; import net.media.openrtb3.User; +import net.media.openrtb3.VideoPlacement; import net.media.utils.Provider; @SuppressWarnings("unchecked") diff --git a/converter-core/src/main/java/net/media/driver/Convert30To25ResponseManager.java b/converter-core/src/main/java/net/media/driver/Convert30To25ResponseManager.java index 646edddb..caed2d07 100644 --- a/converter-core/src/main/java/net/media/driver/Convert30To25ResponseManager.java +++ b/converter-core/src/main/java/net/media/driver/Convert30To25ResponseManager.java @@ -16,16 +16,40 @@ package net.media.driver; -import net.media.converters.response30toresponse25.*; +import net.media.converters.response30toresponse25.AdToBidConverter; +import net.media.converters.response30toresponse25.Asset30ToAsset25Converter; +import net.media.converters.response30toresponse25.AudioToBidConverter; +import net.media.converters.response30toresponse25.Bid30ToBid25Converter; +import net.media.converters.response30toresponse25.DisplayToBidConverter; +import net.media.converters.response30toresponse25.LinkAssetToLinkConverter; +import net.media.converters.response30toresponse25.MediatoBidConverter; +import net.media.converters.response30toresponse25.Native30ToNative10Converter; +import net.media.converters.response30toresponse25.OpenRtbResponseToBidResponseConverter; +import net.media.converters.response30toresponse25.OpenRtbWrapperToBidResponseConverter; +import net.media.converters.response30toresponse25.SeatBid30ToSeatBid25Converter; +import net.media.converters.response30toresponse25.VideoToBidConverter; import net.media.openrtb25.response.BidResponse2_X; import net.media.openrtb25.response.SeatBid; import net.media.openrtb25.response.nativeresponse.AssetResponse; import net.media.openrtb25.response.nativeresponse.Link; import net.media.openrtb25.response.nativeresponse.NativeResponse; -import net.media.openrtb3.*; +import net.media.openrtb3.Ad; +import net.media.openrtb3.Asset; +import net.media.openrtb3.Audio; +import net.media.openrtb3.Bid; +import net.media.openrtb3.Display; +import net.media.openrtb3.LinkAsset; +import net.media.openrtb3.Media; +import net.media.openrtb3.Native; +import net.media.openrtb3.OpenRTB3_X; +import net.media.openrtb3.OpenRTBWrapper3_X; +import net.media.openrtb3.Seatbid; +import net.media.openrtb3.Video; import net.media.utils.Provider; -/** Created by shiva.b on 28/03/19. */ +/** + * Created by shiva.b on 28/03/19. + */ @SuppressWarnings("unchecked") public class Convert30To25ResponseManager { diff --git a/converter-core/src/main/java/net/media/driver/ConverterManager.java b/converter-core/src/main/java/net/media/driver/ConverterManager.java index e88e6e12..8cb1244c 100644 --- a/converter-core/src/main/java/net/media/driver/ConverterManager.java +++ b/converter-core/src/main/java/net/media/driver/ConverterManager.java @@ -16,15 +16,14 @@ package net.media.driver; +import static java.util.Objects.nonNull; + +import java.util.Map; import net.media.config.Config; import net.media.converters.Converter; import net.media.enums.OpenRtbVersion; import net.media.utils.Provider; -import java.util.Map; - -import static java.util.Objects.nonNull; - /** * Stores and manages {@link Converter} implementations that can be used for various transformation * operations. @@ -89,7 +88,7 @@ public Provider getConverterProvider(Map overrideMap, Con add2_XConverters(provider, config); if (nonNull(overrideMap)) { overrideMap.forEach( - provider::register); + provider::register); } return provider; } diff --git a/converter-core/src/main/java/net/media/driver/OpenRtbConverter.java b/converter-core/src/main/java/net/media/driver/OpenRtbConverter.java index 643db9a3..31337aa5 100644 --- a/converter-core/src/main/java/net/media/driver/OpenRtbConverter.java +++ b/converter-core/src/main/java/net/media/driver/OpenRtbConverter.java @@ -16,6 +16,11 @@ package net.media.driver; +import static java.util.Objects.isNull; + +import java.util.HashMap; +import java.util.Map; +import javax.naming.ConfigurationException; import net.media.config.Config; import net.media.converters.Converter; import net.media.exceptions.OpenRtbConverterException; @@ -23,12 +28,6 @@ import net.media.utils.Provider; import net.media.utils.validator.ValidatorUtils; -import javax.naming.ConfigurationException; -import java.util.HashMap; -import java.util.Map; - -import static java.util.Objects.isNull; - /** * Interface for interacting with openRtb Converter. {@link #config} default converter config {@link * Config} {@link #converterManager} contains the pipeline for converter dependencies {@link @@ -37,19 +36,19 @@ *

* *

    - *
  • {@link OpenRtbConverter(Config)} : instantiates OpenRtb converter object single object - * would be enough for the entire object - *
  • {@link #convert(Config, Object, Class, Class)} : converts source object from source class - * to target class, fields being passed in {@link Config} overrides the values for default - * {@link #config} for that particular call - *
  • {@link #convert(Object, Class, Class)} : uses {@link #convert(Config, Object, Class, - * Class)} without overriding config - *
  • {@link #enhance(Config, Object, Object, Class, Class)} : enhances the target object using - * the source object, fields being passed in {@link Config} overrides the values for default - * {@link #config} for that particular call - *
  • {@link #enhance(Object, Object, Class, Class)} uses {@link #enhance(Config, Object, Object, - * Class, Class)} without overriding config - *
+ *
  • {@link OpenRtbConverter(Config)} : instantiates OpenRtb converter object single object + * would be enough for the entire object + *
  • {@link #convert(Config, Object, Class, Class)} : converts source object from source class + * to target class, fields being passed in {@link Config} overrides the values for default + * {@link #config} for that particular call + *
  • {@link #convert(Object, Class, Class)} : uses {@link #convert(Config, Object, Class, + * Class)} without overriding config + *
  • {@link #enhance(Config, Object, Object, Class, Class)} : enhances the target object using + * the source object, fields being passed in {@link Config} overrides the values for default + * {@link #config} for that particular call + *
  • {@link #enhance(Object, Object, Class, Class)} uses {@link #enhance(Config, Object, Object, + * Class, Class)} without overriding config + * * * @author shiva.b * @since 1.0 diff --git a/converter-core/src/main/java/net/media/enums/AdType.java b/converter-core/src/main/java/net/media/enums/AdType.java index 31fce463..5b86e8e3 100644 --- a/converter-core/src/main/java/net/media/enums/AdType.java +++ b/converter-core/src/main/java/net/media/enums/AdType.java @@ -16,7 +16,9 @@ package net.media.enums; -/** Created by vishnu on 9/5/16. */ +/** + * Created by vishnu on 9/5/16. + */ public enum AdType { BANNER(1), VIDEO(2), @@ -32,7 +34,9 @@ public enum AdType { public static AdType getAdType(int value) { for (AdType adType : values()) { - if (adType.getValue() == value) return adType; + if (adType.getValue() == value) { + return adType; + } } throw new IllegalArgumentException("Invalid adtype value '" + value + "' provided"); } diff --git a/converter-core/src/main/java/net/media/enums/OpenRtbVersion.java b/converter-core/src/main/java/net/media/enums/OpenRtbVersion.java index 9df663f6..5815cb0c 100644 --- a/converter-core/src/main/java/net/media/enums/OpenRtbVersion.java +++ b/converter-core/src/main/java/net/media/enums/OpenRtbVersion.java @@ -16,7 +16,9 @@ package net.media.enums; -/** Created by rajat.go on 03/04/19. */ +/** + * Created by rajat.go on 03/04/19. + */ public enum OpenRtbVersion { TWO_DOT_THREE, TWO_DOT_FOUR, diff --git a/converter-core/src/main/java/net/media/template/EncodeTemplate.java b/converter-core/src/main/java/net/media/template/EncodeTemplate.java index 749c5aed..7ae1d4fc 100644 --- a/converter-core/src/main/java/net/media/template/EncodeTemplate.java +++ b/converter-core/src/main/java/net/media/template/EncodeTemplate.java @@ -20,7 +20,9 @@ import java.util.function.Function; import java.util.regex.Pattern; -/** Created by shiva.b on 02/01/19. */ +/** + * Created by shiva.b on 02/01/19. + */ public class EncodeTemplate extends SimpleTemplate { EncoderProvider encoderProvider; @@ -81,6 +83,7 @@ public String replace(TokenValue tokenValue, Function exce @FunctionalInterface public interface EncoderProvider { + Function getEncoder(Token token); } } diff --git a/converter-core/src/main/java/net/media/template/MacroMapper.java b/converter-core/src/main/java/net/media/template/MacroMapper.java index 2c2b6181..28cababd 100644 --- a/converter-core/src/main/java/net/media/template/MacroMapper.java +++ b/converter-core/src/main/java/net/media/template/MacroMapper.java @@ -16,16 +16,22 @@ package net.media.template; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import net.media.openrtb25.response.nativeresponse.NativeResponse; import net.media.openrtb25.response.nativeresponse.NativeResponseBody; -import net.media.openrtb3.*; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; +import net.media.openrtb3.Audio; +import net.media.openrtb3.Banner; +import net.media.openrtb3.Bid; +import net.media.openrtb3.Display; +import net.media.openrtb3.Native; +import net.media.openrtb3.Video; public class MacroMapper { + public static BiMap macrosTwoXToThreeX; static { @@ -69,19 +75,24 @@ public static void macroReplaceTwoX(net.media.openrtb25.response.Bid bid) { bid.setBurl(MacroMapper.macroReplaceTwoX(bid.getBurl())); bid.setLurl(MacroMapper.macroReplaceTwoX(bid.getLurl())); bid.setNurl(MacroMapper.macroReplaceTwoX(bid.getNurl())); - if (bid.getAdm() instanceof NativeResponse) + if (bid.getAdm() instanceof NativeResponse) { MacroMapper.macroReplaceTwoX((NativeResponse) bid.getAdm()); - else if (bid.getAdm() instanceof String) MacroMapper.macroReplaceTwoX((String) bid.getAdm()); + } else if (bid.getAdm() instanceof String) { + MacroMapper.macroReplaceTwoX((String) bid.getAdm()); + } } public static void macroReplaceThreeX(Display display) { - if (isNull(display)) return; - if (display.getAdm() instanceof Banner) + if (isNull(display)) { + return; + } + if (display.getAdm() instanceof Banner) { MacroMapper.macroReplaceThreeX((Banner) display.getAdm()); - else if (display.getAdm() instanceof Native) + } else if (display.getAdm() instanceof Native) { MacroMapper.macroReplaceThreeX((Native) display.getAdm()); - else if (display.getAdm() instanceof String) + } else if (display.getAdm() instanceof String) { MacroMapper.macroReplaceThreeX((String) display.getAdm()); + } MacroMapper.macroReplaceThreeX(display.getBanner()); MacroMapper.macroReplaceThreeX(display.get_native()); @@ -89,7 +100,9 @@ else if (display.getAdm() instanceof String) } public static void macroReplaceThreeX(Banner banner) { - if (isNull(banner)) return; + if (isNull(banner)) { + return; + } MacroProcessor.getOpenRtbMacroProcessor(banner.getImg()) .replace(MacroProcessor.getThreeXToken()); if (nonNull(banner.getLink())) { @@ -101,7 +114,9 @@ public static void macroReplaceThreeX(Banner banner) { } public static void macroReplaceThreeX(Native _native) { - if (isNull(_native)) return; + if (isNull(_native)) { + return; + } if (nonNull(_native.getLink())) { MacroProcessor.getOpenRtbMacroProcessor(_native.getLink().getUrl()) .replace(MacroProcessor.getThreeXToken()); @@ -123,7 +138,9 @@ public static void macroReplaceThreeX(Native _native) { } public static void macroReplaceThreeX(Video video) { - if (isNull(video)) return; + if (isNull(video)) { + return; + } MacroProcessor.getOpenRtbMacroProcessor((String) video.getAdm()) .replace(MacroProcessor.getThreeXToken()); MacroProcessor.getOpenRtbMacroProcessor(video.getCurl()) @@ -131,7 +148,9 @@ public static void macroReplaceThreeX(Video video) { } public static void macroReplaceThreeX(Audio audio) { - if (isNull(audio)) return; + if (isNull(audio)) { + return; + } MacroProcessor.getOpenRtbMacroProcessor((String) audio.getAdm()) .replace(MacroProcessor.getThreeXToken()); MacroProcessor.getOpenRtbMacroProcessor(audio.getCurl()) @@ -147,7 +166,9 @@ public static String macroReplaceThreeX(String text) { } public static void macroReplaceTwoX(NativeResponse nativeResponse) { - if (isNull(nativeResponse)) return; + if (isNull(nativeResponse)) { + return; + } NativeResponseBody nativeResponseBody = nativeResponse.getNativeResponseBody(); nativeResponseBody .getAsset() diff --git a/converter-core/src/main/java/net/media/template/MacroProcessor.java b/converter-core/src/main/java/net/media/template/MacroProcessor.java index 072f08d6..ee2e6160 100644 --- a/converter-core/src/main/java/net/media/template/MacroProcessor.java +++ b/converter-core/src/main/java/net/media/template/MacroProcessor.java @@ -20,8 +20,11 @@ import java.util.Objects; import java.util.regex.Pattern; -/** @author shiva.b */ +/** + * @author shiva.b + */ public class MacroProcessor { + public static final Pattern OPEN_RTB_TOKEN_PATTERN = Pattern.compile("\\$\\{(?.*?)(:(?.*?)){0,1}\\}"); public static Template.TokenProvider TOKEN_PROVIDER = @@ -30,13 +33,15 @@ public class MacroProcessor { EncodeTemplate.getEncoderProviderByGroupName("algo"); public static Template getOpenRtbMacroProcessor(String text) { - if (Objects.isNull(text)) return tokenValue -> ""; + if (Objects.isNull(text)) { + return tokenValue -> ""; + } return new EncodeTemplate( text, OPEN_RTB_TOKEN_PATTERN, TOKEN_PROVIDER, ENCODER_PROVIDER, - Template.Token::getTextValue); + Template.Token::getTextValue); } public static final Template.TokenValue getTwoXToken() { diff --git a/converter-core/src/main/java/net/media/template/SimpleTemplate.java b/converter-core/src/main/java/net/media/template/SimpleTemplate.java index afd881d5..e65b6809 100644 --- a/converter-core/src/main/java/net/media/template/SimpleTemplate.java +++ b/converter-core/src/main/java/net/media/template/SimpleTemplate.java @@ -21,8 +21,11 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -/** Created by shiva.b on 02/01/19. */ +/** + * Created by shiva.b on 02/01/19. + */ public class SimpleTemplate implements Template { + final LinkedList groupPrefix = new LinkedList<>(); String tail; private Template.DefaultValueProvider defaultValueProvider; @@ -58,7 +61,9 @@ public SimpleTemplate( Template.TokenProvider tokenProvider, Template.DefaultValueProvider defaultValueProvider) { int queryParamCount = 0; - if (template.contains("?")) queryParamCount++; + if (template.contains("?")) { + queryParamCount++; + } final Matcher matcher = pattern.matcher(template); int prev = 0; while (matcher.find()) { @@ -70,8 +75,9 @@ public SimpleTemplate( String macro = token.getValue(); char delimiter = (queryParamCount == 0) ? '?' : '&'; Matcher matcher1 = pattern.matcher(macro); - if (matcher1.find()) + if (matcher1.find()) { groupPrefix.add(new Group(tokenProvider.getToken(matcher1), delimiter + token.getKey())); + } queryParamCount++; } tail = template.substring(prev); @@ -93,6 +99,7 @@ public String replace(Template.TokenValue tokenValue) { } static class Group { + Token token; String prefix; diff --git a/converter-core/src/main/java/net/media/template/StaticEncoder.java b/converter-core/src/main/java/net/media/template/StaticEncoder.java index 09f89ab1..bb8bc49e 100644 --- a/converter-core/src/main/java/net/media/template/StaticEncoder.java +++ b/converter-core/src/main/java/net/media/template/StaticEncoder.java @@ -17,13 +17,14 @@ package net.media.template; import com.google.common.base.Charsets; - import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Base64; import java.util.function.Function; -/** Created by shiva.b on 02/01/19. */ +/** + * Created by shiva.b on 02/01/19. + */ public enum StaticEncoder implements Function { B64(source -> Base64.getEncoder().encodeToString(source.getBytes())), UTF8( diff --git a/converter-core/src/main/java/net/media/template/Template.java b/converter-core/src/main/java/net/media/template/Template.java index 889a6566..c5ee8dad 100644 --- a/converter-core/src/main/java/net/media/template/Template.java +++ b/converter-core/src/main/java/net/media/template/Template.java @@ -22,8 +22,11 @@ import java.util.function.Function; import java.util.regex.Matcher; -/** Created by shiva.b on 02/01/19. */ +/** + * Created by shiva.b on 02/01/19. + */ public interface Template { + static Template.TokenProvider getTokenProviderByGroupNames(List groupNames) { return matcher -> { Map groups = new HashMap<>(groupNames.size()); @@ -48,20 +51,24 @@ default String replace( @FunctionalInterface interface TokenValue { + String get(Token token); } @FunctionalInterface interface TokenProvider { + Token getToken(Matcher matcher); } @FunctionalInterface interface DefaultValueProvider { + String getDefaultValue(Token token); } class Token { + final String textValue; private final Map groups; @@ -84,15 +91,23 @@ public Map getGroups() { } public boolean equals(Object o) { - if (o == this) return true; - if (!(o instanceof Token)) return false; + if (o == this) { + return true; + } + if (!(o instanceof Token)) { + return false; + } final Token other = (Token) o; - if (!other.canEqual(this)) return false; + if (!other.canEqual(this)) { + return false; + } final Object this$textValue = this.getTextValue(); final Object other$textValue = other.getTextValue(); if (this$textValue == null ? other$textValue != null - : !this$textValue.equals(other$textValue)) return false; + : !this$textValue.equals(other$textValue)) { + return false; + } final Object this$groups = this.getGroups(); final Object other$groups = other.getGroups(); return this$groups == null ? other$groups == null : this$groups.equals(other$groups); diff --git a/converter-core/src/main/java/net/media/template/UrlEncodedTemplate.java b/converter-core/src/main/java/net/media/template/UrlEncodedTemplate.java index db75436f..e81b97ea 100644 --- a/converter-core/src/main/java/net/media/template/UrlEncodedTemplate.java +++ b/converter-core/src/main/java/net/media/template/UrlEncodedTemplate.java @@ -20,7 +20,9 @@ import java.util.function.Function; import java.util.regex.Pattern; -/** Created by shiva.b on 02/01/19. */ +/** + * Created by shiva.b on 02/01/19. + */ public class UrlEncodedTemplate extends EncodeTemplate { public UrlEncodedTemplate( @@ -66,7 +68,9 @@ public String replace(TokenValue tokenValue, Function exce appendedTail = true; } } - if (!appendedTail) res.append(tail); + if (!appendedTail) { + res.append(tail); + } return res.toString(); } catch (Exception e) { throw exceptionSupplier.apply(e); @@ -79,7 +83,9 @@ private void appendToURL(StringBuilder res, boolean appendedTail, Group group, S res.append(tail); } else { - if (!appendedTail) res.append(tail); + if (!appendedTail) { + res.append(tail); + } res.append(group.prefix).append(getMacroReplacement(value, group.token)); } } diff --git a/converter-core/src/main/java/net/media/utils/CollectionToCollectionConverter.java b/converter-core/src/main/java/net/media/utils/CollectionToCollectionConverter.java index 044e2c63..07d8e527 100644 --- a/converter-core/src/main/java/net/media/utils/CollectionToCollectionConverter.java +++ b/converter-core/src/main/java/net/media/utils/CollectionToCollectionConverter.java @@ -16,16 +16,16 @@ package net.media.utils; -import net.media.config.Config; -import net.media.converters.Converter; -import net.media.exceptions.OpenRtbConverterException; - import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; +import net.media.config.Config; +import net.media.converters.Converter; +import net.media.exceptions.OpenRtbConverterException; public class CollectionToCollectionConverter { + public static Collection convert( Collection collection, Converter stConverter, diff --git a/converter-core/src/main/java/net/media/utils/CollectionUtils.java b/converter-core/src/main/java/net/media/utils/CollectionUtils.java index f77dca79..f9adf7c2 100644 --- a/converter-core/src/main/java/net/media/utils/CollectionUtils.java +++ b/converter-core/src/main/java/net/media/utils/CollectionUtils.java @@ -16,16 +16,17 @@ package net.media.utils; -import net.media.config.Config; +import static java.util.Objects.nonNull; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Set; +import net.media.config.Config; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 04/01/19. */ +/** + * Created by rajat.go on 04/01/19. + */ public class CollectionUtils { public static T firstElementFromCollection(Collection in) { diff --git a/converter-core/src/main/java/net/media/utils/JacksonObjectMapperUtils.java b/converter-core/src/main/java/net/media/utils/JacksonObjectMapperUtils.java index ce0c18d2..d706d6e4 100644 --- a/converter-core/src/main/java/net/media/utils/JacksonObjectMapperUtils.java +++ b/converter-core/src/main/java/net/media/utils/JacksonObjectMapperUtils.java @@ -26,13 +26,14 @@ import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.fasterxml.jackson.module.paramnames.ParameterNamesModule; - -import net.media.exceptions.OpenRtbConverterException; - import java.io.IOException; +import net.media.exceptions.OpenRtbConverterException; -/** Created by rajat.go on 27/12/18. */ +/** + * Created by rajat.go on 27/12/18. + */ public class JacksonObjectMapperUtils { + private static final ObjectMapper mapper = new ObjectMapper(); static { @@ -67,7 +68,7 @@ public static ObjectMapper getMapper() { } public static U convertToObject(Class klass, String json) - throws OpenRtbConverterException { + throws OpenRtbConverterException { try { return getMapper().readValue(json, klass); } catch (IOException e) { diff --git a/converter-core/src/main/java/net/media/utils/MapUtils.java b/converter-core/src/main/java/net/media/utils/MapUtils.java index bf687a2a..cef4aaa9 100644 --- a/converter-core/src/main/java/net/media/utils/MapUtils.java +++ b/converter-core/src/main/java/net/media/utils/MapUtils.java @@ -1,16 +1,16 @@ package net.media.utils; -import net.media.config.Config; +import static java.util.Objects.nonNull; import java.util.HashMap; import java.util.Map; - -import static java.util.Objects.nonNull; +import net.media.config.Config; /** * Created by rajat.go on 21/04/19. */ public class MapUtils { + public static Map copyMap(Map input, Config config) { if (config.isCloningDisabled()) { return input; diff --git a/converter-core/src/main/java/net/media/utils/OsMap.java b/converter-core/src/main/java/net/media/utils/OsMap.java index 41a6d7c8..7d66d568 100644 --- a/converter-core/src/main/java/net/media/utils/OsMap.java +++ b/converter-core/src/main/java/net/media/utils/OsMap.java @@ -21,6 +21,7 @@ @SuppressWarnings("ResultOfMethodCallIgnored") public class OsMap { + public static BiMap osMap; static { diff --git a/converter-core/src/main/java/net/media/utils/Provider.java b/converter-core/src/main/java/net/media/utils/Provider.java index 5c7582ae..4c48637f 100644 --- a/converter-core/src/main/java/net/media/utils/Provider.java +++ b/converter-core/src/main/java/net/media/utils/Provider.java @@ -16,13 +16,12 @@ package net.media.utils; -import net.media.converters.Converter; -import net.media.driver.Conversion; +import static java.util.Objects.isNull; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; - -import static java.util.Objects.isNull; +import net.media.converters.Converter; +import net.media.driver.Conversion; /** * Generic Provider maintains a one to one mapping of a key to a value. @@ -67,7 +66,9 @@ public boolean contains(Conversion key) { return !(isNull(key) || !providerMap.containsKey(key)); } - /** clears the entire map */ + /** + * clears the entire map + */ public void clear() { providerMap.clear(); } diff --git a/converter-core/src/main/java/net/media/utils/validator/CheckAtLeastOneNotNull.java b/converter-core/src/main/java/net/media/utils/validator/CheckAtLeastOneNotNull.java index 0aa9b562..418191cf 100644 --- a/converter-core/src/main/java/net/media/utils/validator/CheckAtLeastOneNotNull.java +++ b/converter-core/src/main/java/net/media/utils/validator/CheckAtLeastOneNotNull.java @@ -16,20 +16,24 @@ package net.media.utils.validator; -import org.apache.commons.beanutils.PropertyUtils; - +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Arrays; import javax.validation.Constraint; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import javax.validation.Payload; -import java.lang.annotation.*; -import java.util.Arrays; +import org.apache.commons.beanutils.PropertyUtils; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Constraint(validatedBy = CheckAtLeastOneNotNull.CheckAtLeastOneNotNullValidator.class) @Documented public @interface CheckAtLeastOneNotNull { + String message() default ""; Class[] groups() default {}; @@ -40,6 +44,7 @@ class CheckAtLeastOneNotNullValidator implements ConstraintValidator { + private String[] fieldNames; public void initialize(CheckAtLeastOneNotNull constraint) { diff --git a/converter-core/src/main/java/net/media/utils/validator/CheckAtMostOneNotNull.java b/converter-core/src/main/java/net/media/utils/validator/CheckAtMostOneNotNull.java index c6d3b67b..f0eceaa8 100644 --- a/converter-core/src/main/java/net/media/utils/validator/CheckAtMostOneNotNull.java +++ b/converter-core/src/main/java/net/media/utils/validator/CheckAtMostOneNotNull.java @@ -16,20 +16,24 @@ package net.media.utils.validator; -import org.apache.commons.beanutils.PropertyUtils; - +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Arrays; import javax.validation.Constraint; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import javax.validation.Payload; -import java.lang.annotation.*; -import java.util.Arrays; +import org.apache.commons.beanutils.PropertyUtils; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Constraint(validatedBy = CheckAtMostOneNotNull.CheckAtMostOneNotNullValidator.class) @Documented public @interface CheckAtMostOneNotNull { + String message() default ""; Class[] groups() default {}; @@ -40,6 +44,7 @@ class CheckAtMostOneNotNullValidator implements ConstraintValidator { + private String[] fieldNames; public void initialize(CheckAtMostOneNotNull constraint) { diff --git a/converter-core/src/main/java/net/media/utils/validator/CheckExactlyOneNotNull.java b/converter-core/src/main/java/net/media/utils/validator/CheckExactlyOneNotNull.java index 935af14b..e6837e7f 100644 --- a/converter-core/src/main/java/net/media/utils/validator/CheckExactlyOneNotNull.java +++ b/converter-core/src/main/java/net/media/utils/validator/CheckExactlyOneNotNull.java @@ -16,20 +16,24 @@ package net.media.utils.validator; -import org.apache.commons.beanutils.PropertyUtils; - +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.util.Arrays; import javax.validation.Constraint; import javax.validation.ConstraintValidator; import javax.validation.ConstraintValidatorContext; import javax.validation.Payload; -import java.lang.annotation.*; -import java.util.Arrays; +import org.apache.commons.beanutils.PropertyUtils; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE}) @Constraint(validatedBy = CheckExactlyOneNotNull.CheckExactlyOneNotNullValidator.class) @Documented public @interface CheckExactlyOneNotNull { + String message() default ""; Class[] groups() default {}; @@ -40,6 +44,7 @@ class CheckExactlyOneNotNullValidator implements ConstraintValidator { + private String[] fieldNames; public void initialize(CheckExactlyOneNotNull constraint) { diff --git a/converter-core/src/main/java/net/media/utils/validator/ValidatorErrorHandler.java b/converter-core/src/main/java/net/media/utils/validator/ValidatorErrorHandler.java index fd27d273..0d44e5d6 100644 --- a/converter-core/src/main/java/net/media/utils/validator/ValidatorErrorHandler.java +++ b/converter-core/src/main/java/net/media/utils/validator/ValidatorErrorHandler.java @@ -19,6 +19,7 @@ import javax.validation.ConstraintValidatorContext; public class ValidatorErrorHandler { + public static void setErrorMessage(ConstraintValidatorContext context, String message) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(message).addConstraintViolation(); diff --git a/converter-core/src/main/java/net/media/utils/validator/ValidatorUtils.java b/converter-core/src/main/java/net/media/utils/validator/ValidatorUtils.java index c987f702..1764d65c 100644 --- a/converter-core/src/main/java/net/media/utils/validator/ValidatorUtils.java +++ b/converter-core/src/main/java/net/media/utils/validator/ValidatorUtils.java @@ -1,13 +1,12 @@ package net.media.utils.validator; -import java.util.Set; +import static javax.validation.Validation.buildDefaultValidatorFactory; +import java.util.Set; import javax.naming.ConfigurationException; import javax.validation.ConstraintViolation; import javax.validation.Validator; -import static javax.validation.Validation.buildDefaultValidatorFactory; - /** * Created by rajat.go on 21/04/19. */ @@ -20,10 +19,12 @@ public static void validate(T t) throws ConfigurationException { StringBuilder sb = new StringBuilder("Following violations has been violated: \n"); for (ConstraintViolation constrainViolation : invalids) { sb.append(constrainViolation.getPropertyPath()) - .append("=>") - .append(constrainViolation.getMessage()) - .append('\n'); + .append("=>") + .append(constrainViolation.getMessage()) + .append('\n'); + } + if (!invalids.isEmpty()) { + throw new ConfigurationException(sb.toString()); } - if (!invalids.isEmpty()) throw new ConfigurationException(sb.toString()); } } diff --git a/converter-core/src/test/java/net.media/Case.java b/converter-core/src/test/java/net.media/Case.java index 0777cb7f..a4c5f400 100644 --- a/converter-core/src/test/java/net.media/Case.java +++ b/converter-core/src/test/java/net.media/Case.java @@ -17,10 +17,10 @@ package net.media; import com.fasterxml.jackson.databind.JsonNode; - import java.util.Map; public class Case { + private String inputFile; private String inputType; private Map inputEdits; @@ -32,7 +32,8 @@ public class Case { private String purpose; private Map params; - public Case() {} + public Case() { + } public String getInputFile() { return this.inputFile; diff --git a/converter-core/src/test/java/net.media/ConverterTest.java b/converter-core/src/test/java/net.media/ConverterTest.java index 18f9fdaf..9cfa55da 100644 --- a/converter-core/src/test/java/net.media/ConverterTest.java +++ b/converter-core/src/test/java/net.media/ConverterTest.java @@ -16,23 +16,23 @@ package net.media; +import static java.util.Objects.isNull; +import static java.util.Objects.nonNull; + +import java.io.File; +import java.nio.file.Files; import net.media.config.Config; import net.media.driver.OpenRtbConverter; import net.media.openrtb25.request.BidRequest2_X; import net.media.openrtb25.response.BidResponse2_X; import net.media.openrtb3.OpenRTBWrapper3_X; import net.media.utils.JacksonObjectMapperUtils; - import org.junit.Assert; import org.junit.Test; -import java.io.File; -import java.nio.file.Files; - -import static java.util.Objects.isNull; -import static java.util.Objects.nonNull; - -/** Created by rajat.go on 09/01/19. */ +/** + * Created by rajat.go on 09/01/19. + */ public class ConverterTest { @Test diff --git a/converter-core/src/test/java/net.media/ORTBTester.java b/converter-core/src/test/java/net.media/ORTBTester.java index 57d5098c..5b1eb5b1 100644 --- a/converter-core/src/test/java/net.media/ORTBTester.java +++ b/converter-core/src/test/java/net.media/ORTBTester.java @@ -19,10 +19,11 @@ import net.media.config.Config; import net.media.driver.OpenRtbConverter; import net.media.utils.JacksonObjectMapperUtils; - import org.skyscreamer.jsonassert.JSONAssert; -/** Created by rajat.go on 09/01/19. */ +/** + * Created by rajat.go on 09/01/19. + */ public class ORTBTester { private OpenRtbConverter openRtbConverter; @@ -55,9 +56,9 @@ public void test( V converted = openRtbConverter.convert(config, bidRequest, sourceClass, targetClass); JSONAssert.assertEquals( - JacksonObjectMapperUtils.getMapper().writeValueAsString(target), - JacksonObjectMapperUtils.getMapper().writeValueAsString(converted), - true); + JacksonObjectMapperUtils.getMapper().writeValueAsString(target), + JacksonObjectMapperUtils.getMapper().writeValueAsString(converted), + true); } catch (Exception | AssertionError e) { OutputTestPojo outputTestPojo = new OutputTestPojo(); diff --git a/converter-core/src/test/java/net.media/OutputTestPojo.java b/converter-core/src/test/java/net.media/OutputTestPojo.java index 88e703b2..d39c404b 100644 --- a/converter-core/src/test/java/net.media/OutputTestPojo.java +++ b/converter-core/src/test/java/net.media/OutputTestPojo.java @@ -16,8 +16,11 @@ package net.media; -/** Created by sourav.p on . */ +/** + * Created by sourav.p on . + */ public class OutputTestPojo { + private String inputFile; private String inputType; diff --git a/converter-core/src/test/java/net.media/Test.java b/converter-core/src/test/java/net.media/Test.java index f02bd9a9..27740c73 100644 --- a/converter-core/src/test/java/net.media/Test.java +++ b/converter-core/src/test/java/net.media/Test.java @@ -19,9 +19,11 @@ import java.util.List; public class Test { + private List cases; - public Test() {} + public Test() { + } public List getCases() { return this.cases; diff --git a/converter-core/src/test/java/net.media/TestCaseGenerator.java b/converter-core/src/test/java/net.media/TestCaseGenerator.java index 57d498de..e363a848 100644 --- a/converter-core/src/test/java/net.media/TestCaseGenerator.java +++ b/converter-core/src/test/java/net.media/TestCaseGenerator.java @@ -19,9 +19,13 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.*; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.BooleanNode; +import com.fasterxml.jackson.databind.node.DoubleNode; +import com.fasterxml.jackson.databind.node.IntNode; +import com.fasterxml.jackson.databind.node.NullNode; +import com.fasterxml.jackson.databind.node.ObjectNode; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; - import java.io.File; import java.io.IOException; import java.io.PrintWriter; diff --git a/converter-core/src/test/java/net.media/TestOutput.java b/converter-core/src/test/java/net.media/TestOutput.java index bf6a57b9..a55f555d 100644 --- a/converter-core/src/test/java/net.media/TestOutput.java +++ b/converter-core/src/test/java/net.media/TestOutput.java @@ -19,8 +19,11 @@ import java.util.ArrayList; import java.util.List; -/** Created by sourav.p on . */ +/** + * Created by sourav.p on . + */ public class TestOutput { + private Long totalTestCases; private Integer failedTestCases; private List failedTestList = new ArrayList<>(); diff --git a/converter-core/src/test/java/net.media/TestPojo.java b/converter-core/src/test/java/net.media/TestPojo.java index f4b6df39..f4c6010b 100644 --- a/converter-core/src/test/java/net.media/TestPojo.java +++ b/converter-core/src/test/java/net.media/TestPojo.java @@ -16,11 +16,12 @@ package net.media; -import net.media.config.Config; - import java.util.Map; +import net.media.config.Config; -/** Created by rajat.go on 09/01/19. */ +/** + * Created by rajat.go on 09/01/19. + */ public class TestPojo { private String inputType; diff --git a/pom.xml b/pom.xml index 18fe0e7d..3a13bb50 100644 --- a/pom.xml +++ b/pom.xml @@ -15,190 +15,193 @@ ~ limitations under the License. --> - - 4.0.0 + + 4.0.0 - net.media - openrtb3-converter - 1.0.4-SNAPSHOT - openrtb3-converter-parent - Parent of the openrtb3 converter - https://github.com/media-net/openrtb3-converter + net.media + openrtb3-converter + 1.0.4-SNAPSHOT + openrtb3-converter-parent + Parent of the openrtb3 converter + https://github.com/media-net/openrtb3-converter - - 2.8.0 - 1.1.0 - 3.0 - 9.0.0.M6 - 23.0 - 2.7 - 1.8 - 1.8 - + + 2.8.0 + 1.1.0 + 3.0 + 9.0.0.M6 + 23.0 + 2.7 + 1.8 + 1.8 + - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + - - - Anupam Verma - anupam.v@media.net - Media Net - http://www.media.net - - - Rajat Goyal - rajat.go@media.net - Media Net - http://www.media.net - - - Shiva Bhalla - shiva.b@media.net - Media Net - http://www.media.net - - - Ankit Choudhary - ankit.cho@media.net - Media Net - http://www.media.net - - - Sourav Kumar Paul - sourav.p@media.net - Media Net - http://www.media.net - - + + + Anupam Verma + anupam.v@media.net + Media Net + http://www.media.net + + + Rajat Goyal + rajat.go@media.net + Media Net + http://www.media.net + + + Shiva Bhalla + shiva.b@media.net + Media Net + http://www.media.net + + + Ankit Choudhary + ankit.cho@media.net + Media Net + http://www.media.net + + + Sourav Kumar Paul + sourav.p@media.net + Media Net + http://www.media.net + + - pom + pom - - converter-api - converter-core - + + converter-api + converter-core + - - - ossrh - Sonatype Nexus Snapshots - https://oss.sonatype.org/content/repositories/snapshots/ - - - ossrh - Nexus Release Repository - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - + + + ossrh + Sonatype Nexus Snapshots + https://oss.sonatype.org/content/repositories/snapshots/ + + + ossrh + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + - + - - scm:git:git://github.com/media-net/openrtb3-converter.git - scm:git:https://github.com/media-net/openrtb3-converter.git - https://github.com/media-net/openrtb3-converter/tree/master - HEAD - + + scm:git:git://github.com/media-net/openrtb3-converter.git + scm:git:https://github.com/media-net/openrtb3-converter.git + + https://github.com/media-net/openrtb3-converter/tree/master + HEAD + - + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + v@{project.version} + true + releases + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9.1 + + + attach-javadocs + + jar + + + + + + + + + + releases + - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - v@{project.version} - true - releases - - - - org.apache.maven.plugins - maven-gpg-plugin - 1.5 - - - sign-artifacts - verify - - sign - - - - - - org.apache.maven.plugins - maven-source-plugin - 2.2.1 - - - attach-sources - - jar-no-fork - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9.1 - - - attach-javadocs - - jar - - - - - + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.6 + + ossrh + https://oss.sonatype.org/ + true + + + + + + default-deploy + deploy + + deploy + + + + - - - - releases - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.6 - - ossrh - https://oss.sonatype.org/ - true - - - - - - default-deploy - deploy - - deploy - - - - - - - - + + + \ No newline at end of file