@Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { Map<String, Object> result = new HashMap<String, Object>(); Map<String, String> templateArgs = req.getServiceMatch().getTemplateVars(); String placeShortName = templateArgs.get("placeShortName"); Site placeToMigrate = null; try { placeToMigrate = bulkImportSiteService.getSite(placeShortName); } catch (URISyntaxException e) { throw new WebScriptException( Status.STATUS_NOT_FOUND, "Failed to find site with shortName " + placeShortName, e); } catch (InvalidPropertiesFormatException e) { throw new WebScriptException( Status.STATUS_BAD_REQUEST, "Unable to parse properties for site " + placeShortName, e); } catch (IOException e) { throw new WebScriptException( Status.STATUS_BAD_REQUEST, "Unable to read properties file for site " + placeShortName, e); } try { bulkImportSiteService.importSite(placeToMigrate); } catch (Exception e) { throw new WebScriptException( Status.STATUS_INTERNAL_SERVER_ERROR, "Failed to import place namned " + placeShortName + " into Alfresco", e); } return result; }
@Override protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache) { Map<String, Object> result = new HashMap<String, Object>(); result.put("inProgress", true); // Default to in progress to avoid running // on failure BulkImportStatus status2 = bulkImportSiteService.getStatus(); boolean inProgress = status2.inProgress(); result.put("inProgress", inProgress); result.put("status", status2); return result; }