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="java.io.*" %>
21 <%@ page import="java.util.*" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
25 <%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
27 <% Exception ex = (Exception) request.getAttribute(AppConstants.RI_EXCEPTION);
28 DataSet ds = (DataSet) request.getAttribute(AppConstants.RI_DATA_SET); %>
32 <title>SQL Statement Test Run</title>
33 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
34 <script language="JavaScript">
36 function setOpenerConfirm() {
37 <% if(AppUtils.getRequestNvlValue(request, AppConstants.RI_CHK_FIELD_SQL).equals("Y")&&ex==null) { %>
38 window.opener.setVerifyFlag();
44 <body onLoad="setOpenerConfirm()">
45 <table class="mTAB" width="94%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
47 <td class=rbg1 width="100%" valign="Middle"<%= (ds==null)?"":(" colspan="+(ds.getColumnCount()+1)) %>>
48 <b class=rtableheader>SQL Execution <%= (ex==null)?"Result - Success":"Generated Exception" %></b>
55 <font class=rtabletext><%= nvl(ex.getMessage(), " ") %></font>
57 <!-------------------------------------------------------
58 EXCEPTION [<%= ex.getMessage() %>]
59 <% ex.printStackTrace(new PrintWriter(out)); %>
60 -------------------------------------------------------->
63 <% } else if(ds!=null) { %>
66 <% for(int c=0; c<ds.getColumnCount(); c++) { %>
67 <td align="center" valign="Middle"><b class=rtabletext><%= ds.getColumnName(c) %></b></td>
70 <% for(int r=0; r<Math.min(ds.getRowCount(), Globals.getDefaultPageSize()); r++) { %>
71 <tr<%= (r%2==0)?" class=rowalt1":" class=rowalt2" %>>
72 <td align="center" valign="Middle"><font class=rtabletext><%= (r+1) %></font></td>
73 <% for(int c=0; c<ds.getColumnCount(); c++) { %>
74 <td valign="Middle"><font class=rtabletext><%= nvl(ds.getString(r, c), " ") %></font></td>
78 if(ds.getRowCount()>Globals.getDefaultPageSize()) { %>
79 <tr<%= (Globals.getDefaultPageSize()%2==0)?" class=rowalt1":" class=rowalt2" %>>
80 <td align="center" valign="Middle"><font class=rtabletext><%= (Globals.getDefaultPageSize()+1) %></font></td>
81 <td align="left" valign="Middle" colspan="<%= ds.getColumnCount() %>"><font class=rtabletext>...</font></td>
83 <% } else if(ds.getRowCount()==0) { %>
85 <td align="center" valign="Middle" colspan="<%= ds.getColumnCount()+1 %>"><font class=rtabletext>No data found</font></td>
91 <td align="center"<%= (ds==null)?"":(" colspan="+(ds.getColumnCount()+1)) %>>
93 <input type="Submit" class=button value="Close" onClick="window.close();">
101 <%! private String nvl(String s) { return (s==null)?"":s; }
102 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>