awips2/edexOsgi/com.raytheon.edex.uengine/web/templates/VM_global_library.vm
Steve Harris cd4185ef5c 13.1.2-2 baseline
Former-commit-id: 51208e5515 [formerly c0c1d56f3a] [formerly 4ba416aeb3 [formerly 221d0aaf0e19a054387134e72a76a278159bf4d0]]
Former-commit-id: 4ba416aeb3
Former-commit-id: 941337c553
2013-01-06 14:32:24 -06:00

204 lines
No EOL
7.6 KiB
Text

#macro(standardSelect $scriptLibrary $maxRecords $scriptMetadata $ignoreDataTime)
import ${scriptLibrary}
#set($pluginName = $scriptMetadata.get("pluginName").constraintValue)
dataRequest = ${scriptLibrary}.${scriptLibrary}("${pluginName}")
dataRequest.setCount(${maxRecords})
#foreach (${key} in ${scriptMetadata.keySet()})
#if(${key})
#if(${key} != "pluginName" && (${key} != "dataTime" || !${ignoreDataTime}))
#set($constraint = $scriptMetadata.get($key))
#if(${constraint.constraintType} == "IN")
dataRequest.addList("${key}", "${constraint.constraintValue}")
#elseif(${constraint.constraintType} == "LIKE")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "like")
#elseif ($constraint.constraintType == "ISNULL")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "isnull")
#else
dataRequest.addParameter("${key}", "${constraint.constraintValue}")
#end
#end
#end
#end
return dataRequest.execute()
#end
#macro(standardSelectJs $scriptLibrary $maxRecords $scriptMetadata $ignoreDataTime)
include("${scriptLibrary}.js");
#set($pluginName = $scriptMetadata.get("pluginName").constraintValue)
var dataRequest = new ${scriptLibrary}("${pluginName}");
dataRequest.setCount(${maxRecords});
#foreach (${key} in ${scriptMetadata.keySet()})
#if(${key})
#if(${key} != "pluginName" && (${key} != "dataTime" || !${ignoreDataTime}))
#set($constraint = $scriptMetadata.get($key))
#if(${constraint.constraintType} == "IN")
dataRequest.addList("${key}", "${constraint.constraintValue}");
#elseif(${constraint.constraintType} == "LIKE")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "like");
#elseif ($constraint.constraintType == "ISNULL")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "isnull");
#else
dataRequest.addParameter("${key}", "${constraint.constraintValue}");
#end
#end
#end
#end
dataRequest.execute();
#end
#macro(standardImageSelect $scriptLibrary $maxRecords $scriptMetadata $ignoreDataTime)
#set($pluginName = $scriptMetadata.get("pluginName").constraintValue)
#set($colorMap = $scriptMetadata.remove("colormap").constraintValue)
#set($reproject = $scriptMetadata.remove("reproject").constraintValue)
#set($format = $scriptMetadata.remove("format").constraintValue)
import ${scriptLibrary}
#if($pluginName == "grid")
dataRequest = ${scriptLibrary}.${scriptLibrary}("${pluginName}")
#else
dataRequest = ${scriptLibrary}.${scriptLibrary}()
#end
dataRequest.requestImage(1)
dataRequest.setColormap("${colorMap}")
dataRequest.setCount(${maxRecords})
dataRequest.reprojectImage(${reproject})
#foreach (${key} in ${scriptMetadata.keySet()})
#if(${key})
#if(${key} != "pluginName" && (${key} != "dataTime" || !${ignoreDataTime}))
#set($constraint = $scriptMetadata.get($key))
#if(${constraint.constraintType} == "IN")
dataRequest.addList("${key}", "${constraint.constraintValue}")
#elseif(${constraint.constraintType} == "LIKE")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "like")
#elseif ($constraint.constraintType == "ISNULL")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "isnull");
#else
dataRequest.addParameter("${key}", "${constraint.constraintValue}")
#end
#end
#end
#end
#if(${pluginName} == "grid")
dataRequest.setScaleFactor(1)
#end
dataRequest.setFormat("${format}")
return dataRequest.execute()
#end
#macro(standardImageSelectJs $scriptLibrary $maxRecords $scriptMetadata $ignoreDataTime)
include("${scriptLibrary}.js");
#set($pluginName = $scriptMetadata.get("pluginName").constraintValue)
#set($colorMap = $scriptMetadata.remove("colormap").constraintValue)
#set($reproject = $scriptMetadata.remove("reproject").constraintValue)
#set($format = $scriptMetadata.remove("format").constraintValue)
var dataRequest = new ${scriptLibrary}();
dataRequest.requestImage(1);
dataRequest.setCount(${maxRecords});
dataRequest.setColormap("${colorMap}");
dataRequest.reprojectImage(${reproject});
#foreach (${key} in ${scriptMetadata.keySet()})
#if(${key})
#if(${key} != "pluginName" && (${key} != "dataTime" || !${ignoreDataTime}))
#set($constraint = $scriptMetadata.get($key))
#if(${constraint.constraintType} == "IN")
dataRequest.addList("${key}", "${constraint.constraintValue}");
#elseif(${constraint.constraintType} == "LIKE")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "like");
#elseif ($constraint.constraintType == "ISNULL")
dataRequest.addParameter("${key}", "${constraint.constraintValue}", "isnull");
#else
dataRequest.addParameter("${key}", "${constraint.constraintValue}");
#end
#end
#end
#end
#if(${pluginName} == "grid")
dataRequest.setScaleFactor(1);
#end
dataRequest.setFormat("${format}");
dataRequest.execute();
#end
#macro(standardCatalog $scriptLibrary $scriptMetadata)
query = CatalogQuery.CatalogQuery("$scriptMetadata.get("pluginName").constraintValue")
query.setDistinctField("$scriptMetadata.get("fieldName").constraintValue")
#foreach (${name} in ${scriptMetadata.keySet()})
#if(${name} != "pluginName")
#set($constraint = $scriptMetadata.get($name))
#if ($name == "pluginName")
#set($name = "plugin")
#end
#if($name != "fieldName")
#set($operand = "=")
#if ($constraint.constraintType == "NOT_EQUALS")
#set($operand = "!=")
#elseif ($constraint.constraintType == "GREATER_THAN")
#set($operand = ">")
#elseif ($constraint.constraintType == "GREATER_THAN_EQUALS")
#set($operand = ">=")
#elseif ($constraint.constraintType == "LESS_THAN")
#set($operand = "<")
#elseif ($constraint.constraintType == "LESS_THAN_EQUALS")
#set($operand = "<=")
#elseif ($constraint.constraintType == "BETWEEN")
#set($operand = "between")
#elseif ($constraint.constraintType == "IN")
#set($operand = "in")
#elseif ($constraint.constraintType == "LIKE")
#set($operand = "like")
#elseif ($constraint.constraintType == "ISNULL")
#set($operand = "isnull")
#end
query.addConstraint("${name}","${constraint.constraintValue}","${operand}")
#end
#end
#end
return query.execute()
#end
#macro(standardLatestTime $scriptMetadata)
import LatestTime
ltq = LatestTime.LatestTime('$scriptMetadata.get("uriList").constraintValue')
return ltq.execute()
#end
#macro(standardDbQuery $scriptMetadata)
import DbQuery
query = DbQuery.DbQuery("$scriptMetadata.remove("dbName").constraintValue","$scriptMetadata.remove("className").constraintValue")
#if ($scriptMetadata.containsKey("distinctField"))
query.setDistinctField("$scriptMetadata.remove("distinctField").constraintValue")
#end
#if ($scriptMetadata.containsKey("orderBy"))
query.setOrderByList("$scriptMetadata.remove("orderBy").constraintValue","$scriptMetadata.remove("sortOrder").constraintValue")
#end
query.setReturnedFieldList("$scriptMetadata.remove("columns").constraintValue")
#foreach (${name} in ${scriptMetadata.keySet()})
#set($constraint = $scriptMetadata.get($name))
#if($name != "pluginName")
#set($operand = "=")
#if ($constraint.constraintType == "NOT_EQUALS")
#set($operand = "!=")
#elseif ($constraint.constraintType == "GREATER_THAN")
#set($operand = ">")
#elseif ($constraint.constraintType == "GREATER_THAN_EQUALS")
#set($operand = ">=")
#elseif ($constraint.constraintType == "LESS_THAN")
#set($operand = "<")
#elseif ($constraint.constraintType == "LESS_THAN_EQUALS")
#set($operand = "<=")
#elseif ($constraint.constraintType == "BETWEEN")
#set($operand = "between")
#elseif ($constraint.constraintType == "IN")
#set($operand = "in")
#elseif ($constraint.constraintType == "LIKE")
#set($operand = "like")
#elseif ($constraint.constraintType == "ILIKE")
#set($operand = "ilike")
#elseif ($constraint.constraintType == "ISNULL")
#set($operand = "isnull")
#end
query.addConstraint("${name}","${constraint.constraintValue}","${operand}")
#end
#end
return query.execute()
#end