Custom Logic for Connections in the Structure Browser

When editing in a structure browser, the system automatically uses the relationship and direction used by the copied/cut object or passed in using the relationship URL parameter. That relationship may not be valid for the new parent object, or the user may not have connect access. Either of these situations displays an error to the user.

To implement a different method of connecting children to parent objects, you need to write a custom JPO and pass its name to the structure browser using the connectionProgram URL parameter.

The method signature is:

public static Map connectDocument(Context context, String[] 
args) throws Exception

The input args[] array contains a packed map with the entries defined in this table.

Key Content

paramMap

A map containing key/value pairs of the request parameters originally passed to emxIndentedTable.jsp.

parentOID

The object ID of the parent side of the connection.

objectId

The object ID of the child side of the connection.

relId

The relationship ID used by the original connection from where the child object was cut or copied.

level

Level information.

sequence

The sequence of child objects in a given level.

action

One of these values:

remove

add

resequence

none

contextData

The JDOM XML structure.

The method output is a Map that should look like this:

Key Value

Action

SUCCESS--update completed successfully

ERROR--updated failed

Message

Either a string resource key or static text explaining any errors that occurred. The message will be displayed to the user.

changedRows

MapList of all child HashMaps. Each HashMap contains the key value pairs for rowId, relid, oid, markup.

If the Map includes a value for the Message key, the value for the Action key is checked. If Action=SUCCESS, the changes within the transaction are all committed to the database. if Action=ERROR, the entire transaction (all changes marked up within the structure browser) are aborted and not committed to the database. If the JPO does not need to return anything to the structure browser, it can return nothing or an empty map and the Action is assumed to be SUCCESS.