2 ================================================================================
4 ================================================================================
5 Copyright (C) 2017 AT&T Intellectual Property
6 ================================================================================
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 ================================================================================
20 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
21 <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
25 <%@ page import="java.util.List" %>
26 <%@ page import="java.util.ArrayList" %>
27 <%@ page import="java.util.HashMap" %>
28 <%@ page import="java.util.Iterator" %>
29 <%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
30 <%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
31 <%@ page import="java.util.Vector" %>
32 <%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
33 <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
34 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
35 <%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
36 <%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
37 <%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
38 <%@ page import="java.text.SimpleDateFormat"%>
40 ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
41 WizardSequence ws = rdef.getWizardSequence();
42 String curSubStep = ws.getCurrentSubStep();
43 String reportID = rdef.getReportID();
44 boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
45 //boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
46 String dependsOnHelp = "Custom SQL can be defined";
47 boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED_DATAMIN);
49 String classifiers = nvl(rdef.getClassifier());
50 System.out.println(classifiers);
51 List reportCols = rdef.getAllColumns();
53 String dateAttrColId = null;
54 DataColumnType dct = null;
56 HashMap<String, DataColumnType> unusedNumColsMap = new HashMap<String,DataColumnType>();
60 for(iter=reportCols.iterator(); iter.hasNext(); ) {
61 dct = (DataColumnType) iter.next();
63 if(nvl(dct.getDataMiningCol()).equals(AppConstants.DM_DATE_ATTR))
64 dateAttrColId = dct.getColId();
66 if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) {
68 if(nvl(dct.getDataMiningCol()).length()==0)
69 unusedNumColsMap.put(dct.getColId(), dct);
73 String[] fmt = { "Default", "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY" };
76 <table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
78 <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
82 <td class=rbg2 align="right" width="10%" height="30"><font class=rtabletext>Classifiers: </font></td>
83 <td class=rbg3 align="left"><font class=rtabletext>
84 <select name="classifiers">
85 <option value="" <%= classifiers.equals("")?" selected":"" %>>--- Choose Classifiers ---
86 <option value="<%= AppConstants.DM_SVM_CLASSIFIER%>" <%= classifiers.equals(AppConstants.DM_SVM_CLASSIFIER)?" selected":"" %>>SMOreg
87 <option value="<%= AppConstants.DM_GAUSSIAN_CLASSIFIER%>" <%= classifiers.equals(AppConstants.DM_GAUSSIAN_CLASSIFIER)?" selected":"" %>>Gaussian Process
93 <td class=rbg2 align="right" height="30"><font class=rtabletext>Date Attribute: </font></td>
94 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
95 <select name="timeAttribute">
96 <% for(iter=reportCols.iterator(); iter.hasNext(); ) {
97 dct = (DataColumnType) iter.next(); %>
98 <option value="<%= dct.getColId() %>"<%= nvl(dateAttrColId /*, firstColId*/).equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
100 </select></font></td>
104 <td class=rbg2 align="right" height="30"><font class=rtabletext>Date Format: </font></td>
105 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
106 <select name="timeFormat">
107 <% for(int i=0; i<fmt.length; i++) { %>
108 <option value="<%= fmt[i].equals("N/A")?"":fmt[i] %>"<%= (nvl(rdef.getForecastingTimeFormat()).equals(fmt[i].toUpperCase()))?" selected":"" %>><%= fmt[i] %>
116 <td class=rbg2 align="center" colspan="2" height="30"><font class=rtabletext>Forecasting Column:</font></td>
119 <% for(iter=reportCols.iterator(); iter.hasNext(); ) {
120 dct = (DataColumnType) iter.next();
121 if(!nvl(dct.getDataMiningCol()).equals(AppConstants.DM_DATE_ATTR) ) {
125 <td class=rbg3 align="right" width="50%"><font class=rtabletext>
127 <% if (! unusedNumColsMap.containsKey(dct.getColId()) ) { %>
128 <% if (!dct.getDataMiningCol().equals(AppConstants.DM_DATE_ATTR)) %>
129 <input name="forecastCol" type="checkbox" value="<%=dct.getColId() %>" checked></font></td><td class=rbg3 align="left"> <%=dct.getColName() %> </td>
130 <% } else if(isSQLBased||nvl(dct.getColType()).equals(AppConstants.CT_NUMBER)) { %>
131 <input name="forecastCol" type="checkbox" value="<%=dct.getColId() %>"></font></td> <td class=rbg3 align="left"> <%=dct.getColName() %> </td>
141 <td class=rbg2 height="30" align="right">
142 <font class=rtabletext>Forecasting Period: </font>
144 <td class=rbg3 align="left">
145 <select name="forecastingPeriod" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
146 <option value="-1" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
147 <option value="2"<%= (rdef.getForecastingPeriod()==2 )?" selected":"" %>>2
148 <option value="4"<%= (rdef.getForecastingPeriod()==4 )?" selected":"" %>>4
149 <option value="6"<%= (rdef.getForecastingPeriod()==6 )?" selected":"" %>>6
150 <option value="8"<%= (rdef.getForecastingPeriod()==8)?" selected":"" %>>8
151 <option value="10"<%= (rdef.getForecastingPeriod()==10)?" selected":"" %>>10
152 <option value="20"<%= (rdef.getForecastingPeriod()==20)?" selected":"" %>>20
153 <option value="25"<%= (rdef.getForecastingPeriod()==25)?" selected":"" %>>25
154 <option value="30"<%= (rdef.getForecastingPeriod()==30)?" selected":"" %>>30
161 <script language="JavaScript">
162 function dataValidate() {
168 private String nvl(String s) { return (s==null)?"":s; }
169 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
170 private boolean isNumber(String value) { // As per Raptor def, like
173 value = value.trim();
174 if(value.length()>2) return false;
175 for (int i = 0; i < value.length(); i++) {
176 char c = value.charAt(i);
177 if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ','
178 || c == '$' || c == '%'))