|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fao.geonet.services.metadata.AjaxEditUtils
public class AjaxEditUtils
// -------------------------------------------------------------------------- // --- // --- Embedded Metadata Update API for AJAX Editor support // --- // --------------------------------------------------------------------------
| Field Summary | |
|---|---|
protected AccessManager |
accessMan
|
protected ServiceContext |
context
|
protected DataManager |
dataManager
|
protected GeonetContext |
gc
|
protected UserSession |
session
|
protected XmlSerializer |
xmlSerializer
|
| Constructor Summary | |
|---|---|
AjaxEditUtils(ServiceContext context)
|
|
| Method Summary | |
|---|---|
boolean |
addAttribute(Dbms dbms,
String id,
String ref,
String name,
String currVersion)
For Editing : adds an attribute from a metadata ([add] link). |
org.jdom.Element |
addElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
String name,
String childName)
For Ajax Editing : adds an element or an attribute to a metadata element ([add] link). |
protected static String |
addNamespaceToFragment(String fragment)
Adds missing namespace (ie. |
protected org.jdom.Element |
applyChangesEmbedded(Dbms dbms,
String id,
Map<String,String> changes,
String currVersion)
Apply a list of changes to the metadata record in current editing session. |
boolean |
deleteAttribute(Dbms dbms,
String id,
String ref,
String name,
String currVersion)
For Editing : removes an attribute from a metadata ([del] link). |
org.jdom.Element |
deleteAttributeEmbedded(Dbms dbms,
UserSession session,
String id,
String ref)
Removes attribute in embedded mode. |
org.jdom.Element |
deleteElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
String parentRef)
For Ajax Editing : removes an element from a metadata ([del] link). |
org.jdom.Element |
getMetadataEmbedded(ServiceContext srvContext,
String id,
boolean forEditing,
boolean withValidationErrors)
For Ajax Editing : gets Metadata from database and places it in session. |
protected static org.jdom.Element |
getMetadataFromSession(UserSession session,
String id)
TODO javadoc. |
protected static org.jdom.Element |
getOrAdd(org.jdom.Element parent,
String name,
org.jdom.Namespace ns)
If no PT_FreeText element exists, creates a geonet:element with an empty ref. |
void |
preprocessUpdate(org.jdom.Element params,
ServiceContext context)
Performs common editor preprocessing tasks. |
void |
removeMetadataEmbedded(UserSession session,
String id)
For Ajax Editing : removes metadata from session. |
void |
swapElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
boolean down)
For Ajax Editing : swap element with sibling ([up] and [down] links). |
protected void |
swapElements(org.jdom.Element el1,
org.jdom.Element el2)
Used for editing : swaps 2 elements. |
void |
updateContent(org.jdom.Element params)
|
void |
updateContent(org.jdom.Element params,
boolean validate)
Updates metadata content. |
void |
updateContent(org.jdom.Element params,
boolean validate,
boolean embedded)
TODO javadoc. |
protected static boolean |
updatedLocalizedTextElement(org.jdom.Element md,
String ref,
String val,
EditLib editLib)
Adds a localised character string to an element. |
org.jdom.Element |
validateMetadataEmbedded(UserSession session,
Dbms dbms,
String id,
String lang)
For Ajax Editing : retrieves metadata from session and validates it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ServiceContext context
protected DataManager dataManager
protected XmlSerializer xmlSerializer
protected GeonetContext gc
protected AccessManager accessMan
protected UserSession session
| Constructor Detail |
|---|
public AjaxEditUtils(ServiceContext context)
| Method Detail |
|---|
protected org.jdom.Element applyChangesEmbedded(Dbms dbms,
String id,
Map<String,String> changes,
String currVersion)
throws Exception
The changes are a list of KVP. A key contains at least the element identifier from the meta-document. A key starting with an "X" should contain an XML fragment for the value.
The following KVP combinations are allowed:
When using X key ElementValue could contains many XML fragments (eg.
<gmd:keywords .../><gmd:keywords .../>)
separated by XML_FRAGMENT_SEPARATOR. All those fragments are inserted
to the last element of this type in its parent if ElementName is set.
If not, the element with ElementId is replaced.
If _replace suffix is used, then all elements having the same type than elementId are removed before insertion.
dbms - id - Metadata internal identifier.changes - List of changes to apply.currVersion - Editing version which is checked against current editing version.
Exception
protected static org.jdom.Element getMetadataFromSession(UserSession session,
String id)
session - id -
public void removeMetadataEmbedded(UserSession session,
String id)
session - id -
public org.jdom.Element getMetadataEmbedded(ServiceContext srvContext,
String id,
boolean forEditing,
boolean withValidationErrors)
throws Exception
srvContext - id - forEditing - withValidationErrors -
Exception
public org.jdom.Element addElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
String name,
String childName)
throws Exception
dbms - session - id - ref - name - childName -
Exception
public org.jdom.Element deleteElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
String parentRef)
throws Exception
dbms - session - id - ref - parentRef -
Exception
public org.jdom.Element deleteAttributeEmbedded(Dbms dbms,
UserSession session,
String id,
String ref)
throws Exception
dbms - session - id - ref - Attribute identifier (eg. _169_uom).
Exception
public void swapElementEmbedded(Dbms dbms,
UserSession session,
String id,
String ref,
boolean down)
throws Exception
dbms - session - id - ref - down -
Exception
public org.jdom.Element validateMetadataEmbedded(UserSession session,
Dbms dbms,
String id,
String lang)
throws Exception
session - dbms - id - lang -
Exception
public boolean addAttribute(Dbms dbms,
String id,
String ref,
String name,
String currVersion)
throws Exception
dbms - id - ref - name - currVersion -
Exception
public boolean deleteAttribute(Dbms dbms,
String id,
String ref,
String name,
String currVersion)
throws Exception
dbms - id - ref - name - currVersion -
Exception
public void preprocessUpdate(org.jdom.Element params,
ServiceContext context)
throws Exception
params - context -
Exception
public void updateContent(org.jdom.Element params,
boolean validate)
throws Exception
params - validate -
Exception
public void updateContent(org.jdom.Element params,
boolean validate,
boolean embedded)
throws Exception
params - validate - embedded -
Exception
protected static boolean updatedLocalizedTextElement(org.jdom.Element md,
String ref,
String val,
EditLib editLib)
md - metadata recordref - current ref of element. All _lang_AB_123 element will be processed.val -
protected static String addNamespaceToFragment(String fragment)
fragment - The fragment to be checked and processed.
protected static org.jdom.Element getOrAdd(org.jdom.Element parent,
String name,
org.jdom.Namespace ns)
parent - name - ns -
public void updateContent(org.jdom.Element params)
throws Exception
params -
Exception
protected void swapElements(org.jdom.Element el1,
org.jdom.Element el2)
throws Exception
el1 - el2 -
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||