package com.vci.client.framework.delegate;
|
|
import com.vci.client.ClientSession;
|
import com.vci.client.common.objects.LogObject;
|
import com.vci.client.common.objects.UserEntityObject;
|
import com.vci.client.framework.systemConfig.log.LogPeriodObject;
|
import com.vci.client.framework.systemConfig.log.SystemCfgObject;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.framework.data.LogInfo;
|
import com.vci.corba.framework.data.LogPeriodInfo;
|
|
|
/**
|
* 日志管理clientdelegate
|
* @author xiongfei
|
*
|
*/
|
public class LogManagementClientDelegate extends ClientBaseDelegate{
|
|
public LogManagementClientDelegate(UserEntityObject userEntityObject) {
|
super(userEntityObject);
|
}
|
|
/**
|
* 获取日志删除配置,
|
* @return true 自动,false 手动
|
* @throws VCIError
|
*/
|
public boolean getIsAutoDelete() throws VCIError {
|
boolean res = false;
|
res = ClientSession.getFrameworkService().getIsAutoDelete();
|
return res;
|
}
|
|
/**
|
* 获取日志信息
|
* @return
|
* @throws VCIError
|
*/
|
public LogObject[] fetchLogInfo(int pageNo,int pageSize,String sql) throws VCIException {
|
LogObject[] objs = null;
|
try {
|
LogInfo[] logInfos = ClientSession.getFrameworkService().fetchLogInfo((long)pageNo,(long)pageSize,sql);
|
objs = new LogObject[logInfos.length];
|
for(int i = 0;i < logInfos.length;i++){
|
objs[i] = this.changeLogInfoToLogObjcet(logInfos[i]);
|
}
|
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return objs;
|
}
|
|
/**
|
* 获取日志信息
|
* @return
|
* @throws VCIError
|
*/
|
public LogObject[] getLogListByContion(int pageNo,int pageSize,String sql) throws VCIException {
|
LogObject[] objs = null;
|
try {
|
LogInfo[] logInfos = ClientSession.getFrameworkService().getLogListByContion(pageNo,pageSize,sql);
|
objs = new LogObject[logInfos.length];
|
for(int i = 0;i < logInfos.length;i++){
|
objs[i] = this.changeLogInfoToLogObjcet(logInfos[i]);
|
}
|
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return objs;
|
}
|
|
/**
|
* 取得日志条数
|
* @return
|
* @throws VCIError
|
*/
|
public long getSumLogRows(String sql) throws VCIException {
|
long sumCount = 0;
|
try {
|
sumCount = ClientSession.getFrameworkService().getSumLogRows(sql);
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return sumCount;
|
}
|
|
/**
|
* 获取保存期限下拉框的值
|
* @return
|
* @throws VCIError
|
*/
|
public LogPeriodObject[] getPeriods() throws VCIException {
|
LogPeriodObject[] objs = null;
|
try{
|
LogPeriodInfo[] infos = null;
|
infos = ClientSession.getFrameworkService().getPeriods();
|
objs = new LogPeriodObject[infos.length];
|
for(int i=0;i<infos.length;i++) {
|
objs[i] = changePeriodInfoToObj(infos[i]);
|
}
|
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return objs;
|
}
|
|
/**
|
* 获取日志查询页面显示条数
|
* @return 页面显示条数
|
* @throws VCIError
|
*/
|
public int getPageSize() throws VCIException {
|
try {
|
return (int)ClientSession.getFrameworkService().getPageSize();
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return 0;
|
}
|
|
/**
|
* 获取当前期限设置
|
* @param type 判断是保存还是备份期限
|
* @return
|
* @throws VCIError
|
*/
|
public int getCurPeriod(String type) throws VCIException {
|
try {
|
return (int)ClientSession.getFrameworkService().getCurPeriod(type);
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return 0;
|
}
|
|
/**
|
* 保存期限设置
|
* @param systemCfgObject
|
* @param userEntityObject
|
* @return
|
* @throws VCIError
|
*/
|
public boolean savePeriod(SystemCfgObject systemCfgObject) throws VCIException {
|
try {
|
return ClientSession.getFrameworkService().savePeriod(new SystemCfgClientDelegate().changeSystemCfgObjectToSystemCfgInfo(systemCfgObject), UserEntityClientDelegate.changeUserEntityToInfo(userEntityObject));
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return false;
|
}
|
|
/**
|
* 保存备份期限设置
|
* @param systemCfgObject
|
* @param userEntityObject
|
* @return
|
* @throws VCIError
|
*/
|
public boolean saveBackupPeriod(SystemCfgObject systemCfgObject) throws VCIException {
|
try {
|
return ClientSession.getFrameworkService().savePeriod(new SystemCfgClientDelegate().changeSystemCfgObjectToSystemCfgInfo(systemCfgObject), UserEntityClientDelegate.changeUserEntityToInfo(userEntityObject));
|
} catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return false;
|
}
|
|
public boolean deleteLog(String deleteDate) throws VCIException {
|
try {
|
return ClientSession.getFrameworkService().deleteLog(deleteDate);
|
}catch(VCIError e) {
|
this.convertVCIErrorToVCIException(e);
|
}
|
return false;
|
}
|
|
|
/**
|
* period对象的转换
|
* CORBA端对象转成客户端对象
|
*/
|
private LogPeriodObject changePeriodInfoToObj(LogPeriodInfo info) {
|
LogPeriodObject obj = new LogPeriodObject();
|
obj.setCode(info.code);
|
obj.setValue(info.value);
|
return obj;
|
}
|
|
/**
|
* Log对象的转换
|
* CORBA端对象转成客户端对象
|
* @param info
|
* @return
|
*/
|
private LogObject changeLogInfoToLogObjcet(LogInfo info) {
|
LogObject obj = new LogObject();
|
obj.setDate(info.date);
|
obj.setPuid(info.puid);
|
obj.setUsername(info.username);
|
obj.setTruename(info.truename);
|
obj.setUserIp(info.userIp);
|
obj.setType(info.type);
|
obj.setEntityDesc(info.entityDesc);
|
obj.setProperty(info.property);
|
obj.setPreviousVal(info.previousVal);
|
obj.setNewVal(info.newVal);
|
obj.setResult(info.result);
|
obj.setModule(info.moduleName);
|
return obj;
|
}
|
|
}
|