HttpServletResponse response) {
Command command = (Command) request.getAttribute("command");
User user = (User) request.getSession().getAttribute("user");
ArrayList<String> errors = new ArrayList<String>();
ArrayList<VociBusinessObject> problems = new ArrayList<VociBusinessObject>();
ImportManager iman = new ImportManager();
// always get the list of importers for display to users
String importers;
if ((importers = Configuration.getString("vociImporters")) != null) {
String[] importerArray = importers.split(",");
ArrayList<Importer> importerCollection = new ArrayList<Importer>();
String arrayElement;
for (int m = 0; m < importerArray.length; m++) {
arrayElement = importerArray[m].trim();
if (arrayElement.length() > 0) {
Importer importer = iman.getImporter(arrayElement, errors);
importerCollection.add(importer);
}
}
if (importerCollection.size() > 0) {
request.setAttribute("vociImporters", importerCollection);
}
}
// ...then handle user interaction
String query;
if ((command.getModifier() != null)
&& (command.getModifier().equals("query"))
&& ((query = request.getParameter("query")) != null)
&& ((query = query.trim()).length() > 0)) {
Logger.debug("Import query started: " + query + " for type "
+ request.getParameter("ctype"));
// successfulImportCount will get updated if some are done
request.setAttribute("successfulImportCount", 0);
request.setAttribute("successfulImportCount", iman.performImport(
user, request.getParameter("importer"), query, request
.getParameter("ctype"), command.getProject(),
errors, problems));
if ((problems == null) || (problems.size() == 0)) {