⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rowactionselect.java

📁 IBM RSA下的JSF开发示例
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		}
		getSelectedRow().setListRows(new ArrayList());
		return "";
	}
	/**
	 * Exercise 4 - Method to updated the status of orders in a database using SDO
	 * @return
	 */
	public String doButtonUpdate4Action() {
		// Type Java code that runs when the component is clicked
		
		ArrayList lRows = (ArrayList)getSelectedRow().getListRows();
		for(int i = 0; i < lRows.size(); i++) {
			HashMap map = (HashMap)lRows.get(i);
			try{
			DataObject record = (DataObject)getOrders().get(0);
			DataObject root = record.getDataGraph().getRootObject();
			
			// sets the new value
			root.set("ORDERS[ID=" + map.get("ID") + "]/STATUS","Closed");
			getOrdersMediator().applyChanges(root);
			} catch (Throwable e) {
				logException(e);
			} finally {
				SDOConnectionWrapper = null;
			}
		}
		return "";
	}

	protected HtmlCommandExButton getButtonDelete3() {
		if (buttonDelete3 == null) {
			buttonDelete3 = (HtmlCommandExButton) findComponentInRoot("buttonDelete3");
		}
		return buttonDelete3;
	}

	protected HtmlInputRowSelect getRowSelect3() {
		if (rowSelect3 == null) {
			rowSelect3 = (HtmlInputRowSelect) findComponentInRoot("rowSelect3");
		}
		return rowSelect3;
	}

	protected HtmlCommandExButton getButtonDelete4() {
		if (buttonDelete4 == null) {
			buttonDelete4 = (HtmlCommandExButton) findComponentInRoot("buttonDelete4");
		}
		return buttonDelete4;
	}

	protected HtmlCommandExButton getButtonUpdate4() {
		if (buttonUpdate4 == null) {
			buttonUpdate4 = (HtmlCommandExButton) findComponentInRoot("buttonUpdate4");
		}
		return buttonUpdate4;
	}

	/** 
	 * @action id=addCustomer_3
	 */
	public String doAddCustomer_3UpdateAction() {
		try {
			getAddCustomer_3Mediator().applyChanges(
					getRootDataObject(getAddCustomer_3()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addCustomer_3Mediator != null) {
				addCustomer_3Mediator.setConnectionWrapper(null);
			}
		}
		//// update the view records
		doCustomersFetchAction();
		return "";
	}

	/** 
	 * @paramBean id=addCustomer_3
	 */
	public DataObject getAddCustomer_3Parameters() {
		if (addCustomer_3Parameters == null) {
			try {
				addCustomer_3Parameters = getAddCustomer_3Mediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return addCustomer_3Parameters;
	}

	protected JDBCMediator getAddCustomer_3Mediator() {
		if (addCustomer_3Mediator == null) {
			try {
				addCustomer_3Mediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(addCustomer_3_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(addCustomer_3_metadataFileName),
						addCustomer_3Mediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			addCustomer_3Mediator
					.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return addCustomer_3Mediator;
	}

	/** 
	 * This method was created in order to create new data.  To retrieve existing data:
	 *   DataObject graph = getAddCustomer_3Mediator().getGraph( getAddCustomer_3Parameters() );
	 *   addCustomer_3 = (DataObject)graph.getList(0).get(0);  
	 *
	 * @action id=addCustomer_3
	 */
	public String doAddCustomer_3CreateAction() {
		try {
			resolveParams(getAddCustomer_3Parameters(), addCustomer_3ArgNames,
					addCustomer_3ArgValues, "addCustomer_3_params_cache");
			DataObject graph = getAddCustomer_3Mediator().getEmptyGraph();
			addCustomer_3 = graph.createDataObject(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addCustomer_3Mediator != null) {
				addCustomer_3Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}

	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/addCustomer_3.xml
	 * @methodEntry id=addCustomer_3/paramBean=addCustomer_3/action=addCustomer_3
	 * @action CREATE
	 */
	public DataObject getAddCustomer_3() {
		if (addCustomer_3 == null) {
			doAddCustomer_3CreateAction();
		}
		return addCustomer_3;
	}

	protected HtmlInputText getTextId1() {
		if (textId1 == null) {
			textId1 = (HtmlInputText) findComponentInRoot("textId1");
		}
		return textId1;
	}

	protected HtmlInputText getTextName1() {
		if (textName1 == null) {
			textName1 = (HtmlInputText) findComponentInRoot("textName1");
		}
		return textName1;
	}

	protected HtmlInputText getTextAddress1() {
		if (textAddress1 == null) {
			textAddress1 = (HtmlInputText) findComponentInRoot("textAddress1");
		}
		return textAddress1;
	}

	protected HtmlInputText getTextCity1() {
		if (textCity1 == null) {
			textCity1 = (HtmlInputText) findComponentInRoot("textCity1");
		}
		return textCity1;
	}

	protected HtmlInputText getTextState1() {
		if (textState1 == null) {
			textState1 = (HtmlInputText) findComponentInRoot("textState1");
		}
		return textState1;
	}

	protected HtmlMessages getMessages1() {
		if (messages1 == null) {
			messages1 = (HtmlMessages) findComponentInRoot("messages1");
		}
		return messages1;
	}

	protected HtmlCommandExButton getButtonDoAddCustomer_3UpdateAction1() {
		if (buttonDoAddCustomer_3UpdateAction1 == null) {
			buttonDoAddCustomer_3UpdateAction1 = (HtmlCommandExButton) findComponentInRoot("buttonDoAddCustomer_3UpdateAction1");
		}
		return buttonDoAddCustomer_3UpdateAction1;
	}

	/** 
	 * @action id=addInventory_2
	 */
	public String doAddInventory_2UpdateAction() {
		try {
			getAddInventory_2Mediator().applyChanges(
					getRootDataObject(getAddInventory_2()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addInventory_2Mediator != null) {
				addInventory_2Mediator.setConnectionWrapper(null);
			}
		}
		//// update the view records
		doSelectRecordsFetchAction();
		return "";
	}

	/** 
	 * @paramBean id=addInventory_2
	 */
	public DataObject getAddInventory_2Parameters() {
		if (addInventory_2Parameters == null) {
			try {
				addInventory_2Parameters = getAddInventory_2Mediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return addInventory_2Parameters;
	}

	protected JDBCMediator getAddInventory_2Mediator() {
		if (addInventory_2Mediator == null) {
			try {
				addInventory_2Mediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(addInventory_2_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(addInventory_2_metadataFileName),
						addInventory_2Mediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			addInventory_2Mediator
					.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return addInventory_2Mediator;
	}

	/** 
	 * This method was created in order to create new data.  To retrieve existing data:
	 *   DataObject graph = getAddInventory_2Mediator().getGraph( getAddInventory_2Parameters() );
	 *   addInventory_2 = (DataObject)graph.getList(0).get(0);  
	 *
	 * @action id=addInventory_2
	 */
	public String doAddInventory_2CreateAction() {
		try {
			resolveParams(getAddInventory_2Parameters(),
					addInventory_2ArgNames, addInventory_2ArgValues,
					"addInventory_2_params_cache");
			DataObject graph = getAddInventory_2Mediator().getEmptyGraph();
			addInventory_2 = graph.createDataObject(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addInventory_2Mediator != null) {
				addInventory_2Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}

	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/addInventory_2.xml
	 * @methodEntry id=addInventory_2/paramBean=addInventory_2/action=addInventory_2
	 * @action CREATE
	 */
	public DataObject getAddInventory_2() {
		if (addInventory_2 == null) {
			doAddInventory_2CreateAction();
		}
		return addInventory_2;
	}

	protected HtmlInputText getTextId2() {
		if (textId2 == null) {
			textId2 = (HtmlInputText) findComponentInRoot("textId2");
		}
		return textId2;
	}

	protected HtmlInputText getTextCategory1() {
		if (textCategory1 == null) {
			textCategory1 = (HtmlInputText) findComponentInRoot("textCategory1");
		}
		return textCategory1;
	}

	protected HtmlInputText getTextTitle1() {
		if (textTitle1 == null) {
			textTitle1 = (HtmlInputText) findComponentInRoot("textTitle1");
		}
		return textTitle1;
	}

	protected HtmlInputText getTextPrice1() {
		if (textPrice1 == null) {
			textPrice1 = (HtmlInputText) findComponentInRoot("textPrice1");
		}
		return textPrice1;
	}

	protected HtmlInputText getTextQuantity1() {
		if (textQuantity1 == null) {
			textQuantity1 = (HtmlInputText) findComponentInRoot("textQuantity1");
		}
		return textQuantity1;
	}

	protected HtmlMessages getMessages2() {
		if (messages2 == null) {
			messages2 = (HtmlMessages) findComponentInRoot("messages2");
		}
		return messages2;
	}

	protected HtmlCommandExButton getButtonDoAddInventory_2UpdateAction1() {
		if (buttonDoAddInventory_2UpdateAction1 == null) {
			buttonDoAddInventory_2UpdateAction1 = (HtmlCommandExButton) findComponentInRoot("buttonDoAddInventory_2UpdateAction1");
		}
		return buttonDoAddInventory_2UpdateAction1;
	}

	protected HtmlInputRowSelect getRowSelect2() {
		if (rowSelect2 == null) {
			rowSelect2 = (HtmlInputRowSelect) findComponentInRoot("rowSelect2");
		}
		return rowSelect2;
	}

	/** 
	 * @action id=addOrder_4
	 */
	public String doAddOrder_4UpdateAction() {
		try {
			getAddOrder_4Mediator().applyChanges(
					getRootDataObject(getAddOrder_4()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addOrder_4Mediator != null) {
				addOrder_4Mediator.setConnectionWrapper(null);
			}
		}
		//// update the view records
		doOrdersFetchAction();
		return "";
	}

	/** 
	 * @paramBean id=addOrder_4
	 */
	public DataObject getAddOrder_4Parameters() {
		if (addOrder_4Parameters == null) {
			try {
				addOrder_4Parameters = getAddOrder_4Mediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return addOrder_4Parameters;
	}

	protected JDBCMediator getAddOrder_4Mediator() {
		if (addOrder_4Mediator == null) {
			try {
				addOrder_4Mediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(addOrder_4_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(addOrder_4_metadataFileName),
						addOrder_4Mediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			addOrder_4Mediator.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return addOrder_4Mediator;
	}

	/** 
	 * This method was created in order to create new data.  To retrieve existing data:
	 *   DataObject graph = getAddOrder_4Mediator().getGraph( getAddOrder_4Parameters() );
	 *   addOrder_4 = (DataObject)graph.getList(0).get(0);  
	 *
	 * @action id=addOrder_4
	 */
	public String doAddOrder_4CreateAction() {
		try {
			resolveParams(getAddOrder_4Parameters(), addOrder_4ArgNames,
					addOrder_4ArgValues, "addOrder_4_params_cache");
			DataObject graph = getAddOrder_4Mediator().getEmptyGraph();
			addOrder_4 = graph.createDataObject(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (addOrder_4Mediator != null) {
				addOrder_4Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}

	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/addOrder_4.xml
	 * @methodEntry id=addOrder_4/paramBean=addOrder_4/action=addOrder_4
	 * @action CREATE
	 */
	public DataObject getAddOrder_4() {
		if (addOrder_4 == null) {
			doAddOrder_4CreateAction();
		}
		return addOrder_4;
	}

	protected HtmlInputText getTextId3() {
		if (textId3 == null) {
			textId3 = (HtmlInputText) findComponentInRoot("textId3");
		}
		return textId3;
	}

	protected HtmlInputText getTextCustomerid1() {
		if (textCustomerid1 == null) {
			textCustomerid1 = (HtmlInputText) findComponentInRoot("textCustomerid1");
		}
		return textCustomerid1;
	}

	protected HtmlInputText getTextProductid1() {
		if (textProductid1 == null) {
			textProductid1 = (HtmlInputText) findComponentInRoot("textProductid1");
		}
		return textProductid1;
	}

	protected HtmlInputText getTextDateplaced1() {
		if (textDateplaced1 == null) {
			textDateplaced1 = (HtmlInputText) findComponentInRoot("textDateplaced1");
		}
		return textDateplaced1;
	}

	protected HtmlMessages getMessages3() {
		if (messages3 == null) {
			messages3 = (HtmlMessages) findComponentInRoot("messages3");
		}
		return messages3;
	}

	protected HtmlCommandExButton getButtonDoAddOrder_4UpdateAction1() {
		if (buttonDoAddOrder_4UpdateAction1 == null) {
			buttonDoAddOrder_4UpdateAction1 = (HtmlCommandExButton) findComponentInRoot("buttonDoAddOrder_4UpdateAction1");
		}
		return buttonDoAddOrder_4UpdateAction1;
	}

	protected HtmlCommandExButton getButtonDelete1() {
		if (buttonDelete1 == null) {
			buttonDelete1 = (HtmlCommandExButton) findComponentInRoot("buttonDelete1");
		}
		return buttonDelete1;
	}

	protected HtmlInputText getTextDescription1() {
		if (textDescription1 == null) {
			textDescription1 = (HtmlInputText) findComponentInRoot("textDescription1");
		}
		return textDescription1;
	}

	protected HtmlSelectOneMenu getMenuStatus1() {
		if (menuStatus1 == null) {
			menuStatus1 = (HtmlSelectOneMenu) findComponentInRoot("menuStatus1");
		}
		return menuStatus1;
	}	

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -