[New] added StrolchQuery.getSelection() and cleaned up some constants

This commit is contained in:
Robert von Burg 2014-08-04 14:50:56 +02:00
parent bf4c23e241
commit 7b8defc56f
3 changed files with 19 additions and 15 deletions

View File

@ -1,6 +1,9 @@
package li.strolch.agent.impl;
import static li.strolch.runtime.StrolchConstants.INTERPRETATION_RESOURCE_REF;
import java.text.MessageFormat;
import li.strolch.agent.api.ResourceMap;
import li.strolch.exception.StrolchException;
import li.strolch.model.Resource;
@ -15,13 +18,15 @@ public class CachedResourceMap extends CachedElementMap<Resource> implements Res
public Resource getBy(StrolchTransaction tx, StringParameter refP) throws StrolchException {
if (!refP.getInterpretation().equals(INTERPRETATION_RESOURCE_REF)) {
throw new StrolchException(refP.getLocator()
+ " is not an Resource reference as its interpretation is not " + INTERPRETATION_RESOURCE_REF);
String msg = MessageFormat.format("{0} is not an Resource reference as its interpretation is not {1}", //$NON-NLS-1$
refP.getLocator(), INTERPRETATION_RESOURCE_REF);
throw new StrolchException(msg);
}
if (refP.getUom().equals(Parameter.UOM_NONE)) {
throw new StrolchException(refP.getLocator()
+ " is not an Resource reference as its UOM is not set to a type!");
String msg = MessageFormat.format("{0} is not an Resource reference as its UOM is not set to a type!", //$NON-NLS-1$
refP.getLocator());
throw new StrolchException(msg);
}
String type = refP.getUom();

View File

@ -15,9 +15,7 @@
*/
package li.strolch.runtime;
import li.strolch.model.Order;
import li.strolch.model.Resource;
import li.strolch.model.parameter.Parameter;
import li.strolch.model.StrolchModelConstants;
import li.strolch.persistence.api.PersistenceHandler;
import li.strolch.runtime.observer.ObserverHandler;
@ -36,17 +34,18 @@ public class StrolchConstants {
public static final String DEFAULT_XML_VERSION = "1.0"; //$NON-NLS-1$
public static final String DEFAULT_ENCODING = "utf-8"; //$NON-NLS-1$
public static final String TEMPLATE = "Template";
/**
* @see StrolchModelConstants#TEMPLATE
*/
public static final String TEMPLATE = StrolchModelConstants.TEMPLATE;
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to a {@link Resource}
* @see StrolchModelConstants#INTERPRETATION_RESOURCE_REF
*/
public static final String INTERPRETATION_RESOURCE_REF = "Resource-Ref"; //$NON-NLS-1$
public static final String INTERPRETATION_RESOURCE_REF = StrolchModelConstants.INTERPRETATION_RESOURCE_REF;
/**
* This interpretation value indicates that the value of the {@link Parameter} should be understood as a reference
* to an {@link Order}
* @see StrolchModelConstants#INTERPRETATION_ORDER_REF
*/
public static final String INTERPRETATION_ORDER_REF = "Order-Ref"; //$NON-NLS-1$
public static final String INTERPRETATION_ORDER_REF = StrolchModelConstants.INTERPRETATION_ORDER_REF;
}

View File

@ -277,7 +277,7 @@ public abstract class ParameterSelector<T extends GroupedParameterizedElement> i
DateParameter param = bag.getParameter(this.paramKey);
Date value = param.getValue();
return (from == null || !value.before(from)) && (to == null || !value.after(to));
return (this.from == null || !value.before(this.from)) && (this.to == null || !value.after(this.to));
}
}