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

📄 rowaction.java

📁 IBM RSA下的JSF开发示例
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**
 * 
 */
package pagecode.rowActions;

import pagecode.PageCodeBase;
import java.util.List;

import com.ibm.faces.component.html.HtmlCommandExRowAction;
import com.ibm.faces.component.html.HtmlJspPanel;
import com.ibm.websphere.sdo.access.connections.ConnectionManager;
import com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapperFactory;
import com.ibm.websphere.sdo.mediator.jdbc.ConnectionWrapper;
import com.ibm.websphere.sdo.mediator.JDBCMediator;
import com.ibm.websphere.sdo.mediator.exception.MediatorException;
import com.ibm.websphere.sdo.mediator.jdbc.JDBCMediatorFactory;
import commonj.sdo.DataObject;
import java.sql.Connection;
import javax.faces.component.html.HtmlForm;
import javax.faces.component.UIColumn;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.component.html.HtmlCommandLink;

/**
 * @author nan
 *
 */
public class RowAction extends PageCodeBase {

	private static final String SDOConnection_name = "JSFandSDO_Con";
	private ConnectionWrapper SDOConnectionWrapper;
	protected DataObject customersParameters;
	protected JDBCMediator customersMediator;
	private static final int customersTargetPageSize = -1;
	protected List customers;
	protected DataObject updateCustomers2Parameters;
	protected JDBCMediator updateCustomers2Mediator;
	private static final String updateCustomers2_metadataFileName = "/WEB-INF/wdo/updateCustomers2.xml";
	protected static final String[] updateCustomers2ArgNames = { "paramID" };
	protected static final String[] updateCustomers2ArgValues = { "#{param.ID}" };
	protected DataObject updateCustomers2;
	protected DataObject temperatureDetailsParameters;
	protected JDBCMediator temperatureDetailsMediator;
	private static final String temperatureDetails_metadataFileName = "/WEB-INF/wdo/temperatureDetails.xml";
	protected static final String[] temperatureDetailsArgNames = { "requestScopecityDetails" };
	protected static final String[] temperatureDetailsArgValues = { "#{requestScope.cityDetails}" };
	protected DataObject temperatureDetails;
	protected DataObject temperatureParameters;
	protected JDBCMediator temperatureMediator;
	private static final String temperature_metadataFileName = "/WEB-INF/wdo/temperature.xml";
	protected static final String[] temperatureArgNames = {};
	protected static final String[] temperatureArgValues = {};
	private static final int temperatureTargetPageSize = -1;
	protected List temperature;
	protected HtmlForm form1;
	protected UIColumn column1;
	protected HtmlOutputText text1;
	protected HtmlOutputText text3;
	protected HtmlOutputText text5;
	protected HtmlOutputText text20;
	protected HtmlOutputText text8;
	protected HtmlOutputText text9;
	protected HtmlOutputText text10;
	protected HtmlOutputText text11;
	protected HtmlOutputText text12;
	protected HtmlOutputText text13;
	protected HtmlOutputText text14;
	protected HtmlOutputText text15;
	protected HtmlOutputText text16;
	protected HtmlOutputText text17;
	protected HtmlOutputText text18;
	protected HtmlOutputText text19;
	protected HtmlOutputText text7;
	protected HtmlDataTable table2;
	protected UIColumn column4;
	protected HtmlOutputText text23;
	protected HtmlOutputText text25;
	protected HtmlOutputText text33;
	protected HtmlOutputText text27;
	protected HtmlOutputText text39;
	protected HtmlOutputText text40;
	protected HtmlOutputText text34;
	protected HtmlOutputText text35;
	protected HtmlOutputText text36;
	protected HtmlOutputText text37;
	protected HtmlOutputText text38;
	protected HtmlDataTable table1;
	protected HtmlOutputText text2;
	protected UIColumn column2;
	protected HtmlOutputText text4;
	protected UIColumn column3;
	protected HtmlOutputText text6;
	protected HtmlCommandLink link1;
	protected HtmlOutputText text24;
	protected UIColumn column5;
	protected HtmlOutputText text26;
	protected UIColumn column9;
	protected HtmlCommandLink detailsLink;
	protected UIColumn column10;
	protected HtmlCommandLink deleteLink;
	protected HtmlCommandExRowAction rowAction1;
	protected HtmlJspPanel averagePanel;
	protected HtmlJspPanel detailsPanel;
	/** 
		 * @generated by WebSphere Studio
		 */
		private static final String customers_metadataFileName = "/WEB-INF/wdo/customers1.xml";
	protected static final String[] customersArgNames = {};
	protected static final String[] customersArgValues = {};
	
	protected ConnectionWrapper getSDOConnectionWrapper() {
		if (SDOConnectionWrapper == null) {
			try {
				Connection con = ConnectionManager
						.createJDBCConnection(SDOConnection_name);
				SDOConnectionWrapper = ConnectionWrapperFactory.soleInstance
						.createConnectionWrapper(con);
			} catch (Throwable e) {
				logException(e);
			}
		}
		return SDOConnectionWrapper;
	}
	/** 
	 * @action id=customers
	 */
	public String doCustomersUpdateAction() {
		try {
			getCustomersMediator().applyChanges(
					getRootDataObject(getCustomers()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (customersMediator != null) {
				customersMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @paramBean id=customers
	 */
	public DataObject getCustomersParameters() {
		if (customersParameters == null) {
			try {
				customersParameters = getCustomersMediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return customersParameters;
	}
	protected JDBCMediator getCustomersMediator() {
		if (customersMediator == null) {
			try {
				customersMediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(customers_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(customers_metadataFileName),
						customersMediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			customersMediator.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return customersMediator;
	}
	/** 
	 * @action id=customers
	 */
	public String doCustomersFetchAction() {
		try {
			resolveParams(getCustomersParameters(), customersArgNames,
					customersArgValues, "customers_params_cache");
			DataObject graph = getCustomersMediator().getGraph(
					getCustomersParameters());
			customers = graph.getList(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (customersMediator != null) {
				customersMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @action id=updateCustomers2
	 */
	public String doUpdateCustomers2UpdateAction() {
		try {
			getUpdateCustomers2Mediator().applyChanges(
					getRootDataObject(getUpdateCustomers2()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (updateCustomers2Mediator != null) {
				updateCustomers2Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @action id=updateCustomers2
	 */
	public String doUpdateCustomers2DeleteAction() {
		try {
			DataObject root = getRootDataObject(getUpdateCustomers2());
			getUpdateCustomers2().delete();
			getUpdateCustomers2Mediator().applyChanges(root);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (updateCustomers2Mediator != null) {
				updateCustomers2Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @paramBean id=updateCustomers2
	 */
	public DataObject getUpdateCustomers2Parameters() {
		if (updateCustomers2Parameters == null) {
			try {
				updateCustomers2Parameters = getUpdateCustomers2Mediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return updateCustomers2Parameters;
	}
	protected JDBCMediator getUpdateCustomers2Mediator() {
		if (updateCustomers2Mediator == null) {
			try {
				updateCustomers2Mediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(updateCustomers2_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(updateCustomers2_metadataFileName),
						updateCustomers2Mediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			updateCustomers2Mediator
					.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return updateCustomers2Mediator;
	}
	/** 
	 * This method was created in order to retrieve existing data.  To create new data:
	 *   DataObject graph = getUpdateCustomers2Mediator().getEmptyGraph();
	 *   updateCustomers2 = graph.createDataObject(0);  
	 *
	 * @action id=updateCustomers2
	 */
	public String doUpdateCustomers2FetchAction() {
		try {
			resolveParams(getUpdateCustomers2Parameters(),
					updateCustomers2ArgNames, updateCustomers2ArgValues,
					"updateCustomers2_params_cache");
			DataObject graph = getUpdateCustomers2Mediator().getGraph(
					getUpdateCustomers2Parameters());
			updateCustomers2 = (DataObject) graph.getList(0).get(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (updateCustomers2Mediator != null) {
				updateCustomers2Mediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/updateCustomers2.xml
	 * @methodEntry id=updateCustomers2/paramBean=updateCustomers2/action=updateCustomers2
	 * @action FILL
	 */
	public DataObject getUpdateCustomers2() {
		if (updateCustomers2 == null) {
			doUpdateCustomers2FetchAction();
		}
		return updateCustomers2;
	}
	/** 
	 * @action id=temperatureDetails
	 */
	public String doTemperatureDetailsUpdateAction() {
		try {
			getTemperatureDetailsMediator().applyChanges(
					getRootDataObject(getTemperatureDetails()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (temperatureDetailsMediator != null) {
				temperatureDetailsMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @action id=temperatureDetails
	 */
	public String doTemperatureDetailsDeleteAction() {
		try {
			DataObject root = getRootDataObject(getTemperatureDetails());
			getTemperatureDetails().delete();
			getTemperatureDetailsMediator().applyChanges(root);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (temperatureDetailsMediator != null) {
				temperatureDetailsMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @paramBean id=temperatureDetails
	 */
	public DataObject getTemperatureDetailsParameters() {
		if (temperatureDetailsParameters == null) {
			try {
				temperatureDetailsParameters = getTemperatureDetailsMediator()
						.getParameterDataObject();
			} catch (MediatorException e) {
				logException(e);
			}
		}
		return temperatureDetailsParameters;
	}
	protected JDBCMediator getTemperatureDetailsMediator() {
		if (temperatureDetailsMediator == null) {
			try {
				temperatureDetailsMediator = JDBCMediatorFactory.soleInstance
						.createMediator(
								getResourceInputStream(temperatureDetails_metadataFileName),
								getSDOConnectionWrapper());
				initSchema(getRealPath(temperatureDetails_metadataFileName),
						temperatureDetailsMediator.getSchema());
			} catch (Throwable e) {
				logException(e);
			}
		} else {
			temperatureDetailsMediator
					.setConnectionWrapper(getSDOConnectionWrapper());
		}
		return temperatureDetailsMediator;
	}
	/** 
	 * This method was created in order to retrieve existing data.  To create new data:
	 *   DataObject graph = getTemperatureDetailsMediator().getEmptyGraph();
	 *   temperatureDetails = graph.createDataObject(0);  
	 *
	 * @action id=temperatureDetails
	 */
	public String doTemperatureDetailsFetchAction() {
		try {
			resolveParams(getTemperatureDetailsParameters(),
					temperatureDetailsArgNames, temperatureDetailsArgValues,
					"temperatureDetails_params_cache");
			DataObject graph = getTemperatureDetailsMediator().getGraph(
					getTemperatureDetailsParameters());
			temperatureDetails = (DataObject) graph.getList(0).get(0);
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {
				if (SDOConnectionWrapper != null) {
					SDOConnectionWrapper.getConnection().close();
					SDOConnectionWrapper = null;
				}
			} catch (Throwable e1) {
				logException(e1);
			}
			if (temperatureDetailsMediator != null) {
				temperatureDetailsMediator.setConnectionWrapper(null);
			}
		}
		return "";
	}
	/** 
	 * @mediatorFactory com.ibm.etools.sdo.rdb.datahandlers.RelationalDataFactory
	 * @mediatorProperties metadataFileName=/WEB-INF/wdo/temperatureDetails.xml
	 * @methodEntry id=temperatureDetails/paramBean=temperatureDetails/action=temperatureDetails
	 * @action FILL
	 */
	public DataObject getTemperatureDetails() {
		if (temperatureDetails == null) {
			doTemperatureDetailsFetchAction();
		}
		return temperatureDetails;
	}
	/** 
	 * @action id=temperature
	 */
	public String doTemperatureUpdateAction() {
		try {
			getTemperatureMediator().applyChanges(
					getRootDataObject(getTemperature()));
		} catch (Throwable e) {
			logException(e);
		} finally {
			try {

⌨️ 快捷键说明

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