Compare commits

...

2 Commits

Author SHA1 Message Date
lucio 1375852ca4 version modified 2019-10-30 11:05:04 +01:00
lucio c722f022e0 changed xquery template to allow default condition as empty where
statement
2019-10-30 10:33:00 +01:00
5 changed files with 27 additions and 16 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>
@ -30,6 +21,7 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>

View File

@ -5,6 +5,11 @@
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
@ -15,9 +20,17 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.resources.discovery</groupId>
<artifactId>discovery-client</artifactId>
<version>1.0.1</version>
<version>1.0.2-SNASPHOT</version>
<name>Discovery Client</name>
<description>Base API for resource discovery clients</description>

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