proarc/proarc.mods-editor
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
-------------------------------------------------------------------
MODS Editor (SmartGWT component)
-------------------------------------------------------------------
for usage, see sample code in cz.mzk.EditMods.Demo.java
Because, the GWT framework can not work with the annotations made by JAXB, the
counterparts for each class generated by the xjc utility had to be created.
In short, there are two basic user stories. The first one describes the situation
when the new metadata should be created and send to the server side to make the xml
out of it. Then perhaps send to Fedora or whatever.
(ModsTab tab -> ModsCollectionClient tab.getMods() -> ModsCollection -> String xml)
The second user story describes the situation, when the data should be firsly pulled
from the repository as an XML, then converted into ModsCollectionClient object and then
showed to the user as a ModsTab.
(Document xml -> ModsCollection -> ModsCollectionClient -> new ModsTab(ModsCollectionClient))
The conversions are described into more details in the code bellow:
// 1) modsClient -> xml:
// do the following on the client side
ModsTab tab = new ModsTab(1);
// or ModsTab tab = new ModsTab(1, modsClient); in case we have an existing mods for editing
// add tab to some layouts and let the user to use them, then call
ModsCollectionClient modsClient = new ModsCollectionClient();
modsClient.setMods(Arrays.asList(tab.getMods()));
// do the following on the server side
ModsCollection mods = BiblioModsUtils.toMods(modsClient);
String xml = BiblioModsUtils.toXML(mods);
// String xml is the final product
// 2) xml -> editable ModsTab:
// do the following on the server side
org.w3c.dom.Document modsDocument = fedoraAccess.getBiblioMods("uuid");
mods = BiblioModsUtils.getModsCollection(modsDocument);
modsClient = BiblioModsUtils.toModsClient(mods);
// do the following on the client side
tab = new ModsTab(1, modsClient);
// ModsTab tab is the final product