我有一个自定义异常类customException,当调用它时需要三个参数(两个整数和String)。
目前在我的camel.xml文件中我有:
na.omit(ames_test)
抛出异常时,我想要的特定变量为null。如何在Camel中设置该变量?有可能吗?
答案 0 :(得分:2)
您可以将异常定义为具有自定义构造函数参数和属性值的单独bean,并从i
引用它:
handler: (request, reply) => {
const query = request.query;
const quoteNum = request.query.QuoteNum;
let numOfQuotes = request.query.NumOfQuotes;
let filterType = request.query.Filter;
const beginDate = request.query.StartDate;
const endDate = request.query.EndDate;
const optionsType = request.query.MoreOptionsType;
const optionsQuery = request.query.moreOptionsQuery;
const optionsValue = request.query.MoreOptionsString;
switch (numOfQuotes) {
case '100':
numOfQuotes = "SELECT TOP 100";
break;
case '200':
numOfQuotes = "SELECT TOP 200";
break;
case '500':
numOfQuotes = "SELECT TOP 500";
break;
case '1000':
numOfQuotes = "SELECT TOP 1000";
break;
case '2000':
numOfQuotes = "SELECT TOP 2000";
break;
case '5000':
numOfQuotes = "SELECT TOP 5000";
break;
case '10000':
numOfQuotes = "SELECT TOP 10000";
break;
case 'ALL':
numOfQuotes = "SELECT";
break;
default:
numOfQuotes = "SELECT TOP 50";
}
if (filterType != '') {
switch (filterType) {
case 'Q':
filterType = " AND SOHeader.SOTypeID = 'Q'"
break;
case 'SO':
filterType = " AND SOHeader.SOTypeID = 'SO'"
break;
case 'TI':
filterType = " AND SOHeader.SOTypeID = 'TI'"
break;
case 'SO & TI':
filterType = " AND SOHeader.SOTypeID IN ('SO', 'TI')"
break;
case 'RPL':
filterType = " AND SOHeader.SOTypeID = 'RPL'"
break;
case 'RFC':
filterType = " AND SOHeader.SOTypeID = 'RFC'"
break;
case 'BT':
filterType = " AND SOHeader.SOTypeID = 'BT'"
break;
case 'CW':
filterType = " AND SOHeader.SOTypeID = 'CW'"
break;
case 'CWR':
filterType = " AND SOHeader.SOTypeID = 'CWR'"
break;
case 'CWR & BT & CW':
filterType = " AND SOHeader.SOTypeID IN ('CWR','BT','CW')"
break;
}
}
conn.connect().then(() => {
const req = new sql.Request(conn);
let myBeginQuery = `${numOfQuotes} DISTINCT SOHeader.OrdNbr, soheader.sotypeid, soheader.user6, SOheader.LUpd_DateTime, SOHeader.User3, soheader.crtd_user, SOHeader.S4Future01, SOHeader.SlsperID, SOHeader.TotMerch, SOHeader.CustOrdNbr
FROM SOHeader
INNER JOIN Customer ON SOHeader.CustID = Customer.CustId
INNER JOIN SOLine ON SOHeader.OrdNbr = SOLine.OrdNbr
WHERE soheader.CpnyID = 'AOS'
and Customer.custid = @input_param`;
let myQuery = '';
if (filterType != '') {
myQuery = myBeginQuery + filterType;
}
console.log(myQuery);