// determine the discoverable target, set the underlying storable
Discoverable discoverable = propertyClause.getTarget();
if (discoverable == null) {
String sErr = "The PropertyClause.target is null.";
throw new DiscoveryException(sErr);
}
if (discoverable.getStorable() == null) {
String sErr = "The PropertyClause.target.storeable is null.";
throw new DiscoveryException(sErr);
} else {
Storeable storeable = (Storeable)discoverable.getStorable();
this.baseFieldName = storeable.getName();
if (this.baseFieldName.endsWith(".intersects")) {
this.inclusive = true;
this.baseFieldName = this.baseFieldName.substring(0,this.baseFieldName.length()-11);
} else if (this.baseFieldName.endsWith(".within")) {
this.inclusive = false;
this.baseFieldName = this.baseFieldName.substring(0,this.baseFieldName.length()-7);
}
this.intervalMetaFieldName = this.baseFieldName+".imeta";
this.multiplicityFieldName = this.baseFieldName+".num";
this.summaryMetaFieldName = this.baseFieldName+".meta";
}
// initialize values
boolean bInclusive = this.inclusive;
String sLiteral = Val.chkStr(propertyClause.getLiteral());
String sLower = "";
String sUpper = "";
String sErr = null;
String sErrSfx = " is not supported for timeperiod fields,"+
" use PropertyIsBetween.";
if (propertyClause instanceof PropertyIsBetween) {
PropertyIsBetween between = (PropertyIsBetween)propertyClause;
sLower = Val.chkStr(between.getLowerBoundary());
sUpper = Val.chkStr(between.getUpperBoundary());
this.queryLower = this.parseDateTime(sLower,false);
this.queryUpper = this.parseDateTime(sUpper,true);
} else if ((propertyClause instanceof PropertyIsEqualTo) ||
(propertyClause instanceof PropertyIsNotEqualTo)) {
Query q = null;
sLower = Val.chkStr(sLiteral);
sUpper = Val.chkStr(sLiteral);
this.queryLower = this.parseDateTime(sLower,false);
if (this.queryLower == null) {
sErr = "Timeperiod literal cannot be null for PropertyIsEqualTo/PropertyIsNotEqualTo";
} else {
this.queryUpper = this.parseDateTime(sUpper,true);
if (propertyClause instanceof PropertyIsEqualTo) {
q = this.makeEquals();
} else {
q = this.makeNotEquals();
}
appendQuery(activeBooleanQuery,activeLogicalClause,q);
return;
}
} else if (propertyClause instanceof PropertyIsGreaterThan) {
bInclusive = false; // use within logic
sLower = sLiteral;
this.queryLower = this.parseDateTime(sLower,false);
if (this.queryLower != null) {
this.queryLower = new Long(this.queryLower.longValue() + 1);
}
} else if (propertyClause instanceof PropertyIsGreaterThanOrEqualTo) {
bInclusive = false; // use within logic
sLower = sLiteral;
this.queryLower = this.parseDateTime(sLower,false);
} else if (propertyClause instanceof PropertyIsLessThan) {
bInclusive = false; // use within logic
sUpper = sLiteral;
this.queryUpper = this.parseDateTime(sUpper,false);
if (this.queryUpper != null) {
this.queryUpper = new Long(this.queryUpper.longValue() - 1);
}
} else if (propertyClause instanceof PropertyIsLessThanOrEqualTo) {
bInclusive = false; // use within logic
sUpper = sLiteral;
this.queryUpper = this.parseDateTime(sUpper,true);
} else if (propertyClause instanceof PropertyIsNull) {
appendQuery(activeBooleanQuery,activeLogicalClause,this.makeNull());
return;
} else if (propertyClause instanceof PropertyIsLike) {
sErr = "PropertyIsLike"+sErrSfx;
} else {
sErr = "Unrecognized property clause type: "+propertyClause.getClass().getName();
}
if (sErr != null) {
throw new DiscoveryException(sErr);
}
// check for upper < lower
if ((this.queryLower != null) && (this.queryUpper != null)) {
if (this.queryUpper.longValue() < this.queryLower.longValue()) {