@Override public Boolean SaveOrUpdateExecuteSetExecutePlan( GWTExecuteSetExecutePlan gwtExecuteSetExecutePlan) { // TODO Auto-generated method stub ExecuteSetExecutePlan old = null; if (!gwtExecuteSetExecutePlan.isNew()) { // 如果不为新增 old = esExecutePlanDAL.Get( Op.EQ( GWTExecuteSetExecutePlan.N_ID, Integer.parseInt(gwtExecuteSetExecutePlan.GetID()))); if (gwtExecuteSetExecutePlan.GetExecutePlanID().equals("-1")) { // 计划任务ID为-1,表示删除原有计划任务 esExecutePlanDAL.Del(old); return true; } } ExecuteSetExecutePlan data = ModelToBean(old, gwtExecuteSetExecutePlan); if (data.getAddUserId().equals("Administrator")) { data.setAddUserId("0"); } if (gwtExecuteSetExecutePlan.isNew()) { data.setAddTime(new Date()); esExecutePlanDAL.Add(data); } else { esExecutePlanDAL.Edit(data); } return true; }
private ExecuteSetExecutePlan ModelToBean( ExecuteSetExecutePlan bean, GWTExecuteSetExecutePlan model) { ExecuteSetExecutePlan plan; if (bean != null) { plan = bean; } else { plan = new ExecuteSetExecutePlan(); if (!model.isNew()) { plan.setId(Integer.parseInt(model.GetID())); } } plan.setAddUserId(model.GetAddUserID()); plan.setExecuteSetDirId(model.GetExecuteSetID()); plan.setExecutePlanId(Integer.parseInt(model.GetExecutePlanID())); plan.setSystemId(model.GetSystemID()); plan.setScheduledRunStatus(Integer.parseInt(model.GetScheduledRunStatus())); return plan; }