Bug 373582 - XML code completion proposals for class references
Summary: XML code completion proposals for class references
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JPA (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P2 enhancement (vote)
Target Milestone: 3.3 M3   Edit
Assignee: Nan Li CLA
QA Contact:
URL:
Whiteboard: EaseOfUse
Keywords: plan
Depends on:
Blocks:
 
Reported: 2012-03-07 14:40 EST by Karen Butzke CLA
Modified: 2012-10-05 15:33 EDT (History)
1 user (show)

See Also:
neil.hauge: review+


Attachments
proposed patch (94.62 KB, patch)
2012-08-03 12:15 EDT, Nan Li CLA
no flags Details | Diff
proposed patch (86.53 KB, patch)
2012-09-04 13:56 EDT, Nan Li CLA
no flags Details | Diff
NPE when trying to complete "class" value for "partitioning" which may not be directly supported (1.81 KB, text/plain)
2012-10-02 16:36 EDT, Neil Hauge CLA
no flags Details
proposed patch (99.39 KB, patch)
2012-10-03 12:49 EDT, Nan Li CLA
neil.hauge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2012-03-07 14:40:12 EST
bug 188940 covered all of the content assist in XML that we provide in Java. This does not include content assist for class references since in Java those are done  by JDT. We can call this phase 2 for XML content assist.

1. relationship mappings: target-entity - java classes + persistent types in orm.xml
2. collection mappings: map-key-class - java classes + primitives + persistent types in orm.xml
3. element-collection: target-class - java classes + primitives + persistent types in orm.xml
4. entity, mapped-superclass, embeddable class proposals need to include all Classes on the classpath. Also should not limit the choices to those those classes that are in the package specified by the package element
5. converter classes, customizer, id-class, probably more


These are new with dynamic persistence support:

1. attribute-type - this should include all classes, plus primitives. for some mappings this could also includes persistent types listed in the orm.xml since they won't have a corresponding java class

2. parent-class - all java classes + persistent types in the orm.xml
Comment 1 Nan Li CLA 2012-08-03 12:15:48 EDT
Created attachment 219539 [details]
proposed patch

First git patch and hope it works. :)
Comment 2 Neil Hauge CLA 2012-08-03 14:44:33 EDT
Can you confirm that the applicable JUnit tests pass and give a brief technical description of the changes.  Thanks!
Comment 3 Nan Li CLA 2012-08-03 17:11:00 EDT
Yes, JUnit tests all passed. The implementation is pretty much the same as what described in the bug description except for attribute-type.

Code assist for attribute-type works as the following:
1. collection mappings and array mapping: collection types - Collection, List, Map, and Set.
2. embedded, embedded-id and structure mappings: all Java classes + persistent types in the eclipelink_orm.xml
3. version mapping: int, Integer, short, Short, long, Long, Timestamp since the spec says only these types are supported for version properties
4. variable-one-to-one mapping: does not have attribute-type attribute but target-interface whose completion proposals include all Java classes
5. transformation mapping: all Java classes + primitives + collection types + persistent types in the eclipelink_orm.xml (not 100% sure what should be included, but thinking maybe all the types could be transformed)
6. basic and id mapping: primitives
7. 1-1, m-1, basic-map, basic-collection and transient mappings don't have attribute-type attribute.

Notes:
1. Code assist is available for class-extractor element on entity and the completion proposals are all Java classes.
2. Completion proposals are sorted based on groups (Java classes, primitives, collection types, or dynamic persistent types), not all the proposals as a whole to give a better idea where these proposals are from.
3. Code assist is not available for partitioning, entity-listener, cache-interceptor, copy-policy due to lacking of context model support. A separate enhancement will be opened to track that.
4. No public API is added.
5. Java classes don't include the ones from jar files.
6. Package element isn't considered when providing the candidate class references in this implementation. Maybe later?
Comment 4 Neil Hauge CLA 2012-08-31 17:46:10 EDT
I've only found one issue from a functional standpoint.  Basic mapping attribute-type assist is currently limited to primitives + String.  I would expect to see primitive wrappers and the other specific types mentioned in the spec (such as java.util.Date).
Comment 5 Nan Li CLA 2012-09-04 13:56:40 EDT
Created attachment 220692 [details]
proposed patch

This patch includes

- incorporated Karen's changes to code assist (changed method name)
- incorporated Neil's review comments
- made changes to a couple of methods of MappingTools class
Comment 6 Nan Li CLA 2012-09-04 14:28:20 EDT
The latest patch is based on the following commit:

9758de6 support for versionless xml files Paul Fullbright
Comment 7 Neil Hauge CLA 2012-10-02 16:36:17 EDT
Created attachment 221807 [details]
NPE when trying to complete "class" value for "partitioning" which may not be directly supported

Received this NPE when trying to complete "class" value for "partitioning" which may not be something directly supported by this functionality.
Comment 8 Neil Hauge CLA 2012-10-02 17:23:20 EDT
In reference to my last comment, it seems that where content assist is not yet supported, such as partitioning or transformer-class, an NPE is encountered.
Comment 9 Nan Li CLA 2012-10-03 12:49:32 EDT
Created attachment 221855 [details]
proposed patch

This patch 

- fixed the NPE problem
- added missing part for converters including code assist for default-object-value of object-type-converter
- provided only interfaces for target-interface attribute of variable-one-to-one

and is based on the following commit:

575902e Fix bug#386416 - query text area in JPA Details View should be larger Pascal Filion
Comment 10 Neil Hauge CLA 2012-10-05 15:33:03 EDT
Patch committed with some modifications, mostly in the MappingTools class.  There are some limitations to this support, such is assist for areas where we currently have no model.