@Override public SearchResultWrapper<Test> getAvailableTests() { TestSearchTO search = new TestSearchTO(); search.setGroupFilter(GroupFilter.MY_GROUPS); List<String> groups = userService.getLoggedUserGroupNames(); return testDAO.searchTests(search, groups); }
@Override public List<String> getTestsByPrefix(String prefix) { List<Test> tests = testDAO.findByUIDPrefix(prefix); List<String> testuids = new ArrayList<String>(); for (Test test : tests) { if (userService.isLoggedUserInGroup(test.getGroupId())) { testuids.add(test.getUid()); } } return testuids; }
@Override public Test createTest(Test test) throws ServiceException { if (!userService.isLoggedUserInGroup(test.getGroupId())) { throw new org.perfrepo.web.security.SecurityException( "securityException.userNotInGroup.createTest", userService.getLoggedUser().getUsername(), test.getGroupId()); } if (testDAO.findByUid(test.getUid()) != null) { throw new ServiceException("serviceException.testUidExists", test.getUid()); } Test createdTest = testDAO.create(test); // store metrics if (test.getMetrics() != null) { for (Metric metric : test.getMetrics()) { addMetric(test, metric); } } return createdTest; }
@Override public SearchResultWrapper<TestExecution> searchTestExecutions(TestExecutionSearchTO search) { // remove param criteria with empty param name if (search.getParameters() != null) { for (Iterator<ParamCriteria> allParams = search.getParameters().iterator(); allParams.hasNext(); ) { ParamCriteria param = allParams.next(); if (param.isNameEmpty()) { allParams.remove(); } } } return testExecutionDAO.searchTestExecutions(search, userService.getLoggedUserGroupNames()); }
@Override public SearchResultWrapper<Test> searchTest(TestSearchTO search) { return testDAO.searchTests(search, userService.getLoggedUserGroupNames()); }