[
http://jira.jboss.com/jira/browse/GPD-111?page=all ]
Matthew Sandoz reopened GPD-111:
--------------------------------
sorry to have to reopen this but there are several use cases and the one i overlooked
yesterday isnt working.
when i create a node from the palette, the createAdapterFromModel method of the
XmlAdapterFactory is called. At the end of this, the factory calls
createAdapterFromElementName. Unfortunately this doesnt allow the factory to create an
adapter specific to the SemanticElement, but rather the node name. The node name is shared
among many classes and so always returns the same adapter.
I was able to get around this as in my original code by adding the following into the
createAdapterFromModel method:
INodeNotifier element = (INodeNotifier)document.createElement(elementName);
XmlAdapter result;
try {
result = (XmlAdapter)
configurationElement.createExecutableExtension("adapterClass");
result.setNode((Node)element);
result.setFactory(this);
return result;
} catch (CoreException e) {
Logger.logError("Unable to create XML Adapter for " +
jpdlElement.getElementId(), e);
}
right before the final return.
Add ability to forward and reverse map Semantic Elements to/from Dom
Node/Xml Adapters jpdl
-------------------------------------------------------------------------------------------
Key: GPD-111
URL:
http://jira.jboss.com/jira/browse/GPD-111
Project: JBoss jBPM GPD
Issue Type: Feature Request
Components: jpdl
Environment: all? :)
Reporter: Matthew Sandoz
Assigned To: Koen Aers
Fix For: jBPM JPDL Designer 3.1.0.CR
Attachments: solution.zip, solution.zip, solution.zip
Addresses need to add new semantic elements without adding new xml types. Current mapping
forces 1-1 mapping between them.
this change allows one-to-many mapping between elements by introducing a mapping object
for each semantic element.
this mapping object's responsibility is to determine if a chunk of xml should map to
a semantic element and xml adapter or not.
the xml adapter registry holds a set of these mappers and loops through them all, giving
each a chance to accept the xml chunk. all accepting
mappers are then sorted by priority and the lowest priority number is selected. mappings
with no priority are given Integer.MAX priority. Mappings with
no mapperClass are given a default mapper class of ConfiguredSemanticElementDomMapper so
that existing plugin.xml should continue to function
normally.
The priority property allows the maintainer of the plugin.xml to change priorities for
different circumstances, giving different potentially conflicting mappers
a specific preference order.
Details of change:
Added two elements to xmlMappings.exsd: mapperClass and mapperClassPriority
Created interface SemanticElementDomMapper to determine if a given Dom Node can be
assigned to a semantic element
Created class ConfiguredSemanticElementDomMapper as a base implementation of the
SemanticElementDomMapper. This
default implementation checks the current configured xml node name against the node name
of the passed Dom Node. This should
duplicate the existing functionality for existing standard jpdl xml node types.
JythonNodeDomMapper is included as an example but should not be committed to the project
as it is for specialized use.
XmlAdapterRegistry constructs a HashMap of Mappers and has a new
getConfigurationElementByNode method.
XmlAdapter has 2 lines modified in the createSemanticElementFor method to use the new
registry method.
XmlAdapterFactory has modifications in createAdapter and createAdapterFromModel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira