Merge "Issue #1678 Added support for stored query publishing and invocation on the registry" into development
Former-commit-id:9111484d4f
[formerly60b567eeae
] [formerly6fd6fd0725
[formerly 003f889e8aa65c4f01287611518f92b7d8ef05dd]] Former-commit-id:6fd6fd0725
Former-commit-id:65628daf36
This commit is contained in:
commit
39a2c98779
11 changed files with 554 additions and 11 deletions
|
@ -41,6 +41,7 @@ import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResp
|
|||
* 10/8/2013 1682 bphillip Added rest functions for use with the query web interface
|
||||
* 10/23/2013 2385 bphillip restoreSubscriptions throws JAXBException
|
||||
* 10/30/2013 1538 bphillip Moved data delivery specific servics out of registry plugin
|
||||
* 11/7/2013 1678 bphillip Added get custom query method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -73,6 +74,15 @@ public interface IRegistryDataAccessService {
|
|||
@Path("getQueries")
|
||||
public String getValidQueries();
|
||||
|
||||
/**
|
||||
* Gets the list of non-canonical query types contained in the registry
|
||||
*
|
||||
* @return The non-canonical query definitions
|
||||
*/
|
||||
@GET
|
||||
@Path("getCustomQueries")
|
||||
public String getCustomQueries();
|
||||
|
||||
/**
|
||||
* Gets the valid parameters for a given query definition
|
||||
*
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.common.registry.constants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Registry canonical query types
|
||||
|
@ -31,6 +34,7 @@ package com.raytheon.uf.common.registry.constants;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* 4/9/2013 1802 bphillip Initial implementation
|
||||
* 9/18/2013 1705 bphillip Added GetReferencedObject canonical query
|
||||
* 11/7/2013 1678 bphillip Added list of all canonical query types
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -50,20 +54,14 @@ public class CanonicalQueryTypes {
|
|||
|
||||
public static final String GET_CLASSIFICATION_SCHEMES_BY_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetClassificationSchemesById";
|
||||
|
||||
public static final String EXPORT_OBJECT = "urn:oasis:names:tc:ebxml-regrep:query:ExportObject";
|
||||
|
||||
public static final String GET_CHILDREN_BY_PARENT_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetChildrenByParentId";
|
||||
|
||||
public static final String GET_REGISTRY_PACKAGES_BY_MEMBER_ID = "urn:oasis:names:tc:ebxml-regrep:query:GetRegistryPackagesByMemberId";
|
||||
|
||||
public static final String FIND_ALL_MY_OBJECTS = "urn:oasis:names:tc:ebxml-regrep:query:FindAllMyObjects";
|
||||
|
||||
public static final String GARBAGE_COLLECTOR = "urn:oasis:names:tc:ebxml-regrep:query:GarbageCollector";
|
||||
|
||||
public static final String BASIC_QUERY = "urn:oasis:names:tc:ebxml-regrep:query:BasicQuery";
|
||||
|
||||
public static final String EXTRINSIC_OBJECT_QUERY = "urn:oasis:names:tc:ebxml-regrep:query:ExtrinsicObjectQuery";
|
||||
|
||||
public static final String FIND_ASSOCIATIONS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociations";
|
||||
|
||||
public static final String FIND_ASSOCIATED_OBJECTS = "urn:oasis:names:tc:ebxml-regrep:query:FindAssociatedObjects";
|
||||
|
@ -80,4 +78,15 @@ public class CanonicalQueryTypes {
|
|||
|
||||
public static final String GET_REFERENCED_OBJECT = "urn:oasis:names:tc:ebxml-regrep:query:GetReferencedObject";
|
||||
|
||||
public static final List<String> CANONICAL_QUERY_TYPES = Arrays
|
||||
.asList(new String[] { GET_OBJECT_BY_ID, GET_OBJECTS_BY_LID,
|
||||
GET_AUDIT_TRAIL_BY_LID, GET_AUDIT_TRAIL_BY_TIME_INTERVAL,
|
||||
GET_AUDIT_TRAIL_BY_ID, GET_CLASSIFICATION_SCHEMES_BY_ID,
|
||||
GET_CHILDREN_BY_PARENT_ID,
|
||||
GET_REGISTRY_PACKAGES_BY_MEMBER_ID, GARBAGE_COLLECTOR,
|
||||
BASIC_QUERY, FIND_ASSOCIATIONS, FIND_ASSOCIATED_OBJECTS,
|
||||
ADHOC_QUERY, KEYWORD_SEARCH, REGISTRY_PACKAGE_SELECTOR,
|
||||
CLASSIFICATION_SCHEME_SELECTOR, GET_NOTIFICATION,
|
||||
GET_REFERENCED_OBJECT });
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
<property name="dataDeliveryRestClient" ref="dataDeliveryRestClient"/>
|
||||
<property name="registrySoapServices" ref="registryWebServiceClient"/>
|
||||
</bean>
|
||||
|
||||
<bean id="defineRegistryQuery" class="com.raytheon.uf.edex.datadelivery.registry.web.RegistryQueryDefinitionService">
|
||||
<property name="registryObjectDao" ref="registryObjectDao"/>
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- REST Service Definitions -->
|
||||
|
@ -42,6 +46,7 @@
|
|||
<ref bean="registryDataAccessService" />
|
||||
<ref bean="registryAvailabilityService" />
|
||||
<ref bean="registryStatus"/>
|
||||
<ref bean="defineRegistryQuery"/>
|
||||
</jaxrs:serviceBeans>
|
||||
</jaxrs:server>
|
||||
</beans>
|
|
@ -50,6 +50,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.web.IRegistryDataAccessService;
|
||||
import com.raytheon.uf.common.registry.RegistryException;
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.registry.services.rest.response.RestCollectionResponse;
|
||||
import com.raytheon.uf.common.serialization.JAXBManager;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
|
@ -60,6 +61,7 @@ import com.raytheon.uf.edex.core.EDEXUtil;
|
|||
import com.raytheon.uf.edex.core.EdexException;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.QueryDefinitionDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.RegistryQueryUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -75,6 +77,7 @@ import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
|||
* 9/20/2013 2385 bphillip Added subscription backup functions
|
||||
* 10/2/2013 2385 bphillip Fixed subscription backup queries
|
||||
* 10/8/2013 1682 bphillip Added query queries
|
||||
* 11/7/2013 1678 bphillip Added getCustomQueries method
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -147,6 +150,15 @@ public class RegistryDataAccessService implements IRegistryDataAccessService {
|
|||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@GET
|
||||
@Path("getCustomQueries")
|
||||
public String getCustomQueries() {
|
||||
List<String> ids = queryDefinitionDao.getQueryIds();
|
||||
ids.removeAll(CanonicalQueryTypes.CANONICAL_QUERY_TYPES);
|
||||
return RegistryQueryUtil.formatArrayString(ids.toArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
@GET
|
||||
@Path("getParametersForQuery/{queryId}")
|
||||
|
|
|
@ -0,0 +1,201 @@
|
|||
/**
|
||||
* 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.
|
||||
**/
|
||||
package com.raytheon.uf.edex.datadelivery.registry.web;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.InternationalStringType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.ParameterType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.QueryDefinitionType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.RegistryObjectType;
|
||||
import oasis.names.tc.ebxml.regrep.xsd.rim.v4.StringQueryExpressionType;
|
||||
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.raytheon.uf.common.registry.constants.CanonicalQueryTypes;
|
||||
import com.raytheon.uf.common.registry.constants.RegistryObjectTypes;
|
||||
import com.raytheon.uf.common.registry.constants.StatusTypes;
|
||||
import com.raytheon.uf.edex.registry.ebxml.dao.RegistryObjectDao;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.RegistryQueryUtil;
|
||||
import com.raytheon.uf.edex.registry.ebxml.services.query.RegistryQueryUtil.PARAMETER_DATA_TYPE;
|
||||
|
||||
/**
|
||||
*
|
||||
* REST Services used to manage registry query definitions
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 11/7/2013 1678 bphillip Initial Creation
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
* @version 1
|
||||
**/
|
||||
@Path(RegistryQueryDefinitionService.REGISTRY_DEFINE_QUERY_PATH)
|
||||
@Transactional
|
||||
public class RegistryQueryDefinitionService {
|
||||
|
||||
/** The path to this set of services */
|
||||
protected static final String REGISTRY_DEFINE_QUERY_PATH = "/defineQuery/";
|
||||
|
||||
/** Data access object for registry objects */
|
||||
private RegistryObjectDao registryObjectDao;
|
||||
|
||||
/**
|
||||
* Gets the valid data types for query parameters
|
||||
*
|
||||
* @return The valid parameter data types
|
||||
*/
|
||||
@GET
|
||||
@Path("getParameterDataTypes")
|
||||
public String getParameterDataTypes() {
|
||||
return RegistryQueryUtil
|
||||
.formatArrayString(PARAMETER_DATA_TYPE.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the valid query languages
|
||||
*
|
||||
* @return The valid query languages
|
||||
*/
|
||||
@GET
|
||||
@Path("getQueryLanguages")
|
||||
public String getQueryLanguages() {
|
||||
return RegistryQueryUtil
|
||||
.formatArrayString(registryObjectDao
|
||||
.executeHQLQuery(
|
||||
"SELECT obj.code FROM ClassificationNodeType obj where id like 'urn:oasis:names:tc:ebxml-regrep:QueryLanguage:%'")
|
||||
.toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores the query definition to the registry
|
||||
*
|
||||
* @param params
|
||||
* The query definition tokens
|
||||
* @return The status message
|
||||
*/
|
||||
@GET
|
||||
@Path("storeQuery/{params}")
|
||||
public String storeQuery(@PathParam("params") String params) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
QueryDefinitionType queryDef = new QueryDefinitionType();
|
||||
String[] tokens = params.split(",", -1);
|
||||
if (tokens.length < 4) {
|
||||
throw new IllegalArgumentException(
|
||||
"Argument to storeQuery must contain at least 4 comma delimited tokens!");
|
||||
}
|
||||
for (int i = 0; i < tokens.length; i++) {
|
||||
tokens[i] = tokens[i].trim();
|
||||
}
|
||||
String queryName = tokens[0];
|
||||
String queryDescription = tokens[1];
|
||||
String queryLangCode = tokens[2];
|
||||
String queryExpression = tokens[3];
|
||||
queryDef.setId(queryName);
|
||||
queryDef.setLid(queryName);
|
||||
queryDef.setName(new InternationalStringType(queryName));
|
||||
queryDef.setDescription(new InternationalStringType(queryDescription));
|
||||
queryDef.setObjectType(RegistryObjectTypes.QUERY_DEFINITION);
|
||||
queryDef.setStatus(StatusTypes.APPROVED);
|
||||
if (!queryExpression.isEmpty()) {
|
||||
StringQueryExpressionType expr = new StringQueryExpressionType();
|
||||
String queryLanguage = (String) registryObjectDao
|
||||
.executeHQLQuery(
|
||||
"SELECT id FROM ClassificationNodeType obj where obj.code=:code",
|
||||
"code", queryLangCode).get(0);
|
||||
expr.setQueryLanguage(queryLanguage);
|
||||
expr.setValue(queryExpression);
|
||||
queryDef.setQueryExpression(expr);
|
||||
}
|
||||
for (int i = 4; i < tokens.length && !tokens[4].isEmpty(); i += 6) {
|
||||
if ((i + 5) >= tokens.length) {
|
||||
throw new IllegalArgumentException(
|
||||
"Incomplete parameter submitted to storeQuery!");
|
||||
}
|
||||
ParameterType param = new ParameterType();
|
||||
param.setParameterName(tokens[i]);
|
||||
param.setName(new InternationalStringType(tokens[i]));
|
||||
if (!tokens[i + 1].isEmpty()) {
|
||||
param.setDescription(new InternationalStringType(tokens[i + 1]));
|
||||
}
|
||||
if (!tokens[i + 2].isEmpty()) {
|
||||
param.setDataType(tokens[i + 2]);
|
||||
}
|
||||
if (!tokens[i + 3].isEmpty()) {
|
||||
param.setDefaultValue(tokens[i + 3]);
|
||||
}
|
||||
if (!tokens[i + 4].isEmpty()) {
|
||||
param.setMinOccurs(new BigInteger(tokens[i + 4]));
|
||||
}
|
||||
if (!tokens[i + 5].isEmpty()) {
|
||||
param.setMaxOccurs(new BigInteger(tokens[i + 5]));
|
||||
}
|
||||
queryDef.getParameter().add(param);
|
||||
}
|
||||
registryObjectDao.createOrUpdate(queryDef);
|
||||
|
||||
response.append("Successfully created Query Definition: ").append(
|
||||
queryDef.getId());
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes the selected query from the registry
|
||||
*
|
||||
* @param queryId
|
||||
* The ID of the query to delete from the registry
|
||||
* @return Status message whether the query was deleted
|
||||
*/
|
||||
@GET
|
||||
@Path("deleteQuery/{queryId}")
|
||||
public String deleteQuery(@PathParam("queryId") String queryId) {
|
||||
|
||||
if (queryId == null || queryId.isEmpty()) {
|
||||
return "A query id must be specified";
|
||||
}
|
||||
|
||||
// Check to make sure we're not trying to delete a canonical query
|
||||
if (CanonicalQueryTypes.CANONICAL_QUERY_TYPES.contains(queryId)) {
|
||||
return "Cannot delete canonical query!";
|
||||
}
|
||||
RegistryObjectType queryObj = registryObjectDao.getById(queryId);
|
||||
if (queryObj == null) {
|
||||
return "Query Definition [" + queryId
|
||||
+ "] not present in registry!";
|
||||
}
|
||||
|
||||
registryObjectDao.delete(queryObj);
|
||||
return "Successfully deleted query: " + queryId;
|
||||
}
|
||||
|
||||
public void setRegistryObjectDao(RegistryObjectDao registryObjectDao) {
|
||||
this.registryObjectDao = registryObjectDao;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,4 +14,4 @@ ebxml-email.enabled=false
|
|||
ebxml-notification-batch-size=50
|
||||
# Configuration of thread pool used to handle web service requests
|
||||
ebxml-webserver-min-threads=2
|
||||
ebxml-webserver-max-threads=10
|
||||
ebxml-webserver-max-threads=5
|
|
@ -21,7 +21,9 @@ package com.raytheon.uf.edex.registry.ebxml.services.query;
|
|||
|
||||
import java.math.BigInteger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.xml.datatype.DatatypeConfigurationException;
|
||||
|
@ -51,6 +53,7 @@ import com.raytheon.uf.edex.registry.ebxml.util.EbxmlExceptionUtil;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 10/8/2013 1682 bphillip Initial implementation
|
||||
* 11/7/2013 1678 bphillip Added formatArrayString
|
||||
* </pre>
|
||||
*
|
||||
* @author bphillip
|
||||
|
@ -70,6 +73,12 @@ public class RegistryQueryUtil {
|
|||
private static final Pattern REPLACE_LIKE_CHARS_PATTERN = Pattern
|
||||
.compile("\\?");
|
||||
|
||||
/**
|
||||
* Pattern used to format the string representation of arrays
|
||||
*/
|
||||
private static final Pattern ARRAY_STRING_PATTERN = Pattern
|
||||
.compile("(\\[)(.*)(\\])");
|
||||
|
||||
/**
|
||||
* Replaces the registry character wilcard (?) with the database wildcard
|
||||
* (_)
|
||||
|
@ -224,4 +233,20 @@ public class RegistryQueryUtil {
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the string representation of an array as a comma separated list
|
||||
*
|
||||
* @param arrayString
|
||||
* The array string to format
|
||||
* @return The formatted string
|
||||
*/
|
||||
public static String formatArrayString(Object[] arr) {
|
||||
String arrayString = Arrays.toString(arr);
|
||||
Matcher matcher = ARRAY_STRING_PATTERN.matcher(arrayString);
|
||||
if (matcher.find()) {
|
||||
return matcher.group(2);
|
||||
}
|
||||
return arrayString;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,37 @@
|
|||
<!--
|
||||
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.
|
||||
-->
|
||||
|
||||
<!--
|
||||
|
||||
Navigation pane containing links
|
||||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
------------ ---------- ----------- --------------------------
|
||||
10/15/2013 1682 bphillip Initial implementation
|
||||
</pre>
|
||||
|
||||
@author bphillip
|
||||
@version 1
|
||||
-->
|
||||
<html>
|
||||
|
||||
<head>
|
||||
|
@ -68,7 +102,7 @@
|
|||
<br>
|
||||
|
||||
<b>My Registry is Subscribed To:</b>
|
||||
<span id="subscribedToRegistriesSpan"></span>
|
||||
<span id="subscribedToRegistriesSpan">Retrieving Registry List...</span>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
|
@ -76,7 +110,7 @@
|
|||
|
||||
|
||||
<b>Registries Subscribing to My Registry:</b>
|
||||
<span id="subscribedToRegistries"></span>
|
||||
<span id="subscribedToRegistries">Retrieving Registry List...</span>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
@ -87,7 +121,7 @@
|
|||
<br>
|
||||
|
||||
<b>Object Types Currently Replicated:</b>
|
||||
<span id="replicatedObjectListSpan"></span>
|
||||
<span id="replicatedObjectListSpan">Retrieving Object List...</span>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -56,6 +56,8 @@ Date Ticket# Engineer Description
|
|||
<body>
|
||||
<a href="/registry/services/query/Query.html" target="actionFrame">Query Interface</a>
|
||||
<br>
|
||||
<a href="/registry/services/query/DefineQuery.html" target="actionFrame">Define Query</a>
|
||||
<br>
|
||||
<a href="/RegistrySubscriptionBackup.html" target="actionFrame">Subscription Backup</a>
|
||||
<br>
|
||||
<a href="/registry/federation/status.html" target="actionFrame">Federation Status</a>
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
|
||||
/*
|
||||
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.
|
||||
|
||||
Navigation pane containing links
|
||||
|
||||
SOFTWARE HISTORY
|
||||
|
||||
Date Ticket# Engineer Description
|
||||
------------ ---------- ----------- --------------------------
|
||||
10/15/2013 1682 bphillip Initial implementation
|
||||
</pre>
|
||||
|
||||
@author bphillip
|
||||
@version 1
|
||||
*/
|
||||
|
||||
function callRestService(url,arg){
|
||||
var url = "http://"+window.location.host+"/"+url
|
||||
|
|
|
@ -0,0 +1,215 @@
|
|||
<!--
|
||||
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
|
||||
</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='/dataDeliveryUtil.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("dataDelivery/defineQuery/getQueryLanguages","").split(",");
|
||||
for(var i = 0; i < queryLanguages.length;i++){
|
||||
addOptionToList("queryLanguageSelect",queryLanguages[i],queryLanguages[i])
|
||||
}
|
||||
|
||||
var parameterTypes = callRestService("dataDelivery/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("dataDelivery/defineQuery/storeQuery",paramStr)
|
||||
alert(response)
|
||||
location.reload()
|
||||
}
|
||||
|
||||
function deleteQuery(){
|
||||
alert(callRestService("dataDelivery/defineQuery/deleteQuery",document.getElementById("removeQuerySelect").value))
|
||||
location.reload()
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
Loading…
Add table
Reference in a new issue