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" %>
28 ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
29 WizardSequence ws = rdef.getWizardSequence();
30 boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
31 boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
33 <table class=mTAB width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
35 <td class=rbg1 colspan=<%= isSQLBased?"5":"7" %> valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %></b></td>
38 <td align="center" valign="Middle" width="7%" height="30"><b class=rtableheader> No </b></td>
39 <td align="center" valign="Middle" width="58%"><b class=rtableheader>Column</b></td>
40 <% if(isSQLBased) { %>
41 <td align="center" valign="Middle" width="7%"><b class=rtableheader>ID</b></td>
42 <% if(isCrossTab) { %>
43 <td align="center" valign="Middle" width="14%"><b class=rtableheader>Cross-Tab Usage</b></td>
45 <td align="center" valign="Middle" width="7%"<%= isCrossTab?"":" colspan=2" %>><b class=rtableheader>Edit</b></td>
47 <% if(isCrossTab) { %>
48 <td align="center" valign="Middle" width="14%" colspan=2><b class=rtableheader>Cross-Tab Usage</b></td>
50 <td align="center" valign="Middle" width="7%"><b class=rtableheader>Group By</b></td>
51 <td align="center" valign="Middle" width="7%"><b class=rtableheader>Visible</b></td>
53 <td align="center" valign="Middle" width="7%"><b class=rtableheader>Re-order</b></td>
54 <td align="center" valign="Middle" width="14%" colspan=2 nowrap>
55 <% if(isCrossTab) { %>
56 <input type="button" class=button value="Add" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit();">
58 <table border="0" cellspacing="0" cellpadding="0"><tr>
59 <td height="28"><input type="button" class=button value="Add One" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD %>';document.forma.submit()"></td>
61 <td height="28"><input type="button" class=button value="Add Multiple" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_MULTI %>';document.forma.submit()"></td>
63 <td height="28"><input type="button" class=button value="Re-order All" border="0" width="104" height="28" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ORDER_ALL %>';document.forma.submit()"></td>
70 boolean visibleColExist = false;
71 boolean rowColExist = false;
72 boolean colColExist = false;
73 boolean valColExist = false;
74 List reportCols = rdef.getAllColumns();
75 for(Iterator iter=reportCols.iterator(); iter.hasNext(); iCount++) {
76 DataColumnType dct = (DataColumnType) iter.next();
78 visibleColExist = true;
79 if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_ROW))
81 if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_COLUMN))
83 if(nvl(dct.getCrossTabValue()).equals(AppConstants.CV_VALUE))
84 valColExist = true; %>
85 <tr class=<%=(iCount % 2 == 0)?"rowalt1":"rowalt2"%>>
86 <td align="center" height="30"><font class=rtabletext><%= iCount+1 %><!--dct.getOrderSeq(): <%= dct.getOrderSeq() %>--></font></td>
87 <td><font class=rtabletext><%= dct.getDisplayName() %></font></td>
88 <% if(isSQLBased) { %>
89 <td align="center"><font class=rtabletext><%= dct.getColId() %></font></td>
90 <% if(isCrossTab) { %>
91 <td align="center"><font class=rtabletext><%= nvl(rdef.getCrossTabDisplayValue(dct), " ") %></font></td>
93 <td align="center"<%= isCrossTab?"":" colspan=2" %>><input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>pen_paper.gif" alt="Edit" width="12" height="12" onClick="document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_MODIFY %>'; document.getElementById('<%= AppConstants.RI_DETAIL_ID %>').value='<%= dct.getColId() %>'; document.forma.submit();"></td>
95 <% if(isCrossTab) { %>
96 <td align="center" colspan=2><font class=rtabletext><%= nvl(rdef.getCrossTabDisplayValue(dct), " ") %></font></td>
98 <td align="center"><font class=rtabletext><%= dct.isGroupBreak()?"Yes":" " %></font></td>
99 <td align="center"><font class=rtabletext><%= dct.isVisible()?"Yes":"No" %></font></td>
101 <td align="center" nowrap>
102 <% if(iCount==0) { %>
103 <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankdown.gif" width="25" height="7">
105 <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columnup.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_UP %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
107 <% if(iCount==reportCols.size()-1) { %>
108 <img border="0" src="<%= AppUtils.getImgFolderURL() %>columnblankup.gif" width="25" height="7">
110 <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>columndown.gif" width="25" height="7" onClick="document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_MOVE_DOWN %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>';">
113 <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='<%= dct.getColId() %>'; document.forma.submit();"></td>
114 <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 column <%= dct.getDisplayName() %>?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE %>'; document.forma.<%= AppConstants.RI_DETAIL_ID %>.value='<%= dct.getColId() %>'; document.forma.submit();}"></td>
118 <% if(iCount==0) { %>
120 <td colspan=<%= isSQLBased?"5":"7" %> align="center" height="30"><font class=rtabletext>No columns defined</font></td>
126 <script language="JavaScript">
128 function dataValidate() {
130 if(! rowColExist) { %>
131 alert("You must have at least one column used for cross-tab row headings in the report.\nPlease add a column.");
133 <% } else if(! colColExist) { %>
134 alert("You must have at least one column used for cross-tab column headings in the report.\nPlease add a column.");
136 <% } else if(! valColExist) { %>
137 alert("You must have at least one column used for cross-tab report values in the report.\nPlease add a column.");
143 if(visibleColExist) { %>
146 alert("You must have at least one visible column in the report.\nPlease add a column.");
155 private String nvl(String s) { return (s==null)?"":s; }
156 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }