private MultiMap<String, Object, ? extends List> createMultiMap(Map<String, Object> params) { MultiMap<String, Object, ? extends List> result = MultiMaps.createListMultiMap(); for (Map.Entry<String, Object> entry : params.entrySet()) { result.putSingle(entry.getKey(), entry.getValue()); } return result; }
@Override public List<IssueService.IssueResult> travel( User user, Issue issue, Status to, List<IssueService.TransitionValidationResult> errorResults) { return travel(user, issue, to, MultiMaps.<String, Object>createListMultiMap(), errorResults); }
@Override public List<IssueService.IssueResult> travel( User user, Issue issue, Status to, MultiMap<String, Object, ? extends List> params, final List<IssueService.TransitionValidationResult> errorResults) { if (user == null) throw new IllegalArgumentException("user is null, gimme some body"); if (issue == null) throw new IllegalArgumentException("issue is null"); log.debug("issue : " + issue.getKey()); if (to == null) throw new IllegalArgumentException("to status is null"); if (params == null) params = MultiMaps.createListMultiMap(); if (checkForNullValues(params)) throw new IllegalArgumentException("I do not accept null values in param map"); if (to.equals(issue.getStatusObject())) { log.error("to and from are equals"); throw new IllegalArgumentException("to and from are equals"); } log.debug( "travel start... args : " + user.getName() + " to : " + to.getName() + "; issue : " + issue.getKey() + " params length : " + params.size()); Set<Status> availableWorkflowStatuses = getAllAvailableWorkflowStatuses(issue); if (!availableWorkflowStatuses.contains(to)) throw new IllegalArgumentException( "passed status : " + to.getName() + " does not exist in available statuses here or even not exist in issue workflow"); List<IssueService.IssueResult> validResults = simpleTravel(user, issue, to, params, errorResults); // TODO:add not simple travel return validResults; }