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