Examples of ForeignKeyVO


Examples of org.jallinone.sqltool.java.ForeignKeyVO

   */
  private void init(boolean disableGrid) {
    try {
      // retrieve columns that must be defined as lookups...
      Iterator it = tableVO.getForeingKeys().values().iterator();
      ForeignKeyVO fk = null;
      String colName = null;
      Hashtable fks = new Hashtable(); // collection of pairs < fktable.fkcolumn , ForeignKeyVO >
      HashSet colsToDisable = new HashSet(); // collection of fktable.fkcolumn that must be disabled in grid
      while(it.hasNext()) {
        fk = (ForeignKeyVO)it.next();
        colName = fk.getFkTableName()+"."+fk.getFkFieldNames().get(fk.getFkFieldNames().size()-1); // fktable.fkcolumn
        fks.put(colName,fk);
        for(int i=0;i<fk.getFkFieldNames().size()-1;i++)
          colsToDisable.add(fk.getFkTableName()+"."+fk.getFkFieldNames().get(i)); // fktable.fkcolumn
      }

      // create table content...
      jbInit();

      ArrayList cols = tableVO.getColumns();
      grid.setMaxSortedColumns(cols.size());
      ColumnVO vo = null;
      int t;
      Column col = null;
      for(int i=0;i<cols.size();i++) {
        vo = (ColumnVO)cols.get(i);
        t = vo.getColumnSqlType();

        if (vo.getColumnValues()!=null && vo.getColumnValues().size()>0) {
          // column is a combo box...
          col = new ComboColumn();
          Domain domain = new Domain(vo.getColumnName());
          for(int j=0;j<vo.getColumnValues().size();j++)
            domain.addDomainPair(vo.getColumnValues().get(j),vo.getColumnValues().get(j).toString());
          ((ComboColumn)col).setDomain(domain);
        }
        else if (fks.containsKey(vo.getColumnName()) &&
                 t!=Types.DATE && t!=Types.TIMESTAMP && t!=Types.TIME) {
          // lookup...
          col = new CodLookupColumn();
          ((CodLookupColumn)col).setMaxCharacters(vo.getColumnSize().intValue());
          ((CodLookupColumn)col).setAllowOnlyNumbers(t!=Types.VARCHAR && t!=Types.CHAR);
          if (t==Types.CHAR)
            ((CodLookupColumn)col).setCodePadding(true);
          fk = (ForeignKeyVO)fks.get(vo.getColumnName());
          ((CodLookupColumn)col).setEnableCodBox(fk.getFkFieldNames().size()==1);

          // retrieve primary key table infos...
          String sql = "select * from "+fk.getPkTableName();
          TableVO auxVO = new TableVO(sql,new ArrayList(),false);
          Response res = ClientUtils.getData("getQueryInfo",auxVO);
          if (res.isError())
            JOptionPane.showMessageDialog(
              MDIFrame.getInstance(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.