create one document for each of the two collections

X-Application Version: 3.1.3
Tamino Version : 3.1.1
Platform : NT
WebContainer : Tomcat 3.3
JDK Version : 1.3.1


Hi,

I have two collections (coll_A and coll_B) in a Tamino database. And I generated JSP pages for the coll_A using X-Application.

Now, what I want to do is:
When a user creates a document for the coll_A through the JSP pages (that means when he clicks the commit button), the system should also AUTOMATICALLY and DYNAMICALLY create a new document for the coll_B which contains the ino:id value of the document for coll_A created by the user.

How can I do so? One possible method is to use plugin… But I want to know more detail on how to do it. Any sample codings?

Please help me. Thanks a lot.

Andy

Hello,

we don’t have a plugin example that does exactly what you want. However, if you have a look at the code of the ‘AdvancedPlugin’ example, you will find a method that is invoked for the commit of a property document.

For your use case, the formal definition of the action for a plugin would be the same. The code of your method could look like this.

public static void commitDocA(BusinessDocument docA, BusinessDocumentWorkspace ws) {
     BusinessDocument docB = ws.create("name to register doc B", "doctype of your doc B");
     Element idNodeForDocA = docB.selectElement("XPath for the element referring to docA");
     idNodeForDocA.setText(docA.getId());
     // commit the two documents within a transaction as described (see following link)
}



Add some operations before or after the commitment of Create / Delete actions in JSP

For programming with the XApplication Java API have a look at the API examples. You will find them at

%xapplication%\examples\API.…

Bye,
Christian.