changed xquery template to allow default condition as empty where
statement
This commit is contained in:
parent
3522c09f2c
commit
c722f022e0
13
.classpath
13
.classpath
|
@ -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>
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue