@NotNull private static String getLinkedExternalProjectPath(@NotNull Collection<ExternalTaskPojo> tasks) throws IllegalArgumentException { if (tasks.isEmpty()) { throw new IllegalArgumentException( "Can't execute external tasks. Reason: given tasks list is empty"); } String result = null; for (ExternalTaskPojo task : tasks) { String path = task.getLinkedExternalProjectPath(); if (result == null) { result = path; } else if (!result.equals(path)) { throw new IllegalArgumentException( String.format( "Can't execute given external system tasks. Reason: expected that all of them belong to the same external project " + "but they are not (at least two different projects detected - '%s' and '%s'). Tasks: %s", result, task.getLinkedExternalProjectPath(), tasks)); } } assert result != null; return result; }
@Override public ExternalTaskPojo fun(DataNode<TaskData> node) { return ExternalTaskPojo.from(node.getData()); }