主要涉及类:
WfmTaskQryTmpImpl.java
MainViewController.java
TaskQryParam.java
基础类TaskQryParam.java
package nc.uap.portal.task.ctrl;
import java.io.Serializable;
import nc.uap.lfw.core.cmd.base.FromWhereSQL;
public class TaskQryParam
implements Serializable
{
public static final String STATUS_UNREAD = "UnRead";
public static final String STATUS_READED = "Readed";
public static final String STATUS_END = "End";
public static final String STATUS_SUSPEND = "Suspend";
public static final String STATUS_SENDED = "Sended";
public static final String STATUS_UNSEND = "UnSend";
public static final String TIME_NORMAL = "0";
public static final String TIME_WARN = "1";
public static final String TIME_OUT = "2";
public static final String ID_TASK = "c001";
public static final String ID_DELIVERTASK = "c002";
private static final long serialVersionUID = -3579446829360237958L;
String id;
String status;
String system;
String pk_agenter;
String pk_user;
String keyWord;
String startDate;
String endDate;
String billType;
String startDay;
String endDay;
String source;
boolean hasTakEnd;
FromWhereSQL whereSql;
public boolean isHasTakEnd()
{
return this.hasTakEnd;
}
public void setHasTakEnd(boolean hasTakEnd)
{
this.hasTakEnd = hasTakEnd;
}
public String getPk_agenter()
{
return this.pk_agenter;
}
public void setPk_agenter(String pk_agenter)
{
this.pk_agenter = pk_agenter;
}
public String getStartDate()
{
return this.startDate;
}
public void setStartDate(String startDate)
{
this.startDate = startDate;
}
public String getEndDate()
{
return this.endDate;
}
public void setEndDate(String endDate)
{
this.endDate = endDate;
}
public String getPk_user()
{
return this.pk_user;
}
public void setPk_user(String pk_user)
{
this.pk_user = pk_user;
}
public String getKeyWord()
{
return this.keyWord;
}
public void setKeyWord(String keyWord)
{
this.keyWord = keyWord;
}
public String getBillType()
{
return this.billType;
}
public void setBillType(String billType)
{
this.billType = billType;
}
public String getStartDay()
{
return this.startDay;
}
public void setStartDay(String startDay)
{
this.startDay = startDay;
}
public String getEndDay()
{
return this.endDay;
}
public void setEndDay(String endDay)
{
this.endDay = endDay;
}
public String getSource()
{
return this.source;
}
public void setSource(String source)
{
this.source = source;
}
public FromWhereSQL getWhereSql()
{
return this.whereSql;
}
public void setWhereSql(FromWhereSQL whereSql)
{
this.whereSql = whereSql;
}
public String getSystem()
{
return this.system;
}
public void setSystem(String system)
{
this.system = system;
}
public void reset()
{
this.whereSql = null;
}
public String getId()
{
return this.id;
}
public void setId(String category)
{
this.id = category;
//reset();//修正:TaskQryParam的setId方法和setStatus方法的reset取消
}
public String getStatus()
{
return this.status;
}
public void setStatus(String status)
{
this.status = status;
// reset();
}
public String toString()
{
return "DSKEY_" + hashCode();
}
public String getInfo()
{
return "id:" + this.id + " status:" + this.status + " system:" + this.system + " wheresql:" + this.whereSql;
}
}
查询类WfmTaskQryTmpImpl.java
package nc.uap.portal.task.impl;
import java.util.HashMap;
import java.util.Map;
import nc.bs.framework.common.InvocationInfoProxy;
import nc.bs.framework.common.NCLocator;
import nc.uap.lfw.core.crud.CRUDHelper;
import nc.uap.lfw.core.crud.ILfwCRUDService;
import nc.uap.lfw.core.ctx.AppLifeCycleContext;
import nc.uap.lfw.core.ctx.ApplicationContext;
import nc.uap.lfw.core.ctx.OpenProperties;
import nc.uap.lfw.core.ctx.ViewContext;
import nc.uap.lfw.core.data.PaginationInfo;
import nc.uap.lfw.core.exception.LfwBusinessException;
import nc.uap.lfw.core.exception.LfwRuntimeException;
import nc.uap.portal.log.PortalLogger;
import nc.uap.portal.task.ctrl.TaskQryParam;
import nc.uap.portal.task.itf.ITaskQryTmp;
import nc.uap.wfm.dftimpl.DefaultFormOper;
import nc.uap.wfm.engine.IWfmFormOper;
import nc.uap.wfm.engine.TaskProcessUI;
import nc.uap.wfm.exception.WfmServiceException;
import nc.uap.wfm.itf.IWfmFieldRelationQry;
import nc.uap.wfm.itf.IWfmTaskQry;
import nc.uap.wfm.model.ProDef;
import nc.uap.wfm.model.Task;
import nc.uap.wfm.model.TaskProcessResult;
import nc.uap.wfm.utils.WfmClassUtil;
import nc.uap.wfm.utils.WfmTaskUtil;
import nc.uap.wfm.utils.WfmUtilFacade;
import nc.uap.wfm.vo.WfmFlwTypeVO;
import nc.uap.wfm.vo.WfmTaskVO;
import nc.vo.ml.AbstractNCLangRes;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDateTime;
public class WfmTaskQryTmpImpl
implements ITaskQryTmp
{
public WfmTaskVO[] qryTaskList(TaskQryParam param, PaginationInfo pinfo)
{
IWfmTaskQry taskQry = (IWfmTaskQry)NCLocator.getInstance().lookup(IWfmTaskQry.class);
String pk_user = InvocationInfoProxy.getInstance().getUserId();
String taskState = makeTaskState(param.getId(), param.getStatus());
String source = param.getSource();
String startDay = null;
String endDay = null;
String keyWord = null;
String wherePart = " ";
if (param != null)
{
if ((param.getStartDay() != null) && (param.getEndDay() != null))
{
UFDateTime now = new UFDateTime();
endDay = now.getDate().toLocalString();
startDay = now.getDateTimeBefore(7).toLocalString().substring(0, 10);
wherePart = " and t.startdate between '" + startDay + " 00:00:00' and '" + endDay + " 24:00:00' ";
}
if (param.getSource() != null) {
source = param.getSource();
}
if (param.getKeyWord() != null) {
keyWord = param.getKeyWord();
}
if (param.getPk_agenter() != null)
{
pk_user = param.getPk_agenter();
try
{
return taskQry.getMyStartTask(taskState, keyWord, source, pk_user, wherePart, pinfo);
}
catch (WfmServiceException e)
{
PortalLogger.error(e.getMessage(), e);
throw new LfwRuntimeException(e.getMessage(), e);
}
}
}
try
{
return taskQry.queryTask(taskState, keyWord, source, pk_user, wherePart, UFBoolean.FALSE, UFBoolean.valueOf(param.isHasTakEnd()), pinfo);
}
catch (WfmServiceException e)
{
PortalLogger.error(e.getMessage(), e);
throw new LfwRuntimeException(e.getMessage(), e);
}
}
public String makeTaskState(String taskType, String state)
{
if ("c001".equals(taskType))
{
if ("UnRead".equals(state)) {
return "State_Run";
}
if ("Readed".equals(state)) {
return "State_End";
}
if ("End".equals(state)) {
return "State_Finished";
}
if ("Suspend".equals(state)) {
return "State_Suspended";
}
if ("UnSend".equals(state)) {
return "NottStart";
}
if ("Sended".equals(state)) {
return "UnNottStart";
}
}
if ("c002".equals(taskType))
{
if ("UnRead".equals(state)) {
return "State_UnRead";
}
if ("Readed".equals(state)) {
return "State_Readed";
}
if ("End".equals(state)) {
return "State_ReadEnd";
}
}
return "State_Run";
}
public TaskProcessUI getTaskProcessUrl(String pk_task)
{
Task task = (Task)WfmTaskUtil.getTaskFromDB(pk_task);
WfmFlwTypeVO vo = task.getProDef().getFlwtype();
if (vo == null) {
return null;
}
String serverClazz = vo.getServerclass();
if (serverClazz == null) {
serverClazz = DefaultFormOper.class.getName();
}
IWfmFormOper formOper = (IWfmFormOper)WfmClassUtil.loadClass(serverClazz);
TaskProcessUI tpi = formOper.getHanlderUrlByTask(task);
String url = tpi.getUrl();
url = url + "&$$$$$$$$FLOWTYPEPK=" + vo.getPk_flwtype();
tpi.setUrl(url);
if (tpi.getTitle() == null) {
tpi.setTitle(task.getTitile());
}
if (tpi.getHeight() == null) {
tpi.setHeight("100%");
}
if (tpi.getWidth() == null) {
tpi.setWidth("1100");
}
if (tpi.getOpenType() == null) {
tpi.setOpenType("TYPE_DIALOG");
}
return tpi;
}
public TaskProcessResult[] doMutiTaskProcess(String[] pk_task, String oper, String content)
{
String operator = "agree";
if ("readend".equalsIgnoreCase(oper)) {
operator = "readend";
} else if ("unagree".equalsIgnoreCase(oper)) {
operator = "noagree";
}
return (TaskProcessResult[])WfmUtilFacade.batchExecute(pk_task, operator, content);
}
public WfmFlwTypeVO[] getBillTypes()
{
try
{
return (WfmFlwTypeVO[])CRUDHelper.getCRUDService().queryVOs(new WfmFlwTypeVO(), null, null);
}
catch (LfwBusinessException e)
{
PortalLogger.error(e.getMessage(), e);
throw new LfwRuntimeException(e.getMessage(), e);
}
}
public Map<String, String> getVisableColumn(String billtype)
{
IWfmFieldRelationQry qry = (IWfmFieldRelationQry)NCLocator.getInstance().lookup(IWfmFieldRelationQry.class);
return qry.getExtFieldAndDisplayName(billtype);
}
public void doCmd(String cmd, String pk)
{
if ("scratchpad".equals(cmd))
{
String url = "/portal/pt/task/scratchpad?id=" + pk;
AppLifeCycleContext.current().getApplicationContext().showModalDialog(url, NCLangRes4VoTransl.getNCLangRes().getStrByID("pint", "WfmTaskQryTmpImpl-000000"), "480", "320", "isurgency", "");
}
if ("isurgency".equals(cmd))
{
Map<String, String> paramMap = new HashMap();
paramMap.put("pk", pk);
paramMap.put("id", "isurgency");
OpenProperties winProps = new OpenProperties("urgencyView", NCLangRes4VoTransl.getNCLangRes().getStrByID("pint", "WfmTaskQryTmpImpl-000001"), "400", "320", paramMap, "TYPE_DIALOG");
AppLifeCycleContext.current().getViewContext().navgateTo(winProps);
}
}
public String getParentId()
{
return null;
}
}
显示控制类MainViewController.java
package nc.uap.portal.task.ctrl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import nc.uap.ctrl.tpl.qry.FromWhereSQLImpl;
import nc.uap.lfw.core.LfwRuntimeEnvironment;
import nc.uap.lfw.core.WebContext;
import nc.uap.lfw.core.WebSession;
import nc.uap.lfw.core.comp.ButtonComp;
import nc.uap.lfw.core.comp.CheckBoxComp;
import nc.uap.lfw.core.comp.GridColumn;
import nc.uap.lfw.core.comp.GridComp;
import nc.uap.lfw.core.comp.IGridColumn;
import nc.uap.lfw.core.comp.MenuItem;
import nc.uap.lfw.core.comp.MenubarComp;
import nc.uap.lfw.core.comp.RadioGroupComp;
import nc.uap.lfw.core.comp.text.ComboBoxComp;
import nc.uap.lfw.core.comp.text.TextComp;
import nc.uap.lfw.core.ctrl.IController;
import nc.uap.lfw.core.ctx.AppLifeCycleContext;
import nc.uap.lfw.core.ctx.ApplicationContext;
import nc.uap.lfw.core.ctx.OpenProperties;
import nc.uap.lfw.core.ctx.ViewContext;
import nc.uap.lfw.core.ctx.WindowContext;
import nc.uap.lfw.core.data.Dataset;
import nc.uap.lfw.core.data.PaginationInfo;
import nc.uap.lfw.core.data.Row;
import nc.uap.lfw.core.data.RowSet;
import nc.uap.lfw.core.event.DataLoadEvent;
import nc.uap.lfw.core.event.DialogEvent;
import nc.uap.lfw.core.event.MouseEvent;
import nc.uap.lfw.core.event.ScriptEvent;
import nc.uap.lfw.core.event.TextEvent;
import nc.uap.lfw.core.exception.LfwRuntimeException;
import nc.uap.lfw.core.model.plug.TranslatedRow;
import nc.uap.lfw.core.page.LfwView;
import nc.uap.lfw.core.page.ViewComponents;
import nc.uap.lfw.core.page.ViewMenus;
import nc.uap.lfw.core.page.ViewModels;
import nc.uap.lfw.core.serializer.impl.SuperVO2DatasetSerializer;
import nc.uap.lfw.jsp.uimeta.UICardLayout;
import nc.uap.lfw.jsp.uimeta.UIElementFinder;
import nc.uap.lfw.jsp.uimeta.UIMeta;
import nc.uap.lfw.login.vo.LfwSessionBean;
import nc.uap.portal.exception.PortalServiceException;
import nc.uap.portal.log.PortalLogger;
import nc.uap.portal.plugins.PluginManager;
import nc.uap.portal.plugins.model.PtExtension;
import nc.uap.portal.task.itf.ITaskQryTmp;
import nc.uap.portal.task.ui.TaskHelper;
import nc.uap.portal.task.ui.TaskPaginationQueryImpl;
import nc.uap.portal.util.ToolKit;
import nc.uap.wfm.engine.TaskProcessUI;
import nc.uap.wfm.vo.WfmTaskVO;
import nc.vo.ml.AbstractNCLangRes;
import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pub.SuperVO;
import nc.vo.pub.lang.UFDate;
import nc.vo.pub.lang.UFDateTime;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import uap.web.bd.pub.AppUtil;
public class MainViewController
implements IController
{
private static final String TASKWINDOWID = "wfl";
private static final String STATUS_CARD = "status_card";
private static final String TASK_QRY_PARAM = "TASK_QRY_PARAM";
private static final String ID = "id";
private static final String TASKSTATUS = "taskstatus";
private static final String DS_TASK = "ds_task";
private static final String WFMTASKQRY = "wfmtaskqry";
private static final String PLUGIN_QUERYPARA = "plugin_querypara";
public void pluginsimplequery_plugin(Map<String, Object> keys)
{
FromWhereSQLImpl whereSql = (FromWhereSQLImpl)keys.get("whereSql");
TaskQryParam qryParam = new TaskQryParam();
WebSession ws = LfwRuntimeEnvironment.getWebContext().getWebSession();
String extensionId = ws.getOriginalParameter("extensionId");
if (StringUtils.isNotBlank(extensionId)) {
qryParam.setSystem(extensionId);
}
UFDateTime now = new UFDateTime();
if (whereSql.getFieldAndSqlMap() != null)
{
Map<String, String> param = whereSql.getFieldAndSqlMap();
Set<String> set = whereSql.getFieldAndSqlMap().keySet();
Iterator<String> it = set.iterator();
while (it.hasNext())
{
String key = ((String)it.next()).trim();
if (key.startsWith("title"))
{
String keyValue = (String)param.get(key);
if (keyValue != null) {
keyValue = keyValue.replace("'", "").replace("=", "").replace("like", "").replace("%", "").trim();
}
qryParam.setKeyWord(keyValue);
}
else if (key.equals("proinsstartdate"))
{
String keyValue = (String)param.get("proinsstartdate");
qryParam.setStartDate(keyValue);
}
else if (key.equals("enddate"))
{
String keyValue = (String)param.get("enddate");
qryParam.setEndDate(keyValue);
}
else if (key.equals("source"))
{
String keyValue = (String)param.get("source");
if (keyValue != null) {
keyValue = keyValue.replace("'", "").replace("=", "").trim();
}
qryParam.setSource(keyValue);
}
if (key.equals("pk_agenter"))
{
String keyValue = (String)param.get("pk_agenter");
String pk_user = LfwRuntimeEnvironment.getLfwSessionBean().getPk_user();
if ("1001AA1000000000019Q".equals(keyValue)) {
qryParam.setPk_agenter(pk_user);
} else {
qryParam.setPk_agenter(keyValue);
}
}
else if (key.equals("startdate"))
{
String startDay = now.getDateTimeBefore(7).toLocalString();
qryParam.setStartDay(startDay);
}
else if (key.equals("finishdate"))
{
String endDay = now.getDate().toLocalString();
qryParam.setEndDay(endDay);
}
}
}
qryParam.setWhereSql(whereSql);
TaskQryParam cach = new TaskQryParam();
try
{
BeanUtils.copyProperties(cach, qryParam);
}
catch (Exception e)
{
PortalLogger.error(e.getMessage(), e);
cach = qryParam;
}
AppUtil.addAppAttr("plugin_querypara", cach);
setQryParamIdAndStatus(qryParam);
fillDs(qryParam, false);
}
private void resetQryParam(TaskQryParam qryParam)
{
if (qryParam == null) {
return;
}
qryParam.billType = null;
qryParam.billType = null;
qryParam.startDate = null;
qryParam.startDay = null;
qryParam.endDate = null;
qryParam.endDay = null;
qryParam.pk_agenter = null;
qryParam.pk_user = null;
qryParam.status = null;
qryParam.keyWord = null;
qryParam.system = null;
qryParam.source = null;
}
public void plugindoFilterTaskStatus(Map<String, Object> keys)
{
TaskQryParam qryParam = getQryParam();
ViewContext viewContex = AppLifeCycleContext.current().getViewContext();
processQryParam(keys, qryParam);
initQryState(qryParam, viewContex);
fillDs(qryParam, false);
clearQuryPlanCach();
}
public void onBeforeShow(DialogEvent dialogEvent)
{
ViewContext contex = AppLifeCycleContext.current().getWindowContext().getViewContext("main");
CheckBoxComp hasStateEnd = (CheckBoxComp)contex.getView().getViewComponents().getComponent("hasStateEnd");
hasStateEnd.setVisible(false);
}
public void fillDs(TaskQryParam qryParam, boolean isChange)
{
LfwView view = AppUtil.getView("main");
Dataset ds = view.getViewModels().getDataset("ds_task");
if (!isChange)
{
ds.clear();
ds.setCurrentKey(String.valueOf(new Random().nextFloat()));
}
List<WfmTaskVO> taskRes = new ArrayList();
setGridColumn(qryParam);
ComboBoxComp com = (ComboBoxComp)AppUtil.getView("system").getViewComponents().getComponent("systemCombox");
qryParam.setSystem(com.getValue());
if ("all".equals(com.getValue())) {
qryParam.setSystem(null);
}
PaginationInfo pi = ds.getCurrentRowSet().getPaginationInfo();
try
{
taskRes = TaskPaginationQueryImpl.query(qryParam, pi);
}
catch (PortalServiceException e)
{
PortalLogger.error(e.getMessage(), e);
throw new LfwRuntimeException(e.getMessage());
}
setExt7(taskRes);
if (!taskRes.isEmpty()) {
new SuperVO2DatasetSerializer().serialize((SuperVO[])taskRes.toArray(new WfmTaskVO[0]), ds, 0);
}
}
private void setGridColumn(TaskQryParam qryParam)
{
LfwView viewMain=AppUtil.getView("main");
ViewComponents Components=viewMain.getViewComponents();
GridComp grid = (GridComp)Components.getComponent("grid_undnetask");
List<PtExtension> exs = PluginManager.newIns().getExtensions("TASK_QRY_PLUGIN");
for (int i = 0; i < 10; i++)
{
IGridColumn col = grid.getColumnByField("ext" + i);
if (col.isVisible()) {
col.setVisible(false);
}
}
if (ToolKit.notNull(exs)) {
for (PtExtension ex : exs) {
try
{
ITaskQryTmp tqt = (ITaskQryTmp)ex.newInstance(ITaskQryTmp.class);
processGridColumn(grid, tqt, qryParam.getSource());
}
catch (Throwable e)
{
PortalLogger.error(e.getMessage(), e);
}
}
}
}
private void setExt7(List<WfmTaskVO> taskRes)
{
if (ToolKit.notNull(taskRes)) {
for (WfmTaskVO wt : taskRes)
{
UFDateTime finishDate = wt.getFinishdate();
UFDateTime currentData = new UFDateTime();
if ((finishDate != null) && (finishDate.after(currentData)))
{
int warn = UFDateTime.getMinutesBetween(currentData, finishDate);
wt.setExt7(warn < 15 ? "1" : "0");
}
else
{
wt.setExt7(finishDate == null ? "0" : "2");
}
}
}
}
private void processGridColumn(GridComp gc, ITaskQryTmp qry, String source)
{
Map<String, String> cols;
if (source != null)
{
cols = qry.getVisableColumn(source);
if ((cols != null) && (!cols.isEmpty()))
{
Set<String> colkey = cols.keySet();
for (String key : colkey)
{
String text = (String)cols.get(key);
if (text != null)
{
GridColumn col = (GridColumn)gc.getColumnByField(key);
col.setVisible(true);
col.setText(text);
}
}
}
}
}
private void initQryState(TaskQryParam qryParam, ViewContext viewContex)
{
UICardLayout card = (UICardLayout)UIElementFinder.findElementById(viewContex.getUIMeta(), "status_card");
if ("c001".equals(qryParam.getId()))
{
card.setCurrentItem("0");
RadioGroupComp c001 = (RadioGroupComp)getCurrentView().getViewComponents().getComponent("c001");
c001.setValue("UnRead");
MenuItem menue = AppLifeCycleContext.current().getWindowContext().getViewContext("main").getView().getViewMenus().getMenuBar("ctrlmenu").getItem("aud$mutiexec");
menue.setText(NCLangRes4VoTransl.getNCLangRes().getStrByID("pint", "MainViewController-000009"));
setMenuVisable("UnRead");
}
else
{
card.setCurrentItem("1");
RadioGroupComp c002 = (RadioGroupComp)getCurrentView().getViewComponents().getComponent("c002");
c002.setValue("UnRead");
MenuItem menue = AppLifeCycleContext.current().getWindowContext().getViewContext("main").getView().getViewMenus().getMenuBar("ctrlmenu").getItem("aud$mutiexec");
menue.setText(NCLangRes4VoTransl.getNCLangRes().getStrByID("pint", "MainViewController-000010"));
setMenuVisable("UnRead");
}
}
void processQryParam(Map<String, Object> keys, TaskQryParam qryParam)
{
TranslatedRow row = (TranslatedRow)keys.get("taskstatus");
Object id = row.getValue("id");
if (id != null)
{
qryParam.setId((String)id);
qryParam.setStatus("UnRead");
}
}
TaskQryParam getQryParam()
{
WebSession ws = LfwRuntimeEnvironment.getWebContext().getWebSession();
TaskQryParam qryParam = (TaskQryParam)ws.getAttribute("TASK_QRY_PARAM");
if (qryParam == null)
{
qryParam = new TaskQryParam();
String extensionId = ws.getOriginalParameter("extensionId");
if (StringUtils.isNotBlank(extensionId)) {
qryParam.setSystem(extensionId);
}
ws.setAttribute("TASK_QRY_PARAM", qryParam);
}
return qryParam;
}
public void onclick_exec(ScriptEvent mouseEvent)
{
String id = AppLifeCycleContext.current().getParameter("pk");
String sys = AppLifeCycleContext.current().getParameter("pluginid");
if (id == null)
{
Dataset ds = getCurrentView().getViewModels().getDataset("ds_task");
Row selectedRow = ds.getSelectedRow();
id = selectedRow.getString(ds.nameToIndex("pk_task"));
}
if (sys == null) {
sys = getSystemCode();
}
ITaskQryTmp taskQry = TaskHelper.getTaskQry(sys);
TaskProcessUI tpi = taskQry.getTaskProcessUrl(id);
if (tpi != null)
{
ApplicationContext ctx = AppLifeCycleContext.current().getApplicationContext();
ctx.popOuterWindow(tpi.getUrl(), StringUtils.isNotBlank(tpi.getTitle()) ? tpi.getTitle() : " ", tpi.getWidth(), tpi.getHeight(), tpi.getOpenType(), false, "wfl");
}
}
public void doClickIcon(ScriptEvent mouseEvent)
{
String id = AppLifeCycleContext.current().getParameter("pk");
String sys = AppLifeCycleContext.current().getParameter("pluginid");
String icon = AppLifeCycleContext.current().getParameter("icon");
if (id == null)
{
Dataset ds = getCurrentView().getViewModels().getDataset("ds_task");
Row selectedRow = ds.getSelectedRow();
id = selectedRow.getString(ds.nameToIndex("pk_task"));
}
if (sys == null) {
sys = getSystemCode();
}
ITaskQryTmp taskQry = TaskHelper.getTaskQry(sys);
taskQry.doCmd(icon, id);
}
public void reloadData(ScriptEvent mouseEvent)
{
TaskQryParam qryParam = getQryParam();
fillDs(qryParam, false);
}
public void onclick_mutiexec(MouseEvent<ButtonComp> mouseEvent)
{
Dataset ds = getCurrentView().getViewModels().getDataset("ds_task");
Row[] sels = ds.getSelectedRows();
if ((sels == null) || (sels.length == 0)) {
return;
}
String state = sels[0].getString(ds.nameToIndex("state"));
AppUtil.addAppAttr("$$curstate", state);
WindowContext contex = AppLifeCycleContext.current().getApplicationContext().getCurrentWindowContext();
HashMap<String, String> map = new HashMap();
map.put("state", state);
OpenProperties openProperties = new OpenProperties();
openProperties.setOpenId("taskoperate");
openProperties.setWidth("502");
openProperties.setHeight("234");
openProperties.setTitle(NCLangRes4VoTransl.getNCLangRes().getStrByID("pint", "MainViewController-000008"));
openProperties.setParamMap(map);
contex.popView(openProperties);
}
public String getSystemCode()
{
Dataset ds = getCurrentView().getViewModels().getDataset("ds_task");
Row row = ds.getSelectedRow();
if (row != null)
{
String sys = row.getString(ds.nameToIndex("sysext3"));
if (sys != null) {
return sys;
}
}
return "wfmtaskqry";
}
private LfwView getCurrentView()
{
return AppLifeCycleContext.current().getViewContext().getView();
}
public void status_valueChanged(TextEvent textEvent)
{
String val = ((TextComp)textEvent.getSource()).getValue();
TaskQryParam param = getQryParam();
param.setStatus(val);
fillDs(param, false);
}
public void status_valueChanged2(TextEvent textEvent)
{
status_valueChanged(textEvent);
}
public void sys_valueChanged(TextEvent textEvent)
{
fillDs(getQryParam(), false);
}
public void excValueChanged(TextEvent textEvent)
{
String val = ((TextComp)textEvent.getSource()).getValue();
setMenuVisable(val);
TaskQryParam param = getQryParam();
param.setStatus(val);
fillDs(param, false);
clearQuryPlanCach();
}
public void onclick_hasEndTask(ScriptEvent scriptevent)
{
CheckBoxComp com = (CheckBoxComp)scriptevent.getSource();
ViewContext contex = AppLifeCycleContext.current().getWindowContext().getViewContext("main");
RadioGroupComp radiocom = (RadioGroupComp)contex.getView().getViewComponents().getComponent("c001");
TaskQryParam param = getQryParam();
param.setStatus(radiocom.getValue());
param.setHasTakEnd(com.isChecked());
fillDs(param, false);
clearQuryPlanCach();
}
private void setMenuVisable(String status)
{
LfwView main = AppUtil.getView("main");
MenubarComp menu = main.getViewMenus().getMenuBar("ctrlmenu");
boolean isgridMulSel = false;
MenuItem item = menu.getItem("aud$mutiexec");
if ("UnRead".equals(status))
{
item.setVisible(true);
isgridMulSel = true;
}
else
{
item.setVisible(false);
}
GridComp grid = (GridComp)main.getViewComponents().getComponent("grid_undnetask");
if (isgridMulSel) {
grid.setMultiSelect(true);
} else {
grid.setMultiSelect(false);
}
UIMeta uiEle = AppUtil.getViewCtx("main").getUIMeta();
UICardLayout card = (UICardLayout)UIElementFinder.findElementById(uiEle, "status_card");
CheckBoxComp hasStateEnd = (CheckBoxComp)main.getViewComponents().getComponent("hasStateEnd");
if ((("Sended".equals(status)) || ("Readed".equals(status))) && ("0".equals(card.getCurrentItem()))) {
hasStateEnd.setVisible(true);
} else {
hasStateEnd.setVisible(false);
}
}
public void readValueChanged(TextEvent textEvent)
{
setMenuVisable(((TextComp)textEvent.getSource()).getValue());
excValueChanged(textEvent);
}
public void pluginqryplan_plugin(Map<Object, Object> keys) {}
public void onDataLoad(DataLoadEvent dataLoadEvent)
{
TaskQryParam qryParam = new TaskQryParam();
try
{
Serializable obj = AppUtil.getAppAttr("plugin_querypara");
if (obj != null)
{
TaskQryParam cach = (TaskQryParam)obj;
BeanUtils.copyProperties(qryParam, cach);
}
}
catch (Exception e)
{
PortalLogger.error(e.getMessage(), e);
qryParam = getQryParam();
}
setQryParamIdAndStatus(qryParam);
//qryParam.getWhereSql();
fillDs(qryParam, true);
}
public void setQryParamIdAndStatus(TaskQryParam qryParam)
{
LfwView widget = AppUtil.getView("category");
Dataset ds1 = widget.getViewModels().getDataset("cateds");
Object id = ds1.getSelectedRow().getValue(0);
if (id != null)
{
qryParam.setId((String)id);
RadioGroupComp rg = (RadioGroupComp)AppUtil.getView("main").getViewComponents().getComponent((String)id);
qryParam.setStatus(rg.getValue());
CheckBoxComp com = (CheckBoxComp)AppUtil.getView("main").getViewComponents().getComponent("hasStateEnd");
if ((com != null) && (("Sended".equals(rg.getValue())) || ("Readed".equals(rg.getValue()))) && ("c001".equals((String)id))) {
qryParam.setHasTakEnd(com.isChecked());
} else {
qryParam.setHasTakEnd(false);
}
}
}
public void clearQuryPlanCach()
{
AppUtil.addAppAttr("plugin_querypara", null);
}
}