/**
  * @param fromTables
  * @param queryResultObjectDataMap
  * @param query
  */
 public void createQueryResultObjectData(Set fromTables, Map queryResultObjectDataMap, Query query)
     throws DAOException {
   Iterator iterator = fromTables.iterator();
   String tableAlias;
   QueryResultObjectData queryResultObjectData;
   Vector mainQueryObjects = QueryBizLogic.getMainObjectsOfQuery();
   Logger.out.debug(" tables in query:" + fromTables);
   while (iterator.hasNext()) {
     tableAlias = (String) iterator.next();
     Logger.out.debug("*********** table obtained from fromTables set:" + tableAlias);
     if (mainQueryObjects.contains(tableAlias)) {
       queryResultObjectData = createQueryResultObjectData(tableAlias, fromTables);
       if (query.getColumnIds(tableAlias, queryResultObjectData.getDependentObjectAliases()).size()
           != 0) {
         queryResultObjectDataMap.put(tableAlias, queryResultObjectData);
       }
     }
   }
 }
  /**
   * @param fromAliasNameValue
   * @param fromTables
   * @return
   * @throws DAOException
   */
  public QueryResultObjectData createQueryResultObjectData(
      String fromAliasNameValue, Set fromTables) throws DAOException {
    QueryResultObjectData queryResultObjectData;
    queryResultObjectData = new QueryResultObjectData();
    queryResultObjectData.setAliasName(fromAliasNameValue);
    // Aarti: getting related tables that should be dependent
    // on main object for authorization
    Vector relatedTables = new Vector();
    relatedTables = QueryBizLogic.getRelatedTableAliases(fromAliasNameValue);
    // remove all the related objects that are not part of the current query
    for (int i = 0; i < relatedTables.size(); i++) {
      if (!fromTables.contains(relatedTables.get(i))) {
        relatedTables.remove(i--);
      }
    }

    Logger.out.debug("After removing tables not in query relatedTable:" + relatedTables);
    //					Aarti: Get main query objects which should have individual checks
    // for authorization and should not be dependent on others
    Vector mainQueryObjects = QueryBizLogic.getMainObjectsOfQuery();

    String queryObject;
    // Aarti: remove independent query objects from related objects
    // vector and add them to tableSet so that their authorization
    // is checked individually
    for (int i = 0; i < mainQueryObjects.size(); i++) {
      queryObject = (String) mainQueryObjects.get(i);
      if (relatedTables.contains(queryObject)) {
        relatedTables.remove(queryObject);
        //							tableSet.add(queryObject);
        if (!queryObject.equals(fromAliasNameValue)) {
          queryResultObjectData.addRelatedQueryResultObject(new QueryResultObjectData(queryObject));
        }
      }
    }

    // Aarti: Map all related tables to the main table
    //					relatedTablesMap.put(fromAliasNameValue, relatedTables);
    queryResultObjectData.setDependentObjectAliases(relatedTables);
    return queryResultObjectData;
  }
  /**
   * @param queryResultObjectDataMap
   * @param query
   */
  public List addObjectIdentifierColumnsToQuery(Map queryResultObjectDataMap, Query query) {
    DataElement identifierDataElement;

    List columnNames = new ArrayList();
    Set keySet = queryResultObjectDataMap.keySet();
    Iterator keyIterator = keySet.iterator();
    QueryResultObjectData queryResultObjectData2;
    QueryResultObjectData queryResultObjectData3;
    Vector queryObjects;
    Vector queryObjectNames;
    int initialColumnNumbers = query.getResultView().size();
    Map columnIdsMap;

    for (int i = 0; keyIterator.hasNext(); i++) {
      queryResultObjectData2 =
          (QueryResultObjectData) queryResultObjectDataMap.get(keyIterator.next());
      queryObjects = queryResultObjectData2.getIndependentQueryObjects();
      queryObjectNames = queryResultObjectData2.getIndependentObjectAliases();
      for (int j = 0; j < queryObjects.size(); j++) {
        columnIdsMap = query.getIdentifierColumnIds(queryObjectNames);
        queryResultObjectData3 = (QueryResultObjectData) queryObjects.get(j);
        queryResultObjectData3.setIdentifierColumnId(
            ((Integer) columnIdsMap.get(queryResultObjectData3.getAliasName())).intValue() - 1);
      }
    }
    int columnsAdded = query.getResultView().size() - initialColumnNumbers;
    for (int i = 0; i < columnsAdded; i++) {
      columnNames.add(" ID");
    }
    return columnNames;
  }
 /**
  * @param queryResultObjectDataMap
  * @param query
  */
 public void setDependentIdentifiedColumnIds(Map queryResultObjectDataMap, Query query) {
   Iterator keyIterator;
   QueryResultObjectData queryResultObjectData2;
   QueryResultObjectData queryResultObjectData3;
   Vector queryObjects;
   Set keySet2 = queryResultObjectDataMap.keySet();
   keyIterator = keySet2.iterator();
   for (int i = 0; keyIterator.hasNext(); i++) {
     queryResultObjectData2 =
         (QueryResultObjectData) queryResultObjectDataMap.get(keyIterator.next());
     queryObjects = queryResultObjectData2.getIndependentQueryObjects();
     for (int j = 0; j < queryObjects.size(); j++) {
       queryResultObjectData3 = (QueryResultObjectData) queryObjects.get(j);
       queryResultObjectData3.setDependentColumnIds(
           query.getColumnIds(
               queryResultObjectData3.getAliasName(),
               queryResultObjectData3.getDependentObjectAliases()));
       queryResultObjectData3.setIdentifiedDataColumnIds(
           query.getIdentifiedColumnIds(
               queryResultObjectData3.getAliasName(),
               queryResultObjectData3.getDependentObjectAliases()));
       Logger.out.debug(
           " table:"
               + queryResultObjectData3.getAliasName()
               + " columnIds:"
               + queryResultObjectData3.getDependentColumnIds());
     }
   }
 }