// This component does not support iteration, so we output all our data
// once (and only once)
if( this.allDataOutput == true ) return null;
else this.allDataOutput = true;
OrderCriteria criteria = new OrderCriteria();
// Date after
Date dateAfter = getDateAfter();
if(dateAfter != null) {
Calendar dateAfterCal = new GregorianCalendar();
dateAfterCal.setTime(dateAfter);
criteria.setDateAfter(dateAfterCal);
}
// Date before
Date dateBefore = getDateBefore();
if(dateBefore != null) {
Calendar dateBeforeCal = new GregorianCalendar();
dateBeforeCal.setTime(dateBefore);
criteria.setDateBefore(dateBeforeCal);
}
// Customer id in
String customerIdInStr = this.data.getAttribute(CUSTOMER_ID_IN_ATTR);
if(customerIdInStr != null && customerIdInStr.length() > 0)
criteria.setCustomerIdIn(Utils.split(customerIdInStr, ","));
// Hanling status in
String handlingStatusNameInStr = this.data.getAttribute(HANDLING_STATUS_NAME_IN_ATTR);
if(handlingStatusNameInStr != null && handlingStatusNameInStr.length() > 0)
criteria.setHandlingStatusNameIn(Utils.split(handlingStatusNameInStr, ","));
// Handling status not in
String handlingStatusNameNotInStr = this.data.getAttribute(HANDLING_STATUS_NAME_NOT_IN_ATTR);
if(handlingStatusNameNotInStr != null && handlingStatusNameNotInStr.length() > 0)
criteria.setHandlingStatusNameNotIn(Utils.split(handlingStatusNameNotInStr, ","));
// Payment status in
String paymentStatusNameInStr = this.data.getAttribute(PAYMENT_STATUS_NAME_IN_ATTR);
if(paymentStatusNameInStr != null && paymentStatusNameInStr.length() > 0)
criteria.setPaymentStatusNameIn(Utils.split(paymentStatusNameInStr, ","));
// Payment status not in
String paymentStatusNameNotInStr = this.data.getAttribute(PAYMENT_STATUS_NAME_NOT_IN_ATTR);
if(paymentStatusNameNotInStr != null && paymentStatusNameNotInStr.length() > 0)
criteria.setPaymentStatusNameNotIn(Utils.split(paymentStatusNameNotInStr, ","));
// New status
String newStatusName = this.data.getAttribute(NEW_STATUS_NAME_ATTR);
if(newStatusName != null && newStatusName.length() == 0)
newStatusName = null;
// id greater than
String idGTStr = this.data.getAttribute(ID_GREATER_THAN_ATTR);
if(idGTStr != null && idGTStr.length() > 0) {
try {
criteria.setIdGreaterThan(new Long(idGTStr));
} catch(NumberFormatException nfe) {
logger.logMessage(
"Non-numeric value in 'id greater than' criteria",
this,
MessageLogger.ERROR);
throw nfe;
}
}
// id less than
String idLTStr = this.data.getAttribute(ID_LESS_THAN_ATTR);
if(idLTStr != null && idLTStr.length() > 0) {
try {
criteria.setIdLessThan(new Long(idLTStr));
} catch(NumberFormatException nfe) {
logger.logMessage(
"Non-numeric value in 'id greater than' criteria",
this,
MessageLogger.ERROR);
throw nfe;
}
}
// id in
String idInStr = this.data.getAttribute(ID_IN_ATTR);
if(idInStr != null && idInStr.length() > 0) {
String[] idInStrArray = Utils.split(idInStr, ",");
Long[] idInLongArray = new Long[idInStrArray.length];
try {
for(int i = 0; i < idInStrArray.length; i++)
idInLongArray[i] = new Long(idInStrArray[i]);
criteria.setIdIn(idInLongArray);
} catch(NumberFormatException nfe) {
logger.logMessage(
"Non-numeric value in 'id-in' criteria",
this,
MessageLogger.ERROR);
throw nfe;
}
}
// Sum greater than
Double sumGreaterThan = getSumGreaterThan();
if(sumGreaterThan != null && !sumGreaterThan.isNaN())
criteria.setSumGreaterThan(sumGreaterThan);
// Sum less than
Double sumLessThan = getSumLessThan();
if(sumLessThan != null && !sumLessThan.isNaN())
criteria.setSumLessThan(sumLessThan);
logger.logMessage("Calling Open Interface", this, MessageLogger.DEBUG);
try {
ExportResult result;