summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-analytics/src
diff options
context:
space:
mode:
authordinesha <dineshgs@in.ibm.com>2019-08-02 15:52:58 +0530
committerdinesha <dineshgs@in.ibm.com>2019-08-02 15:53:44 +0530
commite699cb06640796f62cd2b8ab70a74d1677ec5d20 (patch)
treee0edc108b9d82f263fbb8e7b7a234832f108ea2d /ecomp-sdk/epsdk-analytics/src
parent71cf9cbe286d92e38b517e3a5829ba833859c93f (diff)
Sonar Fix- PageEvet.Java - Rename the field to match regular expression and define constant instead of duplicating literal
Fixed Sonar Issues accross the file Issue-ID: PORTAL-686 Change-Id: I73e775aab6f8d6b80a65bc0c5cb0614d5de21271 Signed-off-by: dinesha <dineshgs@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src')
-rw-r--r--ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
index 5b8ae4db..59bbed32 100644
--- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
+++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PageEvent.java
@@ -69,8 +69,9 @@ class PageEvent extends PdfPageEventHelper {
private PdfBean pb;
private int pageNo = 0;
- private int omit_page_count = 0;
- private int DEFAULT_LOGO_SIZE = 100;
+ private int omitPageCount = 0;
+ private int defaultLogoSize = 100;
+ private static String nLogo = "<no logo>";
public PageEvent(PdfBean pb) {
this.pb = pb;
@@ -79,10 +80,10 @@ class PageEvent extends PdfPageEventHelper {
private int getHowManyLogos(){
int howManyLogos = 0;
- if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>"))
+ if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase(nLogo))
howManyLogos ++;
- if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>"))
+ if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase(nLogo))
howManyLogos ++;
return howManyLogos;
@@ -121,16 +122,16 @@ class PageEvent extends PdfPageEventHelper {
PdfPTable foot = new PdfPTable(widths);
- if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase("<no logo>"))
- addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo1Size());
+ if(AppUtils.isNotEmpty(pb.getLogo1Url()) && !pb.getLogo1Url().equalsIgnoreCase(nLogo))
+ addLogo(foot, font, pb.getLogo1Url().substring(pb.getLogo1Url().indexOf("|") + 1).trim(), Cell.ALIGN_LEFT, pb.getLogo1Size() == null ? defaultLogoSize : pb.getLogo1Size());
PdfPCell spacingCell = new PdfPCell();
spacingCell.setBorderColor(Color.WHITE);
foot.addCell(spacingCell);
//Using logo1 size for now - use logo2 size if it is required to deal it separately.
- if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase("<no logo>"))
- addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? DEFAULT_LOGO_SIZE : pb.getLogo2Size());
+ if(AppUtils.isNotEmpty(pb.getLogo2Url()) && !pb.getLogo2Url().equalsIgnoreCase(nLogo))
+ addLogo(foot, font, pb.getLogo2Url().substring(pb.getLogo2Url().indexOf("|") + 1).trim(), Cell.ALIGN_RIGHT, pb.getLogo2Size() == null ? defaultLogoSize : pb.getLogo2Size());
foot.setTotalWidth(getPageWidth(document));
foot.writeSelectedRows(0, -1, 36, 600, writer.getDirectContent());
@@ -167,19 +168,19 @@ class PageEvent extends PdfPageEventHelper {
pageNo++;
PdfContentByte cb = writer.getDirectContent();
PdfDestination destination = new PdfDestination(PdfDestination.FITH);
- String bookmark = "Data Page " + (pageNo - omit_page_count);
+ String bookmark = "Data Page " + (pageNo - omitPageCount);
if (pageNo == 1) {
if (pb.isCoverPageIncluded()) {
bookmark = "Cover Page";
- omit_page_count++;
+ omitPageCount++;
} else if (pb.isDisplayChart()) {
bookmark = "Chart";
- omit_page_count++;
+ omitPageCount++;
}
}
if (pageNo == 2 && pb.isCoverPageIncluded() && pb.isDisplayChart()) {
bookmark = "Chart";
- omit_page_count++;
+ omitPageCount++;
}
PdfOutline outline = new PdfOutline(cb.getRootOutline(), destination, bookmark);