PageRenderTime 63ms CodeModel.GetById 3ms app.highlight 50ms RepoModel.GetById 2ms app.codeStats 0ms

/src/main/java/com/sogou/qadev/service/cynthia/service/impl/DataAccessSessionMemory.java

https://github.com/desktopqa/Cynthia
Java | 1650 lines | 607 code | 133 blank | 910 comment | 21 complexity | 4dda5b203d7f89c65ac1493f61659cd4 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1package com.sogou.qadev.service.cynthia.service.impl;
   2
   3import java.sql.Timestamp;
   4import java.util.ArrayList;
   5import java.util.List;
   6import java.util.Map;
   7import java.util.Set;
   8
   9import org.w3c.dom.Document;
  10import org.w3c.dom.Node;
  11
  12import com.sogou.qadev.service.cynthia.bean.Attachment;
  13import com.sogou.qadev.service.cynthia.bean.ChangeLog;
  14import com.sogou.qadev.service.cynthia.bean.Data;
  15import com.sogou.qadev.service.cynthia.bean.DataAccessAction;
  16import com.sogou.qadev.service.cynthia.bean.Filter;
  17import com.sogou.qadev.service.cynthia.bean.GuideBean;
  18import com.sogou.qadev.service.cynthia.bean.JSTree;
  19import com.sogou.qadev.service.cynthia.bean.Script;
  20import com.sogou.qadev.service.cynthia.bean.TagBean;
  21import com.sogou.qadev.service.cynthia.bean.Template;
  22import com.sogou.qadev.service.cynthia.bean.Timer;
  23import com.sogou.qadev.service.cynthia.bean.TimerAction;
  24import com.sogou.qadev.service.cynthia.bean.UUID;
  25import com.sogou.qadev.service.cynthia.bean.UserInfo;
  26import com.sogou.qadev.service.cynthia.bean.UserInfo.UserRole;
  27import com.sogou.qadev.service.cynthia.bean.impl.UserInfoImpl;
  28import com.sogou.qadev.service.cynthia.dao.AttachmentAccessSessionMySQL;
  29import com.sogou.qadev.service.cynthia.dao.BackRightAccessSessionMySQL;
  30import com.sogou.qadev.service.cynthia.dao.DataAccessSessionMySQL;
  31import com.sogou.qadev.service.cynthia.dao.DefaultValueAccessSessionMySQL;
  32import com.sogou.qadev.service.cynthia.dao.EventUserAccessSessionMySQL;
  33import com.sogou.qadev.service.cynthia.dao.FieldNameAccessSessionMySQL;
  34import com.sogou.qadev.service.cynthia.dao.FilterAccessSessionMySQL;
  35import com.sogou.qadev.service.cynthia.dao.FlowAccessSessionMySQL;
  36import com.sogou.qadev.service.cynthia.dao.GuideAccessSessionMySQL;
  37import com.sogou.qadev.service.cynthia.dao.HomeFilterAccessSessionMySQL;
  38import com.sogou.qadev.service.cynthia.dao.JSTreeAccessSessionMySQL;
  39import com.sogou.qadev.service.cynthia.dao.LogAccessSessionMySQL;
  40import com.sogou.qadev.service.cynthia.dao.NewDataNotifyAccessSessionMySQL;
  41import com.sogou.qadev.service.cynthia.dao.ScriptAccessSessionMySQL;
  42import com.sogou.qadev.service.cynthia.dao.TagAccessSessionMySQL;
  43import com.sogou.qadev.service.cynthia.dao.TimerAccessSessionMySQL;
  44import com.sogou.qadev.service.cynthia.dao.TimerActionAccessSessionMySQL;
  45import com.sogou.qadev.service.cynthia.dao.UserDefaultTemplateMySQL;
  46import com.sogou.qadev.service.cynthia.dao.UserInfoAccessSessionMySQL;
  47import com.sogou.qadev.service.cynthia.factory.DataAccessFactory;
  48import com.sogou.qadev.service.cynthia.factory.ScriptAccessFactory;
  49import com.sogou.qadev.service.cynthia.service.ConfigManager;
  50import com.sogou.qadev.service.cynthia.service.DataFilter;
  51import com.sogou.qadev.service.cynthia.service.ProjectInvolveManager;
  52import com.sogou.qadev.service.cynthia.service.ScriptAccessSession;
  53import com.sogou.qadev.service.cynthia.util.ConfigUtil;
  54import com.sogou.qadev.service.cynthia.util.CynthiaUtil;
  55import com.sogou.qadev.service.cynthia.util.XMLUtil;
  56
  57public class DataAccessSessionMemory extends AbstractDataAccessSession
  58{
  59	/**
  60	 * <h1> Title:</h1>
  61	 * <p> Description:</p>
  62	 * @date:2014-5-6 
  63	 * @param username
  64	 * @param agent
  65	 * @param keyId
  66	 */
  67	public DataAccessSessionMemory(String username, String agent, long keyId)
  68	{
  69		super(username, agent, keyId);
  70	}
  71
  72	/**
  73	 * (non-Javadoc)
  74	 * <p> Title:getDataFilter</p>
  75	 * @return
  76	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getDataFilter()
  77	 */
  78	public DataFilter getDataFilter()
  79	{
  80		if (dataFilter == null)
  81			dataFilter = new DataFilterMemory(this);
  82
  83		return dataFilter;
  84	}
  85
  86	/**
  87	 * (non-Javadoc)
  88	 * <p> Title:createScriptAccessSession</p>
  89	 * @return
  90	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createScriptAccessSession()
  91	 */
  92	public ScriptAccessSession createScriptAccessSession()
  93	{
  94		return ScriptAccessFactory.getInstance().createScriptAccessSession(username, keyId);
  95	}
  96
  97	/**
  98	 * (non-Javadoc)
  99	 * <p> Title:createAttachment</p>
 100	 * @param name
 101	 * @param data
 102	 * @return
 103	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createAttachment(java.lang.String, byte[])
 104	 */
 105	public Attachment createAttachment(String name, byte[] data)
 106	{
 107		return new AttachmentAccessSessionMySQL().createAttachment(name, username, data);
 108	}
 109	
 110	/**
 111	 * (non-Javadoc)
 112	 * <p> Title:queryAttachment</p>
 113	 * @param id
 114	 * @param needData
 115	 * @return
 116	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAttachment(com.sogou.qadev.service.cynthia.bean.UUID, boolean)
 117	 */
 118	public Attachment queryAttachment(UUID id, boolean needData)
 119	{
 120		Attachment[] attachmentArray = this.queryAttachments(new UUID[]{id}, needData);
 121		if(attachmentArray.length > 0){
 122			return attachmentArray[0];
 123		}
 124		
 125		return null;
 126	}
 127
 128	/**
 129	 * (non-Javadoc)
 130	 * <p> Title:queryAttachments</p>
 131	 * @param ids
 132	 * @param needData
 133	 * @return
 134	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAttachments(com.sogou.qadev.service.cynthia.bean.UUID[], boolean)
 135	 */
 136	public Attachment[] queryAttachments(UUID[] ids, boolean needData)
 137	{
 138		return new AttachmentAccessSessionMySQL().queryAttachments(ids, needData);
 139	}
 140
 141	/**
 142	 * (non-Javadoc)
 143	 * <p> Title:addFilter</p>
 144	 * @param filter
 145	 * @return
 146	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addFilter(com.sogou.qadev.service.cynthia.bean.Filter)
 147	 */
 148	public Filter addFilter(Filter filter)
 149	{
 150		return new FilterAccessSessionMySQL().addFilter(filter);
 151	}
 152
 153	/**
 154	 * (non-Javadoc)
 155	 * <p> Title:queryFilters</p>
 156	 * @param username
 157	 * @return
 158	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFilters(java.lang.String)
 159	 */
 160	public Filter[] queryFilters(String username)
 161	{
 162		return new FilterAccessSessionMySQL().queryFilters(username);
 163	}
 164	
 165	/**
 166	 * (non-Javadoc)
 167	 * <p> Title:queryFilterIdNameMap</p>
 168	 * @param userName
 169	 * @return
 170	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFilterIdNameMap(java.lang.String)
 171	 */
 172	public Map<String,String> queryFilterIdNameMap(String userName)
 173	{
 174		return new FilterAccessSessionMySQL().queryFilterIdAndName(userName);
 175	}
 176	
 177	/**
 178	 * (non-Javadoc)
 179	 * <p> Title:querySysFilters</p>
 180	 * @param username
 181	 * @return
 182	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#querySysFilters(java.lang.String)
 183	 */
 184	public Filter[] querySysFilters(String username)
 185	{
 186		return new FilterAccessSessionMySQL().querySysFilters(username, this);
 187	}
 188	
 189	/**
 190	 * (non-Javadoc)
 191	 * <p> Title:queryFocusFilters</p>
 192	 * @param username
 193	 * @return
 194	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFocusFilters(java.lang.String)
 195	 */
 196	public Filter[] queryFocusFilters(String username)
 197	{
 198		return new FilterAccessSessionMySQL().queryFocusFilters(username, this);
 199	}
 200
 201	/**
 202	 * (non-Javadoc)
 203	 * <p> Title:queryFilter</p>
 204	 * @param filterId
 205	 * @return
 206	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFilter(com.sogou.qadev.service.cynthia.bean.UUID)
 207	 */
 208	public Filter queryFilter(UUID filterId)
 209	{
 210		return new FilterAccessSessionMySQL().queryFilter(filterId);
 211	}
 212
 213	/**
 214	 * (non-Javadoc)
 215	 * <p> Title:queryAllFilters</p>
 216	 * @return
 217	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllFilters()
 218	 */
 219	@Override
 220	public List<Filter> queryAllFilters()
 221	{
 222		return new FilterAccessSessionMySQL().queryAllFilters();
 223	}
 224	
 225	/**
 226	 * (non-Javadoc)
 227	 * <p> Title:removeFilter</p>
 228	 * @param filterId
 229	 * @return
 230	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeFilter(com.sogou.qadev.service.cynthia.bean.UUID)
 231	 */
 232	public ErrorCode removeFilter(UUID filterId)
 233	{
 234		Filter filter = this.queryFilter(filterId);
 235		if(filter == null){
 236			return ErrorCode.success;
 237		}
 238		
 239		return new FilterAccessSessionMySQL().removeFilter(filterId);
 240	}
 241
 242	/**
 243	 * (non-Javadoc)
 244	 * <p> Title:updateFilter</p>
 245	 * @param filter
 246	 * @return
 247	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateFilter(com.sogou.qadev.service.cynthia.bean.Filter)
 248	 */
 249	public ErrorCode updateFilter(Filter filter)
 250	{
 251		Document doc = null;
 252		try {
 253			doc = XMLUtil.string2Document(filter.getXml(), "UTF-8");
 254			if (doc != null) {
 255				String fieldSql = DataFilterMemory.getFilterSql(filter);
 256				
 257				if (fieldSql != null && fieldSql != "") {
 258					try {
 259						doc = XMLUtil.string2Document(filter.getXml(), "UTF-8");
 260						if (doc != null) {
 261							Node queryNode = XMLUtil.getSingleNode(doc, "query");
 262							Node sqlNode = XMLUtil.getSingleNode(queryNode, "sql");
 263							Node envNode = XMLUtil.getSingleNode(queryNode, "env");
 264							
 265							if (sqlNode != null ) {
 266								sqlNode.setTextContent(fieldSql);
 267							}else {
 268								Node sqlElement = doc.createElement("sql");  //将查询语句作为节点放到filter中
 269								sqlElement.setTextContent(fieldSql);
 270								queryNode.insertBefore(sqlElement, envNode);
 271							}
 272							
 273							filter.setXml(XMLUtil.document2String(doc, "UTF-8"));
 274						}
 275					} catch (Exception e) {
 276						e.printStackTrace();
 277					}
 278				}
 279			}
 280		}  catch (Exception e) {
 281			e.printStackTrace();
 282		}
 283		return new FilterAccessSessionMySQL().updateFilter(filter);
 284	}
 285
 286	/**
 287	 * (non-Javadoc)
 288	 * <p> Title:createFilter</p>
 289	 * @param createUser
 290	 * @param createTime
 291	 * @param fatherId
 292	 * @return
 293	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createFilter(java.lang.String, java.sql.Timestamp, com.sogou.qadev.service.cynthia.bean.UUID)
 294	 */
 295	public Filter createFilter(String createUser, Timestamp createTime, UUID fatherId)
 296	{
 297		return new FilterAccessSessionMySQL().createFilter(createUser, createTime, fatherId);
 298	}
 299	
 300	/**
 301	 * (non-Javadoc)
 302	 * <p> Title:queryFlowSvg</p>
 303	 * @param flowId
 304	 * @return
 305	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFlowSvg(com.sogou.qadev.service.cynthia.bean.UUID)
 306	 */
 307	public String queryFlowSvg(UUID flowId)
 308	{
 309		return new FlowAccessSessionMySQL().querySvg(flowId);
 310	}
 311	
 312	/**
 313	 * (non-Javadoc)
 314	 * <p> Title:createTempFilter</p>
 315	 * @param createUser
 316	 * @param createTime
 317	 * @param fatherId
 318	 * @return
 319	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createTempFilter(java.lang.String, java.sql.Timestamp, com.sogou.qadev.service.cynthia.bean.UUID)
 320	 */
 321	public Filter createTempFilter(String createUser, Timestamp createTime, UUID fatherId)
 322	{
 323		return new FilterAccessSessionMySQL().creatTempFilter(createUser, createTime, fatherId);
 324	}
 325	
 326	/**
 327	 * (non-Javadoc)
 328	 * <p> Title:queryUserFocusFilters</p>
 329	 * @param username
 330	 * @return
 331	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryUserFocusFilters(java.lang.String)
 332	 */
 333	public UUID[] queryUserFocusFilters(String username)
 334	{
 335		return new FilterAccessSessionMySQL().queryUserFocusFilters(username);
 336	}
 337
 338	/**
 339	 * (non-Javadoc)
 340	 * <p> Title:removeUserFocusFilter</p>
 341	 * @param username
 342	 * @param filterId
 343	 * @return
 344	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeUserFocusFilter(java.lang.String, com.sogou.qadev.service.cynthia.bean.UUID)
 345	 */
 346	public ErrorCode removeUserFocusFilter(String username, UUID filterId)
 347	{
 348		return new FilterAccessSessionMySQL().removeUserFocusFilter(username, filterId);
 349	}
 350	
 351	/**
 352	 * (non-Javadoc)
 353	 * <p> Title:removeUserFocusFilter</p>
 354	 * @param filterId
 355	 * @return
 356	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeUserFocusFilter(com.sogou.qadev.service.cynthia.bean.UUID)
 357	 */
 358	public ErrorCode removeUserFocusFilter(UUID filterId)
 359	{
 360		return new FilterAccessSessionMySQL().removeUserFocusFilter(filterId);
 361	}
 362	
 363	/**
 364	 * (non-Javadoc)
 365	 * <p> Title:addUserFocusFilter</p>
 366	 * @param username
 367	 * @param filterId
 368	 * @return
 369	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addUserFocusFilter(java.lang.String, com.sogou.qadev.service.cynthia.bean.UUID)
 370	 */
 371	public ErrorCode addUserFocusFilter(String username, UUID filterId)
 372	{
 373		return new FilterAccessSessionMySQL().addUserFocusFilter(username, filterId);
 374	}
 375	
 376	/**
 377	 * (non-Javadoc)
 378	 * <p> Title:removeRelatedUser</p>
 379	 * @param username
 380	 * @return
 381	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeRelatedUser(java.lang.String)
 382	 */
 383	public ErrorCode removeRelatedUser(String username)
 384	{
 385		return new UserInfoAccessSessionMySQL().removeRelatedUser(username);
 386	}
 387	
 388	/**
 389	 * (non-Javadoc)
 390	 * <p> Title:getNewTaskIdsByFilterAndUser</p>
 391	 * @param filterIdArray
 392	 * @param username
 393	 * @return
 394	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getNewTaskIdsByFilterAndUser(com.sogou.qadev.service.cynthia.bean.UUID[], java.lang.String)
 395	 */
 396	public String getNewTaskIdsByFilterAndUser(UUID[] filterIdArray, String username)
 397	{
 398		return new NewDataNotifyAccessSessionMySQL(this).getNewTaskIdsByFilterAndUser(filterIdArray, username);
 399	}
 400	
 401	/**
 402	 * (non-Javadoc)
 403	 * <p> Title:deleteFilterUserTasks</p>
 404	 * @param dataId
 405	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#deleteFilterUserTasks(com.sogou.qadev.service.cynthia.bean.UUID)
 406	 */
 407	public void deleteFilterUserTasks(UUID dataId)
 408	{
 409		new NewDataNotifyAccessSessionMySQL(this).deleteFilterUserTasks(dataId);
 410	}
 411	
 412	/**
 413	 * (non-Javadoc)
 414	 * <p> Title:cleanNewTagByTaskIds</p>
 415	 * @param filterId
 416	 * @param taskIdArray
 417	 * @param username
 418	 * @return
 419	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#cleanNewTagByTaskIds(com.sogou.qadev.service.cynthia.bean.UUID, com.sogou.qadev.service.cynthia.bean.UUID[], java.lang.String)
 420	 */
 421	public String cleanNewTagByTaskIds(UUID filterId, UUID[] taskIdArray, String username)
 422	{
 423		return new NewDataNotifyAccessSessionMySQL(this).cleanNewTagByTaskIds(filterId, taskIdArray, username);
 424	}
 425	
 426	/**
 427	 * (non-Javadoc)
 428	 * <p> Title:createTimer</p>
 429	 * @param createUser
 430	 * @return
 431	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createTimer(java.lang.String)
 432	 */
 433	public Timer createTimer(String createUser)
 434	{
 435		return new TimerAccessSessionMySQL().createTimer(createUser);
 436	}
 437	
 438	/**
 439	 * (non-Javadoc)
 440	 * <p> Title:addTimer</p>
 441	 * @param timer
 442	 * @return
 443	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addTimer(com.sogou.qadev.service.cynthia.bean.Timer)
 444	 */
 445	public ErrorCode addTimer(Timer timer)
 446	{
 447		return new TimerAccessSessionMySQL().addTimer(timer);
 448	}
 449	
 450	/**
 451	 * (non-Javadoc)
 452	 * <p> Title:removeTimer</p>
 453	 * @param timerId
 454	 * @return
 455	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeTimer(com.sogou.qadev.service.cynthia.bean.UUID)
 456	 */
 457	public ErrorCode removeTimer(UUID timerId)
 458	{
 459		return new TimerAccessSessionMySQL().removeTimer(timerId);
 460	}
 461	
 462	/**
 463	 * (non-Javadoc)
 464	 * <p> Title:modifyTimer</p>
 465	 * @param timer
 466	 * @return
 467	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#modifyTimer(com.sogou.qadev.service.cynthia.bean.Timer)
 468	 */
 469	public ErrorCode modifyTimer(Timer timer)
 470	{
 471		return new TimerAccessSessionMySQL().modifyTimer(timer);
 472	}
 473	
 474	/**
 475	 * (non-Javadoc)
 476	 * <p> Title:queryTimer</p>
 477	 * @param timerId
 478	 * @return
 479	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimer(com.sogou.qadev.service.cynthia.bean.UUID)
 480	 */
 481	public Timer queryTimer(UUID timerId)
 482	{
 483		return new TimerAccessSessionMySQL().queryTimer(timerId);
 484	}
 485	
 486	/**
 487	 * (non-Javadoc)
 488	 * <p> Title:queryTimers</p>
 489	 * @param createUser
 490	 * @return
 491	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimers(java.lang.String)
 492	 */
 493	public Timer[] queryTimers(String createUser)
 494	{
 495		return new TimerAccessSessionMySQL().queryTimers(createUser);
 496	}
 497	
 498	/**
 499	 * (non-Javadoc)
 500	 * <p> Title:queryTimers</p>
 501	 * @return
 502	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimers()
 503	 */
 504	public Timer[] queryTimers()
 505	{
 506		return new TimerAccessSessionMySQL().queryTimers();
 507	}
 508	
 509	/**
 510	 * (non-Javadoc)
 511	 * <p> Title:queryTimersByActionId</p>
 512	 * @param timerActionId
 513	 * @return
 514	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimersByActionId(com.sogou.qadev.service.cynthia.bean.UUID)
 515	 */
 516	public Timer[] queryTimersByActionId(UUID timerActionId)
 517	{
 518		return new TimerAccessSessionMySQL().queryTimersByActionId(timerActionId);
 519	}
 520	
 521	/**
 522	 * (non-Javadoc)
 523	 * <p> Title:createTimerAction</p>
 524	 * @return
 525	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createTimerAction()
 526	 */
 527	public TimerAction createTimerAction()
 528	{
 529		return new TimerActionAccessSessionMySQL().createTimerAction();
 530	}
 531	
 532	/**
 533	 * (non-Javadoc)
 534	 * <p> Title:addTimerAction</p>
 535	 * @param timerAction
 536	 * @return
 537	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addTimerAction(com.sogou.qadev.service.cynthia.bean.TimerAction)
 538	 */
 539	public ErrorCode addTimerAction(TimerAction timerAction)
 540	{
 541		return new TimerActionAccessSessionMySQL().addTimerAction(timerAction);
 542	}
 543	
 544	/**
 545	 * (non-Javadoc)
 546	 * <p> Title:removeTimerAction</p>
 547	 * @param timerActionId
 548	 * @return
 549	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeTimerAction(com.sogou.qadev.service.cynthia.bean.UUID)
 550	 */
 551	public ErrorCode removeTimerAction(UUID timerActionId)
 552	{
 553		return new TimerActionAccessSessionMySQL().removeTimerAction(timerActionId);
 554	}
 555	
 556	/**
 557	 * (non-Javadoc)
 558	 * <p> Title:modifyTimerAction</p>
 559	 * @param timerAction
 560	 * @return
 561	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#modifyTimerAction(com.sogou.qadev.service.cynthia.bean.TimerAction)
 562	 */
 563	public ErrorCode modifyTimerAction(TimerAction timerAction)
 564	{
 565		return new TimerActionAccessSessionMySQL().modifyTimerAction(timerAction);
 566	}
 567	
 568	/**
 569	 * (non-Javadoc)
 570	 * <p> Title:queryTimerAction</p>
 571	 * @param timerActionId
 572	 * @return
 573	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimerAction(com.sogou.qadev.service.cynthia.bean.UUID)
 574	 */
 575	public TimerAction queryTimerAction(UUID timerActionId)
 576	{
 577		return new TimerActionAccessSessionMySQL().queryTimerAction(timerActionId);
 578	}
 579	
 580	/**
 581	 * (non-Javadoc)
 582	 * <p> Title:queryTimerActions</p>
 583	 * @return
 584	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimerActions()
 585	 */
 586	public TimerAction[] queryTimerActions()
 587	{
 588		return new TimerActionAccessSessionMySQL().queryTimerActions();
 589	}
 590	
 591	/**
 592	 * (non-Javadoc)
 593	 * <p> Title:isDataExist</p>
 594	 * @param dataId
 595	 * @return
 596	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#isDataExist(com.sogou.qadev.service.cynthia.bean.UUID)
 597	 */
 598	@Override
 599	public boolean isDataExist(UUID dataId) {
 600		return new DataAccessSessionMySQL().isExist(dataId);
 601	}
 602
 603	/**
 604	 * (non-Javadoc)
 605	 * <p> Title:queryFocusUsersByFilter</p>
 606	 * @param filterId
 607	 * @return
 608	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFocusUsersByFilter(com.sogou.qadev.service.cynthia.bean.UUID)
 609	 */
 610	@Override
 611	public List<String> queryFocusUsersByFilter(UUID filterId) {
 612		return new FilterAccessSessionMySQL().queryFocusUsersByFilter(filterId);
 613	}
 614	
 615	/**
 616	 * (non-Javadoc)
 617	 * <p> Title:queryChilderNodes</p>
 618	 * @param id
 619	 * @param userName
 620	 * @return
 621	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryChilderNodes(int, java.lang.String)
 622	 */
 623	@Override
 624	public List<JSTree> queryChilderNodes(int id,String userName) {
 625		return new JSTreeAccessSessionMySQL().getNodeChilden(id, userName);
 626	}
 627	
 628	/**
 629	 * (non-Javadoc)
 630	 * <p> Title:queryJSTreeNodeById</p>
 631	 * @param id
 632	 * @return
 633	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryJSTreeNodeById(int)
 634	 */
 635	@Override
 636	public JSTree queryJSTreeNodeById(int id) {
 637		return new JSTreeAccessSessionMySQL().getNodeById(id);
 638	}
 639	
 640	/**
 641	 * (non-Javadoc)
 642	 * <p> Title:addJSTreeNode</p>
 643	 * @param parentId
 644	 * @param position
 645	 * @param title
 646	 * @param userName
 647	 * @return
 648	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addJSTreeNode(int, int, java.lang.String, java.lang.String)
 649	 */
 650	@Override
 651	public int addJSTreeNode(int parentId, int position, String title,String userName) {
 652		return new JSTreeAccessSessionMySQL().addNode(parentId, position, title,userName);
 653	}
 654	
 655	/**
 656	 * (non-Javadoc)
 657	 * <p> Title:removJSTreeNode</p>
 658	 * @param id
 659	 * @param userName
 660	 * @return
 661	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removJSTreeNode(int, java.lang.String)
 662	 */
 663	@Override
 664	public boolean removJSTreeNode(int id,String userName) {
 665		return new JSTreeAccessSessionMySQL().removeNode(id,userName);
 666	}
 667	
 668	/**
 669	 * (non-Javadoc)
 670	 * <p> Title:moveJSTreeNode</p>
 671	 * @param id
 672	 * @param refId
 673	 * @param position
 674	 * @param title
 675	 * @param copy
 676	 * @param userName
 677	 * @return
 678	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#moveJSTreeNode(int, int, int, java.lang.String, boolean, java.lang.String)
 679	 */
 680	@Override
 681	public boolean moveJSTreeNode(int id, int refId, int position,
 682			String title, boolean copy, String userName) {
 683		return new JSTreeAccessSessionMySQL().moveNode(id, refId, position, title, copy,userName);
 684	}
 685	
 686	/**
 687	 * (non-Javadoc)
 688	 * <p> Title:updateJSTreeNode</p>
 689	 * @param id
 690	 * @param title
 691	 * @return
 692	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateJSTreeNode(int, java.lang.String)
 693	 */
 694	@Override
 695	public boolean updateJSTreeNode(int id, String title) {
 696		return new JSTreeAccessSessionMySQL().updateNodeName(id, title);
 697	}
 698	
 699	/**
 700	 * (non-Javadoc)
 701	 * <p> Title:queryTimerByFilterId</p>
 702	 * @param filterId
 703	 * @return
 704	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTimerByFilterId(com.sogou.qadev.service.cynthia.bean.UUID)
 705	 */
 706	@Override
 707	public Timer[] queryTimerByFilterId(UUID filterId) {
 708		return new TimerAccessSessionMySQL().queryTimersByFilterId(filterId);
 709	}
 710	
 711	/**
 712	 * (non-Javadoc)
 713	 * <p> Title:queryAllFolderFilters</p>
 714	 * @param userName
 715	 * @return
 716	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllFolderFilters(java.lang.String)
 717	 */
 718	@Override
 719	public List<String> queryAllFolderFilters(String userName) {
 720		return new JSTreeAccessSessionMySQL().getAllFolderFilters(userName);
 721	}
 722	
 723	/**
 724	 * (non-Javadoc)
 725	 * <p> Title:queryFolderFilters</p>
 726	 * @param nodeId
 727	 * @return
 728	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFolderFilters(int)
 729	 */
 730	@Override
 731	public List<String> queryFolderFilters(int nodeId) {
 732		return new JSTreeAccessSessionMySQL().getFolderFilters(nodeId);
 733	}
 734	
 735	/**
 736	 * (non-Javadoc)
 737	 * <p> Title:moveFilterNode</p>
 738	 * @param filterId
 739	 * @param refId
 740	 * @param parentId
 741	 * @return
 742	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#moveFilterNode(int, int, int)
 743	 */
 744	@Override
 745	public boolean moveFilterNode(int filterId, int refId, int parentId) {
 746		return new JSTreeAccessSessionMySQL().moveFilter(filterId, refId, parentId);
 747	}
 748	
 749	/**
 750	 * (non-Javadoc)
 751	 * <p> Title:queryRootNode</p>
 752	 * @param id
 753	 * @return
 754	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryRootNode(int)
 755	 */
 756	@Override
 757	public List<JSTree> queryRootNode(int id) {
 758		return new JSTreeAccessSessionMySQL().getRootNode(id);
 759	}
 760	
 761	/**
 762	 * (non-Javadoc)
 763	 * <p> Title:removeFilterId</p>
 764	 * @param filterId
 765	 * @param parentId
 766	 * @return
 767	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeFilterId(int, int)
 768	 */
 769	@Override
 770	public boolean removeFilterId(int filterId, int parentId) {
 771		return new JSTreeAccessSessionMySQL().removeFilterId(filterId, parentId);
 772	}
 773	
 774	/**
 775	 * (non-Javadoc)
 776	 * <p> Title:queryFavoriteFilters</p>
 777	 * @param userName
 778	 * @return
 779	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryFavoriteFilters(java.lang.String)
 780	 */
 781	@Override
 782	public String[] queryFavoriteFilters(String userName) {
 783		return new JSTreeAccessSessionMySQL().getFavorateFilters(userName);
 784	}
 785	
 786	/**
 787	 * (non-Javadoc)
 788	 * <p> Title:addFavoriteFilter</p>
 789	 * @param userName
 790	 * @param filterId
 791	 * @return
 792	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addFavoriteFilter(java.lang.String, java.lang.String)
 793	 */
 794	@Override
 795	public boolean addFavoriteFilter(String userName, String filterId) {
 796		return new JSTreeAccessSessionMySQL().addFavoriteFilters(userName, filterId);
 797	}
 798	
 799	/**
 800	 * (non-Javadoc)
 801	 * <p> Title:removeFavoriteFilter</p>
 802	 * @param userName
 803	 * @param filterId
 804	 * @return
 805	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeFavoriteFilter(java.lang.String, java.lang.String)
 806	 */
 807	@Override
 808	public boolean removeFavoriteFilter(String userName, String filterId) {
 809		return new JSTreeAccessSessionMySQL().removeFavoriteFilters(userName, filterId);
 810	}
 811	
 812	/**
 813	 * (non-Javadoc)
 814	 * <p> Title:updataFavoriteFilters</p>
 815	 * @param filterarrays
 816	 * @param userName
 817	 * @return
 818	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updataFavoriteFilters(java.lang.String, java.lang.String)
 819	 */
 820	public boolean updataFavoriteFilters(String filterarrays,String userName){
 821		return new JSTreeAccessSessionMySQL().updateFavoriteFilters(filterarrays,userName);
 822	}
 823	
 824	/**
 825	 * (non-Javadoc)
 826	 * <p> Title:addHomeFilter</p>
 827	 * @param userName
 828	 * @param filterId
 829	 * @return
 830	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addHomeFilter(java.lang.String, java.lang.String)
 831	 */
 832	@Override
 833	public boolean addHomeFilter(String userName, String filterId) {
 834		return new HomeFilterAccessSessionMySQL().addHomeFilter(userName, filterId);
 835	}
 836	
 837	/**
 838	 * (non-Javadoc)
 839	 * <p> Title:queryHomeFilter</p>
 840	 * @param userName
 841	 * @return
 842	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryHomeFilter(java.lang.String)
 843	 */
 844	@Override
 845	public String queryHomeFilter(String userName) {
 846		return new HomeFilterAccessSessionMySQL().getHomeFilter(userName);
 847	}
 848	
 849	/**
 850	 * (non-Javadoc)
 851	 * <p> Title:updateHomeFilter</p>
 852	 * @param userName
 853	 * @param filterId
 854	 * @return
 855	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateHomeFilter(java.lang.String, java.lang.String)
 856	 */
 857	@Override
 858	public boolean updateHomeFilter(String userName, String filterId) {
 859		return new HomeFilterAccessSessionMySQL().updateHomeFilter(userName, filterId);
 860	}
 861	
 862	/**
 863	 * (non-Javadoc)
 864	 * <p> Title:updateFavoritesFilters</p>
 865	 * @param filterId
 866	 * @param position
 867	 * @param userName
 868	 * @return
 869	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateFavoritesFilters(java.lang.String, int, java.lang.String)
 870	 */
 871	@Override
 872	public boolean updateFavoritesFilters(String filterId, int position,
 873			String userName) {
 874		return new JSTreeAccessSessionMySQL().updateFavorites(filterId, position, userName);
 875	}
 876	
 877	/**
 878	 * (non-Javadoc)
 879	 * <p> Title:addFilterToFolder</p>
 880	 * @param fitlerId
 881	 * @param nodeId
 882	 * @return
 883	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addFilterToFolder(java.lang.String, int)
 884	 */
 885	@Override
 886	public boolean addFilterToFolder(String fitlerId, int nodeId) {
 887		return new JSTreeAccessSessionMySQL().addFilterToFolder(fitlerId, nodeId);
 888	}
 889	
 890	/**
 891	 * (non-Javadoc)
 892	 * <p> Title:queryAllScripts</p>
 893	 * @param userName
 894	 * @param keyId
 895	 * @return
 896	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllScripts(java.lang.String, long)
 897	 */
 898	@Override
 899	public List<Script> queryAllScripts(String userName,long keyId) {
 900		return new ScriptAccessSessionMySQL(userName,keyId).queryAllScripts();
 901	}
 902	
 903	/**
 904	 * (non-Javadoc)
 905	 * <p> Title:updateFilterOrders</p>
 906	 * @param folderId
 907	 * @param userName
 908	 * @param newOrders
 909	 * @return
 910	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateFilterOrders(int, java.lang.String, java.lang.String)
 911	 */
 912	@Override
 913	public boolean updateFilterOrders(int folderId, String userName,
 914			String newOrders) {
 915		return new JSTreeAccessSessionMySQL().updateFiltersOrder(folderId, userName, newOrders);
 916	}
 917	
 918	/**
 919	 * (non-Javadoc)
 920	 * <p> Title:queryDefaultFilters</p>
 921	 * @param userName
 922	 * @return
 923	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryDefaultFilters(java.lang.String)
 924	 */
 925	@Override
 926	public List<String> queryDefaultFilters(String userName) {
 927		return  new JSTreeAccessSessionMySQL().getDefaultFilters(userName);
 928	}
 929	
 930	/**
 931	 * (non-Javadoc)
 932	 * <p> Title:updateDefaultFilters</p>
 933	 * @param userName
 934	 * @param filters
 935	 * @return
 936	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateDefaultFilters(java.lang.String, java.lang.String)
 937	 */
 938	@Override
 939	public boolean updateDefaultFilters(String userName, String filters) {
 940		return  new JSTreeAccessSessionMySQL().updateDefaultFilters(userName, filters);
 941	}
 942	
 943	/**
 944	 * (non-Javadoc)
 945	 * <p> Title:addEvent</p>
 946	 * @param eventName
 947	 * @return
 948	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addEvent(java.lang.String)
 949	 */
 950	@Override
 951	public boolean addEvent(String eventName) {
 952		return new EventUserAccessSessionMySQL().addEvent(eventName);
 953	}
 954	
 955	/**
 956	 * (non-Javadoc)
 957	 * <p> Title:addEventUser</p>
 958	 * @param userName
 959	 * @param eventId
 960	 * @return
 961	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addEventUser(java.lang.String, int)
 962	 */
 963	@Override
 964	public boolean addEventUser(String userName, int eventId) {
 965		return new EventUserAccessSessionMySQL().addEventUser(userName, eventId);
 966	}
 967	
 968	/**
 969	 * (non-Javadoc)
 970	 * <p> Title:removeEventUser</p>
 971	 * @param userName
 972	 * @param eventId
 973	 * @return
 974	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeEventUser(java.lang.String, int)
 975	 */
 976	@Override
 977	public boolean removeEventUser(String userName, int eventId) {
 978		return new EventUserAccessSessionMySQL().deleteEventUser(userName, eventId);
 979	}
 980	
 981	/**
 982	 * (non-Javadoc)
 983	 * <p> Title:updateEvent</p>
 984	 * @param eventName
 985	 * @return
 986	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateEvent(java.lang.String)
 987	 */
 988	@Override
 989	public boolean updateEvent(String eventName) {
 990		return new EventUserAccessSessionMySQL().updateEvent(eventName);
 991	}
 992	
 993	/**
 994	 * (non-Javadoc)
 995	 * <p> Title:isValidUser</p>
 996	 * @param userName
 997	 * @param eventId
 998	 * @return
 999	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#isValidUser(java.lang.String, int)
1000	 */
1001	@Override
1002	public boolean isValidUser(String userName, int eventId) {
1003		return new EventUserAccessSessionMySQL().isValidUser(userName, eventId);
1004	}
1005	
1006	/**
1007	 * (non-Javadoc)
1008	 * <p> Title:addScript</p>
1009	 * @param script
1010	 * @return
1011	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addScript(com.sogou.qadev.service.cynthia.bean.Script)
1012	 */
1013	@Override
1014	public UUID addScript(Script script) {
1015		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).addScript(script);
1016	}
1017	
1018	/**
1019	 * (non-Javadoc)
1020	 * <p> Title:queryAllScripts</p>
1021	 * @return
1022	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllScripts()
1023	 */
1024	@Override
1025	public List<Script> queryAllScripts() {
1026		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).queryAllScripts();
1027	}
1028	
1029	/**
1030	 * (non-Javadoc)
1031	 * <p> Title:queryScript</p>
1032	 * @param scriptId
1033	 * @return
1034	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryScript(com.sogou.qadev.service.cynthia.bean.UUID)
1035	 */
1036	@Override
1037	public Script queryScript(UUID scriptId) {
1038		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).queryScript(scriptId);
1039	}
1040	
1041	/**
1042	 * (non-Javadoc)
1043	 * <p> Title:queryScriptNoImport</p>
1044	 * @param scriptId
1045	 * @return
1046	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryScriptNoImport(com.sogou.qadev.service.cynthia.bean.UUID)
1047	 */
1048	public Script queryScriptNoImport(UUID scriptId){
1049		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).queryScriptNoImport(scriptId);
1050	}
1051	
1052	/**
1053	 * (non-Javadoc)
1054	 * <p> Title:removeScript</p>
1055	 * @param scriptId
1056	 * @return
1057	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeScript(com.sogou.qadev.service.cynthia.bean.UUID)
1058	 */
1059	@Override
1060	public ErrorCode removeScript(UUID scriptId) {
1061		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).removeScript(scriptId);
1062	}
1063	
1064	/**
1065	 * (non-Javadoc)
1066	 * <p> Title:updateScript</p>
1067	 * @param script
1068	 * @return
1069	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateScript(com.sogou.qadev.service.cynthia.bean.Script)
1070	 */
1071	@Override
1072	public ErrorCode updateScript(Script script) {
1073		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).updateScript(script);
1074	}
1075	
1076	/**
1077	 * (non-Javadoc)
1078	 * <p> Title:createScript</p>
1079	 * @param createUser
1080	 * @return
1081	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#createScript(java.lang.String)
1082	 */
1083	@Override
1084	public Script createScript(String createUser) {
1085		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).createScript(createUser);
1086	}
1087	
1088	/**
1089	 * (non-Javadoc)
1090	 * <p> Title:queryAllowedTemplateScripts</p>
1091	 * @param templateId
1092	 * @return
1093	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllowedTemplateScripts(com.sogou.qadev.service.cynthia.bean.UUID)
1094	 */
1095	@Override
1096	public Script[] queryAllowedTemplateScripts(UUID templateId) {
1097		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).queryAllowedTemplateScripts(templateId);
1098	}
1099	
1100	/**
1101	 * (non-Javadoc)
1102	 * <p> Title:queryTemplateScripts</p>
1103	 * @param templateId
1104	 * @return
1105	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryTemplateScripts(com.sogou.qadev.service.cynthia.bean.UUID)
1106	 */
1107	@Override
1108	public Script[] queryTemplateScripts(UUID templateId) {
1109		return new ScriptAccessSessionMySQL(ConfigUtil.sysEmail,DataAccessFactory.magic).queryTemplateScripts(templateId);
1110	}
1111	
1112	/**
1113	 * (non-Javadoc)
1114	 * <p> Title:addOrUpdateUserDefaultTemplate</p>
1115	 * @param userName
1116	 * @param templateId
1117	 * @return
1118	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addOrUpdateUserDefaultTemplate(java.lang.String, java.lang.String)
1119	 */
1120	@Override
1121	public boolean addOrUpdateUserDefaultTemplate(String userName,
1122			String templateId) {
1123		return new UserDefaultTemplateMySQL().addOrUpdateUserDefaultTemplate(userName, templateId);
1124	}
1125	
1126	/**
1127	 * (non-Javadoc)
1128	 * <p> Title:getUserDefaultTemplate</p>
1129	 * @param userName
1130	 * @return
1131	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getUserDefaultTemplate(java.lang.String)
1132	 */
1133	@Override
1134	public String getUserDefaultTemplate(String userName) {
1135		return new UserDefaultTemplateMySQL().getDefaultTemplateId(userName);
1136	}
1137	
1138	/**
1139	 * (non-Javadoc)
1140	 * <p> Title:addUserInfo</p>
1141	 * @param userInfo
1142	 * @return
1143	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addUserInfo(com.sogou.qadev.service.cynthia.bean.UserInfo)
1144	 */
1145	@Override
1146	public boolean addUserInfo(UserInfo userInfo) {
1147		return new UserInfoAccessSessionMySQL().addUserInfo(userInfo);
1148	}
1149	
1150	/**
1151	 * (non-Javadoc)
1152	 * <p> Title:isUserExisted</p>
1153	 * @param userName
1154	 * @return
1155	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#isUserExisted(java.lang.String)
1156	 */
1157	@Override
1158	public boolean isUserExisted(String userName) {
1159		return new UserInfoAccessSessionMySQL().isUserExisted(userName);
1160	}
1161	
1162	/**
1163	 * (non-Javadoc)
1164	 * <p> Title:queryUserInfoById</p>
1165	 * @param id
1166	 * @return
1167	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryUserInfoById(int)
1168	 */
1169	@Override
1170	public UserInfo queryUserInfoById(int id) {
1171		return new UserInfoAccessSessionMySQL().queryUserInfoById(id);
1172	}
1173	
1174	/**0
1175	 * (non-Javadoc)
1176	 * <p> Title:queryUserInfoByUserName</p>
1177	 * @param userName
1178	 * @return
1179	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryUserInfoByUserName(java.lang.String)
1180	 */
1181	public UserInfo queryUserInfoByUserName(String userName) {
1182		if (ConfigManager.getEnableSso()) {
1183			return ProjectInvolveManager.getInstance().getUserInfoByMail(userName);
1184		}else {
1185			return new UserInfoAccessSessionMySQL().queryUserInfoByUserName(userName);
1186		}
1187	}
1188	
1189	/**
1190	 * 
1191	 * @description:TODO
1192	 * @date:2014-8-13 下午8:20:54
1193	 * @version:v1.0
1194	 * @param userMails
1195	 * @return
1196	 */
1197	public Map<String, UserInfo> queryUserInfoByUserNames(String[] userMails){
1198		return new UserInfoAccessSessionMySQL().queryUserInfoByUserNames(userMails);
1199	}
1200	
1201	/**
1202	 * (non-Javadoc)
1203	 * <p> Title:removeUserInfo</p>
1204	 * @param userInfo
1205	 * @return
1206	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#removeUserInfo(com.sogou.qadev.service.cynthia.bean.UserInfo)
1207	 */
1208	@Override
1209	public boolean removeUserInfo(UserInfo userInfo) {
1210		return new UserInfoAccessSessionMySQL().removeUserInfo(userInfo);
1211	}
1212	
1213	/**
1214	 * (non-Javadoc)
1215	 * <p> Title:updateUserInfo</p>
1216	 * @param userInfo
1217	 * @return
1218	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateUserInfo(com.sogou.qadev.service.cynthia.bean.UserInfo)
1219	 */
1220	@Override
1221	public boolean updateUserInfo(UserInfo userInfo) {
1222		return new UserInfoAccessSessionMySQL().updateUserInfo(userInfo);
1223	}
1224	
1225	/**
1226	 * (non-Javadoc)
1227	 * <p> Title:getUserClassifyDataMap</p>
1228	 * @param userName
1229	 * @return
1230	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getUserClassifyDataMap(java.lang.String)
1231	 */
1232	@Override
1233	public Map<String, String> getUserClassifyDataMap(String userName) {
1234		return new TagAccessSessionMySQL().getUserTagDataMap(userName);
1235	}
1236	
1237	/**
1238	 * (non-Javadoc)
1239	 * <p> Title:updateSvg</p>
1240	 * @param flowId
1241	 * @param svgCode
1242	 * @return
1243	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateSvg(com.sogou.qadev.service.cynthia.bean.UUID, java.lang.String)
1244	 */
1245	@Override
1246	public boolean updateSvg(UUID flowId, String svgCode) {
1247		return new FlowAccessSessionMySQL().updateSvg(flowId, svgCode);
1248	}
1249	
1250	/**
1251	 * (non-Javadoc)
1252	 * <p> Title:addTag</p>
1253	 * @param userName
1254	 * @param tagName
1255	 * @param tagColor
1256	 * @return
1257	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addTag(java.lang.String, java.lang.String, java.lang.String)
1258	 */
1259	@Override
1260	public int addTag(String userName, String tagName, String tagColor){
1261		return new TagAccessSessionMySQL().addTag(userName, tagName,tagColor);
1262	}
1263	
1264	
1265	/**
1266	 * (non-Javadoc)
1267	 * <p> Title:updateTag</p>
1268	 * @param tagId
1269	 * @param tagName
1270	 * @param tagColor
1271	 * @return
1272	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateTag(java.lang.String, java.lang.String, java.lang.String)
1273	 */
1274	@Override
1275	public boolean updateTag(String tagId, String tagName, String tagColor){
1276		return new TagAccessSessionMySQL().updateTag(tagId, tagName,tagColor);
1277	}
1278	
1279	/**
1280	 * (non-Javadoc)
1281	 * <p> Title:deleteTag</p>
1282	 * @param tagId
1283	 * @return
1284	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#deleteTag(java.lang.String)
1285	 */
1286	@Override
1287	public boolean deleteTag(String tagId){
1288		return new TagAccessSessionMySQL().deleteTag(tagId);
1289	}
1290	
1291	/**
1292	 * (non-Javadoc)
1293	 * <p> Title:getAllTag</p>
1294	 * @param userName
1295	 * @return
1296	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getAllTag(java.lang.String)
1297	 */
1298	@Override
1299	public List<TagBean> getAllTag(String userName){
1300		return new TagAccessSessionMySQL().getAllTag(userName);
1301	}
1302	
1303	/**
1304	 * (non-Javadoc)
1305	 * <p> Title:addTagData</p>
1306	 * @param toTagId
1307	 * @param dataIds
1308	 * @return
1309	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addTagData(java.lang.String, java.lang.String[])
1310	 */
1311	@Override
1312	public boolean addTagData(String toTagId, String[] dataIds){
1313		return new TagAccessSessionMySQL().addTagData(toTagId, dataIds);
1314	}
1315	
1316	/**
1317	 * (non-Javadoc)
1318	 * <p> Title:deleteTagData</p>
1319	 * @param tagId
1320	 * @param dataIds
1321	 * @return
1322	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#deleteTagData(java.lang.String, java.lang.String[])
1323	 */
1324	@Override
1325	public boolean deleteTagData(String tagId, String[] dataIds){
1326		return new TagAccessSessionMySQL().deleteTagData(tagId, dataIds);
1327	}
1328	
1329	/**
1330	 * (non-Javadoc)
1331	 * <p> Title:getTagDataById</p>
1332	 * @param tagId
1333	 * @return
1334	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getTagDataById(java.lang.String)
1335	 */
1336	@Override
1337	public String[] getTagDataById(String tagId){
1338		return new TagAccessSessionMySQL().getTagDataById(tagId);
1339	}
1340	
1341	/**
1342	 * (non-Javadoc)
1343	 * <p> Title:getDataTags</p>
1344	 * @param userName
1345	 * @param dataId
1346	 * @return
1347	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getDataTags(java.lang.String, java.lang.String)
1348	 */
1349	@Override
1350	public List<TagBean> getDataTags(String userName,String dataId){
1351		return new TagAccessSessionMySQL().getDataTags(userName,dataId);
1352	}
1353	
1354	/**
1355	 * (non-Javadoc)
1356	 * <p> Title:setDefaultValues</p>
1357	 * @param userName
1358	 * @param templateId
1359	 * @param defaultValueJson
1360	 * @return
1361	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#setDefaultValues(java.lang.String, java.lang.String, java.lang.String)
1362	 */
1363	@Override
1364	public boolean setDefaultValues(String userName, String templateId, String defaultValueJson){
1365		return new DefaultValueAccessSessionMySQL().setDefaultValues(userName,templateId,defaultValueJson);
1366	}
1367	
1368	/**
1369	 * (non-Javadoc)
1370	 * <p> Title:getDefaultValues</p>
1371	 * @param userName
1372	 * @param templateId
1373	 * @return
1374	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getDefaultValues(java.lang.String, java.lang.String)
1375	 */
1376	@Override
1377	public String getDefaultValues(String userName, String templateId){
1378		return new DefaultValueAccessSessionMySQL().getDefaultValues(userName,templateId);
1379	}
1380	
1381	/**
1382	 * (non-Javadoc)
1383	 * <p> Title:getBackRightUsers</p>
1384	 * @return
1385	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getBackRightUsers()
1386	 */
1387	@Override
1388	public List<UserInfo> getBackRightUsers(){
1389		return new BackRightAccessSessionMySQL().getBackRightUsers();
1390	}
1391	
1392	/**
1393	 * (non-Javadoc)
1394	 * <p> Title:addBackRightUser</p>
1395	 * @param userMail
1396	 * @return
1397	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addBackRightUser(java.lang.String)
1398	 */
1399	@Override
1400	public boolean addBackRightUser(String userMail){
1401		return new BackRightAccessSessionMySQL().addBackRightUser(userMail);
1402	}
1403	
1404	/**
1405	 * (non-Javadoc)
1406	 * <p> Title:delBackRightUser</p>
1407	 * @param userMail
1408	 * @return
1409	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#delBackRightUser(java.lang.String)
1410	 */
1411	@Override
1412	public boolean delBackRightUser(String userMail){
1413		return new BackRightAccessSessionMySQL().delBackRightUser(userMail);
1414	}
1415	
1416	/**
1417	 * (non-Javadoc)
1418	 * <p> Title:getTemplateRightUser</p>
1419	 * @param templateId
1420	 * @return
1421	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getTemplateRightUser(java.lang.String)
1422	 */
1423	@Override
1424	public List<UserInfo> getTemplateRightUser(String templateId){
1425		
1426		if (ConfigManager.getProjectInvolved()) {
1427			List<UserInfo> allUsers = new ArrayList<UserInfo>();
1428			Set<String> users = new BackRightAccessSessionMySQL().getTemplateRightUserMails(templateId);
1429			for (String user : users) {
1430				UserInfo userInfo = new UserInfoImpl();
1431				userInfo.setUserName(user);
1432				userInfo.setNickName(CynthiaUtil.getUserAlias(user));
1433				allUsers.add(userInfo);
1434			}
1435			return allUsers;
1436		}else {
1437			return new BackRightAccessSessionMySQL().getTemplateRightUser(templateId);
1438		}
1439	}
1440	
1441	/**
1442	 * (non-Javadoc)
1443	 * <p> Title:delUserTemplateRight</p>
1444	 * @param templateId
1445	 * @param userMail
1446	 * @return
1447	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#delUserTemplateRight(java.lang.String, java.lang.String)
1448	 */
1449	@Override
1450	public boolean delUserTemplateRight(String templateId, String userMail){
1451		return new BackRightAccessSessionMySQL().delUserTemplateRight(templateId,userMail);
1452	}
1453	
1454	/**
1455	 * (non-Javadoc)
1456	 * <p> Title:addUserTemplateRight</p>
1457	 * @param templateIds
1458	 * @param userMail
1459	 * @return
1460	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addUserTemplateRight(java.lang.String[], java.lang.String)
1461	 */
1462	@Override
1463	public boolean addUserTemplateRight(String[] templateIds, String userMail){
1464		return new BackRightAccessSessionMySQL().addUserTemplateRight(templateIds,userMail);
1465	}
1466	
1467	/**
1468	 * (non-Javadoc)
1469	 * <p> Title:queryUserTemplateRights</p>
1470	 * @param userMail
1471	 * @return
1472	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryUserTemplateRights(java.lang.String)
1473	 */
1474	@Override
1475	public Map<String, String> queryUserTemplateRights(String userMail){
1476		return new BackRightAccessSessionMySQL().queryUserTemplateRights(userMail);
1477	}
1478	
1479	/**
1480	 * (non-Javadoc)
1481	 * <p> Title:setSystemOption</p>
1482	 * @param systemJson
1483	 * @return
1484	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#setSystemOption(java.lang.String)
1485	 */
1486	@Override
1487	public boolean setSystemOption(String systemJson){
1488		return new BackRightAccessSessionMySQL().setSystemOption(systemJson);
1489	}
1490	
1491	/**
1492	 * (non-Javadoc)
1493	 * <p> Title:getSystemOption</p>
1494	 * @param userMail
1495	 * @return
1496	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getSystemOption(java.lang.String)
1497	 */
1498	@Override
1499	public String getSystemOption(String userMail){
1500		return new BackRightAccessSessionMySQL().getSystemOption(userMail);
1501	}
1502	
1503	/**
1504	 * (non-Javadoc)
1505	 * <p> Title:addFieldColName</p>
1506	 * @param templateId
1507	 * @param fieldColName
1508	 * @param fieldId
1509	 * @param fieldType
1510	 * @return
1511	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addFieldColName(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
1512	 */
1513	@Override
1514	public boolean addFieldColName(String templateId,String fieldColName,String fieldId,String fieldType){
1515		return new FieldNameAccessSessionMySQL().addFieldColName(templateId,fieldColName,fieldId,fieldType);
1516	}
1517	
1518	/**
1519	 * (non-Javadoc)
1520	 * <p> Title:queryStatisticByUser</p>
1521	 * @param userName
1522	 * @return
1523	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryStatisticByUser(java.lang.String)
1524	 */
1525	@Override
1526	public TimerAction[] queryStatisticByUser(String userName)
1527	{
1528		return new TimerActionAccessSessionMySQL().queryStatisticByUser(userName);
1529	}
1530	
1531	/**
1532	 * (non-Javadoc)
1533	 * <p> Title:updateDataLog</p>
1534	 * @param dataId
1535	 * @param logIndex
1536	 * @param logContent
1537	 * @return
1538	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateDataLog(com.sogou.qadev.service.cynthia.bean.UUID, int, java.lang.String)
1539	 */
1540	public boolean updateDataLog(UUID dataId, int logIndex, String logContent){
1541		Data data = queryData(dataId);
1542		if (data == null) {
1543			return false;
1544		}
1545		try {
1546			ChangeLog changeLog = data.getChangeLogs()[logIndex-1];
1547			changeLog.setActionComment(logContent);
1548			updateCache(DataAccessAction.update, dataId.getValue(), data);
1549			return new LogAccessSessionMySQL().updateLogComment(dataId, data.getTemplateId(), logIndex, logContent);
1550		} catch (Exception e) {
1551			e.printStackTrace();
1552			return false;
1553		}
1554	}
1555	
1556	/**
1557	 * (non-Javadoc)
1558	 * <p> Title:queryAllUsersByStatAndName</p>
1559	 * @param userStat
1560	 * @param userName
1561	 * @return
1562	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#queryAllUsersByStatAndName(java.lang.String, java.lang.String)
1563	 */
1564	public List<UserInfo> queryAllUsersByStatAndName(String curUser,String userStat,String queryUser){
1565		if (ConfigManager.getProjectInvolved()) {
1566			return ProjectInvolveManager.getInstance().getCompanyUsersByMail(curUser);
1567		}else {
1568			return new UserInfoAccessSessionMySQL().queryAllUsersByStatAndName(userStat,queryUser);
1569		}
1570	}
1571	
1572	/**
1573	 * (non-Javadoc)
1574	 * <p> Title:updateAttachment</p>
1575	 * @param attachment
1576	 * @return
1577	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#updateAttachment(com.sogou.qadev.service.cynthia.bean.Attachment)
1578	 */
1579	public boolean updateAttachment(Attachment attachment){
1580		return new AttachmentAccessSessionMySQL().updateAttachment(attachment);
1581	}
1582	
1583	/**
1584	 * (non-Javadoc)
1585	 * <p> Title:addtemplateUserRight</p>
1586	 * @param templateId
1587	 * @param users
1588	 * @return
1589	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#addtemplateUserRight(java.lang.String, java.lang.String[])
1590	 */
1591	public boolean addtemplateUserRight(String templateId,String[] users){
1592		return new BackRightAccessSessionMySQL().addtemplateUserRight(templateId, users);
1593	}
1594	
1595	/**
1596	 * (non-Javadoc)
1597	 * <p> Title:delTemplateUserRight</p>
1598	 * @param templateId
1599	 * @param user
1600	 * @return
1601	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#delTemplateUserRight(java.lang.String, java.lang.String)
1602	 */
1603	public boolean delTemplateUserRight(String templateId,String user){
1604		return new BackRightAccessSessionMySQL().deltemplateUserRight(templateId, user);
1605	}
1606	
1607	/**
1608	 * (non-Javadoc)
1609	 * <p> Title:getAllGuide</p>
1610	 * @return
1611	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getAllGuide()
1612	 */
1613	public List<GuideBean> queryAllGuide(){
1614		return new GuideAccessSessionMySQL().getAll();
1615	}
1616	
1617	/**
1618	 * (non-Javadoc)
1619	 * <p> Title:getGuideHtmlByGuideId</p>
1620	 * @param guideId
1621	 * @return
1622	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#getGuideHtmlByGuideId(java.lang.String)
1623	 */
1624	public String queryGuideHtmlByGuideId( String guideId){
1625		return new GuideAccessSessionMySQL().getGuideHtmlByGuideId(guideId);
1626	}
1627	
1628	/**
1629	 * (non-Javadoc)
1630	 * <p> Title:setValidDataOfTemplate</p>
1631	 * @param templateId
1632	 * @param isValid
1633	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#setValidDataOfTemplate(UUID, boolean)
1634	 */
1635	public boolean setValidDataOfTemplate(UUID templateId , boolean isValid){
1636		return new DataAccessSessionMySQL().setValidDataOfTemplate(templateId,isValid);
1637	}
1638	
1639	/**
1640	 * (non-Javadoc)
1641	 * <p> Title:saveGuideHtml</p>
1642	 * @param guideId
1643	 * @param guideHtml
1644	 * @return
1645	 * @see com.sogou.qadev.service.cynthia.service.DataAccessSession#saveGuideHtml(java.lang.String, java.lang.String)
1646	 */
1647	public boolean saveGuideHtml(String guideId , String guideHtml){
1648		return new GuideAccessSessionMy

Large files files are truncated, but you can click here to view the full file