Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

DaliRefactoringParticipants

Revision as of 09:47, 14 June 2010 by Karen.moore.oracle.com (Talk | contribs) (Java Refactoring Participants)

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 class elements from that match the deleted package
    • EclipseLink properties - delete if the class matches
      • eclipselink.session.customizer
      • eclipselink.descriptor.customizer
      • eclipselink.logging.logger
      • eclipselink.session-event-listener
  • orm.xml mappings files
    • delete entity/embeddable/mapped-superclass class element
    • Package element in an orm.xml - delete it if it matches?
    • 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

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 elements that match the package to be renamed
    • EclipseLink properties - rename if the class matches
      • eclipselink.session.customizer
      • eclipselink.descriptor.customizer
      • eclipselink.logging.logger
      • eclipselink.session-event-listener
  • orm.xml 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
  • orm.xml 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.
  • orm.xml
    • 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

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

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 name is not currently specified
    • Insert @JoinColumn

Refactoring Contributions

  • Move annotations to xml
  • Move xml to annotations

Back to the top