diff options
Diffstat (limited to 'ecomp-sdk')
43 files changed, 756 insertions, 216 deletions
diff --git a/ecomp-sdk/epsdk-aaf/pom.xml b/ecomp-sdk/epsdk-aaf/pom.xml index 34b0c7b7..0377c511 100644 --- a/ecomp-sdk/epsdk-aaf/pom.xml +++ b/ecomp-sdk/epsdk-aaf/pom.xml @@ -7,12 +7,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-aaf</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK AAF Authorization</name> diff --git a/ecomp-sdk/epsdk-analytics/pom.xml b/ecomp-sdk/epsdk-analytics/pom.xml index 48c67c67..aa2f9052 100644 --- a/ecomp-sdk/epsdk-analytics/pom.xml +++ b/ecomp-sdk/epsdk-analytics/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java index b42bdf9c..d77e6bc7 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/pdf/PdfReportHandler.java @@ -1,7 +1,7 @@ /* * ============LICENSE_START========================================== * ONAP Portal SDK - * =================================================================== + * =================================================================== * Copyright © 2017 AT&T Intellectual Property. All rights reserved. * =================================================================== * @@ -10,7 +10,7 @@ * you may not use this software except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -124,7 +124,7 @@ import org.onap.portalsdk.analytics.view.ReportData; import org.onap.portalsdk.analytics.view.RowHeader; import org.onap.portalsdk.analytics.view.RowHeaderCol; import org.onap.portalsdk.analytics.xmlobj.DataColumnType; -import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; /** * @author mwliu and sundar @@ -161,7 +161,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ int returnValue = 0; ReportRuntime rr = null; - if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rr==null) + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); boolean isDashboard = false; if ((request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)!=null) && ( ((String) request.getSession().getAttribute(AppConstants.SI_DASHBOARD_REP_ID)).equals(rr.getReportID())) ) { @@ -247,17 +248,21 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ //ReportRuntime rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); //ReportData rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); rr = null; - ReportData rd = null; + ReportData rd = null; String parent = ""; int parentFlag = 0; - if(!nvl(request.getParameter("parent"), "").equals("N")) parent = nvl(request.getParameter("parent"), ""); - if(parent.startsWith("parent_")) parentFlag = 1; + if(!nvl(request.getParameter("parent"), "").equals("N")) + parent = nvl(request.getParameter("parent"), ""); + if(parent.startsWith("parent_")) + parentFlag = 1; if(parentFlag == 1) { rr = (ReportRuntime) request.getSession().getAttribute(parent+"_rr"); rd = (ReportData) request.getSession().getAttribute(parent+"_rd"); } - if(rr==null) rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); - if(rd==null) rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); + if(rr==null) + rr = (ReportRuntime) request.getSession().getAttribute(AppConstants.SI_REPORT_RUNTIME); + if(rd==null) + rd = (ReportData) request.getSession().getAttribute(AppConstants.RI_REPORT_DATA); pb = preparePdfBean(request,rr); FONT_FAMILY = rr.getPDFFont(); @@ -738,9 +743,11 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ //System.out.println("chartGroupOrg " + chartGroupOrg); if(nvl(chartGroupOrg).length()>0) tempChartGroupCurrent = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); - if(i>0) tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|")); + if(i>0) + tempChartGroupPrev = ((String) lGroups.get(i-1)).substring(0,((String) lGroups.get(i-1)).lastIndexOf("|")); //System.out.println("TEMPCHARTGROUP " + tempChartGroupCurrent + " " + tempChartGroupPrev); - if(tempChartGroupCurrent.equals(tempChartGroupPrev)) continue; + if(tempChartGroupCurrent.equals(tempChartGroupPrev)) + continue; //System.out.println("CHARTGROUPORG " + chartGroupOrg + " " + lGroups) ; //String chartGroup = chartGroupOrg.substring(0,chartGroupOrg.lastIndexOf("|")); String chartGroup = chartGroupOrg; @@ -1422,7 +1429,8 @@ public class PdfReportHandler extends org.onap.portalsdk.analytics.RaptorObject{ DataRow dr = rd.reportDataRows.getNext(); for(dr.resetNext();dr.hasNext();) { DataValue dv = dr.getNext(); - if(!dv.isVisible()) totalVisbleColumn--; + if(!dv.isVisible()) + totalVisbleColumn--; } break; 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 19b7b138..52077aa8 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 @@ -59,10 +59,10 @@ import java.util.TimeZone; import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; + import org.apache.commons.lang.time.DateUtils; import org.onap.portalsdk.analytics.error.RaptorException; import org.onap.portalsdk.analytics.model.base.ChartSeqComparator; @@ -291,7 +291,8 @@ public class ChartD3Helper { if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { if((dct.isChartSeries()!=null && dct.isChartSeries().booleanValue()) || (dct.getChartSeq()!=null && dct.getChartSeq()>0) ) { - if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(nvl(dct.getChartColor()).length()>0) + hasCustomizedChartColor = true; if(hasCustomizedChartColor) { //duplicates are avoided if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) @@ -465,12 +466,14 @@ public class ChartD3Helper { try { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement)))); //if(MAXNUM < YAXISNUM) MAXNUM = YAXISNUM; - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get((hasCustomizedChartColor?(uniqueElement.indexOf("|")!=-1?uniqueElement.substring(0, uniqueElement.indexOf("|")):uniqueElement):uniqueElement)))); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -507,12 +510,14 @@ public class ChartD3Helper { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); dateStrList.add(new Long(date.getTime()).toString()); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -579,12 +584,14 @@ public class ChartD3Helper { dateStrList.add("'"+dateStr+"'"); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -630,12 +637,14 @@ public class ChartD3Helper { dateStrList.add(new Long(date.getTime()).toString()); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } catch (NumberFormatException ex1) { flagNull = 1; } @@ -939,8 +948,10 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; - if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; + if( MAXNUMDECIMALPLACES >=3 ) + MAXNUMDECIMALPLACES = 2; if(!logScale) wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n"); else @@ -1085,7 +1096,8 @@ public class ChartD3Helper { //System.out.println(dct.getDisplayName() + " " + yText); if(!(nvl(dct.getColOnChart()).equals(AppConstants.GC_LEGEND))) { if(yTextSeries.contains((String)dct.getDisplayName())) { - if(nvl(dct.getChartColor()).length()>0) hasCustomizedChartColor = true; + if(nvl(dct.getChartColor()).length()>0) + hasCustomizedChartColor = true; if(hasCustomizedChartColor) { //duplicates are avoided if(!ts.contains(dct.getDisplayName()+"|"+nvl(dct.getChartColor()))) @@ -1251,7 +1263,8 @@ public class ChartD3Helper { date = getDateFromDateStr(dateStr); formatFlag = getFlagFromDateStr(dateStr); } - if(date==null && timeAxis) continue; + if(date==null && timeAxis) + continue; //if(ds.getString(i, 2).equals(uniqueElements[j])) { @@ -1260,13 +1273,15 @@ public class ChartD3Helper { uniqueElement = (String)uniqueRevElements[j]; try { YAXISNUM = Integer.parseInt(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagNull = 1; @@ -1289,13 +1304,15 @@ public class ChartD3Helper { if(i<ds.getRowCount()-1) { try { YAXISNUM = Integer.parseInt(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1)?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i+1, columnMap.get(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement)))); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagSecondNull = 1; @@ -1343,7 +1360,8 @@ public class ChartD3Helper { formatFlag = getFlagFromDateStr(dateStr); } - if(date==null && timeAxis) continue; + if(date==null && timeAxis) + continue; uniqueElement = (String)uniqueRevElements[j]; //date = MMDDYYYYFormat.parse(ds.getString(i, 1), new ParsePosition(0)); @@ -1352,13 +1370,15 @@ public class ChartD3Helper { // minTime = date.getTime(); try { YAXISNUM = Integer.parseInt(ds.getString(i, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(i, 3)); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { @@ -1383,13 +1403,15 @@ public class ChartD3Helper { if (ds.getString(k, 2).equals(((hasCustomizedChartColor||nvl(chartRightAxisLabel).length()>0) && (uniqueElement.lastIndexOf("|") != -1) ?uniqueElement.substring(0, uniqueElement.lastIndexOf("|")):uniqueElement))) { try { YAXISNUM = Integer.parseInt(ds.getString(k, 3)); - if(MAXDOUBLENUM < YAXISNUM) MAXDOUBLENUM = YAXISNUM; + if(MAXDOUBLENUM < YAXISNUM) + MAXDOUBLENUM = YAXISNUM; } catch (NumberFormatException ex) { try { YAXISDOUBLENUM = Double.parseDouble(ds.getString(k, 3)); if(RIGHTAXISSERIES!=j) { MAXNUMDECIMALPLACES = getNumberOfDecimalPlaces(YAXISDOUBLENUM); - if(MAXDOUBLENUM < YAXISDOUBLENUM) MAXDOUBLENUM = YAXISDOUBLENUM; + if(MAXDOUBLENUM < YAXISDOUBLENUM) + MAXDOUBLENUM = YAXISDOUBLENUM; } } catch (NumberFormatException ex1) { flagSecondNull = 1; @@ -1588,8 +1610,10 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); //if(nvl(subType).length() > 0 && subType.equals("area")) { - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; - if( MAXNUMDECIMALPLACES >=3 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; + if( MAXNUMDECIMALPLACES >=3 ) + MAXNUMDECIMALPLACES = 2; wholeScript.append(" .tickFormat(d3.format(',."+MAXNUMDECIMALPLACES+"f')); \n"); /*} else { wholeScript.append(" .tickFormat(d3.format(',.2f')); \n"); @@ -1614,7 +1638,8 @@ public class ChartD3Helper { } wholeScript.append(" .axisLabel('" + chartLeftAxisLabel + "') \n"); //if(nvl(subType).length() > 0 && subType.equals("area")) { - if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) MAXNUMDECIMALPLACES = 2; + if(MAXDOUBLENUM <=5 && MAXNUMDECIMALPLACES == 0 ) + MAXNUMDECIMALPLACES = 2; if( MAXNUMDECIMALPLACES >=3 ) { MAXNUMDECIMALPLACES = 2; } @@ -2902,7 +2927,8 @@ public class ChartD3Helper { int rowCount = ds.getRowCount(); for (int i = 0; i < ds.getRowCount(); i++) { s.append("{ \"name\": \""+ ds.getString(i,"ei1") +"\" , \"group\":"+ ds.getString(i,"groups") +", \"level\":2 }"); - if (i < (rowCount-1)) s.append(","); + if (i < (rowCount-1)) + s.append(","); dataStr.append(s); s = new StringBuilder(""); } @@ -2911,7 +2937,8 @@ public class ChartD3Helper { dataStr.append("\"links\":["); for (int i = 0; i < ds.getRowCount(); i++) { s.append("{ \"source\": "+ ds.getString(i,"source") +" , \"target\":"+ ds.getString(i,"target") +", \"value\":2 }"); - if (i < (rowCount-1)) s.append(","); + if (i < (rowCount-1)) + s.append(","); dataStr.append(s); s = new StringBuilder(""); } @@ -3306,7 +3333,8 @@ public class ChartD3Helper { } else if (filter == 1 && (dc.isCreateInNewChart()==null || !dc.isCreateInNewChart().booleanValue())) { chartValueCols.add(dc); } - else if(filter == 0) chartValueCols.add(dc); + else if(filter == 0) + chartValueCols.add(dc); } else chartValueCols.add(dc); } // } else @@ -3577,116 +3605,142 @@ public class ChartD3Helper { */ date = MMDDYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; if(date==null) { date = EEEMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYOFTHEWEEKFLAG; + if(date!=null) + formatFlag = DAYOFTHEWEEKFLAG; } if(date==null) { date = MMDDYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { //MMDDYYYYHHFormat.setTimeZone(TimeZone.getTimeZone("UTC")); date = MMDDYYYYHHFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = MMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = YYYYMMDDFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = timestampHrFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = HOURFLAG; + if(date!=null) + formatFlag = HOURFLAG; } if(date==null) { date = timestampDayFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = MMMMMDDYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MONTHYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MONTHFLAG; + if(date!=null) + formatFlag = MONTHFLAG; } if(date==null) { date = YYYYMMDDHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = YYYYMMDDHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = DDMONYYYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = DDMONYYYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = MMDDYYHHMMSSFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYHHMMFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = MMDDYYFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = DAYFLAG; + if(date!=null) + formatFlag = DAYFLAG; } if(date==null) { date = timestampFormat1.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) { date = MMDDYYYYHHMMZFormat.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = MINFLAG; + if(date!=null) + formatFlag = MINFLAG; } if(date==null) { date = YYYYFormat.parse(dateStr, new ParsePosition(0)); /* Some random numbers should not satisfy this year format. */ - if(dateStr.length()>4) date = null; - if(date!=null) formatFlag = YEARFLAG; + if(dateStr.length()>4) + date = null; + if(date!=null) + formatFlag = YEARFLAG; } if(date==null) { date = timestamp_W_dash.parse(dateStr, new ParsePosition(0)); - if(date!=null) formatFlag = SECFLAG; + if(date!=null) + formatFlag = SECFLAG; } if(date==null) date = null; @@ -3713,8 +3767,10 @@ public class ChartD3Helper { public boolean getBooleanValue(String s, Boolean defaultValue) { s = nvl(s); - if(s.length()<=0 && defaultValue!=null) return defaultValue.booleanValue(); - else if(s.length()<=0) return false; + if(s.length()<=0 && defaultValue!=null) + return defaultValue.booleanValue(); + else if(s.length()<=0) + return false; else { if(s.toUpperCase().startsWith("Y") || s.toLowerCase().equals("true")) return true; @@ -3819,7 +3875,8 @@ public class ChartD3Helper { value.append("("); } for(int j = 0 ; j < vals.length; j++) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); @@ -3834,7 +3891,8 @@ public class ChartD3Helper { } - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(j != vals.length -1) { value.append(","); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java index 2d46326b..2cff3e63 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValues.java @@ -132,7 +132,8 @@ public class ReportParamValues extends Hashtable { long currentTime = System.currentTimeMillis(); //System.out.println("ReportParamValues setParamValues called " + refresh); boolean paramUpdated = false; - if(refresh) clearValues(); + if(refresh) + clearValues(); for (Enumeration enKeys = keys(); enKeys.hasMoreElements();) { String key = (String) enKeys.nextElement(); String oldValue = XSSFilter.filterRequestOnlyScript(getParamValue(key)); diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java index 98718686..483e9fe4 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/model/runtime/ReportParamValuesForPDFExcel.java @@ -111,7 +111,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { //debugLogger.debug("ReportParamValues for PDF Excel setParamValues called " + refresh); long currentTime = System.currentTimeMillis(); boolean paramUpdated = false; - if(refresh) clearValues(); + if(refresh) + clearValues(); String name = null; String value = null; String value1 = ""; @@ -193,7 +194,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { } if(sql!=null && sql.trim().length()>0){ name = ""; - if(name.length()<=0) name = ff.getFieldName(); + if(name.length()<=0) + name = ff.getFieldName(); value = rr.getParamValue(name); //debugLogger.debug("Name "+ name+ " value:" + value); String paramValue = ESAPI.encoder().encodeForSQL( SecurityCodecUtil.getCodec(), getParamValueForSQL(name, value)); @@ -280,7 +282,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { put(ff.getFieldName(), nvl(value1)); } else { - if(ds!=null && ds.getRowCount()>0) put(ff.getFieldName(), nvl(ds.getString(0,1))); + if(ds!=null && ds.getRowCount()>0) + put(ff.getFieldName(), nvl(ds.getString(0,1))); else put(ff.getFieldName(), nvl(value)); } } @@ -315,7 +318,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { //debugLogger.debug("77777777777777 " + value1); } else value1 = nvl(rr.getParamValue(ff.getFieldName())); - if(value1.length()<=0) value1 = nvl(ff.getDefaultValue()); + if(value1.length()<=0) + value1 = nvl(ff.getDefaultValue()); put(ff.getFieldName(), nvl(value1)); } @@ -431,7 +435,8 @@ public class ReportParamValuesForPDFExcel extends Hashtable { }catch(NumberFormatException ex){ numInt = 0; } - if(numInt < 10) return "0"+numInt; + if(numInt < 10) + return "0"+numInt; else return ""+numInt; } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java index f698e556..144c6ea8 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/scheduler/SendEmail.java @@ -39,7 +39,6 @@ package org.onap.portalsdk.analytics.scheduler; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java index 547937f2..972cf721 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/AppUtils.java @@ -165,7 +165,8 @@ public class AppUtils /* implements IAppUtils */{ // This is changed to check for Admin User as admin user also need super user privilege if explicitly specified in properties file. public static boolean isSuperUser(HttpServletRequest request)throws RaptorException { - if(Globals.isAdminRoleEquivalenttoSuperRole()) return isAdminUser(request); + if(Globals.isAdminRoleEquivalenttoSuperRole()) + return isAdminUser(request); else return isUserInRole(request, getSuperRoleID()); } // isSuperUser 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 6718e427..6f55037b 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 @@ -1140,7 +1140,8 @@ return sheetName; StringTokenizer st = new StringTokenizer(vals, "|"); if(st.countTokens()>0) { while(st.hasMoreTokens()) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); String token = st.nextToken(); try { if(token !=null && token.length() > 0) @@ -1149,7 +1150,8 @@ return sheetName; catch (IllegalArgumentException ex1){} catch (Exception ex2){} value.append(token); - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(st.hasMoreTokens()) { value.append(","); } @@ -1163,7 +1165,8 @@ return sheetName; valuesMap.put(fieldNameMap.get(formField), valueStr); valueStr = ""; } - if(isMultiValue) value.append(")"); + if(isMultiValue) + value.append(")"); valuesMap.put(fieldNameMap.get(formField), value.toString()); if(ff.getValidationType().equals(FormField.VT_TIMESTAMP_HR) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_MIN) || ff.getValidationType().equals(FormField.VT_TIMESTAMP_SEC)) { @@ -1209,7 +1212,8 @@ return sheetName; StringTokenizer st = new StringTokenizer(vals, "|"); if(st.countTokens()>0) { while(st.hasMoreTokens()) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); String token = st.nextToken(); try { if(token !=null && token.length() > 0) @@ -1218,7 +1222,8 @@ return sheetName; catch (IllegalArgumentException ex1){} catch (Exception ex2){} value.append(token); - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(st.hasMoreTokens()) { value.append(","); } @@ -1231,7 +1236,8 @@ return sheetName; valuesMap.put(fieldNameMap.get(formField), valueStr); valueStr = ""; } - if(isMultiValue) value.append(")"); + if(isMultiValue) + value.append(")"); valuesMap.put(fieldNameMap.get(formField), value.toString()); @@ -1405,7 +1411,8 @@ return sheetName; value.append("("); } for(int j = 0 ; j < vals.length; j++) { - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); try { if(vals[j] !=null && vals[j].length() > 0) { vals[j] = Utils.oracleSafe(vals[j]); @@ -1420,7 +1427,8 @@ return sheetName; } - if(isMultiValue) value.append("'"); + if(isMultiValue) + value.append("'"); if(j != vals.length -1) { value.append(","); @@ -1542,7 +1550,8 @@ return sheetName; public static int getMemoryThreshold() { int threshold = Integer.parseInt(nvls(raptorProperties.getProperty("memory_threshold_percentage"),"0").trim()); - if(threshold <= 0) threshold = 0; + if(threshold <= 0) + threshold = 0; return threshold; } diff --git a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java index 2a9d487a..c28f6e6c 100644 --- a/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java +++ b/ecomp-sdk/epsdk-analytics/src/main/java/org/onap/portalsdk/analytics/system/RemDbUtils.java @@ -179,8 +179,10 @@ public class RemDbUtils /* implements IDbUtils */{ public static DataSet executeQuery(Connection con, String sql, int maxRowLimit, String dbKey) throws ReportSQLException { try { - if (con==null || con.isClosed()) con = getConnection(dbKey); - if(con==null) throw new ReportSQLException("Remote Connection not configured for "+ dbKey); + if (con==null || con.isClosed()) + con = getConnection(dbKey); + if(con==null) + throw new ReportSQLException("Remote Connection not configured for "+ dbKey); try(Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(sql);){ logger.debug(EELFLoggerDelegate.debugLogger, ("[SQL CALL FROM RAPTOR] [SQL] " + sql)); diff --git a/ecomp-sdk/epsdk-app-common/pom.xml b/ecomp-sdk/epsdk-app-common/pom.xml index 21a56f01..91f7e8dc 100644 --- a/ecomp-sdk/epsdk-app-common/pom.xml +++ b/ecomp-sdk/epsdk-app-common/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> @@ -368,5 +368,12 @@ <artifactId>commons-collections</artifactId> <version>3.2.2</version> </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>20.0</version> + </dependency> + </dependencies> </project> diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz Binary files differindex d0576c6e..ae63bfb4 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/portalsdk-tag-lib-0.0.1.tgz diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.ts index 111cf3f4..7d14ee39 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.ts +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/app/pages/ext/profile/profile.service.ts @@ -38,6 +38,10 @@ export class ProfileService { } + getProfileById(profileId){ + return this.http.get(environment.getProfileById+"?profile_id="+profileId, {withCredentials: true }); + } + removeRole(data,profileId) { return this.http.post(environment.removeUserRole+'?profile_id='+profileId,JSON.stringify({role: data}),{ withCredentials: true }); diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.prod.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.prod.ts index 3612073b..e53aeb67 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.prod.ts +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.prod.ts @@ -1,3 +1,32 @@ export const environment = { - production: true + production: true, + baseUrl: '', + roleFunctionList: 'get_role_functions', + addRoleFunction: 'role_function_list/addRoleFunction', + usageList: 'get_usage_list', + cachedRegions: 'get_regions', + getRole:'get_role', + getFnMenuItems:'admin_fn_menu', + updateFnMenuItem:'admin_fn_menu/updateFnMenu.htm', + getFunctionCdList:'admin_fn_menu/get_function_cd_list', + getParentList:'admin_fn_menu/get_parent_list', + getUserPagination:'get_user_pagination?pageNum=0&viewPerPage=0', + deleteRole:'role_list/removeRole', + getTopMenu:'get_topMenuInfo', + deleteRoleFunction:'role_function_list/removeRoleFunction', + deleteMenu:'admin_fn_menu/removeMenuItem.htm', + getRegion:'jcs_admin/showRegionDetails', + postSearch:'post_search/search', + importSearch:'post_search/process', + getPostProfile:'post_search_sample', + getSelfProfile:'get_self_profile', + getProfileById: 'get_profile', + removeUserRole:'profile/removeRole', + addUserRole:'profile/addNewRole', + saveProfile :'profile/saveProfile', + getFunctionalMenuStaticDetail :'http:/www.sdk.onap.org:8080/epsdk-app-os/get_topMenuInfo', + getLeftMenu :'get_menu', + removeRoleFunction:'role/removeRoleFunction.htm?role_id=', + saveRole:'role/saveRole.htm?role_id=', + toggleProfileActive: 'profile/toggleProfileActive?profile_id=' }; diff --git a/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.ts b/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.ts index 294d41e9..0114df00 100644 --- a/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.ts +++ b/ecomp-sdk/epsdk-app-os/ngappsrc/src/environments/environment.ts @@ -24,6 +24,7 @@ export const environment = { importSearch:'http://www.sdk.onap.org:8080/epsdk-app-os/post_search/process', getPostProfile:'http://www.sdk.onap.org:8080/epsdk-app-os/post_search_sample', getSelfProfile:'http://www.sdk.onap.org:8080/epsdk-app-os/get_self_profile', + getProfileById: 'http://www.sdk.onap.org:8080/epsdk-app-os/get_profile', removeUserRole:'http://www.sdk.onap.org:8080/epsdk-app-os/profile/removeRole', addUserRole:'http://www.sdk.onap.org:8080/epsdk-app-os/profile/addNewRole', saveProfile :'http://www.sdk.onap.org:8080/epsdk-app-os/profile/saveProfile', diff --git a/ecomp-sdk/epsdk-app-os/pom.xml b/ecomp-sdk/epsdk-app-os/pom.xml index 251ba507..4a8eae11 100644 --- a/ecomp-sdk/epsdk-app-os/pom.xml +++ b/ecomp-sdk/epsdk-app-os/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> @@ -26,6 +26,7 @@ <skipassembly>true</skipassembly> <!-- Tests usually require some setup that maven cannot do, so skip. --> <skiptests>false</skiptests> + <angularTestPhase>compile</angularTestPhase> <jacoco.version>0.7.9</jacoco.version> <!-- Version number gets stored only here --> <tomcat.download.path>http://archive.apache.org/dist/tomcat/tomcat-8/v8.0.37/bin</tomcat.download.path> @@ -177,7 +178,7 @@ <goal>npm</goal> </goals> - <phase>compile</phase> + <phase>${angularTestPhase}</phase> <configuration> <arguments>run-script test</arguments> @@ -587,6 +588,12 @@ <version>${jacoco.version}</version> <classifier>runtime</classifier> </dependency> + + <dependency> + <groupId>com.google.guava</groupId> + <artifactId>guava</artifactId> + <version>20.0</version> + </dependency> </dependencies> </project>
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/pom.xml b/ecomp-sdk/epsdk-app-overlay/pom.xml index a71996bb..3e5a9879 100644 --- a/ecomp-sdk/epsdk-app-overlay/pom.xml +++ b/ecomp-sdk/epsdk-app-overlay/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts index f06719fc..7bf5c649 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.ts @@ -78,7 +78,7 @@ export class HeaderComponent implements OnInit { } this.pushRightClass = 'push-right'; - this.appName= 'ONAP ENMT' ; + this.appName= 'ONAP Portal' ; let result = this.headerService.getTopMenuItems(); result.subscribe(res => { this.response = res; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.scss b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.scss index 0f868ab4..d5bf6ac0 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.scss +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.scss @@ -57,4 +57,8 @@ td[_ngcontent-c4], th[_ngcontent-c4] { font-size: 14px; width: 20%; float: left; +} + +rdp-data-table{ + overflow-x : scroll; }
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts index 5d996964..c6fbc8c4 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.ts @@ -72,12 +72,12 @@ export class MenusComponent implements OnInit { public columns: any = []; activeStatusOptions = [ - {index: 0, value: 'true', name: 'Y'}, - {index: 1, value: 'false', name: 'N'} + {id: '0', name: 'Y'}, + {id: '1', name: 'N'} ]; separatorStatusOptions = [ - {index: 0, value: 'true', name: 'Y'}, - {index: 1, value: 'false', name: 'N'} + {id: '0', name: 'Y'}, + {id: '1', name: 'N'} ]; functionCDselectData = []; parentListSelectData = []; @@ -192,6 +192,7 @@ export class MenusComponent implements OnInit { this.parentList.push({id: _data[i][0], name: _data[i][1]}); } console.log("Actual parent list : ", this.parentList); + this.menuService.getParentList(this.parentList); } }, error => { this.showSpinner = false; diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts new file mode 100644 index 00000000..8d5c6637 --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.spec.ts @@ -0,0 +1,134 @@ + +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { TestBed} from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { MenusService } from './menus.service'; +import { AdminService } from '../admin.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; + +describe('MenusService', () => { + + let component:MenusService; + let service:AdminService; + var stubData={"data":['{"active":"data"}','{"separator":"data1"}']}; + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,MenusService] + }) + component = TestBed.get(MenusService); + service = TestBed.get(AdminService); + }); + + it('should be created', () => { + const component: MenusService = TestBed.get(MenusService); + expect(component).toBeTruthy(); + }); + + // it('should test getTotalRowCount method',()=>{ + // component.getTotalRowCount(); + // }) + + it('should test updateStatus method',()=>{ + component['updateStatus']('N'); + }) + + it('should test updateBooleanValue method',()=>{ + component['updateBooleanValue'](true); + component['updateBooleanValue'](false); + }) + + it('should test updateParentNameToID method',()=>{ + component.parentList=[{'name':'data'}]; + component['updateParentNameToID']('data'); + }) + + it('should test menu',()=>{ + console.log(component.menu); + expect(component.menu.action).toEqual(null); + }) + + it('should test add method',()=>{ + component.add("data"); + }) + + it('should test update method',()=>{ + let spy=spyOn(service,'updateFnMenuItem').and.returnValue(Observable.of("")); + component.update(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test getParentData method2 error part ',()=>{ + let spy=spyOn(service,'updateFnMenuItem').and.returnValue(Observable.throw({status:404})); + component.update(stubData) + expect(spy).toHaveBeenCalled(); + }) + + + it('should test delete method',()=>{ + let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.of("")); + component.delete(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test error part of delete method',()=>{ + let spy=spyOn(service,'deleteMenu').and.returnValue(Observable.throw({status:404})); + component.delete(stubData); + expect(spy).toHaveBeenCalled(); + }) + + it('should test getParentList method',()=>{ + component.getParentList("getParentList"); + expect(component.parentList).toEqual("getParentList"); + }) + + it('should test get method',()=>{ + let spy=spyOn(service,'getFnMenuItems').and.returnValue(Observable.of()); + component.get(); + expect(spy).toHaveBeenCalled(); + }) +}); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts index 9df51b51..912b65bb 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.service.ts @@ -104,24 +104,32 @@ export class MenusService implements RdpCrudInterface { data.active = this.updateStatus(data.active); data.separator = this.updateStatus(data.separator); let keys = Object.keys(data); + let menuCache = this.menu; keys.forEach(element => { if (data[element] != null || data[element] != undefined) { if (element == 'parentId') { - this.menu[element] = 1; + if (isNaN(data[element])) { + menuCache[element] = this.updateParentNameToID(data[element]); + } else{ + menuCache[element] = data[element]; + } + console.log("Parent Id to update : ", menuCache[element]); } else { - this.menu[element] = data[element]; + menuCache[element] = data[element]; } } }); - let result = { availableFnMenuItem: this.menu }; + let result = { availableFnMenuItem: menuCache }; let postData = JSON.stringify(result); console.log("postData >>>>>>", postData); this.adminService.updateFnMenuItem(postData) .subscribe(_data => { console.log("Response : ", _data); this.statusResponse.next("200"); + menuCache = this.menu; }, error => { console.log("Error : ", error); + menuCache = this.menu; }); } @@ -131,11 +139,10 @@ export class MenusService implements RdpCrudInterface { console.log(data.active); data.active = this.updateStatus(data.active); data.separator = this.updateStatus(data.separator); - let result = { availableFnMenuItem: data }; - this.adminService.deleteMenu(result).subscribe(response => { + this.adminService.deleteMenu(data).subscribe(response => { console.log("Response ", response); this.statusResponse.next("200"); - }, error =>{ + }, error => { console.log("Error : ", error); }) } @@ -148,15 +155,44 @@ export class MenusService implements RdpCrudInterface { } } + private updateBooleanValue(data) { + if (data) { + return 'Y'; + } else { + return 'N'; + } + } + + parentList: any; + + getParentList(list) { + this.parentList = list; + } + + private updateParentNameToID(data) { + let val; + this.parentList.forEach(ele => { + if (ele['name'] == data) { + val = ele['id']; + } + }); + console.log("ParentId value ", val); + return val; + } + get() { - console.log("get method is getting called from AppServie data:: "); + console.log("get method is getting called from MenuServie data:: "); let response = this.adminService.getFnMenuItems(); let resp; response.subscribe(res => { - console.log("Get Response : ", res); resp = res; - console.log("edited : ",JSON.parse(resp.data).fnMenuItems); - this.updatedData.next(JSON.parse(resp.data).fnMenuItems); + let responseData = JSON.parse(resp.data).fnMenuItems; + responseData.forEach(element => { + element.active = this.updateBooleanValue(element.active); + element.separator = this.updateBooleanValue(element.separator); + }) + this.updatedData.next(responseData); }) } + } diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts index ecc0947d..7ef63baf 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -41,7 +43,12 @@ import { NewRoleFunctionComponent } from './new-role-function.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import {MatRadioModule } from '@angular/material'; +import { RouterTestingModule } from '@angular/router/testing'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; describe('NewRoleFunctionComponent', () => { let component: NewRoleFunctionComponent; @@ -50,10 +57,25 @@ describe('NewRoleFunctionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ schemas:[CUSTOM_ELEMENTS_SCHEMA], - declarations: [ NewRoleFunctionComponent ], - imports:[FormsModule,HttpClientTestingModule], + declarations: [ + NewRoleFunctionComponent, + ConfirmationModalComponent, + InformationModalComponent + ], + imports:[ + FormsModule, + HttpClientTestingModule, + MatRadioModule, + RouterTestingModule, + NgbModule.forRoot() + ], providers:[NgbActiveModal] }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent,InformationModalComponent] + } + }) .compileComponents(); })); @@ -63,7 +85,19 @@ describe('NewRoleFunctionComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test ngOnInit method',()=>{ + component.ngOnInit(); + }) + + it('should test saveRoleFunction method',()=>{ + component.saveRoleFunction(); + }) + + it('should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar") + }) }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts new file mode 100644 index 00000000..0e59f9eb --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts @@ -0,0 +1,62 @@ + +import { TestBed} from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { AdminService } from '../admin.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; +import { RoleFunctionsService } from './role-functions.service'; + +describe('RoleFunctionsService', () => { + + let component:RoleFunctionsService; + let service:AdminService; + //var stubData=['{"data":'{"active":"data2"}'}'] + //var stubData1='{stubData}' + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,RoleFunctionsService] + }) + component = TestBed.get(RoleFunctionsService); + service = TestBed.get(AdminService); + }); + + it('should be created', () => { + const component: RoleFunctionsService = TestBed.get(RoleFunctionsService); + expect(component).toBeTruthy(); + }); + + it('should test add method',()=>{ + component.add("data"); + }) + + it('should test update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.of('your object')); + component.update("data"); + expect(spy).toHaveBeenCalled(); + }) + + it('should test error part of update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.throw({status:404})); + component.update("data"); + expect(spy).toHaveBeenCalled(); +}) + + + it('should test delete method',()=>{ + let spy=spyOn(service,'deleteRoleFunction').and.returnValue(Observable.of('your object')); + component.delete("data"); + expect(spy).toHaveBeenCalled(); + }) + + it('should test get method',()=>{ + let spy=spyOn(service,'getRoleFunctionList').and.returnValue(Observable.of()) + component.get(); + expect(spy).toHaveBeenCalled(); + }) + +});
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts index 4b496f1b..8a30f2a3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts @@ -43,9 +43,10 @@ import {FormsModule} from '@angular/forms'; import { NewRoleComponent } from './new-role.component'; import { MatTableModule } from '@angular/material' import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; -import { HttpClient, HttpClientModule } from '@angular/common/http'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; describe('NewRoleComponent', () => { let component: NewRoleComponent; @@ -56,8 +57,21 @@ describe('NewRoleComponent', () => { TestBed.configureTestingModule({ providers: [NgbActiveModal], schemas: [CUSTOM_ELEMENTS_SCHEMA] , - declarations: [ NewRoleComponent ], - imports: [FormsModule, MatTableModule, HttpClientTestingModule] + declarations: [ + NewRoleComponent, + ConfirmationModalComponent + ], + imports: [ + FormsModule, + MatTableModule, + HttpClientTestingModule, + NgbModule.forRoot() + ] + }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent] + } }) .compileComponents(); })); @@ -69,7 +83,26 @@ describe('NewRoleComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test toggleRoleFunction method',()=>{ + component.ociavailableRoleFunctions=1; + component.toggleRoleFunction("toggleRoleFunction") + }) + + it('should test populateTableData method',()=>{ + component.populateTableData("populateTableData"); + expect(component.roleFunctionDataSource.sort).toEqual(component.sort); + expect(component.roleFunctionDataSource.paginator).toEqual(component.paginator) + }) + + it('should test isRoleAlreadyExist method',()=>{ + component.isRoleAlreadyExist("currentRoleName") + }) + + it('it should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar"); + }) });
\ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts index dcd637fc..92d96135 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts @@ -47,9 +47,10 @@ import { MatTableModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { NewRoleComponent } from './new-role/new-role.component'; describe('RolesComponent', () => { let component: RolesComponent; @@ -102,4 +103,20 @@ describe('RolesComponent', () => { // it('should test openAdoleModaldNewR method',()=>{ // component.openAdoleModaldNewR('dummydata2') // }) + + it('should test openAdoleModaldNewR method',()=>{ + component.toggleRole("") + }) + + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + + // it('should test applyFilter method',()=>{ + // component.applyFilter("filterValue T"); + // expect(component.dataSource.filter).toEqual("filtervalue"); + // }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts index 7481acc8..ee8f7b64 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts @@ -48,6 +48,9 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; +import { ActivatedRoute } from '@angular/router'; +import { RouterTestingModule } from '@angular/router/testing'; +import { ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; describe('SelfComponent', () => { let component: SelfComponent; @@ -66,7 +69,8 @@ describe('SelfComponent', () => { MatSelectModule, MatSlideToggleModule, BrowserAnimationsModule, - HttpClientTestingModule + HttpClientTestingModule, + RouterTestingModule ] }) .compileComponents(); @@ -91,4 +95,10 @@ describe('SelfComponent', () => { }) }) + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts index 45210f80..61b2a343 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.ts @@ -46,6 +46,7 @@ import { InformationModalComponent } from 'src/app/modals/information-modal/info import { ErrorModalComponent } from 'src/app/modals/error-modal/error-modal.component'; import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-self', @@ -54,7 +55,10 @@ import { Column, ColumnTypes, DataTableSettings } from 'portalsdk-tag-lib'; }) export class SelfComponent implements OnInit { - constructor(public userService: UserService, public profileService: ProfileService, private ngModal: NgbModal) { } + constructor(public userService: UserService, + public profileService: ProfileService, + private ngModal: NgbModal, + private route: ActivatedRoute) { } user: User; isAppCentralized; @@ -98,6 +102,11 @@ export class SelfComponent implements OnInit { ngOnInit() { + this.profileId = ""; + console.log("ngOnInit called ",this.profileId); + if(this.route.snapshot.queryParams['profile_id']){ + this.profileId = this.route.snapshot.queryParams['profile_id']; + } this.showSpinner = false; this.finalSelectedRoles = []; let result = this.userService.getFunctionalMenuStaticDetailSession(); @@ -106,7 +115,11 @@ export class SelfComponent implements OnInit { this.user = user; this.isAppCentralized = this.user.isAppCentralized; }); - this.getSelfProfileDetail(); + if (this.profileId != undefined && this.profileId != "") { + this.getProfileById(this.profileId); + } else { + this.getSelfProfileDetail(); + } } /** @@ -116,65 +129,77 @@ export class SelfComponent implements OnInit { this.showSpinner = true; this.response = this.profileService.getSelfProfile(); this.response.subscribe(data => { - let res; - res = data; - this.result = JSON.parse(res.data); - this.profile = JSON.parse(this.result.profile); - this.oriProfile = JSON.parse(this.result.profile); /*original value*/ + this.assignProfileDetails(data); + }); + this.showSpinner = false; + } - this.profileId = this.profile.id; - this.ociavailableRoles = JSON.parse(this.result.availableRoles); - this.ociTimeZones = JSON.parse(this.result.timeZones); - this.ociCountries = JSON.parse(this.result.countries); - this.stateList = JSON.parse(this.result.stateList); + /** + * Get Profile Details by ProfileId + */ + getProfileById(profileId) { + this.showSpinner = true; + this.profileService.getProfileById(profileId).subscribe(response => { + this.assignProfileDetails(response); + }) + this.showSpinner = false; + } - for( let state of this.stateList) - { - if(state.value == this.profile.state){ - this.profile.state= state.value; - } - } + assignProfileDetails(data) { + let res; + res = data; + this.result = JSON.parse(res.data); + + this.profile = JSON.parse(this.result.profile); + this.oriProfile = JSON.parse(this.result.profile); /*original value*/ - for( let country of this.ociCountries) - { - if(country.value == this.profile.country){ - this.profile.country= country.value; - } - } + this.profileId = this.profile.id; + this.ociavailableRoles = this.profile.roles; + console.log("Profile specific roles : ", this.ociavailableRoles); + this.ociTimeZones = JSON.parse(this.result.timeZones); + this.ociCountries = JSON.parse(this.result.countries); + this.stateList = JSON.parse(this.result.stateList); - for( let timeZone of this.ociTimeZones) - { - if(timeZone.value == this.profile.timeZoneId){ - this.profile.timeZoneId= timeZone.value; - } - } + for (let state of this.stateList) { + if (state.value == this.profile.state) { + this.profile.state = state.value; + } + } + + for (let country of this.ociCountries) { + if (country.value == this.profile.country) { + this.profile.country = country.value; + } + } + + for (let timeZone of this.ociTimeZones) { + if (timeZone.value == this.profile.timeZoneId) { + this.profile.timeZoneId = timeZone.value; + } + } - console.log("Data : ", this.ociavailableRoles); - this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null)); - this.settings = new DataTableSettings() - this.settings.columns = this.columns; - this.settings.isPaginationEnabled = false; - this.settings.isReadOnly = true; - this.settings.isTableSearchEnabled = false; - this.settings.isToggleEnabled = true; + this.columns.push(new Column("name", "Name", ColumnTypes.TEXT, false, null)); + this.settings = new DataTableSettings() + this.settings.columns = this.columns; + this.settings.isPaginationEnabled = false; + this.settings.isReadOnly = true; + this.settings.isTableSearchEnabled = false; + this.settings.isToggleEnabled = true; - if (this.ociavailableRoles != null) { - for (let role of this.ociavailableRoles) { - role.selected = false; - for (let profileRole of this.profile.roles) { - if (profileRole.id === role.id) { - role.selected = true; - } - if (role.id === 1) { - this.isUserSystemAdmin = true; - } + if (this.ociavailableRoles != null) { + for (let role of this.ociavailableRoles) { + role.selected = false; + for (let profileRole of this.profile.roles) { + if (profileRole.id === role.id) { + role.selected = true; + } + if (role.id === 1) { + this.isUserSystemAdmin = true; } - this.availableRoles.push(role); } + this.availableRoles.push(role); } - - }); - this.showSpinner = false; + } } /** diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts new file mode 100644 index 00000000..e82a7ebc --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/shared/interceptors/header-interceptor.spec.ts @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ============LICENSE_END============================================ + * + * + */ + +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { HeaderInterceptor } from './header-interceptor'; + +describe('HeaderInterceptor', () => { + let component: HeaderInterceptor; + let fixture: ComponentFixture<HeaderInterceptor>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + }) + .compileComponents(); + })); + + beforeEach(() => { + component=new HeaderInterceptor() + }); + + it('should create', () => { + expect(component).toBeTruthy(); + component.intercept; + }); +}); diff --git a/ecomp-sdk/epsdk-core/pom.xml b/ecomp-sdk/epsdk-core/pom.xml index bf6e1764..2f48a8d1 100644 --- a/ecomp-sdk/epsdk-core/pom.xml +++ b/ecomp-sdk/epsdk-core/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/HibernateConfiguration.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/HibernateConfiguration.java index 2e8875c0..da3dc60a 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/HibernateConfiguration.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/conf/HibernateConfiguration.java @@ -39,7 +39,6 @@ package org.onap.portalsdk.core.conf; import java.sql.Connection; import java.sql.ResultSet; -import java.sql.SQLException; import java.sql.Statement; import java.util.HashMap; import java.util.Map; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/controller/FusionBaseController.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/controller/FusionBaseController.java index 93fb63c2..85bf57a6 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/controller/FusionBaseController.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/controller/FusionBaseController.java @@ -58,7 +58,6 @@ import org.onap.portalsdk.core.util.SystemProperties; import org.onap.portalsdk.core.web.support.UserUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.ModelAttribute; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java index d2d35ef5..2488b1a8 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/service/RoleServiceImpl.java @@ -39,8 +39,6 @@ package org.onap.portalsdk.core.service; import java.sql.Connection; import java.sql.PreparedStatement; -import java.sql.SQLException; -import java.sql.Statement; import java.util.Iterator; import java.util.List; import java.util.Set; diff --git a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java index f69a6dda..f31fc651 100644 --- a/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java +++ b/ecomp-sdk/epsdk-core/src/main/java/org/onap/portalsdk/core/web/support/UserUtils.java @@ -49,7 +49,6 @@ import java.util.Set; import java.util.TreeSet; import java.util.UUID; -import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; diff --git a/ecomp-sdk/epsdk-domain/pom.xml b/ecomp-sdk/epsdk-domain/pom.xml index f1b554e3..c55c4517 100644 --- a/ecomp-sdk/epsdk-domain/pom.xml +++ b/ecomp-sdk/epsdk-domain/pom.xml @@ -5,12 +5,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-domain</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK Domain</name> diff --git a/ecomp-sdk/epsdk-fw/pom.xml b/ecomp-sdk/epsdk-fw/pom.xml index 1c29ceab..5ea16eaa 100644 --- a/ecomp-sdk/epsdk-fw/pom.xml +++ b/ecomp-sdk/epsdk-fw/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/restful/domain/EcompRole.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/restful/domain/EcompRole.java index 0f2b5238..4916c477 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/restful/domain/EcompRole.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/restful/domain/EcompRole.java @@ -39,9 +39,6 @@ package org.onap.portalsdk.core.restful.domain; import java.util.Set; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; - /** * This bean holds the information for a role in the role and user management * REST API. diff --git a/ecomp-sdk/epsdk-logger/pom.xml b/ecomp-sdk/epsdk-logger/pom.xml index 3f0f7df0..1007e8ad 100644 --- a/ecomp-sdk/epsdk-logger/pom.xml +++ b/ecomp-sdk/epsdk-logger/pom.xml @@ -4,12 +4,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-logger</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <name>ONAP Portal SDK Logger</name> diff --git a/ecomp-sdk/epsdk-music/pom.xml b/ecomp-sdk/epsdk-music/pom.xml index cfbc41c1..b952d65d 100644 --- a/ecomp-sdk/epsdk-music/pom.xml +++ b/ecomp-sdk/epsdk-music/pom.xml @@ -5,12 +5,12 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-music</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>jar</packaging> <name>ONAP Portal SDK Music</name> diff --git a/ecomp-sdk/epsdk-workflow/pom.xml b/ecomp-sdk/epsdk-workflow/pom.xml index 128057c2..49e3fc5b 100644 --- a/ecomp-sdk/epsdk-workflow/pom.xml +++ b/ecomp-sdk/epsdk-workflow/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> </parent> <!-- GroupId is inherited from parent --> diff --git a/ecomp-sdk/pom.xml b/ecomp-sdk/pom.xml index c02d6f4b..2c16ed1e 100644 --- a/ecomp-sdk/pom.xml +++ b/ecomp-sdk/pom.xml @@ -13,7 +13,7 @@ <!-- Portal SDK Maven parent project --> <groupId>org.onap.portal.sdk</groupId> <artifactId>epsdk-project</artifactId> - <version>3.0.0-SNAPSHOT</version> + <version>3.3.0-SNAPSHOT</version> <packaging>pom</packaging> <name>portal-sdk</name> <url>https://wiki.onap.org/display/DW/Portal</url> @@ -285,23 +285,6 @@ </executions> </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - <!-- defined in oparent <version>1.6.7</version> --> - <extensions>true</extensions> - <configuration> - <nexusUrl>${nexusproxy}</nexusUrl> - <stagingProfileId>176c31dfe190a</stagingProfileId> - <serverId>ecomp-staging</serverId> - </configuration> - </plugin> - - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-release-plugin</artifactId> - <version>2.5.3</version> - </plugin> </plugins> </build> diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts index 24cb2e6f..5fd507ff 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-cell-editor/rdp-select-editor/rdp-select-editor.component.ts @@ -60,7 +60,6 @@ export class RdpSelectEditorComponent implements OnInit { @Input() data: any[]; @Output() changedColumnValue = new EventEmitter<any>(); columnValue: any; - constructor() { } ngOnInit() { @@ -68,12 +67,20 @@ export class RdpSelectEditorComponent implements OnInit { let rowObj = JSON.parse(this.rowdata); let column = this.columntitle; this.columnValue = rowObj[column]; + for(let i=0; i<this.data.length; i++){ + if(this.data[i]['id'] == this.columnValue){ + this.columnValue = this.data[i].name; + break; + } + } } else { this.columnValue = null; } + console.log("Select title: ",this.columntitle+" Select Value: ",this.columnValue); } detectChange(changedValue) { + console.log("Changed value : ", changedValue); this.changedColumnValue.emit(changedValue); } diff --git a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts index 954d0941..983a2726 100644 --- a/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts +++ b/ecomp-sdk/portalsdk-tag-library/projects/portalsdk-tag-lib/src/lib/rdp/rdp-data-table/rdp-data-table.component.ts @@ -224,6 +224,15 @@ export class RdpDataTableComponent<T> implements OnChanges, AfterViewInit, OnIni deleteRow(data: any) { this.dataTableService.delete(this.applicationService, data); + this.applicationService.statusResponse.subscribe(response => { + console.log("Response : ",response); + if(response == 200){ + this.applicationService.get(); + this.applicationService.updatedData.subscribe(updatedResponse =>{ + this.setData(updatedResponse); + }) + } + }) } applyFilter(filterValue: string) { |