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.util.*" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
25 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
26 <%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
27 <%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
29 <% String tableName = AppUtils.getRequestValue(request, AppConstants.RI_TABLE_NAME);
30 String remoteDbPrefix = (String) session.getAttribute("remoteDB");
31 Vector tableSources = null;
32 Vector dbColumns = null;
34 tableSources = DataCache.getReportTableSources(remoteDbPrefix);
35 if(tableSources.size()>0)
36 tableName = ((TableSource) DataCache.getReportTableSources(remoteDbPrefix).get(0)).getTableName();
39 dbColumns = DataCache.getReportTableDbColumns(tableName.toUpperCase(),remoteDbPrefix);
42 boolean isSingleValueChoice = AppUtils.getRequestFlag(request, "single_value");
43 boolean includeTableNameInResult = AppUtils.getRequestFlag(request, "return_table_name");
44 boolean includeColTypeInResult = AppUtils.getRequestFlag(request, "return_col_type"); %>
48 <title>Table Columns</title>
49 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
50 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/ral.css">
52 <script language=JavaScript>
54 function setValue(newValue) {
55 window.opener.addText(newValue);
59 function clearValue() {
60 window.opener.clearText();
69 <% if(! isSingleValueChoice) { %>
70 <script language=JavaScript>
72 function getSelection() {
74 <% if(dbColumns!=null) { %>
75 for(var i=0; i<<%= dbColumns.size() %>; i++)
76 if(document.dataform.dataChk[i].checked)
77 selList += ((selList=="")?"":", ")+document.dataform.dataChk[i].value;
90 <form name="dataform" action="<%= AppUtils.getBaseURL() %>" method="post">
91 <input type="hidden" name="action" value="raptor">
92 <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.popup.table.cols">
93 <% if(isSingleValueChoice) { %>
94 <input type="hidden" name="single_value" value="Y">
96 <% if(includeTableNameInResult) { %>
97 <input type="hidden" name="return_table_name" value="Y">
99 <% if(includeColTypeInResult) { %>
100 <input type="hidden" name="return_col_type" value="Y">
103 <table class="mTAB" width=94% border=0 cellspacing=1 align=center>
105 <td align="center" valign="middle" height="30">
106 <% if(! isSingleValueChoice) { %>
107 <input type=image src='<%= AppUtils.getImgFolderURL() %>downloadicon.gif' alt='Store selection' width=12 height=12 border=0 onClick="return getSelection()">
110 <td colspan="2" valign="middle" nowrap>
111 <select name="<%= AppConstants.RI_TABLE_NAME %>" onChange="document.dataform.submit()">
112 <% for(Iterator iter=DataCache.getReportTableSources(remoteDbPrefix).iterator(); iter.hasNext(); ) {
113 String iTableName = ((TableSource) iter.next()).getTableName(); %>
114 <option value="<%= iTableName %>"<%= iTableName.equals(tableName)?" selected":"" %>><%= iTableName %>
118 <b class=rtableheader> DB Table Columns</b>
123 for(rNum=0; rNum<dbColumns.size(); rNum++) {
124 DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(rNum);
125 String sValue = (includeTableNameInResult?(tableName+"."):"")+dbCol.getColName()+(includeColTypeInResult?("|"+dbCol.getColType()):"");
126 String sDisplay = "["+tableName+"]."+dbCol.getColName(); %>
127 <tr<%= (rNum%2==0)?" class=rowalt1":" class=rowalt2" %>>
128 <td align="center" height="30"><font class=rtabletext><%= (rNum+1) %></font></td>
129 <% if(isSingleValueChoice) { %>
130 <td colspan="2"><font class=rtabletext><a href="javascript:setValue('<%= sValue %>')"><%= sDisplay %></a></font></td>
132 <td align="center" valign="middle">
133 <input type="checkbox" name="dataChk" value="<%= sValue %>">
135 <td><font class=rtabletext><%= sDisplay %></font></td>
142 <td align="center" height="30" colspan="3"><font class=rtabletext>No columns found for table [<%= tableName %>]</font></td>
147 <td colspan="3"><font class=rtabletext><a href="javascript:clearValue()"><%= "CLEAR VALUE" %></a></font></td>
153 <td align="center" valign="middle" height="30">
154 <% if(! isSingleValueChoice) { %>
155 <input type=image src='<%= AppUtils.getImgFolderURL() %>downloadicon.gif' alt='Store selection' width=12 height=12 border=0 onClick="return getSelection()">
158 <td colspan="2"> </td>
162 <input type="hidden" name="dataChk" value="">
163 <input type="hidden" name="dataChk" value="">
169 <%! private String nvl(String s) { return (s==null)?"":s; }
170 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>