コード例 #1
0
  /**
   * Gets the alias names of the tables in path and adds them in the fromTables Set passed.
   *
   * @param fromTables The Set to which the alias names are to be added.
   * @param tableInPath The ids of tables in path separated by :
   * @throws DAOException
   */
  private void addTablesInPathToFromSet(List fromTables, String tableInPath) throws DAOException {
    StringTokenizer tableInPathTokenizer = new StringTokenizer(tableInPath, ":");
    while (tableInPathTokenizer.hasMoreTokens()) {
      Long tableId = Long.valueOf(tableInPathTokenizer.nextToken());
      QueryBizLogic bizLogic =
          new QueryBizLogic(); // (QueryBizLogic)BizLogicFactory.getBizLogic(Constants.SIMPLE_QUERY_INTERFACE_ID);
      String aliasName = bizLogic.getAliasName(Constants.TABLE_ID_COLUMN, tableId);

      if (aliasName != null) {
        addInListIfNotPresent(fromTables, aliasName);
      }
    }
  }
コード例 #2
0
  /**
   * @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;
  }
コード例 #3
0
 /**
  * @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);
       }
     }
   }
 }