Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX -
Contents Index PreviousNext

Part 2 Developing Applications by APIs> Chapter 9 Developing Java Applications> 9.3 How to Use Java APIs> 9.3.3 Updating Data

9.3.3.2 Deleting Data by Specifying Record IDs

Use the prepareDeleteRecordID method to delete data.

The Java APIs use record IDs to delete data. Before deleting data, use the getRecordID method to obtain the record IDs of the data items to be deleted.

The following diagram shows the process for deleting data by specifying a record ID.

[Figure 9-14 Flow of the Process for Deleting Data by Specifying a Record ID]

mark1Sample Code

ShunConnection con = new ShunConnection();

ShunPreparedRecordID prid = con.prepareDeleteRecordID();      (1)
prid.add(recordID);                                           (2)
prid.deleteByRecordID();                                      (3)
prid.close();                                                 (4)

con.close();

mark2(1) Create a ShunPreparedRecordID Object

Use the prepareDeleteRecordID method to create a ShunPreparedRecordID object.

mark2(2) Specify the record IDs of the Data Items to be Deleted

Use the add method to specify the record ID. Record IDs can be obtained using the getRecordID method.

Multiple record IDs can be specified with the add method. Any existing record IDs will be overwritten if they are specified again.

By specifying multiple record IDs with the add method, multiple XML documents can be obtained at once.

mark2(3) Delete the Data

Execute the delete process using the deleteByRecordID method.

mark2(4) Release the ShunPreparedRecordID Object

Use the close method of the ShunPreparedRecordID object to release the object when it is no longer required.

mark1Sample Codes for Studio

The following are entry examples available when Studio is used.

Business Class

String recordID = dataBean.getDetailButton();
ShunConnection con = new ShunConnection();

ShunsakuAccessController controller = new ShunsakuAccessController(con);
controller.delete(recordID);

con.close();

Shunsaku Access Class

public void delete(String recordID) throws ShunException {
   ShunPreparedRecordID prid = con.prepareDeleteRecordID();        (1)
   prid.add(recordID);                                             (2)
   prid.deleteByRecordID();                                        (3)
   prid.close();                                                   (4)
}

Contents Index PreviousNext

All Rights Reserved, Copyright(C) FUJITSU LIMITED 2006