diff options
author | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-06-08 16:40:16 -0400 |
---|---|---|
committer | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-06-14 10:03:31 -0400 |
commit | f51a3e2b128f0b96bc9ed67dfc3081f4b41d1303 (patch) | |
tree | db4f24c3bc4e70bcda2916d7fa7027e9ab984cf3 /ecomp-sdk/epsdk-analytics/src/main | |
parent | 1ffd6b689a0176875b401fb089bd33db96f07b62 (diff) |
Junit Test Cases & Raptors
Issue-ID: PORTAL-273. PORTAL-301
Covered JUNITS for sdk modules and RAPTOR reports fixes
Change-Id: Ifaf3bf06f0ec123051a791cc8e7f10662f97a525
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-analytics/src/main')
13 files changed, 647 insertions, 99 deletions
diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java index d8fa23e3..26f33a35 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/line/LineInfo.java @@ -72,12 +72,12 @@ public class LineInfo { public LineInfo clone() { LineInfo lineInfo = new LineInfo(nodeID1, nodeID2); + lineInfo.setLineID(lineID); lineInfo.geoCoordinate1.longitude = geoCoordinate1.longitude; lineInfo.geoCoordinate1.latitude = geoCoordinate1.latitude; lineInfo.geoCoordinate2.longitude = geoCoordinate2.longitude; lineInfo.geoCoordinate2.latitude = geoCoordinate2.latitude; lineInfo.setDescription(lineDescription); - lineInfo.setLineID(lineID); lineInfo.setLineType(lineType); lineInfo.setMoveable(moveable); lineInfo.setDeleteable(deleteable); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java index 86f85be2..5c3f938a 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/gmap/node/NodeCollection.java @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal SDK * =================================================================== - * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * Copyright © 2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java index 378c6a87..66d6e965 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/ReportLoader.java @@ -583,7 +583,7 @@ public class ReportLoader extends org.onap.portalsdk.analytics.RaptorObject { String query = Globals.getLoadQuickLinks(); query = query.replace("[userID]", ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(),userID)); - query = query.replace("[roleList.toString()]", ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(),roleList.toString())); + query = query.replace("[roleList.toString()]", roleList.toString()); query = query.replace("[nvls(menuId)]", ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(),nvls(menuId))); DataSet ds = DbUtils diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java index 44a05512..72eb64b8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/ReportDefinition.java @@ -1422,6 +1422,153 @@ public class ReportDefinition extends ReportWrapper implements Serializable { resetCache(false); } // parseReportSQL + public void parseReportSQL(String sql, boolean storeInSession) throws RaptorException { + StringBuffer parsedSQL = new StringBuffer(); + + Vector updatedReportCols = new Vector(); + + curSQLParsePos = 0; + int lastParsePos = curSQLParsePos; + String lastToken = null; + String nextToken = getNextSQLParseToken(sql, true); + + String dbInfo = getDBInfo(); + boolean isCYMBALScript = false; + if (!isNull(dbInfo) && (!dbInfo.equals(AppConstants.DB_LOCAL))) { + try { + org.onap.portalsdk.analytics.util.RemDbInfo remDbInfo = new org.onap.portalsdk.analytics.util.RemDbInfo(); + String dbType = remDbInfo.getDBType(dbInfo); + if (dbType.equals("DAYTONA") && !(nextToken.toUpperCase().equals("SELECT"))) { + isCYMBALScript = true; + } + } catch (Exception ex) { + throw new RaptorException(ex); + } + } + if ( isCYMBALScript == false ) { + while (nextToken.length() > 0) { + if (parsedSQL.length() == 0) { + if (nextToken.toUpperCase().equals("SELECT")) + parsedSQL.append("SELECT "); + else + throw new org.onap.portalsdk.analytics.error.ValidationException( + "The SQL must start with the SELECT keyword."); + } else if (nextToken.toUpperCase().equals("DISTINCT") + && parsedSQL.toString().equals("SELECT ")) { + parsedSQL.append("DISTINCT "); + } else if (nextToken.equals("*") + && (parsedSQL.toString().equals("SELECT ") || parsedSQL.toString().equals( + "SELECT DISTINCT "))) { + throw new org.onap.portalsdk.analytics.error.ValidationException( + "You cannot use \"SELECT *\". Please specify select columns/expressions."); + } else if (nextToken.toUpperCase().equals("FROM")) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, parsedSQL, + updatedReportCols, false)); + lastToken = null; + } + + parsedSQL.append(" \n"); + while (lastParsePos < sql.length() + && Character.isWhitespace(sql.charAt(lastParsePos))) + lastParsePos++; + parsedSQL.append(sql.substring(lastParsePos)); + break; + } else { + if (nextToken.charAt(nextToken.length() - 1) == ',') { + // The token ends with , + nextToken = nextToken.substring(0, nextToken.length() - 1); + + if (nextToken.length() == 0) { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, null, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else just comma => ignore it + } else { + if (lastToken != null) { + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } else + updatedReportCols.add(getParseSQLDataColumn(nextToken, null, + parsedSQL, updatedReportCols, false)); + } + } else { + // The token doesn't end with , + if (lastToken == null) + lastToken = nextToken; + else { + String token = getNextSQLParseToken(sql, false); + if (!token.toUpperCase().equals("FROM")) + throw new org.onap.portalsdk.analytics.error.ValidationException( + "|FROM keyword or a comma expected after [" + nextToken + + "]."); + + updatedReportCols.add(getParseSQLDataColumn(lastToken, nextToken, + parsedSQL, updatedReportCols, false)); + lastToken = null; + } // else + } // else + } // else + + lastParsePos = curSQLParsePos; + nextToken = getNextSQLParseToken(sql, true); + } // while + } else { // if CYMBAL Script + curSQLParsePos = 0; + Pattern re = null; + Matcher matcher = null; + String extracted = null; + nextToken = getNextCYMBALSQLParseToken(sql,true); + while (nextToken.length() > 0) { + if (lastToken == null) lastToken = nextToken; + + if( lastToken.toUpperCase().startsWith("DO DISPLAY")) { + re = Pattern.compile("each(.*)\\[.(.*?)\\]"); //\\[(.*?)\\] + matcher = re.matcher(nextToken); + if (matcher.find()) { + extracted = matcher.group(); + re = Pattern.compile("\\[(.*?)\\]"); + matcher = re.matcher(nextToken); + if(matcher.find()) { + extracted = matcher.group(); + extracted = extracted.substring(1,extracted.length()-1); + StringTokenizer sToken = new StringTokenizer(extracted, ","); + while(sToken.hasMoreTokens()) { + String str1 = sToken.nextToken().trim().substring(1); + updatedReportCols.add(getParseSQLDataColumn("", str1, + new StringBuffer(""), updatedReportCols, true)); + } + } + + } + + } + lastToken = nextToken; + nextToken = getNextCYMBALSQLParseToken(sql, true); + } + + } + if (updatedReportCols.size() == 0) + throw new org.onap.portalsdk.analytics.error.ValidationException( + "The SQL statement must have at least one column in the SELECT clause."); + if (getDataSourceList().getDataSource().size() == 0) + addDataSourceType(new ObjectFactory(), "du0", "DUAL", "", "DUAL", null, null, null); + DataSourceType dst = (DataSourceType) getDataSourceList().getDataSource().get(0); + dst.getDataColumnList().getDataColumn().clear(); + + for (int i = 0; i < updatedReportCols.size(); i++) { + DataColumnType dct = (DataColumnType) updatedReportCols.get(i); + dct.setTableId(dst.getTableId()); + dct.setOrderSeq(i + 1); + dst.getDataColumnList().getDataColumn().add(dct); + } // for + if(storeInSession) + setReportSQL(parsedSQL.toString()); + resetCache(false); + } // parseReportSQL + private String getNextCYMBALSQLParseToken(String sql, boolean updateParsePos) { int braketCount = 0; boolean isInsideQuote = false; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java index e5fc94ae..3281eee7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/ColumnEditJSON.java @@ -48,6 +48,14 @@ public class ColumnEditJSON implements WizardJSON { private String displayHeaderAlignment; private boolean sortable; private boolean visible; + private Integer displayWidth; + private Integer displayWidthInPixel; + private String colType; + private Integer groupByPos; + private Integer level; + private String dataType; + private String noWrap; + private Integer indentation; private String drilldownURL; private String drilldownParams; @@ -55,6 +63,13 @@ public class ColumnEditJSON implements WizardJSON { private String errorMessage; private String errorStackTrace; + private String depeondsOnForField; + private String subTotalCustomText; + private boolean hideRepeatedKey; + private Integer colspan; + private String displayName; + private String displayTotal; + public String getTabId() { return tabId; } @@ -133,5 +148,93 @@ public class ColumnEditJSON implements WizardJSON { public void setDrilldownType(String drilldownType) { this.drilldownType = drilldownType; } + + public Integer getDisplayWidth() { + return displayWidth; + } + public void setDisplayWidth(Integer displayWidth) { + this.displayWidth = displayWidth; + } + public Integer getDisplayWidthInPixel() { + return displayWidthInPixel; + } + public void setDisplayWidthInPixel(Integer displayWidthInPixel) { + this.displayWidthInPixel = displayWidthInPixel; + } + public Integer getGroupByPos() { + return groupByPos; + } + public void setGroupByPos(Integer groupByPos) { + this.groupByPos = groupByPos; + } + public Integer getLevel() { + return level; + } + public void setLevel(Integer level) { + this.level = level; + } + public String getDataType() { + return dataType; + } + public void setDataType(String dataType) { + this.dataType = dataType; + } + public String getNoWrap() { + return noWrap; + } + public void setNoWrap(String noWrap) { + this.noWrap = noWrap; + } + public Integer getIndentation() { + return indentation; + } + public void setIndentation(Integer indentation) { + this.indentation = indentation; + } + public String getColType() { + return colType; + } + public void setColType(String colType) { + this.colType = colType; + } + public String getDepeondsOnForField() { + return depeondsOnForField; + } + public void setDepeondsOnForField(String depeondsOnForField) { + this.depeondsOnForField = depeondsOnForField; + } + public String getSubTotalCustomText() { + return subTotalCustomText; + } + public void setSubTotalCustomText(String subTotalCustomText) { + this.subTotalCustomText = subTotalCustomText; + } + public boolean isHideRepeatedKey() { + return hideRepeatedKey; + } + public void setHideRepeatedKey(boolean hideRepeatedKey) { + this.hideRepeatedKey = hideRepeatedKey; + } + public Integer getColspan() { + return colspan; + } + public void setColspan(Integer colspan) { + this.colspan = colspan; + } + public String getDisplayName() { + return displayName; + } + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public String getDisplayTotal() { + return displayTotal; + } + public void setDisplayTotal(String displayTotal) { + this.displayTotal = displayTotal; + } + + + } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java index 73ac97d8..47b1ef9e 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/DefinitionJSON.java @@ -64,7 +64,15 @@ public class DefinitionJSON implements WizardJSON { private Integer numFormCols; private String reportTitle; private String reportSubTitle; - + private String oneTimeRec; + private String hourlyRec; + private String dailyRec; + private String dailyMFRec; + private String weeklyRec; + private String monthlyRec; + private String allowScheduler; + private String sizedByContent; + private String repDefType; @Override public String getTabName() { return tabName; @@ -246,7 +254,78 @@ public class DefinitionJSON implements WizardJSON { public void setReportSubTitle(String reportSubTitle) { this.reportSubTitle = reportSubTitle; } + + public String getOneTimeRec() { + return oneTimeRec; + } + + public void setOneTimeRec(String oneTimeRec) { + this.oneTimeRec = oneTimeRec; + } + + public String getHourlyRec() { + return hourlyRec; + } + + public void setHourlyRec(String hourlyRec) { + this.hourlyRec = hourlyRec; + } + + public String getDailyRec() { + return dailyRec; + } + + public void setDailyRec(String dailyRec) { + this.dailyRec = dailyRec; + } + + public String getDailyMFRec() { + return dailyMFRec; + } + + public void setDailyMFRec(String dailyMFRec) { + this.dailyMFRec = dailyMFRec; + } + + public String getWeeklyRec() { + return weeklyRec; + } + + public void setWeeklyRec(String weeklyRec) { + this.weeklyRec = weeklyRec; + } + + public String getMonthlyRec() { + return monthlyRec; + } + + public void setMonthlyRec(String monthlyRec) { + this.monthlyRec = monthlyRec; + } + + public String getAllowScheduler() { + return allowScheduler; + } + + public void setAllowScheduler(String allowScheduler) { + this.allowScheduler = allowScheduler; + } + + public String getSizedByContent() { + return sizedByContent; + } + + public void setSizedByContent(String sizedByContent) { + this.sizedByContent = sizedByContent; + } + + public String getRepDefType() { + return repDefType; + } + + public void setRepDefType(String repDefType) { + this.repDefType = repDefType; + } - } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java index bc39006f..e8238534 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/FormEditJSON.java @@ -48,6 +48,7 @@ public class FormEditJSON implements WizardJSON { private String fieldName; private String fieldType; private boolean visible; + private boolean groupFormField; private String defaultValue; private String fieldDefaultSQL; private String fieldSQL; @@ -56,7 +57,7 @@ public class FormEditJSON implements WizardJSON { private String message; private String errorMessage; private String errorStackTrace; - + private Integer orderSeq; public String getMessage() { return message; @@ -145,5 +146,19 @@ public class FormEditJSON implements WizardJSON { public void setFieldSQL(String fieldSQL) { this.fieldSQL = fieldSQL; } + public boolean isGroupFormField() { + return groupFormField; + } + public void setGroupFormField(boolean groupFormField) { + this.groupFormField = groupFormField; + } + public Integer getOrderSeq() { + return orderSeq; + } + public void setOrderSeq(Integer orderSeq) { + this.orderSeq = orderSeq; + } + + } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java index b3cfe243..f80ba993 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/definition/wizard/SearchFieldJSON.java @@ -41,6 +41,7 @@ public class SearchFieldJSON implements ElementJSON { private String id; private String name; + private Integer orderSeq; public String getId() { return id; } @@ -53,6 +54,12 @@ public class SearchFieldJSON implements ElementJSON { public void setName(String name) { this.name = name; } + public Integer getOrderSeq() { + return orderSeq; + } + public void setOrderSeq(Integer orderSeq) { + this.orderSeq = orderSeq; + } 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 cfae1ab3..5ed8f9f6 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 @@ -75,20 +75,6 @@ class PageEvent extends PdfPageEventHelper { public PageEvent(PdfBean pb) { this.pb = pb; } - - private int getWidthEntries(int howManyLogos){ - int widthEntries = 0; - - if(howManyLogos == 2) - widthEntries = 3; - else - if(howManyLogos == 1) - widthEntries = 2; - else - widthEntries = 0; - - return widthEntries; - } private int getHowManyLogos(){ int howManyLogos = 0; @@ -220,13 +206,6 @@ class PageEvent extends PdfPageEventHelper { table.addCell(new Paragraph(pb.getLeftFooter(), font)); } - private void addHeaderDummy(PdfPTable table, Font font) { - Font font1 = new Font(font); - font1.setSize(Globals.getPDFFooterFontSize()); - - table.addCell(new Paragraph("Header row", font1)); - } - private void addLogo(PdfPTable table, Font font, String imgSrc, int alignment, int absoluteSize) { Image img = null; @@ -243,7 +222,6 @@ class PageEvent extends PdfPageEventHelper { //log that the input file couldnt be loaded - } else{ - //img.scaleAbsolute(absoluteSize, absoluteSize); img.scalePercent(absoluteSize, absoluteSize); PdfPCell cell = new PdfPCell(img); cell.setBorderColor(Color.WHITE); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java index 80860912..ec83ffbf 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ChartD3Helper.java @@ -47,6 +47,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Enumeration; +import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Iterator; import java.util.List; @@ -54,6 +55,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedSet; +import java.util.TimeZone; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -68,6 +70,7 @@ import org.onap.portalsdk.analytics.model.ReportHandler; import org.onap.portalsdk.analytics.model.base.ChartSeqComparator; import org.onap.portalsdk.analytics.system.AppUtils; import org.onap.portalsdk.analytics.system.ConnectionUtils; +import org.onap.portalsdk.analytics.system.Globals; import org.onap.portalsdk.analytics.util.AppConstants; import org.onap.portalsdk.analytics.util.DataSet; import org.onap.portalsdk.analytics.util.HtmlStripper; @@ -1804,6 +1807,9 @@ public class ChartD3Helper { } wholeScript.append(" .tickFormat(function(d) { \n"); + wholeScript.append(" var local_dt = new Date(); \n var utc = d + (local_dt.getTimezoneOffset() * 60000);\n"); + wholeScript.append(" var nd = new Date(utc + (3600000*"+getCurrentTimezoneOffset()+")); "); + if(formatFlag==DAYFLAG) wholeScript.append(" return d3.time.format('%m/%d/%Y')(new Date(d)) }); \n"); else if(formatFlag==HOURFLAG) @@ -3569,6 +3575,11 @@ public class ChartD3Helper { return title; } + public java.util.Date timezoneConversion(SimpleDateFormat sdf, String dateStr) { + // sdf.setTimeZone(TimeZone.getTimeZone("GMT")); + return sdf.parse(dateStr, new ParsePosition(0)); + } + public java.util.Date getDateFromDateStr(String dateStr) { SimpleDateFormat MMDDYYYYFormat = new SimpleDateFormat("MM/dd/yyyy"); SimpleDateFormat EEEMMDDYYYYFormat = new SimpleDateFormat("EEE, MM/dd/yyyy"); //2012-11-01 00:00:00 @@ -3619,117 +3630,142 @@ public class ChartD3Helper { int flagDate = 10; */ - date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; if(date==null) { - date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(EEEMMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { - date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYYYHHFormat, dateStr); if(date!=null) formatFlag = HOURFLAG; } if(date==null) { - date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + //date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(YYYYMMDDFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = timestampFormat.parse(dateStr, new ParsePosition(0)); + //date = timestampFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(timestampFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + //date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(timestampHrFormat, dateStr); if(date!=null) formatFlag = HOURFLAG; } if(date==null) { - date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + //date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(timestampDayFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MONYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMMMMDDYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MONTHYYYYFormat, dateStr); if(date!=null) formatFlag = MONTHFLAG; } if(date==null) { - date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + //date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(YYYYMMDDHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + //date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(YYYYMMDDHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + //date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(DDMONYYYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + //date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(DDMONYYYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(DDMONYYYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYHHMMSSFormat, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYHHMMFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYFormat, dateStr); if(date!=null) formatFlag = DAYFLAG; } if(date==null) { - date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + //date = timestampFormat1.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(timestampFormat1, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) { - date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + //date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(MMDDYYYYHHMMZFormat, dateStr); if(date!=null) formatFlag = MINFLAG; } if(date==null) { - date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + //date = YYYYFormat.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(YYYYFormat, dateStr); /* Some random numbers should not satisfy this year format. */ if(dateStr.length()>4) date = null; if(date!=null) formatFlag = YEARFLAG; } if(date==null) { - date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); + //date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); + date = timezoneConversion(timestamp_W_dash, dateStr); if(date!=null) formatFlag = SECFLAG; } if(date==null) @@ -4085,6 +4121,23 @@ public class ChartD3Helper { return valuesMap; - } + } + + public static int getCurrentTimezoneOffset() { + + TimeZone tz = TimeZone.getDefault(); + java.util.Calendar cal = GregorianCalendar.getInstance(tz); + int offsetInMillis = tz.getOffset(cal.getTimeInMillis()); + int hourOffset = Math.abs(offsetInMillis / 3600000) * 60; + boolean isDST = tz.inDaylightTime(new java.util.Date()); + if(isDST){ + hourOffset += 60; + } + int offset = hourOffset + Math.abs((offsetInMillis / 60000) % 60); + if (offsetInMillis > 0) + offset *= -1; + + return Globals.getTimezoneOffset(); + } } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java index 529790e9..bb99318f 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportRuntime.java @@ -2895,6 +2895,7 @@ public List getMapMarkers(ReportData rd, org.onap.portalsdk.analytics.xmlobj.Rep reportJSONRuntime.setReportID(getReportID()); reportJSONRuntime.setReportName(getReportName()); reportJSONRuntime.setReportSubTitle(getReportSubTitle()); + reportJSONRuntime.setAllowEdit(isAllowEdit(request)); reportJSONRuntime.setNumFormCols(getNumFormColsAsInt()); ArrayList<IdNameValue> formFieldValues = new ArrayList<IdNameValue>(); ArrayList<FormFieldJSON> formFieldJSONList = new ArrayList<FormFieldJSON>(); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java index f0991e94..a1196808 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/Globals.java @@ -1530,6 +1530,13 @@ public class Globals extends org.onap.portalsdk.analytics.RaptorObject { } } + public static int getTimezoneOffset() { + try { + return Integer.parseInt(nvls(raptorProperties.getProperty("time_zone_offset"), new Integer(0).toString()).trim()); + } catch (Exception ex) { return 0;} + } + + //new method added to get the help message for schedule tab public static String getScheduleHelpMessage() { return nvls(raptorProperties.getProperty("schedule_help_text"),"").trim(); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java index b2ce1b7d..e06a1765 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/fusion/web/RaptorControllerAsync.java @@ -66,9 +66,13 @@ import org.onap.portalsdk.analytics.error.RaptorRuntimeException; import org.onap.portalsdk.analytics.error.ReportSQLException; import org.onap.portalsdk.analytics.model.DataCache; import org.onap.portalsdk.analytics.model.ReportHandler; +import org.onap.portalsdk.analytics.model.ReportLoader; +import org.onap.portalsdk.analytics.model.base.IdNameList; import org.onap.portalsdk.analytics.model.base.IdNameValue; import org.onap.portalsdk.analytics.model.base.ReportUserRole; +import org.onap.portalsdk.analytics.model.definition.DrillDownParamDef; import org.onap.portalsdk.analytics.model.definition.ReportDefinition; +import org.onap.portalsdk.analytics.model.definition.ReportLogEntry; import org.onap.portalsdk.analytics.model.definition.SecurityEntry; import org.onap.portalsdk.analytics.model.definition.wizard.ColumnEditJSON; import org.onap.portalsdk.analytics.model.definition.wizard.ColumnJSON; @@ -296,6 +300,20 @@ public class RaptorControllerAsync extends RestrictedBaseController { } } + @RequestMapping(value = "/report/wizard/drill_down_param/{parameter}", method = RequestMethod.GET, produces = "application/json") + public @ResponseBody List<DrillDownParamDef> getDrillDownParamDef (@PathVariable("parameter") String parameter, HttpServletRequest request, HttpServletResponse response) + throws IOException, RaptorException { + List<DrillDownParamDef> list = new ArrayList<>(); + String[] tmepArray = null; + if(parameter!=null){ + tmepArray = parameter.split("&"); + } + for(String str:tmepArray){ + list.add(new DrillDownParamDef(str)); + } + return list; + } + @RequestMapping(value = "/report/wizard/list_columns", method = RequestMethod.GET, produces = "application/json") public @ResponseBody ArrayList<ColumnJSON> listColumns(HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException { @@ -307,7 +325,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { for (DataColumnType reportColumnType : reportColumnList) { columnJSON = new ColumnJSON(); columnJSON.setId(reportColumnType.getColId()); - columnJSON.setName(reportColumnType.getColName()); + columnJSON.setName(reportColumnType.getDisplayName()); listJSON.add(columnJSON); } return listJSON; @@ -375,6 +393,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { String fieldDisplay = fft.getFieldName(); fieldJSON.setId(fieldId); fieldJSON.setName(fieldDisplay); + fieldJSON.setOrderSeq(fft.getOrderBySeq()); listJSON.add(fieldJSON); } } @@ -501,20 +520,15 @@ public class RaptorControllerAsync extends RestrictedBaseController { fft.setFieldDefaultSQL(formEditJSON.getFieldDefaultSQL()); fft.setFieldSQL(formEditJSON.getFieldSQL()); fft.setValidationType(formEditJSON.getValidationType()); - + fft.setGroupFormField(formEditJSON.isGroupFormField()); + fft.setOrderBySeq(formEditJSON.getOrderSeq()); // clear predefined value - if (fft.getPredefinedValueList() != null) { - for (Iterator<String> iter = fft.getPredefinedValueList().getPredefinedValue() - .iterator(); iter.hasNext();) - iter.remove(); - } - + PredefinedValueList predefinedValueList = new ObjectFactory().createPredefinedValueList(); + fft.setPredefinedValueList(predefinedValueList); + List<IdNameBooleanJSON> predefList = formEditJSON.getPredefinedValueList(); if (predefList != null && predefList.size() > 0) { for (IdNameBooleanJSON item : predefList) { - PredefinedValueList predefinedValueList = new ObjectFactory() - .createPredefinedValueList(); - fft.setPredefinedValueList(predefinedValueList); fft.getPredefinedValueList().getPredefinedValue().add(item.getId()); } } @@ -540,6 +554,52 @@ public class RaptorControllerAsync extends RestrictedBaseController { return messageJSON; } + + @RequestMapping(value = "report/wizard/add_formfield_tab_data", method = RequestMethod.POST) + public @ResponseBody MessageJSON addFFTabWiseData(@RequestBody FormEditJSON formEditJSON, + HttpServletRequest request, HttpServletResponse response) throws IOException, RaptorException { + ReportDefinition rdef = null; + rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION); + + MessageJSON messageJSON = new MessageJSON(); + try { + if (rdef != null) { + FormEditJSON wizardJSON = new FormEditJSON(); + wizardJSON.setTabId("FormEdit"); + wizardJSON.setTabName("Form Edit"); + String fieldId =""; + if(rdef.getFormFieldList()==null || rdef.getFormFieldList().getFormField()==null || rdef.getFormFieldList().getFormField().size()==0) + fieldId = "ff1"; + else + fieldId = "ff"+(rdef.getFormFieldList().getFormField().size()+1); + FormFieldType currField = rdef.addFormFieldType(new ObjectFactory(), "", "", "", "", "", "", "", "", null, null, "",""); + currField.setFieldId(fieldId); + currField.setFieldName(formEditJSON.getFieldName()); + currField.setFieldType(formEditJSON.getFieldType()==null?null:formEditJSON.getFieldType()); + currField.setVisible(formEditJSON.isVisible()?"Y":"N"); + currField.setDefaultValue(formEditJSON.getDefaultValue()); + currField.setFieldDefaultSQL(formEditJSON.getFieldDefaultSQL()); + currField.setFieldSQL(formEditJSON.getFieldSQL()); + currField.setValidationType(formEditJSON.getValidationType()); + currField.setGroupFormField(formEditJSON.isGroupFormField()); + persistReportDefinition(request, rdef); + + messageJSON.setMessage("Success formfield Details of given report is saved in session."); + messageJSON.setAnyStacktrace(rdef.getReportID() + " is added to session and DB."); + + } else { + messageJSON.setMessage("Report Definition is not in session"); + messageJSON.setAnyStacktrace("Report Definition is not in session"); + + } + } catch (Exception ex) { + messageJSON.setMessage("Error occured while formfield details Tab"); + messageJSON.setAnyStacktrace(getStackTrace(ex)); + return messageJSON; + } + + return messageJSON; + } @RequestMapping(value = "report/wizard/save_col_tab_data", method = RequestMethod.POST) public @ResponseBody MessageJSON saveColTabWiseData(@RequestBody ColumnEditJSON columnEditJSON, @@ -558,6 +618,18 @@ public class RaptorControllerAsync extends RestrictedBaseController { // columnJSON = new ColumnJSON(); if (reportColumnType.getColId().equals(colId)) { reportColumnType.setColName(columnEditJSON.getColName()); + reportColumnType.setDependsOnFormField(columnEditJSON.getDepeondsOnForField()==null?"":columnEditJSON.getDepeondsOnForField()); + reportColumnType.setColType(columnEditJSON.getDataType()==null?"":columnEditJSON.getDataType()); + reportColumnType.setDbColName(columnEditJSON.getDataType()==null?"":columnEditJSON.getDataType()); + reportColumnType.setGroupByPos(columnEditJSON.getGroupByPos()); + reportColumnType.setSubTotalCustomText(columnEditJSON.getSubTotalCustomText()); + reportColumnType.setHideRepeatedKey(columnEditJSON.isHideRepeatedKey()); + reportColumnType.setLevel(columnEditJSON.getLevel()); + reportColumnType.setColspan(columnEditJSON.getColspan()); + reportColumnType.setDisplayName(columnEditJSON.getDisplayName()); + reportColumnType.setDisplayWidthInPxls(columnEditJSON.getDisplayWidthInPixel()==null?null:String.valueOf(columnEditJSON.getDisplayWidthInPixel())); + reportColumnType.setNowrap(columnEditJSON.getNoWrap()); + reportColumnType.setIndentation(columnEditJSON.getIndentation()); reportColumnType.setDisplayAlignment(columnEditJSON.getDisplayAlignment()); reportColumnType.setDisplayHeaderAlignment(columnEditJSON.getDisplayHeaderAlignment()); reportColumnType.setIsSortable(columnEditJSON.isSortable()); @@ -565,7 +637,9 @@ public class RaptorControllerAsync extends RestrictedBaseController { reportColumnType.setDrillDownURL(columnEditJSON.getDrilldownURL()); reportColumnType.setDrillDownParams(columnEditJSON.getDrilldownParams()); reportColumnType.setDrillDownType(columnEditJSON.getDrilldownType()); - + if(columnEditJSON.getDisplayTotal()!=null) + reportColumnType.setDisplayTotal(columnEditJSON.getDisplayTotal()); + } } @@ -650,22 +724,28 @@ public class RaptorControllerAsync extends RestrictedBaseController { rdef.setFormHelpText(formHelpText); Integer pageSize = definitionJSON.getPageSize(); - rdef.setPageSize(pageSize); + if(pageSize!=null) + rdef.setPageSize(pageSize); List<IdNameBooleanJSON> menuIds = definitionJSON.getDisplayArea(); - for (IdNameBooleanJSON menuId : menuIds) { - if (menuId.isSelected()) { - rdef.setMenuID(menuId.getName()); - } + if(menuIds!=null){ + for (IdNameBooleanJSON menuId : menuIds) { + if (menuId.isSelected()) { + rdef.setMenuID(menuId.getName()); + } + } } + Boolean hideFormFieldsAfterRun = definitionJSON.getHideFormFieldsAfterRun(); - rdef.setHideFormFieldAfterRun(hideFormFieldsAfterRun); + rdef.setHideFormFieldAfterRun(hideFormFieldsAfterRun==null?false:hideFormFieldsAfterRun); Integer maxRowsInExcelCSVDownload = definitionJSON.getMaxRowsInExcelCSVDownload(); - rdef.setMaxRowsInExcelDownload(maxRowsInExcelCSVDownload); + if(maxRowsInExcelCSVDownload!=null) + rdef.setMaxRowsInExcelDownload(maxRowsInExcelCSVDownload); Integer frozenColumns = definitionJSON.getFrozenColumns(); - rdef.setFrozenColumns(frozenColumns); + if(frozenColumns!=null) + rdef.setFrozenColumns(frozenColumns); String dataGridAlign = definitionJSON.getDataGridAlign(); rdef.setDataGridAlign(dataGridAlign); String emptyMessage = definitionJSON.getEmptyMessage(); @@ -674,10 +754,11 @@ public class RaptorControllerAsync extends RestrictedBaseController { rdef.setDataContainerHeight(dataContainerHeight); String dataContainerWidth = definitionJSON.getDataContainerWidth(); rdef.setDataContainerWidth(dataContainerWidth); - boolean runtimeColSortDisabled = definitionJSON.getRuntimeColSortDisabled(); - rdef.setRuntimeColSortDisabled(runtimeColSortDisabled); + Boolean runtimeColSortDisabled = definitionJSON.getRuntimeColSortDisabled(); + rdef.setRuntimeColSortDisabled(runtimeColSortDisabled==null?false:runtimeColSortDisabled); Integer numFormCols = definitionJSON.getNumFormCols(); - rdef.setNumFormCols(Integer.toString(numFormCols)); + if(numFormCols!=null) + rdef.setNumFormCols(Integer.toString(numFormCols)); String reportTitle = definitionJSON.getReportTitle(); rdef.setReportTitle(reportTitle); String reportSubTitle = definitionJSON.getReportSubTitle(); @@ -685,24 +766,45 @@ public class RaptorControllerAsync extends RestrictedBaseController { List<NameBooleanJSON> displayOptions = definitionJSON.getDisplayOptions(); StringBuffer displayOptionStr = new StringBuffer("NNNNNNN"); - for (NameBooleanJSON displayOption : displayOptions) { - if (displayOption.isSelected()) { - if (displayOption.getName().equals("HideFormFields")) { - displayOptionStr.setCharAt(0, 'Y'); - } else if (displayOption.getName().equals("HideChart")) { - displayOptionStr.setCharAt(1, 'Y'); - } else if (displayOption.getName().equals("HideReportData")) { - displayOptionStr.setCharAt(2, 'Y'); - } else if (displayOption.getName().equals("HideExcel")) { - displayOptionStr.setCharAt(5, 'Y'); - } else if (displayOption.getName().equals("HidePdf")) { - displayOptionStr.setCharAt(6, 'Y'); + if(displayOptions!=null){ + for (NameBooleanJSON displayOption : displayOptions) { + if (displayOption.isSelected()) { + if (displayOption.getName().equals("HideFormFields")) { + displayOptionStr.setCharAt(0, 'Y'); + } else if (displayOption.getName().equals("HideChart")) { + displayOptionStr.setCharAt(1, 'Y'); + } else if (displayOption.getName().equals("HideReportData")) { + displayOptionStr.setCharAt(2, 'Y'); + } else if (displayOption.getName().equals("HideExcel")) { + displayOptionStr.setCharAt(5, 'Y'); + } else if (displayOption.getName().equals("HidePdf")) { + displayOptionStr.setCharAt(6, 'Y'); + } } - } + } } - - rdef.setDisplayOptions(displayOptionStr.toString()); + + if(displayOptionStr!=null) + rdef.setDisplayOptions(displayOptionStr.toString()); + + if(definitionJSON.getAllowScheduler()!=null) + rdef.setAllowSchedule(definitionJSON.getAllowScheduler().equals("true")?"Y":"N"); + if(definitionJSON.getSizedByContent()!=null) + rdef.setSizedByContent(definitionJSON.getSizedByContent().equals("true")?"Y":"N"); + if(definitionJSON.getOneTimeRec()!=null) + rdef.setIsOneTimeScheduleAllowed(definitionJSON.getOneTimeRec().equals("true")?"Y":"N"); + if(definitionJSON.getHourlyRec()!=null) + rdef.setIsHourlyScheduleAllowed(definitionJSON.getHourlyRec().equals("true")?"Y":"N"); + if(definitionJSON.getDailyRec()!=null) + rdef.setIsDailyScheduleAllowed(definitionJSON.getDailyRec().equals("true")?"Y":"N"); + if(definitionJSON.getDailyMFRec()!=null) + rdef.setIsDailyMFScheduleAllowed(definitionJSON.getDailyMFRec().equals("true")?"Y":"N"); + if(definitionJSON.getWeeklyRec()!=null) + rdef.setIsWeeklyScheduleAllowed(definitionJSON.getWeeklyRec().equals("true")?"Y":"N"); + if(definitionJSON.getMonthlyRec()!=null) + rdef.setIsMonthlyScheduleAllowed(definitionJSON.getMonthlyRec().equals("true")?"Y":"N"); + } if (id.equals("Create")) { rdef.persistReport(request); @@ -779,7 +881,8 @@ public class RaptorControllerAsync extends RestrictedBaseController { wizardJSON.setFieldDefaultSQL(fft.getFieldDefaultSQL()); wizardJSON.setFieldSQL(fft.getFieldSQL()); wizardJSON.setValidationType(fft.getValidationType()); - + wizardJSON.setGroupFormField(fft.isGroupFormField()); + wizardJSON.setOrderSeq(fft.getOrderBySeq()); PredefinedValueList preDefined = fft.getPredefinedValueList(); if (preDefined != null) { @@ -847,7 +950,20 @@ public class RaptorControllerAsync extends RestrictedBaseController { reportColumnType.getDrillDownParams() == null ? "" : reportColumnType.getDrillDownParams()); wizardJSON.setDrilldownType( reportColumnType.getDrillDownType() == null ? "" : reportColumnType.getDrillDownType()); - + wizardJSON.setDataType(reportColumnType.getDbColType() == null ? "" :reportColumnType.getDbColType()); + wizardJSON.setGroupByPos(reportColumnType.getGroupByPos()); + wizardJSON.setLevel(reportColumnType.getLevel()); + wizardJSON.setDisplayWidth(reportColumnType.getDisplayWidth()); + wizardJSON.setNoWrap(reportColumnType.getNowrap() == null ? "" : reportColumnType.getNowrap()); + wizardJSON.setIndentation(reportColumnType.getIndentation()); + + wizardJSON.setDepeondsOnForField(reportColumnType.getDependsOnFormField() ==null?"":reportColumnType.getDependsOnFormField()); + wizardJSON.setSubTotalCustomText(reportColumnType.getSubTotalCustomText()==null?"":reportColumnType.getSubTotalCustomText()); + + wizardJSON.setHideRepeatedKey(reportColumnType.isHideRepeatedKey()==null?false:reportColumnType.isHideRepeatedKey()); + wizardJSON.setColspan(reportColumnType.getColspan()==null?null:reportColumnType.getColspan()); + wizardJSON.setDisplayName(reportColumnType.getDisplayName()); + wizardJSON.setDisplayTotal(reportColumnType.getDisplayTotal()); } } } else { @@ -905,6 +1021,17 @@ public class RaptorControllerAsync extends RestrictedBaseController { return wizardJSON; } + @RequestMapping(value = { "/report/wizard/retrieveTotalForTheColList" }, method = RequestMethod.GET) + public @ResponseBody List<IdNameValue> getTotalForTheCol(HttpServletRequest request) + throws IOException, RaptorException { + IdNameList idNameList = AppConstants.TOTAL_FUNCTIONS; + List<IdNameValue> list = new ArrayList<>(); + for(int i=0; i<idNameList.getCount(); i++) + list.add(idNameList.getValue(i)); + + return list; + } + @RequestMapping(value = { "/report/wizard/security/retrieveReportUserList" }, method = RequestMethod.GET) public @ResponseBody List<SecurityEntry> getReportUserList(HttpServletRequest request) throws IOException, RaptorException { @@ -1339,7 +1466,17 @@ public class RaptorControllerAsync extends RestrictedBaseController { wizardJSON.setNumFormCols((rdef != null) ? rdef.getNumFormColsAsInt() : 1); wizardJSON.setReportTitle((rdef != null) ? rdef.getReportTitle() : ""); wizardJSON.setReportSubTitle((rdef != null) ? rdef.getReportSubTitle() : ""); - + + /*Robert add*/ + wizardJSON.setOneTimeRec((rdef != null) ? rdef.getIsOneTimeScheduleAllowed() : "false"); + wizardJSON.setHourlyRec((rdef != null) ? rdef.getIsHourlyScheduleAllowed() : "false"); + wizardJSON.setDailyRec((rdef != null) ? rdef.getIsDailyScheduleAllowed() : "false"); + wizardJSON.setDailyMFRec((rdef != null) ? rdef.getIsDailyMFScheduleAllowed() : "false"); + wizardJSON.setWeeklyRec((rdef != null) ? rdef.getIsWeeklyScheduleAllowed() : "false"); + wizardJSON.setMonthlyRec((rdef != null) ? rdef.getIsMonthlyScheduleAllowed() : "false"); + wizardJSON.setAllowScheduler((rdef != null) ? rdef.getAllowSchedule() : "false"); + wizardJSON.setSizedByContent((rdef != null) ? rdef.getSizedByContentOption() : "false"); + wizardJSON.setRepDefType(rdef.getReportDefType()); } ObjectMapper mapper = new ObjectMapper(); @@ -1357,7 +1494,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { RaptorResponse raptorResponse = new RaptorResponse(); String sql = queryJSON.getQuery(); String jsonInString = ""; - + ServletContext servletContext = request.getSession().getServletContext(); if (!Globals.isSystemInitialized()) { Globals.initializeSystem(servletContext); @@ -1440,7 +1577,7 @@ public class RaptorControllerAsync extends RestrictedBaseController { QueryResultJSON queryResultJSON = new QueryResultJSON(); queryResultJSON.setQuery(queryJSON.getQuery()); String query = XSSFilter.filterRequestOnlyScript(queryJSON.getQuery()); - rdef.parseReportSQL(query); + rdef.parseReportSQL(query,validate); queryResultJSON.setQuery(query); int numColumns = ds.getColumnCount(); @@ -1548,6 +1685,23 @@ public class RaptorControllerAsync extends RestrictedBaseController { return raptorResponse; } + + + @RequestMapping(value = "/report/wizard/get_report_log/{reportID}", method = RequestMethod.GET) + public @ResponseBody ArrayList<ReportLogEntry> getLogs(@PathVariable("reportID") String reportId, HttpServletRequest request, + HttpServletResponse ReportLogEntry) throws IOException { + ArrayList<ReportLogEntry> arrayList = new ArrayList<>(); + try { + Vector<ReportLogEntry> v = ReportLoader.loadReportLogEntries(reportId); + for(ReportLogEntry r:v ){ + arrayList.add(r); + } + } catch (RaptorException e) { + logger.error(EELFLoggerDelegate.errorLogger, + "RaptorControllerAsync getLogs.", e); + } + return arrayList; + } @RequestMapping(value = "save_chart", method = RequestMethod.POST) public void reportChartReceive(@RequestBody ChartJSON chartJSON, HttpServletRequest request, @@ -1627,7 +1781,12 @@ public class RaptorControllerAsync extends RestrictedBaseController { dct.setChartSeq(-1); // if we set it to -1, means this range axis will not be included else dct.setChartSeq(++r); - dct.setColOnChart("0"); + + if (!dct.getColId().equals(domainAxis)) { + dct.setColOnChart("0"); + }else{ + dct.setChartSeq(-1); + } dct.setYAxis(rangeYAxis); // +"|"+dct.getColId()); dct.setChartGroup(rangeChartGroup); // +"|"+dct.getColId()); dct.setChartColor(rangeColor); @@ -1646,7 +1805,6 @@ public class RaptorControllerAsync extends RestrictedBaseController { } } - reportRuntime.setChartLeftAxisLabel(chartJSON.getPrimaryAxisLabel()); reportRuntime.setChartRightAxisLabel(chartJSON.getSecondaryAxisLabel()); |