Custom-Mapping of IDs to names

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Custom-Mapping of IDs to names

Post by Patrik » Wed Nov 11, 2020 7:03 pm

Hi,

I have a usecase where the XML file needs to cntains IDs but the user should be able to see and search for a name. The mapping I will need to get at runtime (or when starting to edit the xml file) from another webservice.

So I have actuelly two oxygen related issues:
  1. Display the name for the ID in author mode? (In oXygen desktop version I used the LinkTextResolver in a similar usecase).
  2. Since there might be 1000+ possible IDs I need a dialog for the user to find the correct ID with a full text search in the names. I guess I will need to implement a custom action to create such a dialog with javascript, or do you have any other suggestions?
Thanks and regards,
Patrik

cristi_talau
Posts: 332
Joined: Thu Sep 04, 2014 4:22 pm

Re: Custom-Mapping of IDs to names

Post by cristi_talau » Thu Nov 12, 2020 9:04 pm

Hello,

Your use-case is fairly common.

Regarding the LinkTextResolver approach, I expect to work in Web Author as well. In the DITA framework we use this approach to present topic title for links.

Regarding the ID chooser, yes, you will need to create a custom action and bind it to a form control. Although the action will be implemented in JS you will need to define the action in the framework configuration as well (only the rendering properties - see the note here [1]). Other useful information can be found here [2].

Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... zzf_pns_vz
[2] https://www.oxygenxml.com/maven/com/oxy ... ialog.html

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Custom-Mapping of IDs to names

Post by Patrik » Mon Nov 16, 2020 6:59 pm

Hi Christian,

thanks for the hints. Adding an edit-botton by css that calls a js-action already works. But some issues are remaining:
  1. I don't know how to implement or register the LinkTextResolver for the web author. In desktop version I implemented an extension bundle but I'm not aware that this exists in the web author. Could you point me to some documentation please?
  2. At some point I need to call another webservice to retrieve the mapping of IDs and names. I generated the classes with wsimport and it works as console application. But when using the same code as web author plugin I get an error:

    Code: Select all

    java.lang.IllegalStateException: MASM0003: Default [ jaxws-tubes-default.xml ] configuration file was not loaded
    Do you have any ideas how to fix this? Or can you suggets any other method to send a SOAP request from a user action to another webservice?
Thanks and regards,
Patrik

cristi_talau
Posts: 332
Joined: Thu Sep 04, 2014 4:22 pm

Re: Custom-Mapping of IDs to names

Post by cristi_talau » Mon Nov 16, 2020 8:16 pm

Hello,

1. Frameworks developed for Oxygen XML Editor are compatible with Web Author. ExtensionsBundle is also supported for Web Author. For example, in DITA, we have the same framework. So, the ExtensionsBundle implemented for the desktop application works in Web Author as well. We did not make any change to have LinkTextResolver working in Web Author.
2. I am not very familiar with SOAP or wsimport. From what I can see, wsimport generates the server-side part of the application. Anyway, the error seems to suggest that a configuration file cannot be loaded. Some things to look for:
- If you did not do this already, check the server logs for more details about the exception.
- Web Author uses a Java SecurityManager that restricts file access to various parts of the application. You may need to run AccessController.doPrivileged to pass the security checks.
- Web Author uses a dedicated classloader for each plugin. You either need to place configuration files in the classpath of this plugin.
- The Thread.contextClassLoader() is not the classloader of the plugin. If you need it to be, you have to set it (and reset after your code finishes).

Best,
Cristian

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Custom-Mapping of IDs to names

Post by Patrik » Mon Nov 23, 2020 7:51 pm

Hi,
about the LinkTextResolver I have done so far:
  1. Added an implementation for ExensionBundle and LinkTextResolver into my plugin
  2. added the plugin-jar to the classpath for my custom documenttype
  3. selected the extensionbundle for my custom documenttype
  4. added oxy_link-text() in the css
In the Oxygen XML Editor this works fine: The text form the LinkTextResolver is displayed.

When uploading plugin and framework to the webauthor no linktext is displayed. And in the logs I can't find any error message. So I must have missed something.

In the framework-file I find these entries:

Code: Select all

<field name="classpath">
	<String-array>
		<String>${frameworks}/Plugin/TgicServiceCatalogPlugin.jar</String>
	</String-array>
</field>
and

Code: Select all

<field name="extensionsBundleClassName">
	<String>com.gdvdl.webauth.TgicServiceCatalogExtensionBundle</String>
</field>
Any more ideas?

Thanks and regards,
Patrik

cristi_talau
Posts: 332
Joined: Thu Sep 04, 2014 4:22 pm

Re: Custom-Mapping of IDs to names

Post by cristi_talau » Tue Nov 24, 2020 9:54 am

Hello,

One thing to check: The JAR with the LinkTextResolver should be bundled in the framework archive. The plugins are uploaded in a different location in Web Author.

Best,
Cristian

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Custom-Mapping of IDs to names

Post by Patrik » Tue Nov 24, 2020 4:22 pm

Hi again,

thanks. I could make it work now. And it turned out that I don't need a plugin at all: I can do it all - including the custom actions (e.g. XSLT-transformation) on the server - just with the framework after adding the jar file to the classpath.
For completion: instead of getting the xslt script from the plugin-folder I included it into the jar file and loaded it with class.getResource.

So thanks for now - until I hit the next issue... ;)

Patrik

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Custom-Mapping of IDs to names

Post by Patrik » Thu Dec 03, 2020 12:04 pm

Hi again,

with my dialog to modify the text content I first need to get the current content and later set it.

I know I can do both steps with editor.getActionsManager().invokeOperation(). Is this the best way or are there alternatives?

And I know there are existing operations to set the content. But I could not find one to get the text content of the current node. So do I have to implement my own one?

Thanks and regards,
Patrik

cristi_talau
Posts: 332
Joined: Thu Sep 04, 2014 4:22 pm

Re: Custom-Mapping of IDs to names

Post by cristi_talau » Thu Dec 03, 2020 2:23 pm

Hello,

To read the text content of an XML node, you could use the DOM API [1], for example, node.textContent. To modify the content of a node you have to invoke a server-side operation, as you mentioned.

To set the text content of an element you can use the ReplaceElementContentOperation [2].

Best,
Cristian

[1] https://www.oxygenxml.com/maven/com/oxy ... .Node.html
[2] https://www.oxygenxml.com/doc/versions/ ... pp_zss_3jb

Patrik
Posts: 279
Joined: Thu Nov 28, 2013 9:32 am
Location: Hamburg/Germany
Contact:

Re: Custom-Mapping of IDs to names

Post by Patrik » Thu Dec 03, 2020 6:50 pm

Thanks again. I could make it work now! :)

Regards,
Patrik

Post Reply