123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290 |
- package com.persistence.service;
- import java.io.IOException;
- import java.io.InputStream;
- import java.io.OutputStream;
- import java.io.Reader;
- import java.io.Writer;
- import java.sql.Connection;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import com.persistence.service.assitant.DataObject;
- import com.persistence.service.assitant.Field;
- import com.persistence.service.exception.PersistenceException;
- import com.persistence.service.exception.TransformTypeException;
- import com.sysmodel.datamodel.xmlmodel.DataContent;
- import com.sysmodel.datamodel.xmlmodel.PropertyValue;
- import com.sysmodel.datamodel.xmlmodel.able.MdpConstant;
- import com.sysmodel.datamodel.xmlmodel.able.Template;
- import net.sf.json.JSONObject;
- import org.w3c.dom.Document;
- public interface SysPersistence{
- /**
- * @return 默认数据库连接
- */
- public Connection getConnection();
- /**
- * @return 默认数据库连接
- */
- public Connection getConnection(int claasid);
- /**
- * 添加数据 如果添加成功返回主键
- */
- public String addObjectData(DataObject dataobject) throws TransformTypeException,
- PersistenceException;
- /**
- * 更新数据
- */
- public boolean updateObjectData(DataObject dataobject) throws TransformTypeException,
- PersistenceException;
- /**
- * 查询数据,不包括lob数据
- */
- public DataObject searchObjectData(String objectID, int classid) throws PersistenceException;
- /**
- * 查询数据,不包括lob数据
- *
- * @param objectID
- * 纪录ID
- * @param classid
- * 所在表ID
- * @param objectIDName
- * 纪录id所在字段英文名
- * @return
- * @throws PersistenceException
- */
- public DataObject searchObjectData(String objectID, int classid, String objectIDName)
- throws PersistenceException;
- /**
- * 根据条件查询数据,只查询该表数据
- *
- * @param SQLcondition
- * where 后面查询条件
- * @return 返回数据集合,每个对象为DataObject
- */
- public ArrayList<DataObject> searchAllData(int classid, String SQLcondition)
- throws TransformTypeException, PersistenceException;
- /**
- * 根据条件查询数据,只查询该表数据
- *
- * @param condition
- * 每个对象是Field,blob,clob类型不能作为条件
- * @return 返回数据集合,每个对象为DataObject
- */
- public ArrayList<DataObject> searchAllData(int classid, List<Field> condition)
- throws TransformTypeException, PersistenceException;
- /**
- * 根据主键删除数据,如果存在主从关系,子表数据也会删除 真删除
- */
- public boolean deleteData(String objectID, int classid) throws PersistenceException;
- /**
- * 根据主键删除数据,如果存在主从关系,子表数据也会删除
- *
- * @param objectID
- * @param classid
- * @param isreal
- * @return
- * @throws PersistenceException
- * 当isreal 为FALSE时,假删除:调用这个方法时,数据库中必须有列字段is_Del
- */
- public boolean deleteData(String objectID, int classid, boolean isreal)
- throws PersistenceException;
- public void storeBlob(int classid, String objectID, String attributeName, InputStream is)
- throws TransformTypeException, PersistenceException;
- public void storeClob(int classid, String objectID, String attributeName, Reader reader)
- throws TransformTypeException, PersistenceException;
- public void readBlobToOutputStream(int classid, String objectID, String attributeName,
- OutputStream os) throws TransformTypeException, PersistenceException;
- public void readClobToWriter(int classid, String objectID, String attributeName, Writer writer)
- throws TransformTypeException, PersistenceException;
- /**
- * 返回数据库时间 格式:yyyy-MM-dd HH:mm:ss
- */
- public String getDataBaseTime() throws PersistenceException;
- /**
- * 结果集中每个对象是字符串数组,内容是sql语句的查询字段
- */
- public ArrayList<String[]> getSearchResult(int classid, String sql) throws PersistenceException;
- /**
- * 结果集中每个对象是字符串数组,内容是sql语句的查询字段
- */
- public ArrayList<Map<String, String>> getSearchResultToMap(int classid, String sql)
- throws PersistenceException;
- /**
- * 执行sql语句,返回执行结果
- */
- public int executeUpdateSQL(int classid, String sql) throws PersistenceException;
- /**
- * 批量执行sql语句,返回执行结果
- */
- public int[] executeUpdateSQL(int classid, ArrayList<String> sql) throws PersistenceException;
- /**
- * 返回数值运算函数结果
- */
- public int getFunctionNumber(int classid, String sql) throws PersistenceException;
- /**
- * 分页查询数据,常量编码值没有转换成相应描述
- *
- * @param intPageSize
- * 每页中记录个数
- * @param intCurrentPage
- * 当前页数
- * @return ArrayList集合中每个对象是字符串数组,内容是sql语句的查询字段
- */
- public ArrayList<String[]> searchPageResult(int classid, String sql, int intPageSize,
- int intCurrentPage) throws PersistenceException;
- // 常量表操作方法 begin
- /**
- * @param codeName
- * 常量名称
- * @param listPropertyValue
- * PropertyValue的集合
- */
- public boolean insertConstant(String codeName, ArrayList<PropertyValue> listPropertyValue)
- throws TransformTypeException, PersistenceException;
- /**
- * @param codeName
- * 常量名称
- * @param listPropertyValue
- * PropertyValue的集合
- */
- public boolean updateConstant(String codeName, ArrayList<PropertyValue> listPropertyValue)
- throws TransformTypeException, PersistenceException;
- /**
- * @param codeName
- * 常量名称
- * @param keyID
- * 主键值
- */
- public boolean deleteConstant(String codeName, String keyID) throws PersistenceException;
- /**
- * @param codeName
- * 常量名称
- * @param keyID
- * 主键值
- * @return PropertyValue的集合
- */
- public ArrayList<PropertyValue> searchConstant(String codeName, String keyID)
- throws PersistenceException;
- /**
- * @param codeName
- * 常量名称
- * @param keyID
- * 主键值
- * @return DataContent 的集合
- */
- public ArrayList<DataContent> searchDataContentByMdpConstant(MdpConstant constant)
- throws PersistenceException;
- public ArrayList<DataContent> searchDataContentByTemplate(Template template)
- throws PersistenceException;
- // 常量表操作方法 end
- /**
- * 构造出DataObject从HttpServletRequest
- */
- public DataObject generalDataObject(int classid, HttpServletRequest request);
- /**
- * 构造出DataObject从HttpServletRequest '-' 分割的字段
- */
- public DataObject generalDataObjectBySplit(int classid, HttpServletRequest request);
- // ---------------------------------------------------------------------
- /**
- * 2007.11.13 孙志刚新增通过 构造出XmlDocument从HttpServletRequest
- *
- * @throws IOException
- */
- public Document generalXmlDocument(HttpServletRequest request);
- /**
- * 构造出DataObject从xMLdOC
- */
- public DataObject generalDataObject(int classid, Document xmlDoc);
- public DataObject generalDataObjectJson(JSONObject JSONObject);
- public ArrayList<Map<String, String>> getPagingSearchResultToMap(int classid, String sql,
- String firstPageNum, String lastPageNum) throws PersistenceException;
- /**
- * 根据sql条件、及分页条件进行查询,只查询该表数据 吴潇 2009-12-25
- *
- * @param SQLcondition
- * where 后面查询条件
- * @return 返回数据集合,每个对象为DataObject
- */
- public ArrayList<DataObject> getPagingSearchResultToDataObject(int classid, String sql,
- String firstPageNum, String lastPageNum) throws PersistenceException;
- // --------------------------------------------------------------
- /**
- * 添加子表数据,返回主键
- */
- public String addChildData(DataObject dataobject, String parentid)
- throws TransformTypeException, PersistenceException;
- /**
- * 根据parentid删除子表数据
- */
- public boolean deleteChildData(int classid, String parentid) throws PersistenceException;
- /**
- * 根据parentid删除子表数据
- *
- * @param classid
- * @param parentid
- * @param isreal
- * @return
- * @throws PersistenceException
- */
- public boolean deleteChildData(int classid, String parentid, boolean isreal)
- throws PersistenceException;
- /**
- * 构造出DataObject从Uploader 带文件上传页面生成DataObject的方法
- */
- // public DataObject generalDataObjectByUploader(int classid,Uploader
- // myUploader);
- /* *//**
- * 查询数据,不包括lob数据 适用于存储数据库时FD_OBJECTID 前几位为DATAMODEL中CLASSID情况
- * 建议尽量不要使用此方法
- */
- /*
- * public DataObject searchObjectData(String objectID) throws
- * PersistenceException;
- */
- }
|