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.Iterator" %>
27 <%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
28 <%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
29 <%@ page import="java.util.Vector" %>
30 <%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
31 <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
32 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.ColFilterType" %>
34 ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
35 WizardSequence ws = rdef.getWizardSequence();
36 String curSubStep = ws.getCurrentSubStep();
37 String reportID = rdef.getReportID();
39 <table class="mTAB" width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
41 <td class=rbg1 colspan=8 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
44 <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader> No </b></td>
45 <td align="center" valign="Middle" width="10%"><b class=rtableheader> </b></td>
46 <td align="center" valign="Middle" width="5%"><b class=rtableheader> </b></td>
47 <td align="center" valign="Middle" width="33%"><b class=rtableheader>Column</b></td>
48 <td align="center" valign="Middle" width="26%"><b class=rtableheader>Filter</b></td>
49 <td align="center" valign="Middle" width="5%"><b class=rtableheader> </b></td>
50 <td align="center" valign="Middle" width="14%" colspan=2><input type="button" class=button value="Add" border="0" width="71" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit()"></td>
54 int nOpenBrackets = 0;
55 int nCloseBrackets = 0;
57 List reportFilters = rdef.getAllFilters();
58 for(Iterator iter=reportFilters.iterator(); iter.hasNext(); iCount++, iPos++) {
59 ColFilterType cft = (ColFilterType) iter.next();
61 nOpenBrackets += nvl(cft.getOpenBrackets()).length();
62 nCloseBrackets += nvl(cft.getCloseBrackets()).length();
64 if(! colId.equals(cft.getColId()))
66 colId = cft.getColId(); %>
67 <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
68 <td align="center" height="30"><font class=rtabletext><%= iCount+1 %></font></td>
69 <td align="center"><font class=rtabletext><%= iCount>0?cft.getJoinCondition():" " %></font></td>
70 <td align="center"><font class=rtabletext><%= nvl(cft.getOpenBrackets(), " ") %></font></td>
71 <td><font class=rtabletext><%= rdef.getColumnById(colId).getDisplayName() %></font></td>
72 <td><font class=rtabletext><%= HTMLEncode(rdef.getFilterLabel(cft)) %></font></td>
73 <td align="center"><font class=rtabletext><%= nvl(cft.getCloseBrackets(), " ") %></font></td>
74 <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_EDIT %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= colId+"|"+iPos %>';"></td>
75 <td align="center"><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! confirm('Are you sure you want to remove this filter?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= colId+"|"+iPos %>'; }"></td>
80 <td colspan=8 align="center" height="30"><font class=rtabletext>No filters defined</font></td>
86 <script language="JavaScript">
88 function dataValidate() {
89 <% if(nOpenBrackets!=nCloseBrackets) { %>
90 alert("The number of opening brackets (<%= nOpenBrackets %>) must be equal to the number of closing brackets (<%= nCloseBrackets %>).");
99 private String HTMLEncode(String value) {
100 StringBuffer sb = new StringBuffer(value);
102 for(int i=0; i<sb.length(); i++)
103 if(sb.charAt(i)=='<')
104 sb.replace(i, i+1, "<");
105 else if(sb.charAt(i)=='>')
106 sb.replace(i, i+1, ">");
107 else if(sb.charAt(i)=='"')
108 sb.replace(i, i+1, """);
110 return sb.toString();
112 private String nvl(String s) { return (s==null)?"":s; }
113 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }