<%-- ================================================================================ eCOMP Portal SDK ================================================================================ Copyright (C) 2017 AT&T Intellectual Property ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 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. ================================================================================ --%> <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %> <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %> <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %> <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %> <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Iterator" %> <%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %> <%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %> <%@ page import="java.util.Vector" %> <%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %> <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %> <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %> <%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %> <%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %> <%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %> <%@ page import="java.text.SimpleDateFormat"%> <% ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION); WizardSequence ws = rdef.getWizardSequence(); String curSubStep = ws.getCurrentSubStep(); String reportID = rdef.getReportID(); boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB); boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); String dependsOnHelp = "Custom SQL can be defined"; %> <% String[] dateFormats = { "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY" }; String[] charFormats = { "N/A" }; boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT); FormFieldType currField = null; if(isEdit) currField = rdef.getFormFieldById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); String currColId = (currField!=null)?nvl(currField.getColId()):""; String remoteDbPrefix = (String) session.getAttribute("remoteDB"); String colTableName = null; String colColumnName = null; String colDisplayFormat = null; String colDisplayName = null; if(isSQLBased) if(currColId.length()>0) { colTableName = ReportWrapper.getSQLBasedFFTColTableName(currColId); colColumnName = ReportWrapper.getSQLBasedFFTColColumnName(currColId); colDisplayFormat = ReportWrapper.getSQLBasedFFTColDisplayFormat(currColId); if(currColId.indexOf("|")>=0) currColId = currColId.substring(0, currColId.indexOf('|')); colDisplayName = colColumnName; //colDisplayName = currColId.substring(currColId.indexOf('.')+1); } %> <% if(isSQLBased) { String colType = AppConstants.CT_CHAR; if(colTableName!=null&&colColumnName!=null) try { colType = nvl(DataCache.getReportTableDbColumnType(colTableName, colColumnName,((String) session.getAttribute("remoteDB"))), AppConstants.CT_CHAR); } catch(Exception e) {} String[] fmt; if(colType.equals(AppConstants.CT_DATE)) fmt = dateFormats; else fmt = charFormats; %> <% } // if %> <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %> <% } %> <%if(! isSQLBased) { %> <% } else { %> <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %> <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %> <% } %> <% } // if admin user %> <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %> <% } %> <% } //else %> <%}else{%>style="display:none"<%}%>> <% if(Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) { %> <% } else { %> "> <% } %> <% List predefinedValues = (currField!=null&&currField.getPredefinedValueList()!=null)?currField.getPredefinedValueList().getPredefinedValue():null; %> <% if(predefinedValues!=null&&predefinedValues.size()>1) for(int i=1; i <% } // for %>
Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %>
Field Name: ">
Based On Column: <% if(isSQLBased) { %> Select database column <% } else { %> <% } // else if(isSQLBased) if(colDisplayName!=null) { %> <% } // if %>
Display Format:
Visible?
Is used in Group By Clause? >
Field Type: <% String curValue = nvl((currField!=null)?currField.getFieldType():"", FormField.FFT_TEXT_W_POPUP); %>
Visible Size:
Default Value: "> Select from list
Is Default Value should be SQL 0?" checked":"" %> onClick="toggleDiv(this.checked)">
Default Value:
">
Verify Field Value As: <% curValue = nvl((currField!=null)?currField.getValidationType():"", FormField.VT_NONE); %>
Valid Date Range: From To        Instructions 
"> ">
   
<% String stDate = ""; String endDate = ""; if (currField!= null && currField.getRangeStartDate() != null && currField.getRangeStartDate().equals("") == false && currField.getRangeEndDate() != null && currField.getRangeEndDate().equals("") == false){ SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy"); stDate = dtf.format(currField.getRangeStartDate().toGregorianCalendar().getTime()); endDate = dtf.format(currField.getRangeEndDate().toGregorianCalendar().getTime()); } %>
  <% curValue = nvl((currField!=null)?currField.getMandatory():"", "N"); %> > User must provide value for this field
Field Help Text:
SQL Generating Custom List of Values:
(overrides default list)
">     
 Instructions 
<% curValue = nvl((currField!=null)?currField.getDependsOn():"", "N"); %> >
Provide Predefined List of Values: <% if(predefinedValues==null||predefinedValues.size()==0) { %> Do not use Predefined list - Generate list from database <% } else { String value = (String) predefinedValues.get(0); %> <%= value %>       <% } %>
  <%= value %>      
  document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>';">

<%! private String nvl(String s) { return (s==null)?"":s; } private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } private boolean isNumber(String value) { // As per Raptor def, like // -$3,270.56 value = value.trim(); if(value.length()>2) return false; for (int i = 0; i < value.length(); i++) { char c = value.charAt(i); if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ',' || c == '$' || c == '%')) return false; } // for return true; } // isNumber %>