cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "priyanka (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (CAY-1469) Modeler: dbRelationships renaming problem
Date Thu, 19 May 2011 12:43:47 GMT

    [ https://issues.apache.org/jira/browse/CAY-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13036158#comment-13036158
] 

priyanka edited comment on CAY-1469 at 5/19/11 12:41 PM:
---------------------------------------------------------

// ResolveDbRelationshipDialog.java ----> save() 
 // extract names...
        String sourceEntityName = name.getText();
      
        ObjRelationship objRelationship = null, objReverseRelation = null;
        for (ObjEntity obj : relationship.getSourceEntity().getDataMap().getObjEntities())
{
            if (obj.getDbEntityName().equals(relationship.getSourceEntity().getName())) {
                objRelationship = obj.getRelationshipForDbRelationship(relationship);
                break;
            }
        }
  
      if (objRelationship != null) {
            if (!Util.nullSafeEquals(sourceObjEntityName, objRelationship.getName())) {
                String oldName = objRelationship.getName();

                ProjectUtil.setRelationshipName(
                        objRelationship.getSourceEntity(),
                        objRelationship,
                        sourceObjEntityName);

                ProjectUtil.setRelationshipName(
                        objRelationship.getTargetEntity(),
                        objReverseRelation,
                        targetObjEntityName);

                undo.addNameUndo(objRelationship, oldName, sourceObjEntityName);

                getMediator().fireObjRelationshipEvent(
                        new RelationshipEvent(this, objRelationship, objRelationship
                                .getSourceEntity(), oldName));

                getMediator().fireObjRelationshipEvent(
                        new RelationshipEvent(
                                this,
                                objReverseRelation,
                                objReverseRelation.getTargetEntity(),
                                objReverseRelation.getName()));
            }
        }


      was (Author: pinky):
    // ResolveDbRelationshipDialog.java ----> save() 
 // extract names...
        String sourceEntityName = name.getText();
        // issue 1469
        ObjRelationship objRelationship = null, objReverseRelation = null;
        for (ObjEntity obj : relationship.getSourceEntity().getDataMap().getObjEntities())
{
            if (obj.getDbEntityName().equals(relationship.getSourceEntity().getName())) {
                objRelationship = obj.getRelationshipForDbRelationship(relationship);
                break;
            }
        }
// issue 1469
        if (objRelationship != null) {
            if (!Util.nullSafeEquals(sourceObjEntityName, objRelationship.getName())) {
                String oldName = objRelationship.getName();

                ProjectUtil.setRelationshipName(
                        objRelationship.getSourceEntity(),
                        objRelationship,
                        sourceObjEntityName);

                ProjectUtil.setRelationshipName(
                        objRelationship.getTargetEntity(),
                        objReverseRelation,
                        targetObjEntityName);

                undo.addNameUndo(objRelationship, oldName, sourceObjEntityName);

                getMediator().fireObjRelationshipEvent(
                        new RelationshipEvent(this, objRelationship, objRelationship
                                .getSourceEntity(), oldName));

                getMediator().fireObjRelationshipEvent(
                        new RelationshipEvent(
                                this,
                                objReverseRelation,
                                objReverseRelation.getTargetEntity(),
                                objReverseRelation.getName()));
            }
        }

  
> Modeler: dbRelationships renaming problem
> -----------------------------------------
>
>                 Key: CAY-1469
>                 URL: https://issues.apache.org/jira/browse/CAY-1469
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Modeler
>            Reporter: Ksenia Khailenko
>            Priority: Minor
>
> While the renaming of db relationships leaves the corresponding obj relationships without
renaming and this may be not user-friendly, but doesn't cause the error, there exist the problem
with flattened obj attributes. For example, let there is a dbEntity "DbEntity" with db relationship
"rel" and some attribute, which dbpath goes through this relation: attr_db_path="rel.some_property".
 So, when I change name of relationship from "rel" to "anotherRel", the table of object attributes
is redrawn incorrectly(empty cells), and on attempt to save there fails an error:
> org.apache.cayenne.exp.ExpressionException: [v.3.0-SNAPSHOT Jul 28 2010 10:27:31] Can't
resolve path component: [DbEntity.rel].
> 	at org.apache.cayenne.map.Entity$PathIterator.next(Entity.java:439)
> 	at org.apache.cayenne.map.Entity$PathIterator.next(Entity.java:1)
> 	at org.apache.cayenne.map.ObjAttribute.getDbAttribute(ObjAttribute.java:170)
> 	at org.apache.cayenne.project.validator.ObjAttributeValidator.validateObject(ObjAttributeValidator.java:128)
> 	at org.apache.cayenne.project.validator.TreeNodeValidator.validate(TreeNodeValidator.java:133)
> 	at org.apache.cayenne.project.validator.Validator.validate(Validator.java:162)
> 	at org.apache.cayenne.project.validator.Validator.validate(Validator.java:148)
> 	at org.apache.cayenne.modeler.action.SaveAsAction.performAction(SaveAsAction.java:127)
> 	at org.apache.cayenne.modeler.action.SaveAsAction.performAction(SaveAsAction.java:122)
> 	at org.apache.cayenne.modeler.util.CayenneAction.actionPerformed(CayenneAction.java:163)
> 	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2028)
> 	............................

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message