Lance Drug IS WSAD Manual

154
DRUG INFORMATION SYSTEM IDS 517 Project Report by: GARY LANCE MAY 6, 2004

Transcript of Lance Drug IS WSAD Manual

Page 1: Lance Drug IS WSAD Manual

DRUG INFORMATION SYSTEM

IDS 517Project Report by:

GARY LANCE

MAY 6, 2004

Page 2: Lance Drug IS WSAD Manual

TABLE OF CONTENTS

I. INTRODUCTION.............................................................................................................................................4

II. SCREEN SHOTS OF THE PROGRAM.........................................................................................................5

III. ENTITY RELATIONSHIP DIAGRAM......................................................................................................27

IV. CREATE TABLE STATEMENTS..............................................................................................................28

V. QUERIES PERFORMED IN THE PROGRAM BY USERS AND ADMINISTRATORS.........................32

VI. ABOUT THE MULTUM DATABASE......................................................................................................35

VII. CREATION OF IBM DB2 TABLES FROM MS ACCESS TABLES......................................................37

VIII. JAVABEAN FILES...................................................................................................................................41

DeleteAdministrator.java................................................................................................................................41

DrugsByMfg.java...........................................................................................................................................43

DrugsByMfgRow.java....................................................................................................................................45

GetAdminLogonInfo.java...............................................................................................................................46

GetAdminLogonInfoRow.java.......................................................................................................................48

GetAnAdministrator.java...............................................................................................................................49

GetAnAdministratorRow.java........................................................................................................................51

GetMfgRowFromCode.java...........................................................................................................................53

GetMfgRowFromCodeRow.java....................................................................................................................55

GetMfgRowFromCodeRow.java....................................................................................................................57

GetNextMfgSourceId.java..............................................................................................................................59

GetNextMfgSourceIdRow.java......................................................................................................................61

Global.java......................................................................................................................................................62

IngredientListForBrandNamesLike.java........................................................................................................63

IngredientListForBrandNamesLikeRow.java.................................................................................................65

InsertAdmin.java............................................................................................................................................66

InsertVendor.java...........................................................................................................................................68

SelectAllBrands.java......................................................................................................................................70

SelectAllBrandsLike.java...............................................................................................................................72

SelectAllBrandsLikeRow.java.......................................................................................................................74

SelectAllBrandsRow.java...............................................................................................................................75

SelectAllDrugNamesLike.java.......................................................................................................................76

SelectAllDrugNamesLikeRow.java...............................................................................................................78

2

Page 3: Lance Drug IS WSAD Manual

SelectAllMfgInfo.java....................................................................................................................................79

SelectAllMfgInfoRow.java.............................................................................................................................81

SelectAllMfgs.java.........................................................................................................................................83

SelectAllMfgsRow.java..................................................................................................................................85

SelectDrugNames.java...................................................................................................................................86

SelectDrugNamesRow.java............................................................................................................................88

SelectObsoleteDrugs.java...............................................................................................................................89

SelectObsoleteDrugsRow.java.......................................................................................................................91

ShowAllAdministrators.java..........................................................................................................................92

ShowAllAdministratorsRow.java...................................................................................................................94

UpdateAdminInfo.java...................................................................................................................................96

IX. JAVA SERVER PAGES (JSP) FILES.........................................................................................................98

admin.jsp.........................................................................................................................................................98

brands.jsp......................................................................................................................................................100

checkAdmin.jsp............................................................................................................................................101

confirmAdminDelete.jsp..............................................................................................................................103

doVendorInsert.jsp.......................................................................................................................................105

drugNames.jsp..............................................................................................................................................106

drugsByMfg.jsp............................................................................................................................................108

index.jsp........................................................................................................................................................110

ingredList1.jsp..............................................................................................................................................112

insertVendor.jsp............................................................................................................................................114

logoff.jsp.......................................................................................................................................................116

mfgInfo.jsp...................................................................................................................................................117

mfgs.jsp.........................................................................................................................................................119

register.jsp.....................................................................................................................................................121

selectObsoleteDrugs.jsp...............................................................................................................................122

showAllAdministrators.jsp...........................................................................................................................124

updateAdminInfo.jsp....................................................................................................................................127

userDeleted.jsp.............................................................................................................................................128

3

Page 4: Lance Drug IS WSAD Manual

I. INTRODUCTION

We’ve designed and implemented an IBM Websphere based application that enables users to pull information about drugs from a central database. This information includes:

Manufacturers

Generic names

Brand names

Inactive Drugs

Ingredients

Our website is available to everyone. There are two kinds of users: administrators and public. Both types of users use the same main page. Administrators have to register before using some extra features. After logged in, an administrator can add, delete or modify administrators and add drug vendors which do not exist in the database. By using our website, public can get general information about drugs. We wanted to give answers to common questions such as “Is the drug currently on the market?” “How many different manufacturers produce the same product?” “What’re the ingredients of a drug?” “What brand names exist for given a generic product?” We answer these questions by providing a query list. Our list has the following queries:

Brand Name List

Ingredient List

Manufacturer List

All Obsolete Drugs

Query on Drug Names

Administrator Management

Add New Vendor

Our website also provides three important links to other websites which have information about drugs. These are Medicare, MedlinePlus and WebMD. If a user cannot find the information about a drug, he can go to these websites and make an extended research.

There are many excellent sources of information online. Our project, being of such small scope, is not meant to replace them, but to emulate a few prominent features which are available in most of the online resources.

This project is the first step towards creating a substantial, beneficial source of drug-related information. But it will not currently be able to give advice. For that type of application, one would need to have physicians and other drug professionals on staff.

4

Page 5: Lance Drug IS WSAD Manual

II. SCREEN SHOTS OF THE PROGRAM

This is the opening page. The right side is the administrator login area.

The left list box displays the queries. Insert and update queries are only available for the administrator, who must logon.

5

Page 6: Lance Drug IS WSAD Manual

If you press “LOGIN” without entering your Sign-in ID and/or Password, the following screen will appear.

If you put in Sign-in ID and Password combination that is not in database, the following screen will appear.

6

Page 7: Lance Drug IS WSAD Manual

If you are new administrator, you should register. When you press “REGISTER” button, the following screen will appear.

In order to register, administrator should provide the following information and press “REGISTER” button. All fields must be filled in. It adds information to the ADMIN table.

7

Page 8: Lance Drug IS WSAD Manual

If you’re registered successfully, the following message will appear.

Administrator can login using his Sign-in ID and Password. An HttpSession object allows the creation of a key/value pair, using the setAttribute() method. This method can be tested using getAttribute() method.

8

Page 9: Lance Drug IS WSAD Manual

If you’re logged on successfully, the following message will appear.

Additional queries are available to a logged-in administrator. Notice “Administrator Management” and “Add Drug Vendor” queries. These queries appear only if the user is logged in as an administrator. User and administrator share the same start page.

9

Page 10: Lance Drug IS WSAD Manual

When you select “Administrator Management” query, following screen appears. You can register a new administrator by pressing the “Register” button and providing the information. On this screen all administrators in database are shown, with complete information.

In order to modify an administrator information, username and password of that administrator should be entered and “Delete/Modify Administrator” button should be pressed.

10

Page 11: Lance Drug IS WSAD Manual

When you press “Delete/Modify Administrator” button, the following screen will appear. It has the administrator information that you can modify. But you can’t change the username or userid.

You can change the administrator information by entering the new information into textfields. On the following screen, Gary Lance’s address and phone is changed.

11

Page 12: Lance Drug IS WSAD Manual

When you press “Modify” button, the following screen will appear. It has the new information of Gary Lance.

In order to modify administrator information, username and password of that administrator should be entered and “Delete/Modify Administrator” button should be pressed.

12

Page 13: Lance Drug IS WSAD Manual

When you press “Delete/Modify Administrator” button, the following screen will appear. It has the administrator information that you want to delete. You can delete the record by pressing “OK to Delete” button.

When you press “OK to Delete” button, the following screen will appear. Notice the administrator that you’ve deleted is not in the list.

13

Page 14: Lance Drug IS WSAD Manual

You can add a new drug vendor by selecting “Add New Drug Vendor” query from the list and pressing “Process” button.

When you press “Process” button, following screen will appear. The table Ndc_source lists all the vendors by SourceID. This table is queried to return one or more than the maximum SourceID. This value is placed in the “Source ID” text field. It is a read only field which means the user cannot change the value. Otherwise, the user might enter a currently used SourceID.

In order to add a new vendor; the fields on the following screen should be filled in.14

Page 15: Lance Drug IS WSAD Manual

When you press “Add Vendor to Database”, following screen will appear, so that you can continue to add new vendors. Notice SourceID is incremented.

15

Page 16: Lance Drug IS WSAD Manual

You can log off using the button on the homepage. When you press the “Log Off” button and logged off successfully, the following message will appear.

In order to see all the brand names in the database, select “Brand Name List” query and press “Process.”

16

Page 17: Lance Drug IS WSAD Manual

When you press “Process”, the following screen will appear.

In order to see all the ingredients in the database, select “Ingredient List” query and press “Process.”

17

Page 18: Lance Drug IS WSAD Manual

When you press “Process”, the following screen will appear.

You can use an ingredient as a search term to find the drug names which have that ingredient. When you enter the search term and press “Process” following screen will appear.

18

Page 19: Lance Drug IS WSAD Manual

In order to see all the manufacturers in the database, select “Manufacturer List” query and press “Process.”

When you press “Process”, the following screen will appear.

19

Page 20: Lance Drug IS WSAD Manual

When you press “Info” button next to a manufacturer, a new window with detailed manufacturer information will appear.

When you press “Products” button next to a manufacturer, a new window with a list of manufacturer’s products will appear.

20

Page 21: Lance Drug IS WSAD Manual

In order to see all the obsolete drugs in the database, select “All Obsolete Drugs” query and press “Process.”

When you press “Process”, the following screen will appear.

21

Page 22: Lance Drug IS WSAD Manual

In the list boxes, pick month, day and year. Only the drugs that are made obsolete on or after this date will be listed. The date “February 3, 2004” has been selected in the example below. After selecting date, press the “PROCESS” button.

When you press “Process”, following screen displays all the drugs made obsolete on or after “February 3, 2004”. They are sorted by NDC.

22

Page 23: Lance Drug IS WSAD Manual

In order to search for drugs, select “Query on Drug Names” query and press “Process.”

When you press “Process”, the following screen will appear.

23

Page 24: Lance Drug IS WSAD Manual

You can use a search term to search for drugs. In this example “live” is entered as search term.

After you press “Search for Drug Names” button, the following screen will appear. It lists the drugs that have the search key “live” in their names.

24

Page 25: Lance Drug IS WSAD Manual

At the bottom of the main page, there are three links to web pages which have information about drugs.

When you click “Medicare”, the following web page will appear.

25

Page 26: Lance Drug IS WSAD Manual

When you click “MedlinePlus”, the following web page will appear.

When you click “WebMD”, the following web page will appear.

26

Page 27: Lance Drug IS WSAD Manual

III. ENTITY RELATIONSHIP DIAGRAM

27

Page 28: Lance Drug IS WSAD Manual

IV. CREATE TABLE STATEMENTS

The following output was generated by the Java program AccessToDB2. The numbered items are, for each table, the field names and the MS Access types. The “Create table” statement is the IBM DB2 statement that creates the IBM DB2 table. Notice that, although the order of the fields for IBM DB2 is identical to that of MS Access, so of the field names have been changed. Some of the types have also changed, as MS Access and IBM DB2 types are not 100% compatible.

********** Create DRUG_SOURCE ****************

Table drug_source does not exist1. source_id SMALLINT(5)2. source_desc VARCHAR(120)3. address1 VARCHAR(100)4. city VARCHAR(50)5. state VARCHAR(2)6. zip VARCHAR(10)Create table ids517team2.drug_source (

source_id SMALLINT NOT NULL, source_desc VARCHAR(120) NOT NULL, address VARCHAR(100) NOT NULL, city VARCHAR(50) NOT NULL, state VARCHAR(2) NOT NULL, zip VARCHAR(10) NOT NULL, URL VARCHAR(155), CONSTRAINT PK_DRUG_SOURCE PRIMARY KEY(source_id))

********** Create BRAND_NAME ****************

Table brand_name does not exist1. brand_code INTEGER(10)2. brand_description VARCHAR(255)Create table ids517team2.brand_name (

brand_code INTEGER NOT NULL, brand_description VARCHAR(255) NOT NULL, CONSTRAINT PK_BRAND_NAME PRIMARY KEY(brand_code))

********** Create DRUG_ID ****************

Table drug_id does not exist1. drug_id VARCHAR(6)2. drug_name VARCHAR(255)Create table ids517team2.drug_id (

drug_id VARCHAR(6) NOT NULL, drug_name VARCHAR(255) NOT NULL, CONSTRAINT PK_DRUG_ID PRIMARY KEY(drug_id))

********** Create PRODUCT_STRENGTH ****************

Table product_strength does not exist1. product_strength_code INTEGER(10)2. product_strength_description VARCHAR(255)

28

Page 29: Lance Drug IS WSAD Manual

Create table ids517team2.product_strength (product_strength_code INTEGER NOT NULL, product_strength_description VARCHAR(255) NOT NULL, CONSTRAINT PK_PROD_STRENGTH PRIMARY KEY(product_strength_code))

********** Create DOSE FORM ****************

Table dose_form does not exist1. dose_form_code INTEGER(10)2. dose_form_description VARCHAR(255)Create table ids517team2.dose_form (

dose_form_code INTEGER NOT NULL, dose_form_description VARCHAR(255) NOT NULL, CONSTRAINT PK_DOSE_FORM PRIMARY KEY(dose_form_code))

********** Create ROUTE ****************

Table route does not exist1. route_code INTEGER(10)2. route_description VARCHAR(255)Create table ids517team2.route (

route_code INTEGER NOT NULL, route_description VARCHAR(255) NOT NULL, CONSTRAINT PK_ROUTE PRIMARY KEY(route_code))

********** Create DRUG_CODE ****************

Table drug_code does not exist1. main_multum_drug_code INTEGER(10)2. principal_route_code INTEGER(10)3. dose_form_code INTEGER(10)4. product_strength_code INTEGER(10)5. drug_id VARCHAR(6)Create table ids517team2.drug_code (

drug_code INTEGER NOT NULL, route_code INTEGER NOT NULL, dose_form_code INTEGER NOT NULL, product_strength_code INTEGER NOT NULL, drug_id VARCHAR(6) NOT NULL, CONSTRAINT PK_DRUG_CODE PRIMARY KEY(drug_code), CONSTRAINT FK_ROUTE_CODE FOREIGN KEY(route_code) REFERENCES ids517team2.route

(route_code), CONSTRAINT FK_DOSE_FORM_CODE FOREIGN KEY(dose_form_code) REFERENCES

ds517team2.dose_form, CONSTRAINT FK_PROUCT_STR_CODE FOREIGN KEY(product_strength_code) REFERENCES

ids517team2.product_strength, CONSTRAINT FK_DRUG_ID FOREIGN KEY(drug_id) REFERENCES ids517team2.drug_id))

29

Page 30: Lance Drug IS WSAD Manual

********** Create CORE_DESCRIPTION ****************

Table core_description does not exist1. ndc_code VARCHAR(11)2. main_multum_drug_code INTEGER(10)3. brand_code INTEGER(10)4. obsolete_date DATETIME(19)5. source_id INTEGER(10)Create table ids517team2.core_description (

ndc_code VARCHAR(11) NOT NULL, drug_code INTEGER, brand_code INTEGER, obsolete_date DATE, source_id INTEGER, CONSTRAINT PK_CORE_DESC PRIMARY KEY(ndc_code), CONSTRAINT FK_SOURCE_ID FOREIGN KEY(source_id) REFERENCES

ids517team2.drug_source, CONSTRAINT FK_DRUG_CODE FOREIGN KEY(drug_code) REFERENCES

ids517team2.drug_code, CONSTRAINT FK_BRAND_CODE FOREIGN KEY(brand_code) REFERENCES

ids517team2.brand_name)

********** Create ACTIVE_INGREDIENT ****************

Table active_ingredient does not exist1. active_ingredient_code INTEGER(10)2. active_ingredient VARCHAR(255)Create table ids517team2.active_ingredient (

active_ingredient_code INTEGER NOT NULL, active_ingredient VARCHAR(255), CONSTRAINT PK_ACTIVE_INGRED PRIMARY KEY(active_ingredient_code))

********** Create MULTUM_UNITS ****************

Table multum_units does not exist1. unit_id INTEGER(10)2. unit_description VARCHAR(255)Create table ids517team2.multum_units (

unit_id INTEGER NOT NULL, unit_description VARCHAR(255) NOT NULL, CONSTRAINT PK_UNITS PRIMARY KEY(unit_id))

********** Create INGREDIENT_STRENGTH ****************

Table ingredient_strength does not exist1. ingredient_strength_code INTEGER(10)2. strength_num_amount DOUBLE(15)3. strength_num_unit INTEGER(10)4. strength_denom_amount DOUBLE(15)5. strength_denom_unit INTEGER(10)Create table ids517team2.ingredient_strength (

ingredient_strength_code INTEGER NOT NULL, strength_num_amount REAL NOT NULL,

30

Page 31: Lance Drug IS WSAD Manual

strength_num_unit INTEGER NOT NULL, strength_denom_amount REAL NOT NULL, strength_denom_unit INTEGER NOT NULL, CONSTRAINT PK_INGRED_STR PRIMARY KEY(ingredient_strength_code), CONSTRAINT FK_STR_NUM FOREIGN KEY(strength_num_unit) REFERENCES

ids517team2.multum_units(unit_id), CONSTRAINT FK_STR_DENOM FOREIGN KEY(strength_denom_unit) REFERENCES

ids517team2.multum_units(unit_id))

********** Create ACTIVE_INGREDIENT_LIST ****************

Table active_ingredient_list does not exist1. main_multum_drug_code INTEGER(10)2. active_ingredient_code INTEGER(10)3. ingredient_strength_code INTEGER(10)Create table ids517team2.active_ingredient_list (

drug_code INTEGER NOT NULL, active_ingredient_code INTEGER NOT NULL, ingredient_strength_code INTEGER NOT NULL,CONSTRAINT PK_ACTIVE_LIST PRIMARY KEY(drug_code, active_ingredient_code,

ingredient_strength_code), CONSTRAINT FK_STR_CODE FOREIGN KEY(active_ingredient_code) REFERENCES

ids517team2.active_ingredient, CONSTRAINT FK_INGRED FOREIGN KEY(ingredient_strength_code) REFERENCES

ids517team2.ingredient_strength, CONSTRAINT FK_DRUG_CODE FOREIGN KEY(drug_code) REFERENCES

ids517team2.drug_code))

31

Page 32: Lance Drug IS WSAD Manual

V. QUERIES PERFORMED IN THE PROGRAM BY USERS AND ADMINISTRATORS

Brand Name List

SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE,

IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION

FROM IDS517TEAM2.BRAND_NAME

Ingredient List

SELECT DISTINCT X.DRUG_NAME, A.ACTIVE_INGREDIENT

FROM IDS517TEAM2.ACTIVE_INGREDIENT AS A, IDS517TEAM2.ACTIVE_INGREDIENT_LIST

AS I, IDS517TEAM2.DRUG_CODE AS D, IDS517TEAM2.DRUG_ID AS X

WHERE A.ACTIVE_INGREDIENT_CODE = I.ACTIVE_INGREDIENT_CODE AND I.DRUG_CODE =

D.DRUG_CODE AND D.DRUG_ID = X.DRUG_ID AND A.ACTIVE_INGREDIENT_CODE IN (

SELECT L.ACTIVE_INGREDIENT_CODE FROM

IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS L

WHERE L.DRUG_CODE IN

( SELECT C.DRUG_CODE FROM IDS517TEAM2.DRUG_ID AS B,

IDS517TEAM2.DRUG_CODE AS C WHERE B.DRUG_ID = C.DRUG_ID AND

B.DRUG_NAME LIKE :name1 ) )

AND X.DRUG_NAME LIKE :name2

Manufacturer List

Show All the Manufacturers

SELECT D.SOURCE_ID, D.SOURCE_DESC

FROM IDS517TEAM2.DRUG_SOURCE D

ORDER BY D.SOURCE_DESC

Show Manufacturer Information

SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_ID,

IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC,

IDS517TEAM2.DRUG_SOURCE.ADDRESS, IDS517TEAM2.DRUG_SOURCE.CITY,

IDS517TEAM2.DRUG_SOURCE.STATE, IDS517TEAM2.DRUG_SOURCE.ZIP,

IDS517TEAM2.DRUG_SOURCE.URL

FROM IDS517TEAM2.DRUG_SOURCE

32

Page 33: Lance Drug IS WSAD Manual

Show Products of the Manufacturer

SELECT DISTINCT D.SOURCE_DESC, B.BRAND_DESCRIPTION, C.OBSOLETE_DATE

FROM IDS517TEAM2.DRUG_SOURCE AS D, IDS517TEAM2.CORE_DESCRIPTION AS C,

IDS517TEAM2.BRAND_NAME AS B WHERE D.SOURCE_ID = C.SOURCE_ID AND

C.BRAND_CODE = B.BRAND_CODE AND D.SOURCE_ID = :code

ORDER BY SOURCE_DESC, BRAND_DESCRIPTION

All Obsolete Drugs

SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC,

IDS517TEAM2.CORE_DESCRIPTION.NDC_CODE,

IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE,

IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION

FROM IDS517TEAM2.BRAND_NAME, IDS517TEAM2.CORE_DESCRIPTION,

IDS517TEAM2.DRUG_SOURCE

WHERE IDS517TEAM2.BRAND_NAME.BRAND_CODE =

IDS517TEAM2.CORE_DESCRIPTION.BRAND_CODE AND

IDS517TEAM2.DRUG_SOURCE.SOURCE_ID =

IDS517TEAM2.CORE_DESCRIPTION.SOURCE_ID AND

IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE >= :date

ORDER BY NDC_CODE ASC, BRAND_DESCRIPTION ASC, SOURCE_DESC ASC,

OBSOLETE_DATE ASC

Query on Drug Names

SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE,

IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION

FROM IDS517TEAM2.BRAND_NAME

WHERE IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION LIKE :descr

Administrator Management

Show All Administrators

SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID,

IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME,

IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY,

IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP,

IDS517TEAM2.ADMIN.PHONE

FROM IDS517TEAM2.ADMIN

33

Page 34: Lance Drug IS WSAD Manual

Insert New Administrator

INSERT INTO IDS517TEAM2.ADMIN(CODENAME, USERID, FIRSTNAME, LASTNAME,

STREET, STATE, ZIP, PHONE)

VALUES (:codename, :firstname, : lastname, :street, :city, :state, :zip, :phone)

Show the Information of an Administrator

SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID,

IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME,

IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY,

IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP,

IDS517TEAM2.ADMIN.PHONE

FROM IDS517TEAM2.ADMIN

WHERE IDS517TEAM2.ADMIN.CODENAME = :username AND

IDS517TEAM2.ADMIN.USERID = :userid

Update Administrator Information

UPDATE IDS517TEAM2.ADMIN SET FIRSTNAME = :firstname, LASTNAME = :lastname,

STREET = :street, CITY = :city, STATE = :state, ZIP = :zip, PHONE = :phone

WHERE IDS517TEAM2ADMIN.CODENAME = :codename AND

IDS517TEAM2.ADMIN.USERID = :userid

Delete an Existing Administrator

DELETE FROM IDS517TEAM2.ADMIN

WHERE IDS517TEAM2.ADMIN.CODENAME = :codename

AND IDS517TEAM2.ADMIN.USERID = :userid

Add New Vendor

INSERT INTO IDS517TEAM2.DRUG_SOURCE (SOURCE_ID, SOURCE_DESC, ADDRESS, CITY,

STATE, ZIP, URL)

VALUES (:id, :descr, :address, :city, :state, :zip, :url)

34

Page 35: Lance Drug IS WSAD Manual

VI. ABOUT THE MULTUM DATABASE

A description of the tables in the Multum database can be found in the Multum Lexicon, downloadable from http://205.169.47.10/Lexicon.htm. The database is an MS Access database. Users need to be knowledgable in MS Access and Structured Query Language (SQL) in order to extract information from the lexicon. The information in this section has been extracted from the Lexicon.

Each drug number in the database includes a unique combination of:

ingredients (represented by the drug_id: acetaminophen),

strength (represented by the product_strength_code – 325 mg, 650 mg, 120 mg/2.5 ml, 120 mg/5 ml),

route (represented by the principal_route_code - oral, rectal), and

dose form (represented by the dose_form_code - tablet, suppository, capsule, solution, elixir).

Each (ingredient) strength in the database has a unique identifier (so it can be reused with many other active ingredients). The identifier is called the ingredient_strength_code. Each ingredient_strength_code is associated with a unique combination of the following four fields:

1. strength_num_amount

2. strength_num_unit

3. strength_denom_amount

4. strength_denom_unit

For example, if the strength of a particular liquid ingredient in a drug is 125 mg/5 ml, then:

strength_num_amount = 125

strength_num_unit = 4 (mg)

strength_denom_amount = 5

strength_denom_unit = 5 (ml)

Active_ingredient is for the pharmacists. Active_ingredient is always a generic name. In the case of mono-ingredient drugs, the active_ingredient is a simple description of the generic chemical name of the drug in question, including all the pharmacist-friendly information tacked on the end. Each drug code is associated with at least one active_ingredient, but can be associated with an unlimited number of active_ingredients via the ndc_active_ingredient_list table – another table in the database.

Drug_ids correspond to the generic names of drugs. Unfortunately, any given drug can have one or more active ingredients that are also drugs, and they therefore also have drug_ids.

For example, there are a thousand or more different products on the market that contain acetaminophen as a mono-ingredient. (It ís the active ingredient in Tylenol and lots of other drug products.) Many of these products are nearly identical - they may just be packaged differently or sold by different manufacturers under different names. In fact, there are only about 20 different acetaminophen product types. For example, here are a few of them:

acetaminophen 325 mg oral tablets35

Page 36: Lance Drug IS WSAD Manual

acetaminophen 325 mg rectal suppositories

acetaminophen 650 mg oral capsules

acetaminophen 120 mg/2.5 ml oral solution

acetaminophen 120 mg/ 5 ml oral elixir

Concerning the NDC (National Drug Code), the FDA assigns a labeler code to a manufacturer/repackager of drugs. Basically the FDA is just giving out a series of numbers for a manufacturer/repackager to use. In addition, the FDA requires that each manufacturer/repackager fill out a paper form, which identifies the NDCs the manufacturer/labeler has assigned to its products. Every time the labeler/manufacturer changes the packaging or anything else important about the drug, it is supposed to assign a new NDC.

36

Page 37: Lance Drug IS WSAD Manual

VII. CREATION OF IBM DB2 TABLES FROM MS ACCESS TABLES

The data for the project were created from the Multum tables. The entire database can be downloaded from http://205.169.47.10/ForConsumers.htm. A description of the tables in are in the Multum Lexicon, downloadable from http://205.169.47.10/Lexicon.htm. The database is an MS Access database. Users need to be knowledgable in MS Access and Structured Query Language (SQL) in order to extract information from the lexicon.

The tables in the database, as explained in the Lexicon, are both normalized and denormalized. For the developer, a query is done using the normalized tables. However, for the average user, there is a table (ndc_denorm) which has a great number of attributes. This table can be used by people wanting to avoid the joins and other operations required in normalized databases. We avoid this table in our project for obvious reasons.

The project description required the use of IBM DB2. This posed a problem, as the Multum database is an MS Access database. In addition, the tables required by our program had about 40MByes of data. Thus, entering each record in a newly-created IBM DB2 table was not feasible. In order to accomplish this task, a Java application was created that read the data from the required MS Access (source) tables, and used that data to populate IBM DB2 (target) tables.

The database portion of the project had two phases, which ran concurrently. In what follows, source tables will always refer to the MS Access tables, while target tables will always refer to the IBM DB2 tables. First, the source tables had to be queried to discover their composition (field names, types). Secondly, target tables had to be created from the information gathered in the first phase. Finally, the target tables had to be queried to populate the target tables.

Phase I: The creation of the IBM DB2 tables was accomplished by getting the metatdata from the source table (from MS Access) and creating a target table (in IBM DB2). The name of the target table was an input. In addition, not all the fields of each source table were required. Before creating the table, the name of the field would be available, so it was easy to not include a given field.

The code fragments shown in this section are taken from the Java application AccessToDB2.java, which is the application responsible for the conversion of MS Access data to IBM DB2 data.

The initialize() method (shown in the code section) queries the source table for all the rows using the sql statement (SELECT * FROM SOURCETABLE). The method then returns the number of columns in the source table (variable numCol on line 1). By getting the MetaData object, the number of columns, as well as their type and size (eg, VARCHAR(156)) is easily found by an appropriate accessor. This allows the creation of the target table. Lines 10, 11 and 12 store the field names, types and sizes, respectively, in String arrays fieldName, fieldType and fieldSize, respectively. Note that there are two indices (i and j, lines 6 and 7). The index ‘i’ walks through the data corresponding to the source tables. Certain columns are not being used, so they are skipped (line 8). Index ‘j’ represents the columns of the target table. ‘j’ will be at most equal to ‘i’, meaning that the number of target columns will at most equal the number of source columns. On row 21, we determine the number of target columns, and store that value in variable “rows”. On line 20, we create the beginning of the sql statement that creates the target table. Note that we use a StringBuffer variable ‘sb’. This

37

Page 38: Lance Drug IS WSAD Manual

is more efficient than the continuous concatenation of String objects. The method toString() will eventually be used to create a String object out of ‘sb’, and then that String will be used to create the table.

1. numCol = initialize("ndc_source", "drug_source");2. // The following indices refer to columns in MS Access3. // that are not being used in the project. As a result,4. // we do not process those columns, and they are not5. // added to the IBM BD2 table.6. int j = 1;7. for(int i = 1; i <= numCol; i++){8. if( i != 4 && i != 7 && i != 9)9. {10. fieldName[j] = rsmd.getColumnName(i);11. fieldType[j] = rsmd.getColumnTypeName(i);12. fieldSize[j] = "(" + rsmd.getPrecision(i) + ")";13.14. println(j + ". " + fieldName[j] + "\t" + 15. fieldType[j] + fieldSize[j]);16. ++j;17. }18. }19. // Create the sql statement to create the table20. sb.append( "Create table " + "ids517team2." + targetTable + "(" );21. int rows = j-1;

Phase II: We have stored all the information concerning the source tables in the arrays fieldType, fieldSize and fieldName. We must be careful to use sql that will not throw exceptions in JDBC. For example, MS Access has the type and size INTEGER(10). However, the size “(10)” appended to “INTEGER” is not allowed in IBM DB2, as all INTEGERS have a default size of 36 digits. Thus, on line 22, we check if the current fieldName has a fieldType of INTEGER. If it does, we remove the fieldSize on line 23. This same procedure is used for SMALLINT and DOUBLE. For DATETIME, there are two ways the program uses dates and time. If a comparison is required, which is required when determining if the drug is obsolete, we must convert DATETIME to DATE. This is done in the code on lines 44-46. However, if only a character representation is required, it was sufficient to convert the DATETIME to a VARCHAR. Notice, on line 33, we had to add a size to the type VARCHAR (line 32). For each column in the target table, we must check the types. For each column, after the appropriate conversion is accomplished, the sql to create that column is added on line 40. Notice that if we still have columns left in the table, we need to add a comma to the end of each line (shown in line 41).

21. for(int i = 1; i <= rows; i++){22. if(fieldType[i].trim().equalsIgnoreCase("INTEGER")){23. fieldSize[i] = "";24. }25. else if(fieldType[i].trim().equalsIgnoreCase("SMALLINT")){26. fieldSize[i] = "";27. }

38

Page 39: Lance Drug IS WSAD Manual

28. else if(fieldType[i].trim().equalsIgnoreCase("DOUBLE")){29. fieldSize[i] = "";30. }31. else if(fieldType[i].trim().equalsIgnoreCase("DATETIME")){32. fieldType[i] = "VARCHAR";33. fieldSize[i] = "(10)";34. }35.36. if(fieldName[i].trim().equalsIgnoreCase("address1")){37. fieldName[i] = "address";38. }39.40. sb.append(fieldName[i] + " " + fieldType[i] + fieldSize[i] + " NOT NULL");41. if( i != rows ) sb.append(", ");42. }...MISSING CODE...

43. else if(fieldType[i].trim().equalsIgnoreCase("DATETIME")){44. fieldType[i] = "DATE";45. fieldSize[i] = "";46. }

Phase III: The final phase requires each target table to be populated by querying the associated source table. Since there are many records in the tables, sometimes over 100,000, it is more efficient to create a PreparedStatement object to handle the sql statement and the query to create a new record in the target table. This is done on line 47, where ‘ps’ is a PreparedStatement object. Notice that we go through the code on line 47-56 only once. Once created, all that is left is to step through the ResultSet object (lines 57-65). This object ‘resultSet’ contains all the records of the associated source table. We step through the resultSet one record at a time, extracting the data in each of the field (lines 58-62) and using the PreparedStatement mutators (setDate(), setInt(), etc) to set the fields of the object referenced by ‘ps’. Once this is done, all we need to do is execute the statement, which is done on line 63. Notice that, by the time we reach line 63, the various fields of ‘ps’ have been set, and we send the message “executeUpdate()’ to the object ‘ps’. This results in the query being executed, and a record being added to the respective table.

47. PreparedStatement ps = db2Con.prepareStatement(48. "INSERT INTO " + schema + targetTable + 49. "(" + 50. fieldName[1] + ", " + // NDC_CODE51. fieldName[2] + ", " + // DRUG_CODE52. fieldName[3] + ", " + // BRAND_CODE53. fieldName[4] + ", " + // OBSOLETE_DATE54. fieldName[5] + // SOURCE_ID55. ") VALUES (?,?,?,?,?)"56. );57. while( resultSet.next() ){58. ps.setString( 1, resultSet.getString("NDC_CODE") );59. ps.setInt( 2, resultSet.getInt("MAIN_MULTUM_DRUG_CODE") );60. ps.setInt( 3, resultSet.getInt("BRAND_CODE") );

39

Page 40: Lance Drug IS WSAD Manual

61. ps.setDate( 4, resultSet.getDate("OBSOLETE_DATE") );62. ps.setInt( 5, resultSet.getInt("SOURCE_ID") );63. ps.executeUpdate();64. db2Con.commit(); // COMMIT65. }

40

Page 41: Lance Drug IS WSAD Manual

VIII. JAVABEAN FILES

DeleteAdministrator.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 4:33:29 PM */

public class DeleteAdministrator{

private DBModify modify;

/** * Constructor for a DBModify class. */public DeleteAdministrator(){super();initializer();

}

/** * Creates a DBModify instance and initializes its properties. */protected void initializer(){modify = new DBModify();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");modify.setCommand(

"DELETE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :codename AND IDS517TEAM2.ADMIN.USERID = :userid");

DBParameterMetaData parmMetaData = modify.getParameterMetaData();parmMetaData.setParameter(

1,"codename",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"userid",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String username,String password,String codename,String userid)throws SQLException

{try{

modify.setUsername(username);modify.setPassword(password);

41

Page 42: Lance Drug IS WSAD Manual

modify.setParameter("codename", codename);modify.setParameter("userid", userid);modify.execute();

}

// Free resources of modify object. finally{

modify.close();}

}

/** * Returns a DBModify reference. */public DBModify getDBModify(){return modify;

}}

42

Page 43: Lance Drug IS WSAD Manual

DrugsByMfg.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 8, 2004 1:32:07 AM */

public class DrugsByMfg{

private DBSelect select;

/** * Constructor for a DBSelect class. */public DrugsByMfg(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION, IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE FROM IDS517TEAM2.BRAND_NAME, IDS517TEAM2.CORE_DESCRIPTION, IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.BRAND_NAME.BRAND_CODE = IDS517TEAM2.CORE_DESCRIPTION.BRAND_CODE AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = IDS517TEAM2.CORE_DESCRIPTION.SOURCE_ID AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = :code ORDER BY SOURCE_DESC ASC");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"code",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.SMALLINT,Short.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid,String password,

// int maxRows,Short code)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);

// select.setMaxRows(maxRows);select.setParameter("code", code);select.execute();

}

43

Page 44: Lance Drug IS WSAD Manual

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public DrugsByMfgRow[] getRows(){DrugsByMfgRow[] rows = new DrugsByMfgRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new DrugsByMfgRow(select, i + 1);};return rows;

}}

44

Page 45: Lance Drug IS WSAD Manual

DrugsByMfgRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 8, 2004 1:32:08 AM */

public class DrugsByMfgRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public DrugsByMfgRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this

object. */public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column CORE_DESCRIPTION_OBSOLETE_DATE in the row represented by this

object. */public Object getCORE_DESCRIPTION_OBSOLETE_DATE() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

45

Page 46: Lance Drug IS WSAD Manual

GetAdminLogonInfo.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 11:29:11 PM */

public class GetAdminLogonInfo{

private DBSelect select;

/** * Constructor for a DBSelect class. */public GetAdminLogonInfo(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME LIKE :code AND IDS517TEAM2.ADMIN.USERID LIKE :id");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"code",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"id",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, String code, String id)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setParameter("code", code);select.setParameter("id", id);select.execute();

}

// Free resources of select object. finally

46

Page 47: Lance Drug IS WSAD Manual

{select.close();

}}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public GetAdminLogonInfoRow[] getRows(){GetAdminLogonInfoRow[] rows =

new GetAdminLogonInfoRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new GetAdminLogonInfoRow(select, i + 1);};return rows;

}}

47

Page 48: Lance Drug IS WSAD Manual

GetAdminLogonInfoRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:29:11 PM */

public class GetAdminLogonInfoRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public GetAdminLogonInfoRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column ADMIN_CODENAME in the row represented by this object. */public Object getADMIN_CODENAME() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column ADMIN_USERID in the row represented by this object. */public Object getADMIN_USERID() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

48

Page 49: Lance Drug IS WSAD Manual

GetAnAdministrator.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 6:12:19 PM */

public class GetAnAdministrator{

private DBSelect select;

/** * Constructor for a DBSelect class. */public GetAnAdministrator(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID, IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME, IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY, IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP, IDS517TEAM2.ADMIN.PHONE FROM IDS517TEAM2.ADMIN WHERE IDS517TEAM2.ADMIN.CODENAME = :username AND IDS517TEAM2.ADMIN.USERID = :userid");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"username",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"userid",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String name,String password,String username,String userid)throws SQLException

{try{

select.setUsername(name);select.setPassword(password);

49

Page 50: Lance Drug IS WSAD Manual

select.setParameter("username", username);select.setParameter("userid", userid);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public GetAnAdministratorRow[] getRows(){GetAnAdministratorRow[] rows =

new GetAnAdministratorRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new GetAnAdministratorRow(select, i + 1);};return rows;

}}

50

Page 51: Lance Drug IS WSAD Manual

GetAnAdministratorRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 6:12:20 PM */

public class GetAnAdministratorRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public GetAnAdministratorRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column ADMIN_CODENAME in the row represented by this object. */public Object getADMIN_CODENAME() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column ADMIN_USERID in the row represented by this object. */public Object getADMIN_USERID() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column ADMIN_FIRSTNAME in the row represented by this object. */public Object getADMIN_FIRSTNAME() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column ADMIN_LASTNAME in the row represented by this object. */public Object getADMIN_LASTNAME() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns the value of column ADMIN_STREET in the row represented by this object. */public Object getADMIN_STREET() throws SQLException{return select.getCacheValueAt(rowNumber, 5);

}

/** * Returns the value of column ADMIN_CITY in the row represented by this object. */public Object getADMIN_CITY() throws SQLException{return select.getCacheValueAt(rowNumber, 6);

}

/** * Returns the value of column ADMIN_STATE in the row represented by this object. */

51

Page 52: Lance Drug IS WSAD Manual

public Object getADMIN_STATE() throws SQLException{return select.getCacheValueAt(rowNumber, 7);

}

/** * Returns the value of column ADMIN_ZIP in the row represented by this object. */public Object getADMIN_ZIP() throws SQLException{return select.getCacheValueAt(rowNumber, 8);

}

/** * Returns the value of column ADMIN_PHONE in the row represented by this object. */public Object getADMIN_PHONE() throws SQLException{return select.getCacheValueAt(rowNumber, 9);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

52

Page 53: Lance Drug IS WSAD Manual

GetMfgRowFromCode.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 11:48:11 AM */

public class GetMfgRowFromCode{

private DBSelect select;

/** * Constructor for a DBSelect class. */public GetMfgRowFromCode(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_ID, IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.DRUG_SOURCE.ADDRESS, IDS517TEAM2.DRUG_SOURCE.CITY, IDS517TEAM2.DRUG_SOURCE.STATE, IDS517TEAM2.DRUG_SOURCE.ZIP, IDS517TEAM2.DRUG_SOURCE.URL FROM IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = :id");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"id",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.SMALLINT,Short.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, Short id)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setParameter("id", id);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

53

Page 54: Lance Drug IS WSAD Manual

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public GetMfgRowFromCodeRow[] getRows(){GetMfgRowFromCodeRow[] rows =

new GetMfgRowFromCodeRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new GetMfgRowFromCodeRow(select, i + 1);};return rows;

}}

54

Page 55: Lance Drug IS WSAD Manual

GetMfgRowFromCodeRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:48:11 AM */

public class GetMfgRowFromCodeRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public GetMfgRowFromCodeRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column DRUG_SOURCE_ADDRESS in the row represented by this object. */public Object getDRUG_SOURCE_ADDRESS() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column DRUG_SOURCE_CITY in the row represented by this object. */public Object getDRUG_SOURCE_CITY() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns the value of column DRUG_SOURCE_STATE in the row represented by this object. */public Object getDRUG_SOURCE_STATE() throws SQLException{return select.getCacheValueAt(rowNumber, 5);

}

/** * Returns the value of column DRUG_SOURCE_ZIP in the row represented by this object. */public Object getDRUG_SOURCE_ZIP() throws SQLException{return select.getCacheValueAt(rowNumber, 6);

}

/** * Returns the value of column DRUG_SOURCE_URL in the row represented by this object. */

55

Page 56: Lance Drug IS WSAD Manual

public Object getDRUG_SOURCE_URL() throws SQLException{return select.getCacheValueAt(rowNumber, 7);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

56

Page 57: Lance Drug IS WSAD Manual

GetMfgRowFromCodeRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 11:48:11 AM */

public class GetMfgRowFromCodeRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public GetMfgRowFromCodeRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column DRUG_SOURCE_ADDRESS in the row represented by this object. */public Object getDRUG_SOURCE_ADDRESS() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column DRUG_SOURCE_CITY in the row represented by this object. */public Object getDRUG_SOURCE_CITY() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns the value of column DRUG_SOURCE_STATE in the row represented by this object. */public Object getDRUG_SOURCE_STATE() throws SQLException{return select.getCacheValueAt(rowNumber, 5);

}

/** * Returns the value of column DRUG_SOURCE_ZIP in the row represented by this object. */public Object getDRUG_SOURCE_ZIP() throws SQLException{return select.getCacheValueAt(rowNumber, 6);

}

/** * Returns the value of column DRUG_SOURCE_URL in the row represented by this object. */

57

Page 58: Lance Drug IS WSAD Manual

public Object getDRUG_SOURCE_URL() throws SQLException{return select.getCacheValueAt(rowNumber, 7);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

58

Page 59: Lance Drug IS WSAD Manual

GetNextMfgSourceId.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 1:35:29 AM */

public class GetNextMfgSourceId{

private DBSelect select;

/** * Constructor for a DBSelect class. */public GetNextMfgSourceId(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT (MAX(IDS517TEAM2.DRUG_SOURCE.SOURCE_ID) + 1) FROM IDS517TEAM2.DRUG_SOURCE");}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password) throws SQLException{try{

select.setUsername(userid);select.setPassword(password);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public GetNextMfgSourceIdRow[] getRows()

59

Page 60: Lance Drug IS WSAD Manual

{GetNextMfgSourceIdRow[] rows =

new GetNextMfgSourceIdRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new GetNextMfgSourceIdRow(select, i + 1);};return rows;

}}

60

Page 61: Lance Drug IS WSAD Manual

GetNextMfgSourceIdRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 1:35:30 AM */

public class GetNextMfgSourceIdRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public GetNextMfgSourceIdRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column ColExp1 in the row represented by this object. */public Object getColExp1() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

61

Page 62: Lance Drug IS WSAD Manual

Global.java

/* * Created on Jan 7, 2004 * * To change the template for this generated file go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */package drug;

/** * @author GLANCE * * To change the template for this generated type comment go to * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments */public interface Global{

// Uncomment when using CBA computerstatic String USERNAME = "ids517team2";static String PASSWORD = "glance44";

// Uncomment when using Gary's home computer// static String USERNAME = "glance";// static String PASSWORD = "gl122855";}

62

Page 63: Lance Drug IS WSAD Manual

IngredientListForBrandNamesLike.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 3:25:15 PM */

public class IngredientListForBrandNamesLike{

private DBSelect select;

/** * Constructor for a DBSelect class. */public IngredientListForBrandNamesLike(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT X.DRUG_NAME, A.ACTIVE_INGREDIENT FROM IDS517TEAM2.ACTIVE_INGREDIENT AS A, IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS I, IDS517TEAM2.DRUG_CODE AS D, IDS517TEAM2.DRUG_ID AS X WHERE A.ACTIVE_INGREDIENT_CODE = I.ACTIVE_INGREDIENT_CODE AND I.DRUG_CODE = D.DRUG_CODE AND D.DRUG_ID = X.DRUG_ID AND A.ACTIVE_INGREDIENT_CODE IN ( SELECT L.ACTIVE_INGREDIENT_CODE FROM IDS517TEAM2.ACTIVE_INGREDIENT_LIST AS L WHERE L.DRUG_CODE IN ( SELECT C.DRUG_CODE FROM IDS517TEAM2.DRUG_ID AS B, IDS517TEAM2.DRUG_CODE AS C WHERE B.DRUG_ID = C.DRUG_ID AND B.DRUG_NAME LIKE :name1 ) ) AND X.DRUG_NAME LIKE :name2");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"name1",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"name2",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

} catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, String name1, String name2)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);

63

Page 64: Lance Drug IS WSAD Manual

select.setParameter("name1", name1);select.setParameter("name2", name2);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public IngredientListForBrandNamesLikeRow[] getRows(){IngredientListForBrandNamesLikeRow[] rows =

new IngredientListForBrandNamesLikeRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new IngredientListForBrandNamesLikeRow(select, i + 1);};return rows;

}}

64

Page 65: Lance Drug IS WSAD Manual

IngredientListForBrandNamesLikeRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 3:25:16 PM */

public class IngredientListForBrandNamesLikeRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public IngredientListForBrandNamesLikeRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column X_DRUG_NAME in the row represented by this object. */public Object getX_DRUG_NAME() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column A_ACTIVE_INGREDIENT in the row represented by this object. */public Object getA_ACTIVE_INGREDIENT() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

65

Page 66: Lance Drug IS WSAD Manual

InsertAdmin.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 8:16:39 AM */

public class InsertAdmin{

private DBModify modify;

/** * Constructor for a DBModify class. */public InsertAdmin(){super();initializer();

}

/** * Creates a DBModify instance and initializes its properties. */protected void initializer(){modify = new DBModify();try{

modify.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");modify.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");modify.setCommand(

"INSERT INTO IDS517TEAM2.ADMIN ( CODENAME, USERID, FIRSTNAME, LASTNAME, STREET, CITY, STATE, ZIP, PHONE ) VALUES ( :codename, :userid, :firstname, :lastname, :street, :city, :state, :zip, :phone )");

DBParameterMetaData parmMetaData = modify.getParameterMetaData();parmMetaData.setParameter(

1,"codename",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"userid",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(3,"firstname",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(4,"lastname",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(5,"street",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(6,"city",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

66

Page 67: Lance Drug IS WSAD Manual

parmMetaData.setParameter(7,"state",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(8,"zip",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(9,"phone",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String username,String password,String codename,String userid,String firstname,String lastname,String street,String city,String state,String zip,String phone)throws SQLException

{try{

modify.setUsername(username);modify.setPassword(password);modify.setParameter("codename", codename);modify.setParameter("userid", userid);modify.setParameter("firstname", firstname);modify.setParameter("lastname", lastname);modify.setParameter("street", street);modify.setParameter("city", city);modify.setParameter("state", state);modify.setParameter("zip", zip);modify.setParameter("phone", phone);modify.execute();

}

// Free resources of modify object. finally{

modify.close();}

}

/** * Returns a DBModify reference. */public DBModify getDBModify(){return modify;

}}

67

Page 68: Lance Drug IS WSAD Manual

InsertVendor.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 7, 2004 1:24:17 AM */

public class InsertVendor{

private DBModify modify;

/** * Constructor for a DBModify class. */public InsertVendor(){super();initializer();

}

/** * Creates a DBModify instance and initializes its properties. */protected void initializer(){modify = new DBModify();try{

modify.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");modify.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");modify.setCommand(

"INSERT INTO IDS517TEAM2.DRUG_SOURCE ( SOURCE_ID, SOURCE_DESC, ADDRESS, CITY, STATE, ZIP, URL ) VALUES ( :id, :descr, :address, :city, :state, :zip, :url )");

DBParameterMetaData parmMetaData = modify.getParameterMetaData();parmMetaData.setParameter(

1,"id",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.SMALLINT,Short.class);

parmMetaData.setParameter(2,"descr",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(3,"address",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(4,"city",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(5,"state",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(6,"zip",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(

68

Page 69: Lance Drug IS WSAD Manual

7,"url",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid,String password,Short id,String descr,String address,String city,String state,String zip,String url)throws SQLException

{try{

modify.setUsername(userid);modify.setPassword(password);modify.setParameter("id", id);modify.setParameter("descr", descr);modify.setParameter("address", address);modify.setParameter("city", city);modify.setParameter("state", state);modify.setParameter("zip", zip);modify.setParameter("url", url);modify.execute();

}

// Free resources of modify object. finally{

modify.close();}

}

/** * Returns a DBModify reference. */public DBModify getDBModify(){return modify;

}}

69

Page 70: Lance Drug IS WSAD Manual

SelectAllBrands.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 3:03:51 AM */

public class SelectAllBrands{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectAllBrands(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME");

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, int maxRows)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/**

70

Page 71: Lance Drug IS WSAD Manual

* Returns an array of objects representing the rows in the result set. */public SelectAllBrandsRow[] getRows(){SelectAllBrandsRow[] rows =

new SelectAllBrandsRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectAllBrandsRow(select, i + 1);};return rows;

}}

71

Page 72: Lance Drug IS WSAD Manual

SelectAllBrandsLike.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 2:20:26 AM */

public class SelectAllBrandsLike{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectAllBrandsLike(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME WHERE IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION LIKE :brand");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"brand",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid,String password,int maxRows,String brand)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.setParameter("brand", brand);select.execute();

}

// Free resources of select object. finally{

72

Page 73: Lance Drug IS WSAD Manual

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public SelectAllBrandsLikeRow[] getRows(){SelectAllBrandsLikeRow[] rows =

new SelectAllBrandsLikeRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectAllBrandsLikeRow(select, i + 1);};return rows;

}}

73

Page 74: Lance Drug IS WSAD Manual

SelectAllBrandsLikeRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 2:20:26 AM */

public class SelectAllBrandsLikeRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectAllBrandsLikeRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column BRAND_NAME_BRAND_CODE in the row represented by this object. */public Object getBRAND_NAME_BRAND_CODE() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this

object. */public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

74

Page 75: Lance Drug IS WSAD Manual

SelectAllBrandsRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 3:03:52 AM */

public class SelectAllBrandsRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectAllBrandsRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column BRAND_NAME_BRAND_CODE in the row represented by this object. */public Object getBRAND_NAME_BRAND_CODE() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this

object. */public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

75

Page 76: Lance Drug IS WSAD Manual

SelectAllDrugNamesLike.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 3, 2004 9:56:09 AM */

public class SelectAllDrugNamesLike{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectAllDrugNamesLike(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT IDS517TEAM2.BRAND_NAME.BRAND_CODE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME WHERE IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION LIKE :descr");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"descr",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid,String password,int maxRows,String descr)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.setParameter("descr", descr);select.execute();

}

// Free resources of select object. finally{

76

Page 77: Lance Drug IS WSAD Manual

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public SelectAllDrugNamesLikeRow[] getRows(){SelectAllDrugNamesLikeRow[] rows =

new SelectAllDrugNamesLikeRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectAllDrugNamesLikeRow(select, i + 1);};return rows;

}}

77

Page 78: Lance Drug IS WSAD Manual

SelectAllDrugNamesLikeRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 3, 2004 9:56:09 AM */

public class SelectAllDrugNamesLikeRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectAllDrugNamesLikeRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column BRAND_NAME_BRAND_CODE in the row represented by this object. */public Object getBRAND_NAME_BRAND_CODE() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this

object. */public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

78

Page 79: Lance Drug IS WSAD Manual

SelectAllMfgInfo.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 4, 2004 7:59:59 AM */

public class SelectAllMfgInfo{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectAllMfgInfo(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_ID, IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.DRUG_SOURCE.ADDRESS, IDS517TEAM2.DRUG_SOURCE.CITY, IDS517TEAM2.DRUG_SOURCE.STATE, IDS517TEAM2.DRUG_SOURCE.ZIP, IDS517TEAM2.DRUG_SOURCE.URL FROM IDS517TEAM2.DRUG_SOURCE");

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password) throws SQLException{try{

select.setUsername(userid);select.setPassword(password);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set.

79

Page 80: Lance Drug IS WSAD Manual

*/public SelectAllMfgInfoRow[] getRows(){SelectAllMfgInfoRow[] rows =

new SelectAllMfgInfoRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectAllMfgInfoRow(select, i + 1);};return rows;

}}

80

Page 81: Lance Drug IS WSAD Manual

SelectAllMfgInfoRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 4, 2004 8:00:00 AM */

public class SelectAllMfgInfoRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectAllMfgInfoRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column DRUG_SOURCE_ADDRESS in the row represented by this object. */public Object getDRUG_SOURCE_ADDRESS() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column DRUG_SOURCE_CITY in the row represented by this object. */public Object getDRUG_SOURCE_CITY() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns the value of column DRUG_SOURCE_STATE in the row represented by this object. */public Object getDRUG_SOURCE_STATE() throws SQLException{return select.getCacheValueAt(rowNumber, 5);

}

/** * Returns the value of column DRUG_SOURCE_ZIP in the row represented by this object. */public Object getDRUG_SOURCE_ZIP() throws SQLException{return select.getCacheValueAt(rowNumber, 6);

}

/** * Returns the value of column DRUG_SOURCE_URL in the row represented by this object. */

81

Page 82: Lance Drug IS WSAD Manual

public Object getDRUG_SOURCE_URL() throws SQLException{return select.getCacheValueAt(rowNumber, 7);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

82

Page 83: Lance Drug IS WSAD Manual

SelectAllMfgs.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 4, 2004 7:56:47 AM */

public class SelectAllMfgs{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectAllMfgs(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT D.SOURCE_ID, D.SOURCE_DESC FROM IDS517TEAM2.DRUG_SOURCE D ORDER BY D.SOURCE_DESC");

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, int maxRows)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password)throws SQLException

{try{

select.setUsername(userid);

83

Page 84: Lance Drug IS WSAD Manual

select.setPassword(password);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public SelectAllMfgsRow[] getRows(){SelectAllMfgsRow[] rows = new SelectAllMfgsRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectAllMfgsRow(select, i + 1);};return rows;

}}

84

Page 85: Lance Drug IS WSAD Manual

SelectAllMfgsRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 4, 2004 7:56:47 AM */

public class SelectAllMfgsRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectAllMfgsRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_ID in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_ID() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

85

Page 86: Lance Drug IS WSAD Manual

SelectDrugNames.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 3, 2004 9:51:04 AM */

public class SelectDrugNames{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectDrugNames(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT DISTINCT IDS517TEAM2.DRUG_ID.DRUG_ID, IDS517TEAM2.DRUG_ID.DRUG_NAME FROM IDS517TEAM2.DRUG_ID");

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password, int maxRows)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/**

86

Page 87: Lance Drug IS WSAD Manual

* Returns an array of objects representing the rows in the result set. */public SelectDrugNamesRow[] getRows(){SelectDrugNamesRow[] rows =

new SelectDrugNamesRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectDrugNamesRow(select, i + 1);};return rows;

}}

87

Page 88: Lance Drug IS WSAD Manual

SelectDrugNamesRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 3, 2004 9:51:05 AM */

public class SelectDrugNamesRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectDrugNamesRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_ID_DRUG_ID in the row represented by this object. */public Object getDRUG_ID_DRUG_ID() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column DRUG_ID_DRUG_NAME in the row represented by this object. */public Object getDRUG_ID_DRUG_NAME() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

88

Page 89: Lance Drug IS WSAD Manual

SelectObsoleteDrugs.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 9:46:08 PM */

public class SelectObsoleteDrugs{

private DBSelect select;

/** * Constructor for a DBSelect class. */public SelectObsoleteDrugs(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.DRUG_SOURCE.SOURCE_DESC, IDS517TEAM2.CORE_DESCRIPTION.NDC_CODE, IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE, IDS517TEAM2.BRAND_NAME.BRAND_DESCRIPTION FROM IDS517TEAM2.BRAND_NAME, IDS517TEAM2.CORE_DESCRIPTION, IDS517TEAM2.DRUG_SOURCE WHERE IDS517TEAM2.BRAND_NAME.BRAND_CODE = IDS517TEAM2.CORE_DESCRIPTION.BRAND_CODE AND IDS517TEAM2.DRUG_SOURCE.SOURCE_ID = IDS517TEAM2.CORE_DESCRIPTION.SOURCE_ID AND IDS517TEAM2.CORE_DESCRIPTION.OBSOLETE_DATE >= :date ORDER BY NDC_CODE ASC, BRAND_DESCRIPTION ASC, SOURCE_DESC ASC, OBSOLETE_DATE ASC");

DBParameterMetaData parmMetaData = select.getParameterMetaData();parmMetaData.setParameter(

1,"date",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.DATE,java.sql.Date.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid,String password,int maxRows,java.sql.Date date)throws SQLException

{try{

select.setUsername(userid);select.setPassword(password);select.setMaxRows(maxRows);select.setParameter("date", date);select.execute();

}

89

Page 90: Lance Drug IS WSAD Manual

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

/** * Returns an array of objects representing the rows in the result set. */public SelectObsoleteDrugsRow[] getRows(){SelectObsoleteDrugsRow[] rows =

new SelectObsoleteDrugsRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new SelectObsoleteDrugsRow(select, i + 1);};return rows;

}}

90

Page 91: Lance Drug IS WSAD Manual

SelectObsoleteDrugsRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 9:46:08 PM */public class SelectObsoleteDrugsRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public SelectObsoleteDrugsRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column DRUG_SOURCE_SOURCE_DESC in the row represented by this object. */public Object getDRUG_SOURCE_SOURCE_DESC() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column CORE_DESCRIPTION_NDC_CODE in the row represented by this

object. */public Object getCORE_DESCRIPTION_NDC_CODE() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column CORE_DESCRIPTION_OBSOLETE_DATE in the row represented by this

object. */public Object getCORE_DESCRIPTION_OBSOLETE_DATE() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column BRAND_NAME_BRAND_DESCRIPTION in the row represented by this

object. */public Object getBRAND_NAME_BRAND_DESCRIPTION() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;

91

Page 92: Lance Drug IS WSAD Manual

}return string;}}

ShowAllAdministrators.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBSelect property values. It also provides * methods that execute your SQL statement, return * a DBSelect reference, and return an array of objects * representing the rows in the result set. * Generated: Jan 7, 2004 4:47:43 PM */

public class ShowAllAdministrators{

private DBSelect select;

/** * Constructor for a DBSelect class. */public ShowAllAdministrators(){super();initializer();

}

/** * Creates a DBSelect instance and initializes its properties. */protected void initializer(){select = new DBSelect();try{

select.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");select.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");select.setCommand(

"SELECT IDS517TEAM2.ADMIN.CODENAME, IDS517TEAM2.ADMIN.USERID, IDS517TEAM2.ADMIN.FIRSTNAME, IDS517TEAM2.ADMIN.LASTNAME, IDS517TEAM2.ADMIN.STREET, IDS517TEAM2.ADMIN.CITY, IDS517TEAM2.ADMIN.STATE, IDS517TEAM2.ADMIN.ZIP, IDS517TEAM2.ADMIN.PHONE FROM IDS517TEAM2.ADMIN");

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String userid, String password) throws SQLException{try{

select.setUsername(userid);select.setPassword(password);select.execute();

}

// Free resources of select object. finally{

select.close();}

}

/** * Returns a DBSelect reference. */public DBSelect getDBSelect(){return select;

}

92

Page 93: Lance Drug IS WSAD Manual

/** * Returns an array of objects representing the rows in the result set. */public ShowAllAdministratorsRow[] getRows(){ShowAllAdministratorsRow[] rows =

new ShowAllAdministratorsRow[select.getRowCount()];for (int i = 0; i <= select.getRowCount() - 1; i++){

rows[i] = new ShowAllAdministratorsRow(select, i + 1);};return rows;

}}

93

Page 94: Lance Drug IS WSAD Manual

ShowAllAdministratorsRow.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class represents a specific row of a result set * contained in a DBSelect. * Generated: Jan 7, 2004 4:47:44 PM */

public class ShowAllAdministratorsRow{

private int rowNumber;private DBSelect select;

/** * Constructs an object that represents a row from a DBSelect. */public ShowAllAdministratorsRow(DBSelect aRef, int aRowNumber){select = aRef;rowNumber = aRowNumber;

}

/** * Returns the value of column ADMIN_CODENAME in the row represented by this object. */public Object getADMIN_CODENAME() throws SQLException{return select.getCacheValueAt(rowNumber, 1);

}

/** * Returns the value of column ADMIN_USERID in the row represented by this object. */public Object getADMIN_USERID() throws SQLException{return select.getCacheValueAt(rowNumber, 2);

}

/** * Returns the value of column ADMIN_FIRSTNAME in the row represented by this object. */public Object getADMIN_FIRSTNAME() throws SQLException{return select.getCacheValueAt(rowNumber, 3);

}

/** * Returns the value of column ADMIN_LASTNAME in the row represented by this object. */public Object getADMIN_LASTNAME() throws SQLException{return select.getCacheValueAt(rowNumber, 4);

}

/** * Returns the value of column ADMIN_STREET in the row represented by this object. */public Object getADMIN_STREET() throws SQLException{return select.getCacheValueAt(rowNumber, 5);

}

/** * Returns the value of column ADMIN_CITY in the row represented by this object. */public Object getADMIN_CITY() throws SQLException{return select.getCacheValueAt(rowNumber, 6);

}

/** * Returns the value of column ADMIN_STATE in the row represented by this object. */

94

Page 95: Lance Drug IS WSAD Manual

public Object getADMIN_STATE() throws SQLException{return select.getCacheValueAt(rowNumber, 7);

}

/** * Returns the value of column ADMIN_ZIP in the row represented by this object. */public Object getADMIN_ZIP() throws SQLException{return select.getCacheValueAt(rowNumber, 8);

}

/** * Returns the value of column ADMIN_PHONE in the row represented by this object. */public Object getADMIN_PHONE() throws SQLException{return select.getCacheValueAt(rowNumber, 9);

}

/** * Returns a String that contains all of the values in the row represented by this object. */public String toString(){String string = "";try{

for (int i = 1; i <= select.getColumnCount(); i++){

string += select.getCacheValueAt(rowNumber, i);string += " ";

}}catch (SQLException ex){

return null;}return string;

}}

95

Page 96: Lance Drug IS WSAD Manual

UpdateAdminInfo.java

package drug;import java.sql.*;import com.ibm.db.beans.*;

/** * This class sets the DBModify property values. It also provides * methods that execute your SQL statement and return * a DBModify reference. * Generated: Jan 8, 2004 12:04:49 PM */

public class UpdateAdminInfo{

private DBModify modify;

/** * Constructor for a DBModify class. */public UpdateAdminInfo(){super();initializer();

}

/** * Creates a DBModify instance and initializes its properties. */protected void initializer(){modify = new DBModify();try{

modify.setDriverName("COM.ibm.db2.jdbc.net.DB2Driver");modify.setUrl("jdbc:db2://sphere.cba.uic.edu:6789/GLANCE");modify.setCommand(

"UPDATE IDS517TEAM2.ADMIN SET FIRSTNAME = :firstname, LASTNAME = :lastname, STREET = :street, CITY = :city, STATE = :state, ZIP = :zip, PHONE = :phone WHERE IDS517TEAM2.ADMIN.CODENAME = :codename AND IDS517TEAM2.ADMIN.USERID = :userid");

DBParameterMetaData parmMetaData = modify.getParameterMetaData();parmMetaData.setParameter(

1,"firstname",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(2,"lastname",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(3,"street",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(4,"city",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(5,"state",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(6,"zip",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

96

Page 97: Lance Drug IS WSAD Manual

parmMetaData.setParameter(7,"phone",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(8,"codename",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

parmMetaData.setParameter(9,"userid",java.sql.DatabaseMetaData.procedureColumnIn,java.sql.Types.VARCHAR,String.class);

}catch (SQLException ex){

ex.printStackTrace();}

}

/** * Executes the SQL statement. */public void execute(String username,String password,String firstname,String lastname,String street,String city,String state,String zip,String phone,String codename,String userid)throws SQLException

{try{

modify.setUsername(username);modify.setPassword(password);modify.setParameter("firstname", firstname);modify.setParameter("lastname", lastname);modify.setParameter("street", street);modify.setParameter("city", city);modify.setParameter("state", state);modify.setParameter("zip", zip);modify.setParameter("phone", phone);modify.setParameter("codename", codename);modify.setParameter("userid", userid);modify.execute();

}

// Free resources of modify object. finally{

modify.close();}

}

/** * Returns a DBModify reference. */public DBModify getDBModify(){return modify;

}}

97

Page 98: Lance Drug IS WSAD Manual

IX. JAVA SERVER PAGES (JSP) FILES

admin.jsp

<html><head><title>admin.jsp</title><script type="text/javascript" language="JavaScript">

function validate(){if(!document.data.firstNameField.value)

alert("First name is required.");else if(!document.data.lastNameField.value)

alert("Last name is required.");else if(!document.data.UserIdField.value)

alert("User ID is required.");else if(!document.data.passwordField.value)

alert("Password is required.");else if(!document.data.streetField.value)

alert("Street number/name is required.");else if(!document.data.cityField.value)

alert("City is required.");else if(!document.data.stateField.value)

alert("State is required.");else if(!document.data.zipField.value)

alert("Zip code is required.");else if(!document.data.phoneField.value)

alert("Phone number is required.");}

</script><title>admin.jsp</title>

</head><body><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center" valign="baseline">

<td align="center" valign="baseline"><h2 align="center">ADMINISTRATOR SHEET</h2></td>

</tr></tbody>

</table></center>

<p><br /></p><form name="data" action="register.jsp" method="post"><center><table border="1">

<tbody><tr>

<td>First Name:</td><td><input type="text" name="firstNameField" size="20" /></td><td>User-id:</td><td><input type="text" name="UserIdField" size="20" /></td>

</tr><tr>

<td>Last Name:</td><td><input type="text" name="lastNameField" size="20" /></td><td>Password:</td><td><input type="password" name="passwordField" size="20" /></td>

</tr><tr>

<td>Street:</td><td colspan="3" align="left"><input type="text" name="streetField" size="57" /></td>

</tr><tr>

<td>City:</td><td><input type="text" name="cityField" size="20" /></td><td>State:</td><td><input type="text" name="stateField" size="20" /></td>

</tr><tr>

<td>Zip Code:</td><td><input type="text" name="zipField" size="20" /></td>

98

Page 99: Lance Drug IS WSAD Manual

<td>Phone:</td><td><input type="text" name="phoneField" size="20" /></td>

</tr></tbody>

</table>

<script language="JavaScript">document.data.firstNameField.focus();

</script>

<br /><DIV align="center"><INPUT type="submit" value="REGISTER"></DIV></form></center><p><br /></p><form action="index.jsp"><div align="center"><input type="submit" name="homeBtn" value="HOME" /></div></form></body></html>

99

Page 100: Lance Drug IS WSAD Manual

brands.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!SelectAllBrands sabl;SelectAllBrandsRow[] rows;SelectAllBrandsRow row;

%>

<title>brands.jsp</title></head><body><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td><h2>BRAND DESCRIPTION</h2></td>

</tr></tbody>

</table>

<p><br /></p><form><center><table border="1">

<tbody><tr>

<td><a href="index.jsp">Home</a></td><td></td>

</tr></tbody>

</table></center></form><p><br /></p><form><center><table border="1">

<tbody><tr>

<th>Code</th><th>Description</th>

</tr><%

sabl = new SelectAllBrands();sabl.execute(Global.USERNAME, Global.PASSWORD, 100);

// sabl.execute("glance", "gl122855", 100);rows = sabl.getRows();for(int i = 0; i < rows.length; i++){

row = rows[i];%><tr>

<td><%= row.getBRAND_NAME_BRAND_CODE() %></td><td><%= row.getBRAND_NAME_BRAND_DESCRIPTION() %></td>

</tr><%

}%>

</tbody></table></center></form></body></html>

100

Page 101: Lance Drug IS WSAD Manual

checkAdmin.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"import="java.sql.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<script language="JavaScript" >function doNotProcess(){

window.alert("Missing username and/or password.");window.location.href="index.jsp";

}

function notRegistered(){window.alert("Not in database");window.location.href="index.jsp";

}

function isRegistered(){window.alert("You are now logged in. You may proceed.");window.location.href="index.jsp";

}</script>

<%!String admin, pass;GetAdminLogonInfo gali;GetAdminLogonInfoRow[] rows;GetAdminLogonInfoRow row;

private void installAdminQueries(){System.out.println("In database");

}%>

<title>checkAdmin.jsp</title></head>

<body>

<center><table border="0" width="100%"><tbody>

<tr bgcolor="#ff80ff" align="center" valign="baseline"><td align="center" valign="baseline"><H2 align="center">ADMINISTRATOR LOGON

RESULTS</H2></td></tr>

</tbody></table></center>

<%admin = request.getParameter("nameField");pass = request.getParameter("passwordField");

if(admin != null && pass != null &&admin.trim().length() > 0 &&pass.trim().length() > 0 )

{gali = new GetAdminLogonInfo();gali.execute(Global.USERNAME, Global.PASSWORD, admin, pass);

101

Page 102: Lance Drug IS WSAD Manual

// gali.execute("glance", "gl122855", admin, pass);rows = gali.getRows();

if(rows.length == 0)%>

<script language="JavaScript">notRegistered();</script>

<%else {

%><script language="JavaScript">isRegistered();</script>

<%// set session attribute "loggedIn" to "true"// This can be check ed anywhere.HttpSession sesson = request.getSession(true);session.setAttribute("loggedIn", new String("true"));}

}else {

%><script language="JavaScript">doNotProcess();</script>

<%}

%>

</body></html>

102

Page 103: Lance Drug IS WSAD Manual

confirmAdminDelete.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>confirmAdminDelete.jsp</title>

</head>

<%!GetAnAdministrator gaa;GetAnAdministratorRow[] rows;GetAnAdministratorRow row;

%>

<body><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center" valign="baseline">

<td align="center" valign="baseline"><h2 align="center">CONFIRM ADMINISTRATOR DELETE / MODIFY</h2></td>

</tr></tbody>

</table>

<p><br /></p>

<%String username = request.getParameter("userNameField").trim();;String userid = request.getParameter("userIdField").trim();if( username == null || userid == null ||

username.length() == 0 || userid.length() == 0 ){

response.sendRedirect("showAllAdministrators.jsp");} else {

gaa = new GetAnAdministrator();gaa.execute(Global.USERNAME, Global.PASSWORD, username, userid);

// gaa.execute("glance", "gl122855", username, userid);rows = gaa.getRows();if(rows.length == 0 ){

%><p>USER DOES NOT EXIST.<form action="showAllAdministrators.jsp" method="post">

<input type=SUBMIT value="RETURN" /></form><%

} else {row = rows[0]; // get the administrator tuple

%></center><ul><li>Press CANCEL to return to Administration Management<li>Press OK TO DELETE to delete the administrator from the database<li>Press MODIFY to update administrator information AFTER entering corrected information in text fields below.</ul>

<center>

103

Page 104: Lance Drug IS WSAD Manual

<table><div align="center"><tr>

<td><form action="showAllAdministrators.jsp"><input type="submit" name="returnBtn" value="CANCEL" /></td></form>

<td><form action="userDeleted.jsp"><input type="hidden" name="user" value= "<%= username %>" /><input type="hidden" name="password" value= "<%= userid %>" /><input type="submit" name="deleteBtn" value="OK TO DELETE" /></td></form>

</tr></table><br /><br /><form action="updateAdminInfo.jsp" method=post"><table border="1">

<tbody><tr>

<td>Username:</td><td><%= row.getADMIN_CODENAME() %></td>

</tr><tr>

<td>Userid:</td><td><%= row.getADMIN_USERID() %></td>

</tr><tr>

<td>First Name:</td><td><input = "text" name = "firstname" value = "<%= row.getADMIN_FIRSTNAME() %>"

/></td></tr><tr>

<td>Last Name:</td><td><input = "text" name = "lastname" value = "<%= row.getADMIN_LASTNAME() %>" /></td>

</tr><tr>

<td>Street:</td><td><input = "text" name = "street" value = "<%= row.getADMIN_STREET() %>" /></td>

</tr><tr>

<td>City:</td><td><input = "text" name = "city" value = "<%= row.getADMIN_CITY() %>" /></td>

</tr><tr>

<td>State:</td><td><input = "text" name = "state" value = "<%= row.getADMIN_STATE() %>" /></td>

</tr><tr>

<td>Zip:</td><td><input = "text" name = "zip" value = "<%= row.getADMIN_ZIP() %>" /></td>

</tr><tr>

<td>Phone:</td><td><input = "text" name = "phone" value = "<%= row.getADMIN_PHONE() %>" /></td>

</tr></tbody>

</table>

<br /><center><input type="hidden" name="user2" value= "<%= username %>" /><input type="hidden" name="password2" value= "<%= userid %>" /><input type="submit" name="modifyBtn" value="MODIFY" /></center>

</form>

<%}

}%>

</div></body></html>

104

Page 105: Lance Drug IS WSAD Manual

doVendorInsert.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import = "drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>doVendorInsert.jsp</title></head><body><p>

<%!Short id;String name = "";String address = "";String city = "";String state = "";String zip = "";String url = "";

private void clearAllFields(){name = null;address = null;city = null;state = null;zip = null;url = null;

}%><%

// Get the valuesid = Short.valueOf( request.getParameter("idField") );name = request.getParameter("nameField").trim();address = request.getParameter("addressField").trim();city = request.getParameter("cityField").trim();state = request.getParameter("stateField").trim();zip = request.getParameter("zipField").trim();url = request.getParameter("urlField").trim();

// Verify values are not nullif(name != null && address != null &&

city != null && state != null && zip != null && url != null){

if(name.length() > 0 && address.length() > 0 &&city.length() > 0 && state.length() > 0 && zip.length() > 0 && url.length() > 0)

{InsertVendor iv = new InsertVendor();iv.execute(Global.USERNAME, Global.PASSWORD, id, name, address,

// iv.execute("glance", "gl122855", id, name, address, city, state, zip, url);

// clear all fields, assuming successful insertion// This will prevent fields of inserVendor.jsp from being // filled in with old data.clearAllFields();

}}response.sendRedirect("insertVendor.jsp");

%>

</p></body></html>

105

Page 106: Lance Drug IS WSAD Manual

drugNames.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"import="java.util.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!String nameLike, tempName;List queryList, tempList;SelectAllDrugNamesLikeRow row;SelectAllDrugNamesLikeRow[] rows, rows2;SelectAllDrugNamesLike sadnl, sadnl2;Vector queryVector;

%>

<title>drugNames.jsp</title></head><body bgcolor="#ffffff"><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td align="center" valign="middle"><H2>BRAND NAMES</H2></td></tr>

</tbody></table></center><p><br /></p><center><table border="1">

<tbody><tr>

<td><a href="index.jsp">Home</a></td></tr>

</tbody></table></center><p><br /></p><p></p><form><center><table border="1">

<tbody><tr>

<td><input type="submit" name="processBtn0"value="Search for Drug Names" /></td>

</tr></tbody>

</table><br /><table border="1">

<tbody><tr>

<th>Code</th><th>Drug Name</th>

</tr><tr>

<td>Enter drug name/fragment:</td><td><input type="text" name="drugName" size="30" /></td>

</tr><%

nameLike = request.getParameter("drugName");

if( nameLike != null ){nameLike = nameLike.trim(); // eliminate spaces before and afterqueryVector = new Vector();

if( nameLike.length() > 0 ) // {

tempName = "%" + nameLike + "%";

106

Page 107: Lance Drug IS WSAD Manual

sadnl = new SelectAllDrugNamesLike();sadnl.execute(Global.USERNAME, Global.PASSWORD, 300, tempName );

// sadnl.execute("glance", "gl122855", 300, tempName );rows = sadnl.getRows();

// Store results in a List, which is a CollectionqueryVector.addAll(Arrays.asList(rows));

// if the first letter is not a capital, then do// a query with the first letter as a capital, and// include those results

if( nameLike.length() > 0 ){tempName = "%" + nameLike.substring(0,1).toUpperCase() +

nameLike.substring(1) + "%";

sadnl2 = new SelectAllDrugNamesLike();sadnl2.execute(Global.USERNAME, Global.PASSWORD, 300, tempName );

// sadnl2.execute("glance", "gl122855", 300, tempName );rows = sadnl2.getRows();queryVector.addAll(Arrays.asList(rows));

}

Iterator it = queryVector.iterator();%>

<tr><td>Query string:</td><td><input type="text"

name="queryString" size="30" value= <%= nameLike %>

readonly="readonly"/></td></tr>

<tr></tr><tr>

<td>Number of drugs returned:</td><td><input type="text"

name="numOfDrugs" size="10" value= <%= queryVector.size() %>

readonly="readonly"/></td></tr>

<%while(it.hasNext()){

row = (SelectAllDrugNamesLikeRow)it.next();%>

<tr><td><%= row.getBRAND_NAME_BRAND_CODE() %></td><td><%= row.getBRAND_NAME_BRAND_DESCRIPTION() %></td></tr>

<%}

}}

%></tbody>

</table><br /><input type="submit" name="processBtn" value="Search for Drug Names" /></center></form></body></html>

107

Page 108: Lance Drug IS WSAD Manual

drugsByMfg.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"import="java.sql.Date"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!String code, company, date;Date aDate;int numRows;DrugsByMfg dbm;DrugsByMfgRow[] rows;DrugsByMfgRow row;

%>

<title>drugsByMfg.jsp</title></head><body><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center" valign="baseline">

<td align="center" valign="baseline"><H2 align="center">BRAND NAMES BY MANUFACTURER</H2></td>

</tr></tbody>

</table></center><p><br /></p><form><center>

<%code = request.getParameter("code");dbm = new DrugsByMfg();dbm.execute(Global.USERNAME, Global.PASSWORD, new Short(code));

// dbm.execute("glance", "gl122855", new Short(code));rows = dbm.getRows();numRows = rows.length;if(numRows > 0 )

company = (String)rows[0].getDRUG_SOURCE_SOURCE_DESC();%><table border="1">

<tbody><tr>

<td><b>Company:</b></td><td><%= company %></td>

</tr><tr>

<td><b>Number of Drugs Listed:</b></td><td><%= rows.length %></td>

</tr>

</tbody></table><br /><table border="1">

<tbody><tr>

<td align="center">Brand Description</td><td align="center">Obsolete Date</td>

</tr><%

for(int i = 0; i < rows.length; i++){row = rows[i];aDate = (Date)row.getCORE_DESCRIPTION_OBSOLETE_DATE();if( aDate != null )

date = aDate.toString();

108

Page 109: Lance Drug IS WSAD Manual

elsedate = " ";

%><tr>

<td><%= row.getBRAND_NAME_BRAND_DESCRIPTION() %></td>

<td><%= date %></td></tr><%

}%>

</tbody></table></center></form></body></html>

109

Page 110: Lance Drug IS WSAD Manual

index.jsp

<html><head><title>index.jsp</title><script type="text/javascript" language="JavaScript">

function getSelectValue(formName, selectName){var theMenu = document[formName][selectName];var selectedItem = theMenu.selectedIndex;return theMenu.options[selectedItem].value;

}

function openSite(){window.location.href = getSelectValue("makeChoice", "choice");

}

function goToAdmin(){window.location.href = "checkAdmin.jsp";

}

</script></head>

<%@page import="drug.*" %><%!

boolean userIsRegistered = false;String codeName, userId;GetAdminLogonInfo gali;GetAdminLogonInfoRow[] rows;GetAdminLogonInfoRow row;

private void checkUser(){System.out.println("Hi there");

}%>

<body>

<center><table border="0" width="100%"><tbody>

<tr bgcolor="#ff80ff" align="center" valign="baseline"><td align="center" valign="baseline"><H2 align="center">DRUG INFORMATION

SYSTEM</H2></td></tr>

</tbody></table></center><p><BR>

</p><center><B>You can get the answers you desire, by </B></center>

<CENTER><TABLE><TBODY><TR>

<TD><UL><I><LI>Choosing a query from the predefined query list</LI><LI>Writing an sql statement</LI><LI>Entering the data to the query creator.</LI></I></UL></TD>

</TR></TBODY></TABLE></CENTER>

<P></P><form name="makeChoice" action="checkAdmin.jsp" method="post"><center><table border="0" cellspacing="0" cellpadding="15">

<tbody><tr><td align="center" valign="top">

<select name="choice"><option selected>Select a Query</option><option value="brands.jsp">Brand Name List</option><option value="drugsByMfg.jsp">Drugs (Brand Names) by Manufacturer</option><option value="ingredList1.jsp">Ingredient List</option><option value="mfgs.jsp">Manufacturer List</option><option value="selectObsoleteDrugs.jsp">All Obsolete Drugs</option>

110

Page 111: Lance Drug IS WSAD Manual

<option value="drugNames.jsp">Query on drug names</option><%

// Add additional queries if user is logged// in as an administratorsession = request.getSession(true);String loggedIn = (String)session.getAttribute("loggedIn");if(loggedIn != null && loggedIn.equals("true")){

%><option value="showAllAdministrators.jsp">Administrator Management</option><option value="insertVendor.jsp">Add New Drug Vendor</option>

<%}

%></select><br /><BR>

<input type="button" value="PROCESS" onclick="openSite();">

</td><td>

</td><td align="center"><B>ADMINISTRATOR SECTION</B><BR><table border="0">

<tbody><tr>

<td>Sign-in ID:</td><td><input type="text" name="nameField" size="20" /></td>

</tr><tr>

<td>Password:</td><td><input type="password" name="passwordField" size="20" /></td>

</tr><tr>

<td colspan="2" align="center"><INPUT type="submit" name="registerBtn"value="LOG IN" > </form>

<form action="logoff.jsp" method="post"><INPUT type="submit" name="logOffBtn"value="LOG OFF"><BR></td></tr></form>

<TR><FORM action="admin.jsp" method="post"><P><TD align="center" colspan="2"><INPUT type="submit"

value="NEW USER" ></TD></form></TR>

</tbody></table></td>

</tr></tbody>

</table></center>

<P><BR></P><FORM><CENTER><TABLE border="1" cellpadding="6" cellspacing="0">

<TBODY><TR>

<TD><A href="http://www.medicare.gov/"><IMG border="0"src="medicare.gif" width="144" height="75"></A></TD>

<TD><A href="http://medlineplus.gov/"><IMG border="0"src="medlineplus.gif" width="306" height="75"></A></TD>

<TD><A href="http://www.webmd.com/"><IMG border="0" src="webmd.gif"width="217" height="70"></A></TD>

</TR></TBODY>

</TABLE></CENTER></FORM></body></html>

111

Page 112: Lance Drug IS WSAD Manual

ingredList1.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import = "drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!String rawName = ""; // searchName without begin and end "%"String searchName = ""; // default valuesint numRows = 0; // default valueIngredientListForBrandNamesLike ingred;IngredientListForBrandNamesLikeRow[] rows;IngredientListForBrandNamesLikeRow row;%>

<title>ingredList1.jsp</title></head><body><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center" valign="baseline">

<td align="center" valign="baseline"><H2 align="center">ACTIVE INGREDIENT LIST</H2></td>

</tr></tbody>

</table></center>

<P><CENTER><TABLE> <TBODY>

<TR><TD><UL>

<I><LI>Enter part or all of a brand name</LI><LI>Ingredients for each brand name will be returned.</LI></I>

</UL></TD>

</TR></TBODY></TABLE></CENTER>

<p><form method="post" action="index.jsp"><center><table border="1">

<tbody><tr>

<td><input type="submit" name="homeBtn" value="Home" /></td></tr>

</tbody></table></center></form><p><br /></p>

<form name="form1" method="post"><center><table border="1">

<tbody><tr>

<td>Search Brand Name:</td>

112

Page 113: Lance Drug IS WSAD Manual

<%// Get string from nameField and store in searchName// before it is erased.rawName = request.getParameter("nameField");%>

<td><input type="text" name="nameField" size="22" /></td></tr>

</tbody></table></center>

<script language="JavaScript">document.form1.nameField.focus();

</script>

<br /><center><input type="submit" name="processBtn" value="Process" /></center><br /><center><table border="1">

<%ingred = new IngredientListForBrandNamesLike();searchName = "%" + rawName + "%";ingred.execute(Global.USERNAME, Global.PASSWORD, searchName, searchName);//ingred.execute("glance", "gl122855", searchName, searchName);rows = ingred.getRows();numRows = rows.length;%><tbody><tr>

<%// Avoid putting "null" in "searchString0" if "nameField" is blank,// which always happens when this file opens for the first time.// Same for numRows.if (rawName == null){

rawName = "";numRows = 0;

}%><td>Search is on:</td><td><input type="text" name="searchString0" size="22"

readonly="readonly" value=<%=rawName%>></input></td></tr><tr>

<td>Number of rows returned:</td><td><input type="text" name="numRowsField0" size="7"

readonly="readonly" value=<%=numRows%> /></td></tr>

</tbody></table></center><br /><center><table border="1">

<tbody><tr>

<th>Drug Name</th><th>Active Ingredient</th>

</tr>

<%for (int i = 0; i < numRows; i++){

row = rows[i];%>

<tr><td><%=row.getX_DRUG_NAME()%></td><td><%=row.getA_ACTIVE_INGREDIENT()%></td>

</tr>

<%}

%>

</tbody></table></center></form></body></html>

113

Page 114: Lance Drug IS WSAD Manual

insertVendor.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>insertVendor.jsp</title></head>

<%!GetNextMfgSourceId getId;GetNextMfgSourceIdRow[] rows;int nextId;

%><body><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td><h2>INSERT NEW DRUG MANUFACTURER</h2></td>

</tr></tbody>

</table>

<p><br /></p><form action="index.jsp" method="post"><center><table border="1">

<tbody><tr>

<td><input type=SUBMIT value="HOME"></td></tr>

</tbody></table>

</center></form><p><br /></p>

<%// Get the next available sourceIdgetId = new GetNextMfgSourceId();getId.execute(Global.USERNAME, Global.PASSWORD);

// getId.execute("glance", "gl122855");rows = getId.getRows();nextId = ((Integer)rows[0].getColExp1()).intValue();

%>

<form action="doVendorInsert.jsp" method="post"><center><table border="1">

<tbody><tr>

<td>Source ID:</td><td><input type="text" name="idField" size="20"

value= "<%= nextId %>" readonly="readonly" /></td></tr><tr>

<td>Name:</td><%

String name = "";if(request.getParameter("nameField") != null)

name = request.getParameter("nameField");%>

<td><input type="text" name="nameField"

114

Page 115: Lance Drug IS WSAD Manual

value = "<%= name %>" size="20" /></td></tr><tr>

<td>Address:</td><td><input type="text" name="addressField" size="20" /></td>

</tr><tr>

<td>City:</td><td><input type="text" name="cityField" size="20" /></td>

</tr><tr>

<td>State:</td><td><input type="text" name="stateField" size="20" /></td>

</tr><tr>

<td>Zip:</td><td><input type="text" name="zipField" size="20" /></td>

</tr><tr>

<td>URL:</td><td><input type="text" name="urlField" size="20" /></td>

</tr></tbody>

</table><br /><input type="submit" name="modifyBtn" value="ADD VENDOR TO DATABASE" /></center></form><p><br /></p><form action="index.jsp" method="post"><center><table border="1">

<tbody><tr>

<td><input type="SUBMIT" value="HOME" /></td></tr>

</tbody></table>

</center></form>

</body></html>

115

Page 116: Lance Drug IS WSAD Manual

logoff.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>logoff.jsp</title></head><body><%

session = request.getSession();String loggedIn = (String)session.getAttribute("loggedIn");if(loggedIn != null) // make loggedIn = null, so no longer logged in.

session.setAttribute("loggedIn", null);%>

<script language="JavaScript">window.location.href = "index.jsp";alert("You have successfully logged off. Please come again.");

</script>

</body></html>

116

Page 117: Lance Drug IS WSAD Manual

mfgInfo.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import = "drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!Short hiddenId;GetMfgRowFromCode gmrfc;GetMfgRowFromCodeRow[] rows;GetMfgRowFromCodeRow row;

%>

<title>mfgInfo.jsp</title></head><body><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td><h2>DRUG MFG INFORMATION</h2></td>

</tr></tbody>

</table>

<p></p><p><br /></p><center><table border="1">

<tbody>

<%// Get connection, and send query to dbgmrfc = new GetMfgRowFromCode();hiddenId = new Short( request.getParameter("code") );gmrfc.execute(Global.USERNAME, Global.PASSWORD, hiddenId);

// gmrfc.execute("glance", "gl122855", hiddenId);rows = gmrfc.getRows();if(rows.length == 1) // should only be one mfg

{%>

<tr><th align="left">Code:</th><td><%= rows[0].getDRUG_SOURCE_SOURCE_ID() %></td>

</tr><tr>

<th align="left">Name:</th><td><%= rows[0].getDRUG_SOURCE_SOURCE_DESC() %></td>

</tr><tr>

<th align="left">Address:</th><td><%= rows[0].getDRUG_SOURCE_ADDRESS() %></td>

</tr><tr>

<th align="left">City:</th><td><%= rows[0].getDRUG_SOURCE_CITY() %></td>

</tr><tr>

<th align="left">State:</th><td><%= rows[0].getDRUG_SOURCE_STATE() %></td>

</tr><tr>

<th align="left">Zip:</th><td><%= rows[0].getDRUG_SOURCE_ZIP() %></td>

</tr><tr>

<th align="left">URL:</th><td><%= rows[0].getDRUG_SOURCE_URL() %></td>

117

Page 118: Lance Drug IS WSAD Manual

</tr>

<%}

%>

</tbody></table></center></body></html>

118

Page 119: Lance Drug IS WSAD Manual

mfgs.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<%!SelectAllMfgs sam;SelectAllMfgsRow[] rows;SelectAllMfgsRow row;Short id;

%>

<title>mfgs.jsp</title></head><body><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td><h2>DRUG MANUFACTURERS</h2></td>

</tr></tbody>

</table>

<p><br /></p><form action="index.jsp" method="post"><center><table border="1">

<tbody><tr>

<td><input type=SUBMIT value="HOME"></td></tr>

</tbody></table></center></form><p><br /></p>

<center><table border="1">

<tbody><tr>

<th>Info</th><th>Products</th><th>Code</th><th>Manufacturer</th>

</tr><%

sam = new SelectAllMfgs();sam.execute(Global.USERNAME, Global.PASSWORD);

// sam.execute("glance", "gl122855");rows = sam.getRows();for(int i = 0; i < rows.length; i++){

row = rows[i];id = (Short)row.getDRUG_SOURCE_SOURCE_ID();

%>

<tr><form action="mfgInfo.jsp" target="new">

<td><INPUT TYPE=HIDDEN NAME = code VALUE= <%= id %> ><center><input type="submit" name="infoBtn" value="Info" /></center>

119

Page 120: Lance Drug IS WSAD Manual

</td></form><form action="drugsByMfg.jsp" target="new">

<td><INPUT TYPE=HIDDEN NAME = code VALUE= <%= id %> ><center><input type="submit" name="productBtn" value="Products" /></center>

</td></form>

<td><%= id %></td><td><%= row.getDRUG_SOURCE_SOURCE_DESC() %></td>

</tr>

<%}

%>

</tbody></table></center>

</body></html>

120

Page 121: Lance Drug IS WSAD Manual

register.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

<title>register.jsp</title></head><body><p></p>

<%String[] data = new String[9];data[0] = request.getParameter("UserIdField");data[1] = request.getParameter("passwordField");data[2] = request.getParameter("firstNameField");data[3] = request.getParameter("lastNameField");data[4] = request.getParameter("streetField");data[5] = request.getParameter("cityField");data[6] = request.getParameter("stateField");data[7] = request.getParameter("zipField");data[8] = request.getParameter("phoneField");

boolean isMissing = false;for(int i = 0; i < data.length; i++){

if(data[i] == null){isMissing = true;break;

}}

if( isMissing ){%><script language="JavaScript">alert("Missing some data");</script><%

}else { // add to database. Must take care of constraints later// like violations of primary key constraints

InsertAdmin ia = new InsertAdmin();

// ia.execute("glance", "gl122855",

ia.execute(Global.USERNAME, Global.PASSWORD, data[0],data[1],data[2],data[3],data[4],data[5],data[6],data[7],data[8]

);%><script language="JavaScript">alert("Administrator added to database successfully.");window.location.href="admin.jsp";</script><%

}

%>

</body></html>

121

Page 122: Lance Drug IS WSAD Manual

selectObsoleteDrugs.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"import="java.sql.Date"%>

<%!SelectObsoleteDrugs sod;SelectObsoleteDrugsRow[] rows;SelectObsoleteDrugsRow row;String month, day, year;String date;

%>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>selectObsoleteDrugs.jsp</title></head><body><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center">

<td><h2>OBSOLETE DRUGS</h2></td>

</tr></tbody>

</table>

<form method="post" action="index.jsp"><center><table border="1">

<tbody><tr>

<td><input type="submit" name="homeBtn" value="Home" /></td></tr>

</tbody></table></center></form>

<p align="center"><br />Selects all drugs that became obsolete after this date:<br /></p><form method="post">

<%month = (String)request.getParameter("monthListBox");day = (String)request.getParameter("dayListBox");year = (String)request.getParameter("yearListBox");

%>

<center><table border="0"><tbody align="center">

<tr><td>MONTH:</td><td><select size="4" name="monthListBox">

<option value="01" >January</option><option value="02">February</option><option value="03">March</option><option value="04">April</option><option value="05">May</option><option value="06">June</option><option value="07">July</option><option value="08">August</option><option value="09">September</option><option value="10">October</option><option value="11">November</option><option value="12">December</option>

122

Page 123: Lance Drug IS WSAD Manual

</select></td>

<td>DAY:</td><td><select size="4" name="dayListBox">

<%for(int i = 1; i < 31; i++){

%><option value="<%= i %>" ><%= i %></option>

<%}

%></select></td>

<td>YEAR:</td><td><select size="4" name="yearListBox"><%

for(int i = 2005; i >= 1970; i--){%>

<option value="<%= i %>"><%= i %></option><%

}%></select></td>

</tr></tbody>

</table><br /><input type="submit" name="processBtn" value="PROCESS" /><br /><br />

<%if( day != null && month != null && year != null)

date = year + "-" + month + "-" + day;else

date = null;if (date != null){

out.println("<center>DRUGS OBSOLETE SINCE " + date + "</center><BR>");}

%><table border="1">

<tbody><tr>

<td align="center"><b>NDC</b></td><td align="center"><b>Description</b></td><td align="center"><b>Vendor/Mfg</b></td><td align="center"><b>Obsolete Date</b></td>

</tr>

<%if( date != null) {

sod = new SelectObsoleteDrugs();sod.execute(Global.USERNAME, Global.PASSWORD, 100, Date.valueOf(date));rows = sod.getRows();for(int i = 0; i < rows.length; i++){

row = rows[i];%><tr>

<td><%= row.getCORE_DESCRIPTION_NDC_CODE() %></td><td><%= row.getBRAND_NAME_BRAND_DESCRIPTION() %></td><td><%= row.getDRUG_SOURCE_SOURCE_DESC() %></td><td><%= row.getCORE_DESCRIPTION_OBSOLETE_DATE() %></td>

</tr><%

}}

%></tbody>

</table></center></form><p><br /></p><form method="post" action="index.jsp"><center><table border="1"><tbody>

<tr><td><input type="submit" name="homeBtn0" value="Home" /></td>

</tr></tbody></table></center></form></body></html>

123

Page 124: Lance Drug IS WSAD Manual

showAllAdministrators.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>showAllAdministrators.jsp</title>

<SCRIPT LANGUAGE=JAVASCRIPT>

function checkData(){if (document.getDataForm.userNameField.value == null ||

document.getDataForm.userNameField.value == "" ){

alert("Please enter Login Name!");document.getDataForm.userNameField.focus();document.getDataForm.userNameField.select();return false;

} else if (document.getDataForm.userIdField.value == null || document.getDataForm.userIdField.value == "" )

{alert("Please enter your current password!");document.getDataForm.userIdField.focus();document.getDataForm.userIdField.select();return false;

}return true;

}

</SCRIPT>

</head>

<%!ShowAllAdministrators saa;ShowAllAdministratorsRow[] rows;ShowAllAdministratorsRow row;

%>

<body><center><table border="0" width="100%">

<tbody><tr bgcolor="#ff80ff" align="center" valign="baseline">

<td align="center" valign="baseline"><h2 align="center">ADMINISTRATOR MANAGEMENT</h2></td>

</tr></tbody>

</table></center>

<p><br /></p><div align="center"><table border="0" cellspacing="5">

<tbody align="center"><tr>

<td align="center"><form action="index.jsp" method="post"><input type="submit" name="homeBtn"value="HOME" /></form>

</td><td><form action="admin.jsp" method="post"><input type="submit" name="registerAdminBtn"

value="REGISTER" /></form></td>

</tr>

124

Page 125: Lance Drug IS WSAD Manual

</tbody></table></div><p></p><div align="center">

<table border="3"><tbody>

<tr><td width="526"><div align="center"><form name = "getDataForm" action="confirmAdminDelete.jsp" method="post"

onSubmit="return checkData();" ><i> <b><br />Enter username and userid of administrator to be deleted.</b><br>You will asked to confirm deletion before deletion occurs.</i><br /><br /><table border="1">

<tbody><tr>

<td>Username:</td><td><input type="text" name="userNameField" size="20" /></td>

</tr><tr>

<td>Userid:</td><td><input type="text" name="userIdField" size="20" /></td>

</tr></tbody>

</table><br /><input type="submit" name="deleteBtn" value="Delete / Modify Administrator" /><br /></form></div></td>

</tr></tbody>

</table></div><p><br /></p><center><form><table border="1">

<tbody align="right">

<tr><b><td align="center"><b>Username</b></td><td align="center"><b>Userid</b></td><td align="center"><b>First name</b></td><td align="center"><b>Last name</b></td><td align="center"><b>Street</b></td><td align="center"><b>City</b></td><td align="center"><b>State</b></td><td align="center"><b>Zip</b></td><td align="center"><b>Phone</b></td></b>

</tr><%

saa = new ShowAllAdministrators();saa.execute(Global.USERNAME, Global.PASSWORD);

// saa.execute("glance", "gl122855");rows = saa.getRows();for(int i = 0; i < rows.length; i++){

row = rows[i];%>

<tr><td align="left"><%= row.getADMIN_CODENAME() %></td><td align="left"><%= row.getADMIN_USERID() %></td><td align="left"><%= row.getADMIN_FIRSTNAME() %></td><td align="left"><%= row.getADMIN_LASTNAME() %></td><td align="left"><%= row.getADMIN_STREET() %></td><td align="left"><%= row.getADMIN_CITY() %></td><td align="left"><%= row.getADMIN_STATE() %></td><td align="left"><%= row.getADMIN_ZIP() %></td><td align="left"><%= row.getADMIN_PHONE() %></td>

</tr>

125

Page 126: Lance Drug IS WSAD Manual

<%}

%></tbody>

</table></form></center><p><br /></p><form action="index.jsp" method="post"><div align="center"><input type="submit" name="homeBtn" value="HOME" /></div></form></body></html>

126

Page 127: Lance Drug IS WSAD Manual

updateAdminInfo.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import = "drug.*"%><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>updateAdminInfo.jsp</title></head><body><h2>UPDATE ADMINISTRATOR DATA</h2><p><br /><%

String username = request.getParameter("user2").trim();String userid = request.getParameter("password2").trim();String firstname = request.getParameter("firstname").trim();String lastname = request.getParameter("lastname").trim();String street = request.getParameter("street").trim();String city = request.getParameter("city").trim();String state = request.getParameter("state").trim();String zip = request.getParameter("zip").trim();String phone = request.getParameter("phone").trim();if(username != null && userid != null && firstname != null &&

lastname != null && street != null && city != null &&state != null && zip != null && phone != null)

{UpdateAdminInfo uai = new UpdateAdminInfo();

// uai.execute("glance", "gl122855",uai.execute(Global.USERNAME, Global.PASSWORD,

firstname, lastname, street, city, state, zip, phone, username, userid);

}response.sendRedirect("showAllAdministrators.jsp");

%></p></body></html>

127

Page 128: Lance Drug IS WSAD Manual

userDeleted.jsp

<?xml version="1.0" encoding="ISO-8859-1" ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><%@ page language="java"contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO-8859-1"import="drug.*"%>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>userDeleted.jsp</title></head><body><p>Place content here.</p>

<%String username = request.getParameter("user");String userid = request.getParameter("password");System.out.println(username);System.out.println(userid);DeleteAdministrator da = new DeleteAdministrator();da.execute(Global.USERNAME, Global.PASSWORD, username, userid);

// da.execute("glance", "gl122855", username, userid);response.sendRedirect("showAllAdministrators.jsp");

%></body></html>

128