# ItemsBeanControlTest.jws Sample

This topic inludes the source code for the ItemsBeanControlTest.jws Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/EJBs_ClientApps/finderMethods/

## Sample Source Code

`001 package finderMethods; 002 003 /** 004 */ 005 public class ItemsBeanControlTest implements com.bea.jws.WebService 006 { 007 static final long serialVersionUID = 1L; 008 009 /** @common:control */ 010 public finderMethods.ItemsBeanControl itemsBeanControl; 011 012 /** @common:operation 013 * @jws:conversation phase="start" 014 */ 015 public void startTestDrive() {} 016 017 /** @common:operation 018 * @jws:conversation phase="finish" 019 */ 020 public void finishTestDrive() {} 021 022 /** 023 * <font face="Geneva, Arial, Helvetica, sans-serif"> 024 * findAboveAverage returns the items that are more expensive than the average 025 * price for all the items in the database. 026 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 027 * </font> 028 * 029 * @common:operation 030 * @jws:conversation phase="continue" 031 */ 032 public java.lang.String findAboveAverage() throws Exception 033 { return (itemsBeanControl.findAboveAverage()).toString(); } 034 035 /** 036 * <font face="Geneva, Arial, Helvetica, sans-serif"> 037 * findAll returns all the items known in the items database table. 038 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 039 * </font> 040 * 041 * @common:operation 042 * @jws:conversation phase="continue" 043 */ 044 public java.lang.String findAll() throws Exception 045 { return (itemsBeanControl.findAll()).toString(); } 046 047 /** 048 * <font face="Geneva, Arial, Helvetica, sans-serif"> 049 * findByItemName takes a String argument and returns all the items with that name. 050 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 051 * </font> 052 * 053 * @common:operation 054 * @jws:conversation phase="continue" 055 */ 056 public java.lang.String findByItemName(java.lang.String itemname) throws Exception 057 { return (itemsBeanControl.findByItemName(itemname)).toString(); } 058 059 /** 060 * <font face="Geneva, Arial, Helvetica, sans-serif"> 061 * findByPriceAndQuantity takes a double price and a int quantity as arguments 062 * and returns all the items that are more expensive and have larger quantities 063 * available in stock. 064 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 065 * </font> 066 * 067 * @common:operation 068 * @jws:conversation phase="continue" 069 */ 070 public java.lang.String findByPriceAndQuantity(double arg0, int arg1) throws Exception 071 { return (itemsBeanControl.findByPriceAndQuantity(arg0, arg1)).toString(); } 072 073 /** 074 * <font face="Geneva, Arial, Helvetica, sans-serif"> 075 * findByPrimaryKey takes a integer itemNumber, the primary key, and returns the matching item. 076 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 077 * </font> 078 * 079 * @common:operation 080 * @jws:conversation phase="continue" 081 */ 082 public void findByPrimaryKey(java.lang.Integer arg0) throws Exception 083 { itemsBeanControl.findByPrimaryKey(arg0); } 084 085 /** 086 * <font face="Geneva, Arial, Helvetica, sans-serif"> 087 * findByUSManufacturer returns all the items whose manufacturer is located in the US, 088 * querying the entity relation between items and manufacturers. 089 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 090 * </font> 091 * 092 * @common:operation 093 * @jws:conversation phase="continue" 094 */ 095 public java.lang.String findByUSManufacturer() throws Exception 096 { return (itemsBeanControl.findByUSManufacturer()).toString(); } 097 098 /** 099 * <font face="Geneva, Arial, Helvetica, sans-serif"> 100 * findByUSManufacturerOrdered works exactly like findByUSManufacturer but 101 * uses the WebLogic keyword ORDERBY to order the items returned by itemName. 102 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 103 * </font> 104 * 105 * @common:operation 106 * @jws:conversation phase="continue" 107 */ 108 public java.lang.String findByUSManufacturerOrdered() throws Exception 109 { return (itemsBeanControl.findByUSManufacturerOrdered()).toString(); } 110 111 /** 112 * <font face="Geneva, Arial, Helvetica, sans-serif"> 113 * findFiveCheapestItems uses a correlated subquery to returns the 114 * five least expensive items. 115 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 116 * </font> 117 * 118 * @common:operation 119 * @jws:conversation phase="continue" 120 */ 121 public java.lang.String findFiveCheapestItems() throws Exception 122 { return (itemsBeanControl.findFiveCheapestItems()).toString(); } 123 124 /** 125 * <font face="Geneva, Arial, Helvetica, sans-serif"> 126 * findMostExpensiveItems returns the most expensive items, using a 127 * correlated subquery and the keyword EXISTS. 128 * Each item is shown as: [itemNumber, itemName, price, quantityAvailable] 129 * </font> 130 * 131 * @common:operation 132 * @jws:conversation phase="continue" 133 */ 134 public java.lang.String findMostExpensiveItems() throws Exception 135 { return (itemsBeanControl.findMostExpensiveItems()).toString(); } 136 137 }`