Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Dali/Indigo/DaliRefactoringParticipants"

< Dali‎ | Indigo
(Rename Type)
(Java Refactoring Participants)
Line 21: Line 21:
 
***eclipselink.logging.logger
 
***eclipselink.logging.logger
 
***eclipselink.session-event-listener
 
***eclipselink.session-event-listener
*orm.xml mappings files
+
*Mappings files
 
**delete entity/embeddable/mapped-superclass element
 
**delete entity/embeddable/mapped-superclass element
 
** delete other class references
 
** delete other class references
Line 31: Line 31:
 
**** entity class-extractor
 
**** entity class-extractor
 
**** entity/mapped-superclass cache-interceptor
 
**** entity/mapped-superclass cache-interceptor
**if orm.xml file is empty after the entity element is deleted, we could also delete the file itself and the reference to it in the persistence.xml
+
**if mapping file is empty after the entity element is deleted, we could also delete the file itself and the reference to it in the persistence.xml
  
 
===Delete Package===
 
===Delete Package===
Line 45: Line 45:
 
***eclipselink.logging.logger
 
***eclipselink.logging.logger
 
***eclipselink.session-event-listener
 
***eclipselink.session-event-listener
*orm.xml mapping files
+
*Mapping files
 
** rename entity/embeddable/mapped-superclass class element
 
** rename entity/embeddable/mapped-superclass class element
 
** rename other class references
 
** rename other class references
Line 58: Line 58:
 
===Rename Package===
 
===Rename Package===
 
*all items from Rename Type
 
*all items from Rename Type
*orm.xml mapping files
+
*Mapping files
 
**Rename package element - this can be a fragment
 
**Rename package element - this can be a fragment
  
Line 86: Line 86:
 
***Take that metadata and put it on the attribute?  what if it is different from what already exists?
 
***Take that metadata and put it on the attribute?  what if it is different from what already exists?
 
***We can check for all of this information in the refactoring participant and decide whether there is anything we can do.
 
***We can check for all of this information in the refactoring participant and decide whether there is anything we can do.
*orm.xml
+
*Mapping files
 
**we would have to move the mappings to the subclass entity in orm.xml. If the subclass entity does not exist we create it.
 
**we would have to move the mappings to the subclass entity in orm.xml. If the subclass entity does not exist we create it.
  
 
===Pull Up===
 
===Pull Up===
*
+
**Java
 +
*Mapping files
  
 
===Extract Superclass===
 
===Extract Superclass===
Line 97: Line 98:
 
===Extract Class===
 
===Extract Class===
 
*
 
*
 
  
 
==Mapping File Refactoring==
 
==Mapping File Refactoring==

Revision as of 11:18, 14 June 2010

Refactoring

  • Display changes in the Refactoring preview dialog
  • Support Undo
  • Any XML changes will be done without the user having to check the box 'Update fully qualified names in non-Java text files'. Currently the user can get java type renames to be completed in the persistence.xml by checking that box, but a java type delete will not edit the persistence.xml.
  • Support refactorings in 1 project affecting any JpaProject in the workspace


bug 209489

bug 136333


Java Refactoring Participants

Delete Type

  • persistence.xml
    • delete corresponding class element
    • EclipseLink properties - delete if the class matches
      • eclipselink.session.customizer
      • eclipselink.descriptor.customizer
      • eclipselink.logging.logger
      • eclipselink.session-event-listener
  • Mappings files
    • delete entity/embeddable/mapped-superclass element
    • delete other class references
      • id-class element
      • element-collection map-key-class
      • 1-m/m-m map-key-class
      • EclipseLink
        • entity/mapped-superclass/embeddable customizer
        • entity class-extractor
        • entity/mapped-superclass cache-interceptor
    • if mapping file is empty after the entity element is deleted, we could also delete the file itself and the reference to it in the persistence.xml

Delete Package

  • all items from Delete Type - multiple types will be deleted when a package is deleted
  • package element in an orm.xml - delete it if it matches?

Rename Type

  • persistence.xml
    • udpate class element
    • EclipseLink properties - rename if the class matches
      • eclipselink.session.customizer
      • eclipselink.descriptor.customizer
      • eclipselink.logging.logger
      • eclipselink.session-event-listener
  • Mapping files
    • rename entity/embeddable/mapped-superclass class element
    • rename other class references
      • id-class element
      • element-collection map-key-class
      • 1-m/m-m map-key-class
      • EclipseLink
        • entity/mapped-superclass/embeddable customizer
        • entity class-extractor
        • entity/mapped-superclass cache-interceptor

Rename Package

  • all items from Rename Type
  • Mapping files
    • Rename package element - this can be a fragment

Move Type

  • all items from Rename Type

Rename Field/Method

  • Java
    • rename mappedBy
    • rename MapsId
    • rename MapKey
    • rename AttributeOverride name
    • rename AssociationOverride name
  • Mapping files
    • rename corresponding mapping
    • rename mapped-by
    • rename maps-id
    • rename map-key
    • rename attribute-override name
    • rename association-override name

Push Down

  • Java
    • Annotations move with the method/field
    • What if there are attribute overrides on the subclass for the fields that are being move?
      • Remove the attribute overrides?
      • Take that metadata and put it on the attribute? what if it is different from what already exists?
      • We can check for all of this information in the refactoring participant and decide whether there is anything we can do.
  • Mapping files
    • we would have to move the mappings to the subclass entity in orm.xml. If the subclass entity does not exist we create it.

Pull Up

    • Java
  • Mapping files

Extract Superclass

Extract Class

Mapping File Refactoring

Delete Mapping File

  • persistence.xml
    • delete mapping-file reference

Rename Mapping File

  • persistence.xml
    • update mapping-file reference
    • Rename the default orm.xml/ecliselink-orm.xml file we could add a reference to it in the persistence.xml if it does not exist

Move Mapping File

  • persistence.xml
    • update mapping-file reference

JPA DB Metadata Refactoring Participants

We need a JPA project preference for these since it would only apply for someone who is not generating their schema.

  • Rename/Move Type
    • Add @Table if name is not currently specified(only if it currently matches a table on the database? - would have to be connected)
      • Entity name specified - no need to add @Table
      • Inheritance SINGLE_TABLE strategy - no need to add @Table if not the root
  • Rename attribute
    • Insert @Column if name is not currently specified
    • Insert @JoinColumn

Refactoring Contributions

  • Move annotations to xml
  • Move xml to annotations

Back to the top