PageRenderTime 59ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

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

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