Remove 50% duplicated code in JDBCNormalizer
parent
c7d0fa93d5
commit
0f152fb066
|
@ -324,7 +324,6 @@ public class JDBCNormalizer {
|
||||||
throw new MessagingException(msgEx);
|
throw new MessagingException(msgEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// } //while
|
|
||||||
returnPartName = elementQName.getLocalPart();
|
returnPartName = elementQName.getLocalPart();
|
||||||
|
|
||||||
if (returnPartName == null) {
|
if (returnPartName == null) {
|
||||||
|
@ -341,275 +340,153 @@ public class JDBCNormalizer {
|
||||||
wrapperBuilder.initialize(normalDoc, msg,
|
wrapperBuilder.initialize(normalDoc, msg,
|
||||||
operationInputName);
|
operationInputName);
|
||||||
|
|
||||||
// Part part = msg.getPart(returnPartName);
|
|
||||||
if (part != null) {
|
if (part != null) {
|
||||||
final Element returnPartElement = normalDoc.createElement(
|
final Element returnPartElement = normalDoc.createElement(
|
||||||
returnPartName);
|
returnPartName);
|
||||||
final QName type = part.getTypeName();
|
final QName type = part.getTypeName();
|
||||||
{
|
if (type != null) {
|
||||||
if (type != null) {
|
// get resultset metadata rsmd and add it to the element
|
||||||
// get resultset metadata rsmd and add it to the element
|
final ResultSetMetaData rsmd = rs.getMetaData();
|
||||||
final ResultSetMetaData rsmd = rs.getMetaData();
|
while (rs.next()) {
|
||||||
if (numberOfRecords == -1)
|
mRowCount++;
|
||||||
while (rs.next()) {
|
if (mLogger.isLoggable(
|
||||||
mRowCount++;
|
Level.FINE))
|
||||||
if (mLogger.isLoggable(
|
mLogger.log(Level.FINE,
|
||||||
Level.FINE))
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
mLogger.log(Level.FINE,
|
final Element record =
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
normalDoc.createElement(
|
||||||
final Element record =
|
mRecordPrefix + "_Record"); //113494
|
||||||
normalDoc.createElement(
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
mRecordPrefix + "_Record"); //113494
|
final String colName = rsmd.getColumnName(j);
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
String colValue = JDBCUtil.convertToString(j,
|
||||||
final String colName = rsmd.getColumnName(j);
|
rs, rsmd, dbName);
|
||||||
String colValue = JDBCUtil.convertToString(j,
|
|
||||||
rs, rsmd, dbName);
|
|
||||||
|
|
||||||
final Element e = normalDoc.createElement(
|
final Element e = normalDoc.createElement(
|
||||||
XMLCharUtil.makeValidNCName(
|
XMLCharUtil.makeValidNCName(
|
||||||
colName));
|
colName));
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
colValue = "";
|
colValue = "";
|
||||||
e.setAttribute("isNull",
|
e.setAttribute("isNull",
|
||||||
"true");
|
"true");
|
||||||
} else
|
} else
|
||||||
e.setAttribute("isNull",
|
e.setAttribute("isNull",
|
||||||
"false");
|
"false");
|
||||||
e.appendChild(normalDoc.createTextNode(
|
e.appendChild(normalDoc.createTextNode(
|
||||||
colValue));
|
colValue));
|
||||||
record.appendChild(e);
|
record.appendChild(e);
|
||||||
if (mLogger.isLoggable(
|
if (mLogger.isLoggable(
|
||||||
Level.FINEST))
|
Level.FINEST))
|
||||||
mLogger.log(Level.FINEST,
|
mLogger.log(Level.FINEST,
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
}
|
}
|
||||||
returnPartElement.appendChild(
|
returnPartElement.appendChild(
|
||||||
record);
|
record);
|
||||||
}
|
if (numberOfRecords > 0) {
|
||||||
else
|
numberOfRecords--;
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
if (numberOfRecords == 0)
|
||||||
mRowCount++;
|
break;
|
||||||
if (mLogger.isLoggable(
|
}
|
||||||
Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
final Element record =
|
|
||||||
normalDoc.createElement(
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName = rsmd.getColumnName(j);
|
|
||||||
String colValue = JDBCUtil.convertToString(j,
|
|
||||||
rs, rsmd, dbName);
|
|
||||||
|
|
||||||
final Element e = normalDoc.createElement(
|
|
||||||
XMLCharUtil.makeValidNCName(
|
|
||||||
colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"true");
|
|
||||||
} else
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(
|
|
||||||
colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINEST))
|
|
||||||
mLogger.log(Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
}
|
|
||||||
returnPartElement.appendChild(
|
|
||||||
record);
|
|
||||||
numberOfRecords--;
|
|
||||||
}
|
|
||||||
wrapperBuilder.addPart(part.getName(),
|
|
||||||
returnPartElement);
|
|
||||||
} else {
|
|
||||||
final QName element = part.getElementName();
|
|
||||||
NS = element.getNamespaceURI();
|
|
||||||
|
|
||||||
final Element elementRoot = normalDoc.createElementNS(NS,
|
|
||||||
element.getLocalPart());
|
|
||||||
|
|
||||||
// returnPartElement.appendChild(elementRoot);
|
|
||||||
// get resultset metadata rsmd and add it to the element
|
|
||||||
final ResultSetMetaData rsmd = rs.getMetaData();
|
|
||||||
final List<String> pKeyList =
|
|
||||||
new ArrayList<String>();
|
|
||||||
|
|
||||||
if (numberOfRecords == -1)
|
|
||||||
while (rs.next()) {
|
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
Element record =
|
|
||||||
normalDoc.createElementNS(NS,
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName = rsmd.getColumnName(j);
|
|
||||||
String colValue = JDBCUtil.convertToString(j,
|
|
||||||
rs, rsmd, dbName);
|
|
||||||
|
|
||||||
if (colName.equalsIgnoreCase(
|
|
||||||
pkName) || ("\"" + colName + "\"").
|
|
||||||
equalsIgnoreCase(
|
|
||||||
pkName))
|
|
||||||
if (epb.isClustered()) {
|
|
||||||
boolean inserted =
|
|
||||||
false;
|
|
||||||
mJDBCClusterManager.setPKValue(
|
|
||||||
colValue);
|
|
||||||
//boolean inserted = isRecordInserted(epb, connection, pkName, colValue);
|
|
||||||
inserted =
|
|
||||||
mJDBCClusterManager.
|
|
||||||
isRecordInsertedByCurrentInstance();
|
|
||||||
if (!inserted)
|
|
||||||
record = null;
|
|
||||||
else
|
|
||||||
pKeyList.add(
|
|
||||||
colValue);
|
|
||||||
} else {
|
|
||||||
boolean processed =
|
|
||||||
isRecordProcessed(
|
|
||||||
colValue);
|
|
||||||
if (!processed)
|
|
||||||
pKeyList.add(
|
|
||||||
colValue);
|
|
||||||
else
|
|
||||||
record = null;
|
|
||||||
}
|
|
||||||
if (record != null) {
|
|
||||||
final Element e =
|
|
||||||
normalDoc.createElementNS(
|
|
||||||
NS, XMLCharUtil.makeValidNCName(
|
|
||||||
colName));
|
|
||||||
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute(
|
|
||||||
"isNull",
|
|
||||||
"true");
|
|
||||||
} else
|
|
||||||
e.setAttribute(
|
|
||||||
"isNull",
|
|
||||||
"false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(
|
|
||||||
colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINEST))
|
|
||||||
mLogger.log(
|
|
||||||
Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
} else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (record != null)
|
|
||||||
elementRoot.appendChild(
|
|
||||||
record);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
Element record =
|
|
||||||
normalDoc.createElementNS(NS,
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName = rsmd.getColumnName(j);
|
|
||||||
String colValue = JDBCUtil.convertToString(j,
|
|
||||||
rs, rsmd, dbName);
|
|
||||||
|
|
||||||
if (colName.equalsIgnoreCase(
|
|
||||||
pkName) || ("\"" + colName + "\"").
|
|
||||||
equalsIgnoreCase(
|
|
||||||
pkName))
|
|
||||||
if (epb.isClustered()) {
|
|
||||||
boolean inserted =
|
|
||||||
false;
|
|
||||||
mJDBCClusterManager.setPKValue(
|
|
||||||
colValue);
|
|
||||||
/*List pkDangListValues = mJDBCClusterManager.getDanglingInstancePKList();
|
|
||||||
if(!pkDangListValues.isEmpty()){
|
|
||||||
// check the pk values is exsits in the list
|
|
||||||
//if(pkDangListValues.contains(colValue)){
|
|
||||||
// It means , the current instance took the owner ship of this records and need to process.
|
|
||||||
// the PK records are already present in the result so make the inserted is true.and need to remove the pk value
|
|
||||||
//from the the list to avoid duplicate process.
|
|
||||||
// if pkDangListValues > numberOfRecords, don't remove them from the list and process in the next poll.
|
|
||||||
// inserted = true;
|
|
||||||
// pkDangListValues.remove(colValue);
|
|
||||||
// }else{
|
|
||||||
// inserted = mJDBCClusterManager.isRecordInsertedByCurrentInstance();
|
|
||||||
// }
|
|
||||||
else{*/
|
|
||||||
inserted =
|
|
||||||
mJDBCClusterManager.
|
|
||||||
isRecordInsertedByCurrentInstance();
|
|
||||||
//}
|
|
||||||
//boolean inserted = isRecordInserted(epb, connection, pkName, colValue);
|
|
||||||
if (!inserted)// inserted true means, this records is inserted by this instance and need to process.means add it to the pKeyList
|
|
||||||
record = null;
|
|
||||||
else
|
|
||||||
pKeyList.add(
|
|
||||||
colValue);
|
|
||||||
} else {
|
|
||||||
boolean processed =
|
|
||||||
isRecordProcessed(
|
|
||||||
colValue);
|
|
||||||
if (!processed)
|
|
||||||
pKeyList.add(
|
|
||||||
colValue);
|
|
||||||
else
|
|
||||||
record = null;
|
|
||||||
}
|
|
||||||
if (record != null) {
|
|
||||||
final Element e =
|
|
||||||
normalDoc.createElementNS(
|
|
||||||
NS, XMLCharUtil.makeValidNCName(
|
|
||||||
colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute(
|
|
||||||
"isNull",
|
|
||||||
"true");
|
|
||||||
} else
|
|
||||||
e.setAttribute(
|
|
||||||
"isNull",
|
|
||||||
"false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(
|
|
||||||
colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINEST))
|
|
||||||
mLogger.log(
|
|
||||||
Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
} else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (record != null) {
|
|
||||||
elementRoot.appendChild(
|
|
||||||
record);
|
|
||||||
numberOfRecords--;
|
|
||||||
}
|
|
||||||
} //else
|
|
||||||
epb.setProcessList(pKeyList);
|
|
||||||
if (pKeyList.size() != 0)
|
|
||||||
mInboundExchangeProcessRecordsMap.put(exchange.
|
|
||||||
getExchangeId(),
|
|
||||||
pKeyList);
|
|
||||||
wrapperBuilder.addPart(part.getName(),
|
|
||||||
elementRoot);
|
|
||||||
}
|
}
|
||||||
normalDoc = wrapperBuilder.getResult();
|
wrapperBuilder.addPart(part.getName(),
|
||||||
|
returnPartElement);
|
||||||
|
} else {
|
||||||
|
final QName element = part.getElementName();
|
||||||
|
NS = element.getNamespaceURI();
|
||||||
|
|
||||||
|
final Element elementRoot = normalDoc.createElementNS(NS,
|
||||||
|
element.getLocalPart());
|
||||||
|
|
||||||
|
// returnPartElement.appendChild(elementRoot);
|
||||||
|
// get resultset metadata rsmd and add it to the element
|
||||||
|
final ResultSetMetaData rsmd = rs.getMetaData();
|
||||||
|
final List<String> pKeyList =
|
||||||
|
new ArrayList<String>();
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
mRowCount++;
|
||||||
|
if (mLogger.isLoggable(
|
||||||
|
Level.FINE))
|
||||||
|
mLogger.log(Level.FINE,
|
||||||
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
|
Element record =
|
||||||
|
normalDoc.createElementNS(NS,
|
||||||
|
mRecordPrefix + "_Record"); //113494
|
||||||
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
|
final String colName = rsmd.getColumnName(j);
|
||||||
|
String colValue = JDBCUtil.convertToString(j,
|
||||||
|
rs, rsmd, dbName);
|
||||||
|
|
||||||
|
if (colName.equalsIgnoreCase(
|
||||||
|
pkName) || ("\"" + colName + "\"").
|
||||||
|
equalsIgnoreCase(
|
||||||
|
pkName))
|
||||||
|
if (epb.isClustered()) {
|
||||||
|
boolean inserted =
|
||||||
|
false;
|
||||||
|
mJDBCClusterManager.setPKValue(
|
||||||
|
colValue);
|
||||||
|
inserted =
|
||||||
|
mJDBCClusterManager.
|
||||||
|
isRecordInsertedByCurrentInstance();
|
||||||
|
if (!inserted)
|
||||||
|
record = null;
|
||||||
|
else
|
||||||
|
pKeyList.add(
|
||||||
|
colValue);
|
||||||
|
} else {
|
||||||
|
boolean processed =
|
||||||
|
isRecordProcessed(
|
||||||
|
colValue);
|
||||||
|
if (!processed)
|
||||||
|
pKeyList.add(
|
||||||
|
colValue);
|
||||||
|
else
|
||||||
|
record = null;
|
||||||
|
}
|
||||||
|
if (record != null) {
|
||||||
|
final Element e =
|
||||||
|
normalDoc.createElementNS(
|
||||||
|
NS, XMLCharUtil.makeValidNCName(
|
||||||
|
colName));
|
||||||
|
if (rs.wasNull()) {
|
||||||
|
colValue = "";
|
||||||
|
e.setAttribute(
|
||||||
|
"isNull",
|
||||||
|
"true");
|
||||||
|
} else
|
||||||
|
e.setAttribute(
|
||||||
|
"isNull",
|
||||||
|
"false");
|
||||||
|
e.appendChild(normalDoc.createTextNode(
|
||||||
|
colValue));
|
||||||
|
record.appendChild(e);
|
||||||
|
if (mLogger.isLoggable(
|
||||||
|
Level.FINEST))
|
||||||
|
mLogger.log(
|
||||||
|
Level.FINEST,
|
||||||
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (record != null) {
|
||||||
|
elementRoot.appendChild(
|
||||||
|
record);
|
||||||
|
if (numberOfRecords > 0) {
|
||||||
|
numberOfRecords--;
|
||||||
|
if (numberOfRecords == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // while
|
||||||
|
epb.setProcessList(pKeyList);
|
||||||
|
if (pKeyList.size() != 0)
|
||||||
|
mInboundExchangeProcessRecordsMap.put(exchange.
|
||||||
|
getExchangeId(),
|
||||||
|
pKeyList);
|
||||||
|
wrapperBuilder.addPart(part.getName(),
|
||||||
|
elementRoot);
|
||||||
}
|
}
|
||||||
|
normalDoc = wrapperBuilder.getResult();
|
||||||
} else {
|
} else {
|
||||||
final String msgEx = JDBCNormalizer.mMessages.getString(
|
final String msgEx = JDBCNormalizer.mMessages.getString(
|
||||||
"DBBC_E00703.JDBCN_Failed_NM_Part") +
|
"DBBC_E00703.JDBCN_Failed_NM_Part") +
|
||||||
|
@ -646,65 +523,40 @@ public class JDBCNormalizer {
|
||||||
|
|
||||||
// get resultset metadata rsmd and add it to the element
|
// get resultset metadata rsmd and add it to the element
|
||||||
final ResultSetMetaData rsmd = rs.getMetaData();
|
final ResultSetMetaData rsmd = rs.getMetaData();
|
||||||
if (numberOfRecords == -1)
|
while (rs.next()) {
|
||||||
while (rs.next()) {
|
mRowCount++;
|
||||||
mRowCount++;
|
if (mLogger.isLoggable(Level.FINE))
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
mLogger.log(Level.FINE,
|
||||||
mLogger.log(Level.FINE,
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
final Element record = normalDoc.createElement(
|
||||||
final Element record = normalDoc.createElement(
|
mRecordPrefix + "_Record"); //113494
|
||||||
mRecordPrefix + "_Record"); //113494
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
final String colName = rsmd.getColumnName(j);
|
||||||
final String colName = rsmd.getColumnName(j);
|
String colValue =
|
||||||
String colValue =
|
JDBCUtil.convertToString(j, rs, rsmd,
|
||||||
JDBCUtil.convertToString(j, rs, rsmd,
|
dbName);
|
||||||
dbName);
|
|
||||||
|
|
||||||
final Element e = normalDoc.createElement(
|
final Element e = normalDoc.createElement(
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
XMLCharUtil.makeValidNCName(colName));
|
||||||
|
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
colValue = "";
|
colValue = "";
|
||||||
e.setAttribute("isNull", "true");
|
e.setAttribute("isNull", "true");
|
||||||
} else
|
} else
|
||||||
e.setAttribute("isNull", "false");
|
e.setAttribute("isNull", "false");
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
e.appendChild(normalDoc.createTextNode(colValue));
|
||||||
record.appendChild(e);
|
record.appendChild(e);
|
||||||
if (mLogger.isLoggable(Level.FINEST))
|
if (mLogger.isLoggable(Level.FINEST))
|
||||||
mLogger.log(Level.FINEST,
|
mLogger.log(Level.FINEST,
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
}
|
|
||||||
returnElement.appendChild(record);
|
|
||||||
}
|
}
|
||||||
else
|
returnElement.appendChild(record);
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
if (numberOfRecords > 0) {
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
final Element record = normalDoc.createElement(
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName = rsmd.getColumnName(j);
|
|
||||||
String colValue =
|
|
||||||
JDBCUtil.convertToString(j, rs, rsmd,
|
|
||||||
dbName);
|
|
||||||
final Element e = normalDoc.createElement(
|
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute("isNull", "true");
|
|
||||||
} else
|
|
||||||
e.setAttribute("isNull", "false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(Level.FINEST))
|
|
||||||
mLogger.log(Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
}
|
|
||||||
returnElement.appendChild(record);
|
|
||||||
numberOfRecords--;
|
numberOfRecords--;
|
||||||
|
if (numberOfRecords == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
normalRoot.appendChild(returnElement);
|
normalRoot.appendChild(returnElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -815,71 +667,42 @@ public class JDBCNormalizer {
|
||||||
validColNames = validateColumnNames(rsmd,
|
validColNames = validateColumnNames(rsmd,
|
||||||
validColNames);
|
validColNames);
|
||||||
|
|
||||||
if (numberOfRecords == -1)
|
while (rs.next()) {
|
||||||
while (rs.next()) {
|
mRowCount++;
|
||||||
mRowCount++;
|
if (mLogger.isLoggable(Level.FINE))
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
mLogger.log(Level.FINE,
|
||||||
mLogger.log(Level.FINE,
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
final Element record = normalDoc.createElement(
|
||||||
final Element record = normalDoc.createElement(
|
mRecordPrefix + "_Record"); //113494
|
||||||
mRecordPrefix + "_Record"); //113494
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
final String colName =
|
||||||
final String colName =
|
validColNames[j - 1];
|
||||||
validColNames[j - 1];
|
String colValue = JDBCUtil.convertToString(j, rs,
|
||||||
String colValue = JDBCUtil.convertToString(j, rs,
|
rsmd, driverName);
|
||||||
rsmd, driverName);
|
final Element e =
|
||||||
final Element e =
|
normalDoc.createElement(XMLCharUtil.
|
||||||
normalDoc.createElement(XMLCharUtil.
|
makeValidNCName(colName));
|
||||||
makeValidNCName(colName));
|
if (rs.wasNull()) {
|
||||||
if (rs.wasNull()) {
|
colValue = "";
|
||||||
colValue = "";
|
e.setAttribute("isNull",
|
||||||
e.setAttribute("isNull",
|
"true");
|
||||||
"true");
|
} else
|
||||||
} else
|
e.setAttribute("isNull",
|
||||||
e.setAttribute("isNull",
|
"false");
|
||||||
"false");
|
e.appendChild(normalDoc.createTextNode(colValue));
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
record.appendChild(e);
|
||||||
record.appendChild(e);
|
if (mLogger.isLoggable(
|
||||||
if (mLogger.isLoggable(
|
Level.FINEST))
|
||||||
Level.FINEST))
|
mLogger.log(Level.FINEST,
|
||||||
mLogger.log(Level.FINEST,
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
}
|
|
||||||
returnPartElement.appendChild(record);
|
|
||||||
}
|
}
|
||||||
else
|
returnPartElement.appendChild(record);
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
if (numberOfRecords > 0) {
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
final Element record = normalDoc.createElement(
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName =
|
|
||||||
validColNames[j - 1];
|
|
||||||
String colValue = JDBCUtil.convertToString(j, rs,
|
|
||||||
rsmd, driverName);
|
|
||||||
final Element e =
|
|
||||||
normalDoc.createElement(XMLCharUtil.
|
|
||||||
makeValidNCName(colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"true");
|
|
||||||
} else
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINEST))
|
|
||||||
mLogger.log(Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
}
|
|
||||||
returnPartElement.appendChild(record);
|
|
||||||
numberOfRecords--;
|
numberOfRecords--;
|
||||||
|
if (numberOfRecords == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wrapperBuilder.addPart(part.getName(),
|
wrapperBuilder.addPart(part.getName(),
|
||||||
returnPartElement);
|
returnPartElement);
|
||||||
|
@ -897,76 +720,44 @@ public class JDBCNormalizer {
|
||||||
validColNames = validateColumnNames(rsmd,
|
validColNames = validateColumnNames(rsmd,
|
||||||
validColNames);
|
validColNames);
|
||||||
|
|
||||||
if (numberOfRecords == -1)
|
while (rs.next()) {
|
||||||
while (rs.next()) {
|
mRowCount++;
|
||||||
mRowCount++;
|
if (mLogger.isLoggable(Level.FINE))
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
mLogger.log(Level.FINE,
|
||||||
mLogger.log(Level.FINE,
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
final Element record = normalDoc.createElementNS(NS,
|
||||||
final Element record = normalDoc.createElementNS(NS,
|
mRecordPrefix + "_Record"); //113494
|
||||||
mRecordPrefix + "_Record"); //113494
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
final String colName =
|
||||||
final String colName =
|
validColNames[j - 1];
|
||||||
validColNames[j - 1];
|
String colValue = JDBCUtil.convertToString(j, rs,
|
||||||
String colValue = JDBCUtil.convertToString(j, rs,
|
rsmd, driverName);
|
||||||
rsmd, driverName);
|
|
||||||
|
|
||||||
|
|
||||||
final Element e =
|
final Element e =
|
||||||
normalDoc.createElementNS(NS,
|
normalDoc.createElementNS(NS,
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
XMLCharUtil.makeValidNCName(colName));
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
colValue = "";
|
colValue = "";
|
||||||
e.setAttribute("isNull",
|
e.setAttribute("isNull",
|
||||||
"true");
|
"true");
|
||||||
} else
|
} else
|
||||||
e.setAttribute("isNull",
|
e.setAttribute("isNull",
|
||||||
"false");
|
"false");
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
e.appendChild(normalDoc.createTextNode(colValue));
|
||||||
record.appendChild(e);
|
record.appendChild(e);
|
||||||
if (mLogger.isLoggable(
|
if (mLogger.isLoggable(
|
||||||
Level.FINEST))
|
Level.FINEST))
|
||||||
mLogger.log(Level.FINEST,
|
mLogger.log(Level.FINEST,
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
}
|
|
||||||
elementRoot.appendChild(record);
|
|
||||||
}
|
}
|
||||||
else
|
elementRoot.appendChild(record);
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
if (numberOfRecords > 0) {
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
final Element record = normalDoc.createElementNS(NS,
|
|
||||||
mRecordPrefix + "_Record"); //113494
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName =
|
|
||||||
validColNames[j - 1];
|
|
||||||
String colValue = JDBCUtil.convertToString(j, rs,
|
|
||||||
rsmd, driverName);
|
|
||||||
|
|
||||||
|
|
||||||
final Element e =
|
|
||||||
normalDoc.createElementNS(NS,
|
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"true");
|
|
||||||
} else
|
|
||||||
e.setAttribute("isNull",
|
|
||||||
"false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(
|
|
||||||
Level.FINEST))
|
|
||||||
mLogger.log(Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
|
|
||||||
}
|
|
||||||
elementRoot.appendChild(record);
|
|
||||||
numberOfRecords--;
|
numberOfRecords--;
|
||||||
|
if (numberOfRecords == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wrapperBuilder.addPart(part.getName(),
|
wrapperBuilder.addPart(part.getName(),
|
||||||
elementRoot);
|
elementRoot);
|
||||||
|
@ -1009,66 +800,39 @@ public class JDBCNormalizer {
|
||||||
String[] validColNames = new String[rsmd.getColumnCount()];
|
String[] validColNames = new String[rsmd.getColumnCount()];
|
||||||
validColNames = validateColumnNames(rsmd, validColNames);
|
validColNames = validateColumnNames(rsmd, validColNames);
|
||||||
|
|
||||||
if (numberOfRecords == -1)
|
while (rs.next()) {
|
||||||
while (rs.next()) {
|
mRowCount++;
|
||||||
mRowCount++;
|
if (mLogger.isLoggable(Level.FINE))
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
mLogger.log(Level.FINE,
|
||||||
mLogger.log(Level.FINE,
|
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
final Element record = normalDoc.createElement(
|
||||||
final Element record = normalDoc.createElement(
|
mRecordPrefix + "_Record"); //113494
|
||||||
mRecordPrefix + "_Record"); //113494
|
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
final String colName = validColNames[j - 1];
|
||||||
final String colName = validColNames[j - 1];
|
String colValue =
|
||||||
String colValue =
|
JDBCUtil.convertToString(j, rs, rsmd,
|
||||||
JDBCUtil.convertToString(j, rs, rsmd,
|
driverName);
|
||||||
driverName);
|
|
||||||
|
|
||||||
final Element e = normalDoc.createElement(
|
final Element e = normalDoc.createElement(
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
XMLCharUtil.makeValidNCName(colName));
|
||||||
if (rs.wasNull()) {
|
if (rs.wasNull()) {
|
||||||
colValue = "";
|
colValue = "";
|
||||||
e.setAttribute("isNull", "true");
|
e.setAttribute("isNull", "true");
|
||||||
} else
|
} else
|
||||||
e.setAttribute("isNull", "false");
|
e.setAttribute("isNull", "false");
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
e.appendChild(normalDoc.createTextNode(colValue));
|
||||||
record.appendChild(e);
|
record.appendChild(e);
|
||||||
if (mLogger.isLoggable(Level.FINEST))
|
if (mLogger.isLoggable(Level.FINEST))
|
||||||
mLogger.log(Level.FINEST,
|
mLogger.log(Level.FINEST,
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
"Col Name == " + colName + " and Col Val == " + colValue);
|
||||||
}
|
|
||||||
returnElement.appendChild(record);
|
|
||||||
}
|
}
|
||||||
else
|
returnElement.appendChild(record);
|
||||||
while (rs.next() && (numberOfRecords > 0)) {
|
if (numberOfRecords > 0) {
|
||||||
mRowCount++;
|
|
||||||
if (mLogger.isLoggable(Level.FINE))
|
|
||||||
mLogger.log(Level.FINE,
|
|
||||||
"DBBC_R00706.JDBCN_ProcessNextRecord");
|
|
||||||
final Element record = normalDoc.createElement(
|
|
||||||
"record");
|
|
||||||
for (int j = 1; j <= rsmd.getColumnCount(); j++) {
|
|
||||||
final String colName = validColNames[j - 1];
|
|
||||||
String colValue =
|
|
||||||
JDBCUtil.convertToString(j, rs, rsmd,
|
|
||||||
driverName);
|
|
||||||
|
|
||||||
final Element e = normalDoc.createElement(
|
|
||||||
XMLCharUtil.makeValidNCName(colName));
|
|
||||||
if (rs.wasNull()) {
|
|
||||||
colValue = "";
|
|
||||||
e.setAttribute("isNull", "true");
|
|
||||||
} else
|
|
||||||
e.setAttribute("isNull", "false");
|
|
||||||
e.appendChild(normalDoc.createTextNode(colValue));
|
|
||||||
record.appendChild(e);
|
|
||||||
if (mLogger.isLoggable(Level.FINEST))
|
|
||||||
mLogger.log(Level.FINEST,
|
|
||||||
"Col Name == " + colName + " and Col Val == " + colValue);
|
|
||||||
|
|
||||||
}
|
|
||||||
returnElement.appendChild(record);
|
|
||||||
numberOfRecords--;
|
numberOfRecords--;
|
||||||
|
if (numberOfRecords == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
normalRoot.appendChild(returnElement);
|
normalRoot.appendChild(returnElement);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue