XML file
--------------------
<GDPRTableList>
<delete> <table> <Name>ExpenseReportLineAutoApproved</Name> <query>select * from ExpenseReportLineAutoApproved where ExpenseReportLineId in (select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineApprovalChain</Name> <query>select * from ExpenseReportLineApprovalChain where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineWorkflowHist</Name> <query>select * from ExpenseReportLineWorkflowHist where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineWorkflowState</Name> <query>select * from ExpenseReportLineWorkflowState where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineItemMessage</Name> <query>select * from ExpenseReportLineItemMessage where ExpenseReportLineItemId in(select ExpenseReportLineItemId from ExpenseReportLineitem where ExpenseReportLineId in (Select ExpenseReportLineId from Expensereportline where ExpenseReportId in (Select Documentid from Document where SubmittedForId = ?)))</query> </table>
<table> <Name>ERLineItemAllocation</Name> <query>select * from ERLineItemAllocation where ExpenseReportLineItemId in(select ExpenseReportLineItemId from ExpenseReportLineitem where ExpenseReportLineId in (Select ExpenseReportLineId from Expensereportline where ExpenseReportId in (Select Documentid from Document where SubmittedForId = ?)))</query> </table> <table> <Name>ExpenseReportLineItemTax</Name> <query>select * from ExpenseReportLineItemTax where ExpenseReportLineItemId in(select ExpenseReportLineItemId from ExpenseReportLineitem where ExpenseReportLineId in (Select ExpenseReportLineId from Expensereportline where ExpenseReportId in (Select Documentid from Document where SubmittedForId = ?)))</query> </table>
<table> <Name>ExpenseReportLineItemAttendee</Name> <query>select * from ExpenseReportLineItemAttendee where ERLineItemAttendeeListId in(Select ERLineItemAttendeeListId from ERLineItemAttendeeList where ExpenseReportLineItemId in (Select ExpenseReportLineItemId from ExpenseReportLineItem where ExpenseReportLineId in(Select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in(Select ExpenseReportId from Expensereport where ExpenseReportId in (Select DocumentId from Document where SubmittedForId = ?)))))</query> </table>
<table> <Name>ERLineItemAttendeeList</Name> <query>select * from ERLineItemAttendeeList where ExpenseReportLineItemId in (select ExpenseReportLineItemId from ExpenseReportLineItem where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in(select ExpenseReportId from Expensereport where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))))</query> </table>
<table> <Name>ExpenseReportLineitem</Name> <query>select * from ExpenseReportLineitem where ExpenseReportLineId in (Select ExpenseReportLineId from Expensereportline where ExpenseReportId in (Select Documentid from Document where SubmittedForId = ?))</query> </table> <table> <Name>ExpenseReportLineAllocation</Name> <query>select * from ExpenseReportLineAllocation where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineAttendee</Name> <query>select * from ExpenseReportLineAttendee where ERLineAttendeeListId in (select ERLineAttendeeListId from ExpenseReportLineAttendeeList where ExpenseReportLineId in (select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?)))</query> </table>
<table> <Name>ExpenseReportLineAttendeeList</Name> <query>select * from ExpenseReportLineAttendeeList where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in(Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineMessage</Name> <query>select * from ExpenseReportLineMessage where ExpenseReportLineId in ( select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineMileage</Name> <query>select * from ExpenseReportLineMileage where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ExpenseReportLineTax</Name> <query>select * from ExpenseReportLineTax where ExpenseReportLineId in(select ExpenseReportLineId from ExpenseReportLine where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>CashAdvance</Name> <query>select * from CashAdvance where Employeeid=?</query> </table>
<table> <Name>CCTransaction_AirRail</Name> <query>select * from CCTransaction_AirRail where ChargeCardTransactionid in (select ChargeCardTransactionid from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?))</query> </table>
<table> <Name>CCTransaction_Car</Name> <query>select * from CCTransaction_Car where ChargeCardTransactionid in (select ChargeCardTransactionid from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?))</query> </table>
<table> <Name>CCTransaction_Lodging</Name> <query>select * from CCTransaction_Lodging where ChargeCardTransactionid in (select ChargeCardTransactionid from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?))</query> </table>
<table> <Name>CCTransaction_Purchasing</Name> <query>select * from CCTransaction_Purchasing where ChargeCardTransactionid in (select ChargeCardTransactionid from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?))</query> </table>
<table> <Name>ChargeCardTransactionAdd</Name> <query>select * from ChargeCardTransactionAdd where ChargeCardTransactionid in (select ChargeCardTransactionid from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?))</query> </table>
<table> <Name>ExpenseReportLine</Name> <query>select * from ExpenseReportLine where ExpenseReportId in (select ExpenseReportId from ExpenseReport where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?))</query> </table>
<table> <Name>ChargeCardTransaction</Name> <query>select * from ChargeCardTransaction where ChargeCardID in (select ChargeCardId from ChargeCard where EmployeeId=?)</query> </table>
<table> <Name>AcknowledgeMessage</Name> <query>select * from AcknowledgeMessage where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>ERDefaultAllocation</Name> <query>select * from ERDefaultAllocation where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>ExpenseReportMessage</Name> <query>select * from ExpenseReportMessage where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>ExpenseReport</Name> <query>select * from ExpenseReport where ExpenseReportId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>DocumentWorkflowState</Name> <query>select * from DocumentWorkflowState where DocumentId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>DocumentWorkflowHist</Name> <query>select * from DocumentWorkflowHist where DocumentId in (Select DocumentId from Document where SubmittedForId=?)</query> </table>
<table> <Name>Document</Name> <query>select * from Document where SubmittedForId=?</query> </table>
<table> <Name>ChargeCard</Name> <query>select * from ChargeCard where EmployeeId=?</query> </table>
<table> <Name>EmployeeBankingInfo</Name> <query>select * from EmployeeBankingInfo where EmployeeId=?</query> </table>
<table> <Name>SplitFormulaEmployee</Name> <query>select * from SplitFormulaEmployee where EmployeeId=?</query> </table>
<table> <Name>PettyCashTransaction</Name> <query>select * from PettyCashTransaction where EmployeeId = ?</query> </table>
<table> <Name>EmployeeMessage</Name> <query>select * from EmployeeMessage where EmployeeId = ?</query> </table>
<table> <Name>EmployeeSummary</Name> <query>select * from EmployeeSummary where EmployeeId=?</query> </table>
<table> <Name>EmployeeProxy</Name> <query>select * from EmployeeProxy where EmployeeId= ?</query> </table>
<table> <Name>EmployeeProxyApprover</Name> <query>select * from EmployeeProxyApprover where EmployeeId=?</query> </table>
<table> <Name>EmployeeDocumentType</Name> <query>select * from EmployeeDocumentType where EmployeeId=?</query> </table>
<table> <Name>EmployeeCorporateInfo</Name> <query>select * from EmployeeCorporateInfo where EmployeeId=?</query> </table>
<table> <Name>EmployeeAttendee</Name> <query>select * from EmployeeAttendee where EmployeeId=?</query> </table>
<table> <Name>EmployeeApprovalChain</Name> <query>select * from EmployeeApprovalChain where EmployeeId=?</query> </table>
<table> <Name>EmployeeVehicle</Name> <query>select * from EmployeeVehicle where EmployeeId=?</query> </table>
<table> <Name>Employee</Name> <query>select * from Employee where EmployeeId=?</query> </table>
<table> <Name>UserAccountSubRole</Name> <query>select * from UserAccountSubRole where UserAccountId=?</query> </table>
<table> <Name>UserAccountSession</Name> <query>select * from UserAccountSession where UserAccountId=?</query> </table>
<table> <Name>UserAccountRole</Name> <query>select * from UserAccountRole where UserAccountId=?</query> </table>
<table> <Name>UserNotification</Name> <query>select * from UserNotification where UserNotificationid in (select UserNotificationid from UserNotificationRecipient where RecipientId=?)</query> </table>
<table> <Name>UserAccountIntegration</Name> <query>select * from UserAccountIntegration where UserAccountId=?</query> </table>
<table> <Name>UserAccountScope</Name> <query>select * from UserAccountScope where UserAccountId = ?</query> </table>
<table> <Name>UserAccountPWDHistory</Name> <query>select * from UserAccountPWDHistory where UserAccountId = ?</query> </table>
<table> <Name>UserAccount</Name> <query>select * from UserAccount where UserAccountId = ?</query> </table>
<table> <Name>ApprovalChainApprover</Name> <query>select * from ApprovalChainApprover where ApproverId=?</query> </table>
<table> <Name>UserNotificationRecipient</Name> <query>select * from UserNotificationRecipient where RecipientId = ?</query> </table> </delete>
<update> <table> <Name>ExpenseReportLineApprovalChain</Name> <query>select * from ExpenseReportLineApprovalChain where ApproverId=?</query> </table>
<table> <Name>ExpenseReportLineAutoApproved</Name> <query>select * from ExpenseReportLineAutoApproved where ApproverId=?</query> </table>
<table> <Name>ExpenseReportLineWorkflowHist</Name> <query>select * from ExpenseReportLineWorkflowHist where PerformedById=? OR SentToId=?</query> </table>
<table> <Name>DocumentWorkflowHist</Name> <query> select * from DocumentWorkflowHist where PerformedById=?</query> </table>
<table> <Name>EmployeeProxy</Name> <query>select * from EmployeeProxy Where ProxyId = ?</query> </table>
<table> <Name>EmployeeProxyApprover</Name> <query>select * from EmployeeProxyApprover Where ApproverId = ?</query> </table>
<table> <Name>ExpenseReportLine</Name> <query>select * from ExpenseReportLine where OwnerId=?</query> </table>
<table> <Name>Employee</Name> <query>select * from Employee where ManagerId = ?</query> </table>
<table> <Name>Document</Name> <query>select * from Document where ((CreatedById = ? or SubmittedById = ?) and SubmittedForId != ?) or CheckedOutById = ?</query> </table>
<table> <Name>PettyCash</Name> <query>select * from PettyCash where UserAccountId = ?</query> </table>
<table> <Name>FilterableVersion</Name> <query>select * from FilterableVersion where CreatedById = ?</query> </table>
<table> <Name>UserNotification</Name> <query>select * from UserNotification where SenderId = ?</query> </table>
</update> </GDPRTableList>
Reading Above XML --------------------------- /* * Method reads the xml file adds values in <key,value> pair in linked hashmap * tableName as Key , Select Query as Value */ public boolean readFile() { boolean success = true; String line = ""; int lineNumber = 0;
deleteTableMap = new LinkedHashMap<String, String>(); updateTableMap = new LinkedHashMap<String, String>();
try {
NDebug.writeDebugMethodBegan("readFile");
domparser = new DOMParser(); domparser.parse(getSourceName()); document = domparser.getDocument();
NodeList deletenodeList = document.getElementsByTagName("delete");
for (int i = 0; i < deletenodeList.getLength(); i++) {
Node deleteNode = deletenodeList.item(i);
Element deleteElement = (Element) deleteNode;
NodeList tablesInDeleteNodeList = deleteElement.getElementsByTagName("table");
for (int j = 0; j < tablesInDeleteNodeList.getLength(); j++) {
Node nodesUnderDeleteTag = tablesInDeleteNodeList.item(j);
Element nodesUnderDeleteTagElement = (Element) nodesUnderDeleteTag;
String key = getTagValue("Name", nodesUnderDeleteTagElement); String value = getTagValue("query", nodesUnderDeleteTagElement);
deleteTableMap.put(key.trim(), value.trim());
}
}
NodeList tabelsInUpdateNodeList = document.getElementsByTagName("update");
for (int i = 0; i < tabelsInUpdateNodeList.getLength(); i++) {
Node updateNode = tabelsInUpdateNodeList.item(i);
Element updatesElement = (Element) updateNode;
NodeList updateNodesList = updatesElement.getElementsByTagName("table");
for (int j = 0; j < updateNodesList.getLength(); j++) {
Node nodesUnderUpdateTag = updateNodesList.item(j);
Element nodesUnderUpdateTagElement = (Element) nodesUnderUpdateTag;
String key = getTagValue("Name", nodesUnderUpdateTagElement); String value = getTagValue("query", nodesUnderUpdateTagElement);
updateTableMap.put(key.trim(), value.trim());
}
}
}
catch (IOException e) { success = false; getProcessLog().log("I/O error occured while attempting to open source " + getSourceName(), NErrorLog.ERROR); getProcessLog().log(e.getMessage(), NErrorLog.ERROR);
} catch (SAXException e) {
success = false; getProcessLog().log("Parsing error occured while attempting to open source " + getSourceName(), NErrorLog.ERROR); getProcessLog().log(e.getMessage(), NErrorLog.ERROR);
} catch (NoSuchElementException e) { success = false; getProcessLog().log("Line " + lineNumber + " could not be parsed.", NErrorLog.ERROR); getProcessLog().log(e.getMessage(), NErrorLog.ERROR); } finally { NDebug.writeDebugMethodFinished("readFile");
} return success;
}
private String getTagValue(String tag, Element element) { NodeList nodeList = element.getElementsByTagName(tag).item(0).getChildNodes(); Node node = (Node) nodeList.item(0); return node.getNodeValue(); }
--------------------
Comments
Post a Comment