예제 #1
0
  private List getMatchingRowDataList(Map connectorMap, TableData childRt) {
    List filteredList = new ArrayList();
    boolean allPassed = true;
    int size = childRt.getTableSize();
    for (int i = 0; i < size; i++) {
      RowData child = childRt.getRow(i);

      for (Iterator it = connectorMap.keySet().iterator(); it.hasNext(); ) {
        String key = (String) it.next();
        Object keyData = connectorMap.get(key);
        Object rowData = child.getField(key);
        if (rowData == null || !rowData.toString().equalsIgnoreCase(keyData.toString())) {
          allPassed = false;
          break;
        }
      }

      if (allPassed) {
        filteredList.add(child);
      }

      allPassed = true;
    }

    return filteredList;
  }
예제 #2
0
  private void linkParentWithChild(
      TableData parentRt, TableData childRt, String processorName, List connectorList) {
    if (parentRt == null || childRt == null || childRt.getTableSize() == 0) return;

    int size = parentRt.getAllRows().size();
    Map connectorMap = new HashMap();
    for (int i = 0; i < size; i++) {
      RowData parentRow = parentRt.getRow(i);
      populateConnectorMap(connectorMap, parentRow, connectorList);
      parentRow.addChildRowToMap(processorName, getMatchingRowDataList(connectorMap, childRt));

      // clear the map for next row
      connectorMap.clear();
    }
  }