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

📄 abstractupdateaction.java

📁 羽量级数据持久层开发框架
💻 JAVA
字号:
package org.speedframework.action;

import org.speedframework.entity.ParamEntity;
import org.speedframework.exception.SpeedFrameworkException;
import org.speedframework.message.IMessage;
import org.speedframework.sql.ITableInfoSQL;
import org.speedframework.sql.IUpdateSQL;

import java.util.List;

/**
 * Class AbstractUpdateAction
 * 
 * @author <a href="mailto:santafeng@gmail.com"> lizf </a>
 * @version $Revision:1.0.0, $Date: 2007-10-10 1:46:56 $
 */
public abstract class AbstractUpdateAction extends AbstractAction implements
		IUpdateAction {

	/*
	 * (非 Javadoc)
	 * 
	 * @see org.speedframework.action.IAction#doAction(org.speedframework.message.IMessage)
	 */
	public void doAction(IMessage message) {
		log.debug("Speed engine is Update...");

		ParamEntity entity = message.getParamEntity();
		Object pojo = entity.getEntity();
		String usql;

		try {
			String[] columnCache = columnInfoCache.getColumnInfos(pojo);

			if (columnCache == null) {
				ITableInfoSQL tOffer=this.factory.getTableInfoSQL();
				tOffer.setTableObject(pojo);
				String SQL = tOffer.getSQL();

				this.columnInfoCache.putColumnInfo(pojo, this.executor.select(
						SQL, null));
			}
			

			String[] pkcolumnCache = columnInfoCache
					.getPrimaryKeyColumnInfos(pojo);
			IUpdateSQL uOffer = factory.getUpdateSQL();
			uOffer.setTableObject(pojo);
			uOffer.setColumn(pkcolumnCache);
			if (entity.isOpenTableSchema()) {
				String tableSchema = columnInfoCache.getTableschem(pojo);
				uOffer.setTableSchema(tableSchema);				
			}
			usql = uOffer.getSQL();

			List paramName = uOffer.getParam(usql);
			String[][] columnType = columnInfoCache.getColumnInfoType(pojo,
					paramName);

			log.debug(usql);
			this.executor.update(usql, columnType, pojo);
			resultCache.removeCache(pojo, this.useCache);
			this.result = pojo;
		} catch (Exception e) {
			throw new SpeedFrameworkException("AbstractUpdateAction error " + e);
		}
	}
}

⌨️ 快捷键说明

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