awips2/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/registry/services/query/DefineQuery.html
2022-05-05 12:34:50 -05:00

216 lines
No EOL
7.1 KiB
HTML

<!--
This software was developed and / or modified by Raytheon Company,
pursuant to Contract DG133W-05-CQ-1067 with the US Government.
U.S. EXPORT CONTROLLED TECHNICAL DATA
This software product contains export-restricted data whose
export/transfer/disclosure is restricted by U.S. law. Dissemination
to non-U.S. persons whether in the United States or abroad requires
an export license or other authorization.
Contractor Name: Raytheon Company
Contractor Address: 6825 Pine Street, Suite 340
Mail Stop B8
Omaha, NE 68106
402.291.0100
See the AWIPS II Master Rights File ("Master Rights File.pdf") for
further licensing information.
-->
<!--
SOFTWARE HISTORY
Date Ticket# Engineer Description
------------ ---------- ----------- --------------------------
11/7/2013 1678 bphillip Initial implementation
5/11/2015 4448 bphillip Separated EBXML Registry from Data Delivery
</pre>
@author bphillip
@version 1
-->
<html>
<head>
<style type="text/css">
a {font-weight:bold;}
td {width:175px;}
button {width:130px;}
input{width:200px;}
select {width:200px;}
body { font-family: Helvetica;
margin-left: 75px;
margin-right: 75px;
background: #D3D3D3;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript" src='/registry/registryUtil.js'> </script>
<script type="text/javascript" src='/htmlUtil.js'></script>
<title>Registry Query Definition Manager</title>
</head>
<body onload='populate()'>
<h3>Remove Custom Query Definition</h3>
<table>
<tr>
<td>Query Name</td>
<td><select id="removeQuerySelect"></select></td>
</tr>
</table>
<br>
<button id="removeQueryButton" onclick='deleteQuery()'>Delete Query</button>
<br><br>
<hr/>
<h3>Define New Query Definition</h3>
<b>Query Definition</b>
<br>
<table>
<tr>
<td>Query Name</td>
<td><input id="queryNameInput" type="text"></input></td>
</tr>
<tr>
<td>Query Description</td>
<td><input id="queryDescriptionInput" type="text"></input></td>
</tr>
<tr>
<td>Query Language</td>
<td><select id="queryLanguageSelect"></select></td>
</tr>
<tr>
<td>Query Expression</td>
<td><textarea id="queryExpressionText" rows="2" cols="100"> </textarea></td>
</tr>
</table>
<p>
<b>Query Parameter Definition</b>
<table>
<tr>
<td>Name</td>
<td><input id="parameterNameInput" type="text"></input></td>
<tr>
<tr>
<td>Description</td>
<td><input id="parameterDescriptionInput" type="text"></input></td>
<tr>
<tr>
<td>Data Type</td>
<td><select id="dataTypeSelect"></select></td>
<tr>
<tr>
<td>Default Value</td>
<td><input id="parameterDefaultValueInput" type="text"></input></td>
<tr>
<tr>
<td>Min Occurrences</td>
<td><input id="parameterMinOccurInput" type="text" style="width:30px"></input></td>
<tr>
<tr>
<td>Max Occurrences</td>
<td><input id="parameterMaxOccurInput" type="text" style="width:30px"></input></td>
<tr>
<tr>
<td><button type="button" style='width:130px' onclick='addParameter()'>Add Parameter</button></td>
</td>
</tr>
</table>
<p>
<b>Defined Parameters</b>
<br>
<span id="definedParametersSpan">None</span>
<p>
<button type="button" value="Submit" onclick='submitNewQuery()'>Submit New Query</button>
</body>
<script language="JavaScript">
var nameArray=Array()
function populate(){
var tokens = callDataAccessService("getCustomQueries").split(",")
var selectBox = document.getElementById("queryTypeInput")
for(var i=0;i<tokens.length;i++){
addOptionToList("removeQuerySelect",tokens[i],tokens[i])
}
var queryLanguages = callRestService("rest/defineQuery/getQueryLanguages","").split(",");
for(var i = 0; i < queryLanguages.length;i++){
addOptionToList("queryLanguageSelect",queryLanguages[i],queryLanguages[i])
}
var parameterTypes = callRestService("rest/defineQuery/getParameterDataTypes","").split(",");
for(var i = 0; i < parameterTypes.length;i++){
addOptionToList("dataTypeSelect",parameterTypes[i],parameterTypes[i])
}
}
function addParameter(){
//Check to make sure a parameter name was specified
if(document.getElementById("parameterNameInput").value.trim().length==0){
alert("A parameter name must be specified!")
return
}
nameArray[nameArray.length]=[document.getElementById("parameterNameInput").value,
document.getElementById("parameterDescriptionInput").value,
document.getElementById("dataTypeSelect").value,
document.getElementById("parameterDefaultValueInput").value,
document.getElementById("parameterMinOccurInput").value,
document.getElementById("parameterMaxOccurInput").value,
]
definedParameterSpan = document.getElementById("definedParametersSpan")
var value = "<table border='1'><tr><th>Name</th><th>Description</th><th>Type</th><th>Default Value</th><th>Min Occur</th><th>Max Occur</th></tr>"
for(var i = 0; i < nameArray.length;i++){
value+="<tr>"
for(var j = 0; j < nameArray[i].length;j++){
value+="<td>"+nameArray[i][j]+"</td>"
}
value+="</tr>"
}
value+="</table>"
definedParameterSpan.innerHTML=value
clearParameterValues()
}
function clearParameterValues(){
document.getElementById("parameterNameInput").value=""
document.getElementById("parameterDescriptionInput").value=""
document.getElementById("parameterDefaultValueInput").value=""
document.getElementById("parameterMinOccurInput").value=""
document.getElementById("parameterMaxOccurInput").value=""
}
function submitNewQuery(){
var queryName= document.getElementById("queryNameInput").value
var queryDescription= document.getElementById("queryDescriptionInput").value
if(queryName.length==0){
alert("A query name must be specified.")
return
}
var queryLanguage = document.getElementById("queryLanguageSelect").value
var queryExpression = document.getElementById("queryExpressionText").value
var paramStr=queryName+","+queryDescription+","+queryLanguage+","+queryExpression+","+nameArray.toString()
var response = callRestService("rest/defineQuery/storeQuery",paramStr)
alert(response)
location.reload()
}
function deleteQuery(){
alert(callRestService("rest/defineQuery/deleteQuery",document.getElementById("removeQuerySelect").value))
location.reload()
}
</script>
</html>