Package org.objectstyle.wolips.eomodeler.core.model

Examples of org.objectstyle.wolips.eomodeler.core.model.EOJoin


  }

  @Override
  public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
    try {
      EOJoin newJoin = null;
      if (_createFK) {
        _foreignKey = _sourceEntity.createForeignKeyTo(_destinationEntity, _fkName, _fkColumnName, false);
        newJoin = new EOJoin();
        newJoin.setSourceAttribute(_foreignKey);
        newJoin.setDestinationAttribute(_destinationEntity.getSinglePrimaryKeyAttribute());
      }
      if (_createInverseFK) {
        _inverseForeignKey = _destinationEntity.createForeignKeyTo(_sourceEntity, _inverseFKName, _inverseFKColumnName, false);
        newJoin = new EOJoin();
        newJoin.setSourceAttribute(_sourceEntity.getSinglePrimaryKeyAttribute());
        newJoin.setDestinationAttribute(_inverseForeignKey);
      }

      if (newJoin != null) {
        _relationship.removeAllJoins();
        _relationship.addJoin(newJoin);
View Full Code Here


      EOEntity destination = relationship.getDestination();
      if (destination != null) {
        value = destination.getName();
      }
    } else if (EOJoin.SOURCE_ATTRIBUTE.equals(_property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        value = firstJoin.getSourceAttribute().getName();
      }
    } else if (EOJoin.DESTINATION_ATTRIBUTE.equals(_property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        value = firstJoin.getDestinationAttribute().getName();
      }
    } else {
      value = super.getComparisonValue(_obj, _property);
    }
    return value;
View Full Code Here

      EOEntity destination = relationship.getDestination();
      if (destination != null) {
        text = destination.getName();
      }
    } else if (EOJoin.SOURCE_ATTRIBUTE.equals(property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        EOAttribute sourceAttribute = firstJoin.getSourceAttribute();
        if (sourceAttribute != null) {
          text = sourceAttribute.getName();
        }
      }
    } else if (EOJoin.DESTINATION_ATTRIBUTE.equals(property)) {
      EOJoin firstJoin = relationship.getFirstJoin();
      if (firstJoin != null) {
        EOAttribute destinationAttribute = firstJoin.getDestinationAttribute();
        if (destinationAttribute != null) {
          text = destinationAttribute.getName();
        }
      }
    } else {
View Full Code Here

      TableUtils.packTableColumns(myJoinsTableViewer);
    }
  }

  protected void addSelectedJoin() {
    EOJoin newJoin = new EOJoin();
    myRelationship.addJoin(newJoin);
    myJoinsTableViewer.setSelection(new StructuredSelection(newJoin));
  }
View Full Code Here

    Object[] selectedJoins = ((IStructuredSelection) myJoinsTableViewer.getSelection()).toArray();
    if (selectedJoins.length > 0) {
      boolean confirmed = MessageDialog.openConfirm(getShell(), Messages.getString("EORelationshipBasicEditorSection.removeJoinsTitle"), Messages.getString("EORelationshipBasicEditorSection.removeJoinsMessage"));
      if (confirmed) {
        for (int joinNum = 0; joinNum < selectedJoins.length; joinNum++) {
          EOJoin join = (EOJoin) selectedJoins[joinNum];
          myRelationship.removeJoin(join);
        }
      }
    }
  }
View Full Code Here

    boolean canModify = true;
    return canModify;
  }

  public Object getValue(Object _element, String _property) {
    EOJoin join = (EOJoin) _element;
    Object value = null;
    if (EOJoin.DESTINATION_ATTRIBUTE_NAME.equals(_property)) {
      String attributeName = join.getDestinationAttributeName();
      if (attributeName != null) {
        value = new Integer(Arrays.asList(join.getRelationship().getDestination().getAttributeNames()).indexOf(attributeName));
      }
    } else if (EOJoin.SOURCE_ATTRIBUTE_NAME.equals(_property)) {
      String attributeName = join.getSourceAttributeName();
      if (attributeName != null) {
        value = new Integer(Arrays.asList(join.getRelationship().getEntity().getAttributeNames()).indexOf(attributeName));
      }
    } else {
      value = super.getValue(_element, _property);
    }
    return value;
View Full Code Here

    return value;
  }

  protected boolean _modify(Object _element, String _property, Object _value) throws Throwable {
    boolean modified = false;
    EOJoin join = (EOJoin) _element;
    if (EOJoin.DESTINATION_ATTRIBUTE_NAME.equals(_property)) {
      Integer attributeIndex = (Integer) _value;
      int attributeIndexInt = attributeIndex.intValue();
      if (join.getRelationship().getDestination() != null) {
        String[] destinationAttributeNames = join.getRelationship().getDestination().getAttributeNames();
        String attributeName = (attributeIndexInt == -1) ? null : (String) destinationAttributeNames[attributeIndexInt];
        join.setDestinationAttributeName(attributeName);
      }
      modified = true;
    } else if (EOJoin.SOURCE_ATTRIBUTE_NAME.equals(_property)) {
      Integer attributeIndex = (Integer) _value;
      int attributeIndexInt = attributeIndex.intValue();
      if (join.getRelationship().getEntity() != null) {
        String[] sourceAttributeNames = join.getRelationship().getEntity().getAttributeNames();
        String attributeName = (attributeIndexInt == -1) ? null : (String) sourceAttributeNames[attributeIndexInt];
        join.setSourceAttributeName(attributeName);
      }
      modified = true;
    }
    return modified;
  }
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EOJoin

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.