Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


Share this Page URL
Help

11.6: Implement outbound operations > Implement RMRetrieveCommand class - Pg. 287

11.6.9 Implement RMRetrieveCommand class This class implements business logic to retrieve recursively the RedMaintenance record hierarchy for a given parent key in the data object. Because only a parent key is given, in order to know if the parent has any off spring this class must rely on the application-specific information provided in the business object definition for parent child relationship information. For example, the Apartment business object definition must define that it can contain an array of Maintenance business objects. See implementation in Example 11-12. Example 11-12 RMRetrieveCommand implementation package com.ibm.itso.sab511.outbound.commandpattern; import import import import import import import import import import import import import java.rmi.RemoteException; java.util.Iterator; java.util.List; java.util.Vector; java.util.logging.Level; javax.resource.ResourceException; javax.resource.spi.CommException; com.ibm.itso.rm.common.RMDataImplementation; com.ibm.itso.rm.common.RMDataInterface; com.ibm.itso.rm.common.RMServerRMIInterface; com.ibm.j2ca.base.exceptions.RecordNotFoundException; com.ibm.j2ca.extension.logging.LogUtilConstants; commonj.sdo.DataObject; public class RMRetrieveCommand extends RMBaseCommand { RMServerRMIInterface connection; public RMRetrieveCommand() { super(); } public RMRetrieveCommand(commonj.sdo.DataObject arg0) { super(arg0); } /** * This method is called by the Command Pattern's Interpreter to retrieve * records in RedMaintenance. */ public DataObject execute(DataObject inputObject) throws ResourceException { getLogUtils().traceMethodEntrance(RMRetrieveCommand.class.getName(), "execute()"); String entity = super.getObjectNaming().getEntityName(inputObject); DataObject dataObject; Chapter 11. Implementing outbound request processing 287