changed xquery template to allow default condition as empty where

statement
This commit is contained in:
lucio 2019-10-30 10:33:00 +01:00
parent 3522c09f2c
commit c722f022e0
3 changed files with 12 additions and 15 deletions

View File

@ -6,23 +6,14 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>

View File

@ -38,6 +38,7 @@ public class QueryTemplate extends QueryBox implements Query {
public static final String DEFAULT = "def";
public static final String STATEMENT = "statement";
private static final XMLInputFactory xmlif = XMLInputFactory.newInstance();
@ -157,9 +158,14 @@ public class QueryTemplate extends QueryBox implements Query {
if (name.equals(wrapper))
break;
if (parameters.containsKey(name))
if (parameters.containsKey(name)) {
String statement =xmlr.getAttributeValue(null,STATEMENT);
if (statement != null) {
builder.append(statement).append(" ");
}
builder.append(parameters.get(name));
else {
}else {
// is there a default value?
String def = xmlr.getAttributeValue(null,DEFAULT);
if (def != null)

View File

@ -33,8 +33,8 @@ public class XQuery extends QueryTemplate implements SimpleQuery {
public static final String cond = "cond";
public static final String result = "result";
public static final String template = "<ns/> for $resource in <" + range + "/><vars/> where <" + cond + " " + DEFAULT
+ "='$resource'/> return <" + result + " " + DEFAULT + "='$resource'/>";
public static final String template = "<ns/> for $resource in <" + range + "/><vars/> <" + cond + " "+ STATEMENT +"='where' "+ DEFAULT
+ "=''/> return <" + result + " " + DEFAULT + "='$resource'/>";
public XQuery(Map<String, String> parameters) {// add static parameters