Package net.sf.minuteProject.configuration.bean.model.data

Examples of net.sf.minuteProject.configuration.bean.model.data.Reference


    List<Column> noPrimaryKeyNoForeignKeyColumnsName = new ArrayList<Column>();
    if (noPrimaryKeyNoForeignKeyColumns==null) {
      // populate with foreign key columns
      ForeignKey [] foreignKeys =  getForeignKeys();
      for (int i=0; i < foreignKeys.length; i++) {
        Reference references [] = foreignKeys[i].getReferences();
        for (int j=0; j < references.length; j++) {
          primaryKeyAndForeignKeyColumnsName.add (references[j].getLocalColumnName());
        }
      }
      // add pk columns
View Full Code Here


        boolean error = false;
        for (int i = 0; i < table.getForeignKeys().length; i++) {
          error = false;
          org.apache.ddlutils.model.ForeignKey foreignKeyddlutils = table.getForeignKeys()[i];
          org.apache.ddlutils.model.Reference referenceddlutils = foreignKeyddlutils.getFirstReference();
        Reference reference = new ReferenceDDLUtils (referenceddlutils);

        Table foreignTable = TableUtils.getTable(database,foreignKeyddlutils.getForeignTableName());
        Column foreignCol = new ColumnDDLUtils(referenceddlutils.getForeignColumn(),foreignTable);
        foreignCol.setAlias(ReferenceUtils.getColumnAlias(foreignTable, foreignCol));
        reference.setForeignColumn(foreignCol);
        reference.setForeignColumnName(referenceddlutils.getForeignColumnName());
        reference.setForeignTable(foreignTable);
        reference.setForeignTableName(foreignKeyddlutils.getForeignTableName());
        Column localCol = new ColumnDDLUtils(referenceddlutils.getLocalColumn(), this);
        reference.setLocalColumn(localCol);
        Table localTable = new TableDDLUtils(table);
        reference.setLocalTable(localTable);
        localCol.setAlias(ReferenceUtils.getColumnAlias(localTable, localCol));
        if (reference.getForeignColumnName()==null) {
          System.out.println ("error in ref : no column on "+table.getName()+" - "+reference.getLocalColumnName());
          error = true;
        }
         
        if (!error)
          //parents.add(reference);
View Full Code Here

//      return (Reference[])parents.toArray(new Reference[parents.size()]); 
//    }

  public void setForeignKey(ForeignKey foreignKey) {
    getForeignKeyList().add(foreignKey);
    Reference ref = ReferenceDDLUtils.clone(foreignKey.getFirstReference());
    if (!isPresent(getParentList(), ref))
      getParentList().add(ref);
    children = null;
    columns = null;
    resetNoPrimaryKeyNoForeignKeyColumns();
View Full Code Here

     */
    public Reference [] getChildren() {
      if (children == null) {
        children = new ArrayList<Reference>();
      String columnRef;
      Reference ref;
      Reference reference;
      Table [] tables = database.getEntities();
        for (int i = 0; i < tables.length; i++) {
          ForeignKey [] fk = tables[i].getForeignKeys();
            for (int j = 0; j < fk.length; j++) {
              String tableName = fk[j].getForeignTableName();
              if (tableName!=null) {
                if (tableName.toLowerCase().equals(table.getName().toLowerCase())) {
                  ref = fk[j].getReference(0);
                  columnRef = ref.getLocalColumnName();
                  Column column = ColumnUtils.getColumn (tables[i], ref.getLocalColumnName());
                  //reference = new Reference(tables[i], column2, tables[i].getName(), ref.getLocalColumnName());

                  //org.apache.ddlutils.model.ForeignKey foreignKeyddlutils = tables[i].getForeignKeys()[j].getFirstReference();
                  //org.apache.ddlutils.model.Reference referenceddlutils = foreignKeyddlutils.getFirstReference();
                reference = tables[i].getForeignKeys()[j].getFirstReference();
               
                  //reference = new ReferenceDDLUtils (new org.apache.ddlutils.model.Reference ());
                reference.setForeignColumn(column);
                reference.setForeignColumnName(column.getName());
                reference.setForeignTable(tables[i]);
                reference.setForeignTableName(tables[i].getName());
                //ColumnDDLUtils localCol = (ColumnDDLUtils)TableUtils.getPrimaryFirstColumn(new TableDDLUtils(table));
                //ColumnDDLUtils columnLoc = new ColumnDDLUtils(localCol, new TableDDLUtils(table));
                reference.setLocalColumn(TableUtils.getPrimaryFirstColumn(new TableDDLUtils(table)));
                reference.setLocalTable(new TableDDLUtils(table));
                //reference.setLocalColumn(localCol);

                addReference(children, reference);
                }
              }
View Full Code Here

  public void setAggregateRelationship() {
    relationshipOwnership = Owner.AGGREGATE;
  }

  public static Reference clone (Reference reference) {
    Reference ref = new ReferenceDDLUtils (new org.apache.ddlutils.model.Reference());
    ref.setForeignColumn(reference.getForeignColumn());
    ref.getForeignColumn().setAlias(reference.getForeignColumn().getAlias());
    ref.setForeignColumnName(reference.getForeignColumnName());
    ref.setForeignTable(reference.getForeignTable());
    ref.setForeignTableName(reference.getForeignTableName());
    ref.setLocalColumn(reference.getLocalColumn());
    ref.getLocalColumn().setAlias(reference.getLocalColumn().getAlias());
    ref.setLocalColumnName(reference.getLocalColumnName());
    ref.setLocalTable(reference.getLocalTable());
    ref.setLocalTableName(reference.getLocalTableName());    
    return ref;
  }
View Full Code Here

//          ref.setForeignTableName(reference.getLocalTableName());
//          ref.setLocalColumn(reference.getForeignColumn());
//          ref.setLocalColumnName(reference.getForeignColumnName());
//          ref.setLocalTable(reference.getForeignTable());
//          ref.setLocalTableName(reference.getForeignTableName());
          Reference ref = ReferenceDDLUtils.clone(foreignKey.getFirstReference());

//          ref.setForeignColumn(reference.getForeignColumn());
//          ref.setForeignColumnName(reference.getForeignColumnName());
//          ref.setForeignTable(reference.getForeignTable());
//          ref.setForeignTableName(reference.getForeignTableName());
View Full Code Here

    public Reference[] getReferences()
    {
      if (references == null) {
        references = new ArrayList<Reference>();
        for (int i = 0; i < foreignKey.getReferenceCount(); i++) {
          Reference reference = new ReferenceDDLUtils (foreignKey.getReference(i));
          //reference.setLocalColumn(reference.getLocalColumn());
          references.add(reference);
        }
      }
      return (Reference[])references.toArray(new Reference[references.size()]);         
View Full Code Here

     *
     * @return The first reference
     */
    public Reference getFirstReference()
    {
      Reference ref = getFirstReferenceFormReferencesList();//new ReferenceDDLUtils (foreignKey.getFirstReference());
      if (ref==null) {// case autoprovisioning in enrichment of views
        return new ReferenceDDLUtils (foreignKey.getFirstReference());//getFirstReferenceFormReferencesList();
      }
      return ref;
        //        return new ReferenceDDLUtils (foreignKey.getFirstReference());
View Full Code Here

 
  public static Reference getTargetReferenceEntityByMany2ManyForTag (Reference origin, Table many2many, String tag) {
    if (many2many.isManyToMany()) {
      Reference[] m2mReference = getLinkedReferenceByForeignKeyForTag(many2many, tag);
      for (int i = 0; i < m2mReference.length; i++) {
        Reference ref = m2mReference[i];
//        System.out.println("origin = "+origin.getLocalColumnName()+"-"+origin.getLocalTableName()+"-"+origin.getForeignColumnName()+"-"+origin.getForeignTableName());
//        System.out.println("ref = "+ref.getLocalColumnName()+"-"+ref.getLocalTableName()+"-"+ref.getForeignColumnName()+"-"+ref.getForeignTableName());
        if (!isEqual(origin, ref))
          return ref;
//        if (!ref.getLocalColumnName().equals(origin.getForeignColumnName()) ||
View Full Code Here

 
  public static Reference getTargetReferenceEntityByMany2Many (Reference origin, Table many2many) {
    if (many2many.isManyToMany()) {
      Reference[] m2mReference = getLinkedReferenceByForeignKey(many2many);
      for (int i = 0; i < m2mReference.length; i++) {
        Reference ref = m2mReference[i];
        if (!isEqual(origin, ref)) {
//          if (origin.isMasterRelationship())
//            ref.setAggregateRelationship();
          return ref;
        }
View Full Code Here

TOP

Related Classes of net.sf.minuteProject.configuration.bean.model.data.Reference

Copyright © 2018 www.massapicom. 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.