[New] Implemented param null selector and ParameterBagSelector
This commit is contained in:
parent
7cb7c2749c
commit
352a702c15
|
@ -19,7 +19,7 @@ package li.strolch.model.query;
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface OrderSelectionVisitor extends StrolchElementSelectionVisitor {
|
public interface OrderSelectionVisitor extends StrolchRootElementSelectionVisitor {
|
||||||
|
|
||||||
public void visit(DateSelection selection);
|
public void visit(DateSelection selection);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package li.strolch.model.query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
*/
|
||||||
|
public class ParameterBagSelection implements Selection {
|
||||||
|
|
||||||
|
private String bagKey;
|
||||||
|
|
||||||
|
public ParameterBagSelection(String bagKey) {
|
||||||
|
this.bagKey = bagKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the bagKey
|
||||||
|
*/
|
||||||
|
public String getBagKey() {
|
||||||
|
return this.bagKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasSelection() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(QueryVisitor visitor) {
|
||||||
|
accept((StrolchRootElementSelectionVisitor) visitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void accept(StrolchRootElementSelectionVisitor visitor) {
|
||||||
|
visitor.visit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("nls")
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
builder.append(getClass().getSimpleName() + " [bagKey=");
|
||||||
|
builder.append(this.bagKey);
|
||||||
|
builder.append("]");
|
||||||
|
return builder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class NullParameterBagSelection extends ParameterBagSelection {
|
||||||
|
|
||||||
|
public NullParameterBagSelection(String bagKey) {
|
||||||
|
super(bagKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void accept(StrolchRootElementSelectionVisitor visitor) {
|
||||||
|
visitor.visit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -105,6 +105,22 @@ public abstract class ParameterSelection implements Selection {
|
||||||
return new StringListParameterSelection(bagKey, paramKey, value);
|
return new StringListParameterSelection(bagKey, paramKey, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static NullParameterSelection nullSelection(String bagKey, String paramKey) {
|
||||||
|
return new NullParameterSelection(bagKey, paramKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class NullParameterSelection extends ParameterSelection {
|
||||||
|
|
||||||
|
public NullParameterSelection(String bagKey, String paramKey) {
|
||||||
|
super(bagKey, paramKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(ParameterSelectionVisitor visitor) {
|
||||||
|
visitor.visit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class StringParameterSelection extends ParameterSelection {
|
public static class StringParameterSelection extends ParameterSelection {
|
||||||
|
|
||||||
private StringMatchMode matchMode;
|
private StringMatchMode matchMode;
|
||||||
|
|
|
@ -21,6 +21,7 @@ import li.strolch.model.query.ParameterSelection.DateRangeParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.FloatParameterSelection;
|
import li.strolch.model.query.ParameterSelection.FloatParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.IntegerParameterSelection;
|
import li.strolch.model.query.ParameterSelection.IntegerParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.LongParameterSelection;
|
import li.strolch.model.query.ParameterSelection.LongParameterSelection;
|
||||||
|
import li.strolch.model.query.ParameterSelection.NullParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.StringListParameterSelection;
|
import li.strolch.model.query.ParameterSelection.StringListParameterSelection;
|
||||||
import li.strolch.model.query.ParameterSelection.StringParameterSelection;
|
import li.strolch.model.query.ParameterSelection.StringParameterSelection;
|
||||||
|
|
||||||
|
@ -44,4 +45,6 @@ public interface ParameterSelectionVisitor extends QueryVisitor {
|
||||||
public void visit(DateRangeParameterSelection selection);
|
public void visit(DateRangeParameterSelection selection);
|
||||||
|
|
||||||
public void visit(StringListParameterSelection selection);
|
public void visit(StringListParameterSelection selection);
|
||||||
|
|
||||||
|
public void visit(NullParameterSelection nullParameterSelection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,8 @@ package li.strolch.model.query;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ResourceQueryVisitor extends StrolchElementSelectionVisitor, ParameterSelectionVisitor {
|
public interface ResourceQueryVisitor extends StrolchRootElementSelectionVisitor, ParameterSelectionVisitor {
|
||||||
|
|
||||||
// marker interface
|
// marker interface
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2013 Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package li.strolch.model.query;
|
||||||
|
|
||||||
|
import li.strolch.model.query.ParameterBagSelection.NullParameterBagSelection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||||
|
*/
|
||||||
|
public interface StrolchRootElementSelectionVisitor extends StrolchElementSelectionVisitor {
|
||||||
|
|
||||||
|
public void visit(ParameterBagSelection selection);
|
||||||
|
|
||||||
|
public void visit(NullParameterBagSelection selection);
|
||||||
|
}
|
Loading…
Reference in New Issue