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

Dali/Indigo/DaliRefactoringParticipants

< Dali‎ | Indigo
Revision as of 11:18, 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 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