Index: lams_admin/src/java/org/lamsfoundation/lams/admin/service/IImportService.java =================================================================== diff -u -rcaeb2397273f76343a280cfd59c6f46c790f37e8 -rba24244d8d8029b2673232988f58c6a97672e17e --- lams_admin/src/java/org/lamsfoundation/lams/admin/service/IImportService.java (.../IImportService.java) (revision caeb2397273f76343a280cfd59c6f46c790f37e8) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/service/IImportService.java (.../IImportService.java) (revision ba24244d8d8029b2673232988f58c6a97672e17e) @@ -40,7 +40,6 @@ public static final String SEPARATOR = "|"; public static final String IMPORT_HELP_PAGE = "Import+Users"; - public static final String IMPORTV1_HELP_PAGE = "Import+LAMS+1+Users"; public static final String IMPORT_GROUPS_HELP_PAGE = "Import+Groups"; public static final String STATUS_IMPORT_TOTAL = "importTotal"; public static final String STATUS_IMPORTED = "imported"; @@ -81,14 +80,6 @@ public List parseGroupSpreadsheet(FormFile fileItem) throws IOException; /** - * Returns list of V1 users and orgs after parsing the output of a mysql dump. - * @param fileItem - * @return - * @throws IOException - */ - public List parseV1UsersFile(FormFile fileItem, boolean includeIntegrated) throws IOException; - - /** * Returns number of rows found in spreadsheet. * @param fileItem * @return Index: lams_admin/src/java/org/lamsfoundation/lams/admin/service/ImportService.java =================================================================== diff -u -rd64f99e274c89f686642247169f37e3b0c731aaa -rba24244d8d8029b2673232988f58c6a97672e17e --- lams_admin/src/java/org/lamsfoundation/lams/admin/service/ImportService.java (.../ImportService.java) (revision d64f99e274c89f686642247169f37e3b0c731aaa) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/service/ImportService.java (.../ImportService.java) (revision ba24244d8d8029b2673232988f58c6a97672e17e) @@ -43,9 +43,6 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.struts.upload.FormFile; import org.lamsfoundation.lams.admin.AdminConstants; -import org.lamsfoundation.lams.admin.web.dto.V1OrgRightDTO; -import org.lamsfoundation.lams.admin.web.dto.V1OrganisationDTO; -import org.lamsfoundation.lams.admin.web.dto.V1UserDTO; import org.lamsfoundation.lams.themes.Theme; import org.lamsfoundation.lams.usermanagement.AuthenticationMethod; import org.lamsfoundation.lams.usermanagement.Organisation; @@ -281,125 +278,6 @@ return (hasError ? null : org); } - - public List parseV1UsersFile(FormFile fileItem, boolean includeIntegrated) throws IOException { - ArrayList users = new ArrayList(); - ArrayList orgs = new ArrayList(); - ArrayList results = new ArrayList(); - ArrayList integPrefixes = new ArrayList(); - ArrayList integOrgid = new ArrayList(); - BufferedReader reader = new BufferedReader(new InputStreamReader(fileItem.getInputStream())); - - // get username prefixes, for integrations on the lams 1 server - String line = reader.readLine(); - while (!line.startsWith("login\tpassword")) { - if (!line.startsWith("prefix")) { - String[] lineArray = line.split("\t"); - if (lineArray.length > 0) { - integPrefixes.add(lineArray[0]); - } - if (lineArray.length > 1) { - integOrgid.add(lineArray[1]); - } - } - line = reader.readLine(); - } - - // get user details - // login, password, fname, lname, email - line = reader.readLine(); // skip line containing column headings - while (!line.startsWith("sid\tname")) { - String[] userDetails = line.split("\t"); - line = reader.readLine(); - if (!includeIntegrated && isIntegratedUser(integPrefixes, userDetails[0])) { - continue; - } - V1UserDTO userDTO = new V1UserDTO( - userDetails[0], userDetails[1], userDetails[2], userDetails[3]); - if (userDetails.length > 4 && !StringUtils.equals(userDetails[4], "NULL")) { - userDTO.setEmail(userDetails[4]); - } - users.add(userDTO); - } - - // get organisations - // sid, name, description, account_organisation - line = reader.readLine(); - while (!line.startsWith("login\tg")) { - String[] orgDetails = line.split("\t"); - line = reader.readLine(); - if (orgDetails.length != 4) { - log.debug("LAMS 1 text file has troublesome organisation: "); - for (int i=0; i currentRoles = new ArrayList(); - String currentLogin = ""; - while (!line.startsWith("login\tsid")) { - String[] userRole = line.split("\t"); - line = reader.readLine(); - if (!includeIntegrated && isIntegratedUser(integPrefixes, userRole[0])) { - continue; - } - if (!StringUtils.equals(userRole[0], currentLogin)) { - if (!currentRoles.isEmpty()) { - int index = users.indexOf(new V1UserDTO(currentLogin)); - V1UserDTO userDTO = users.get(index); - userDTO.setRoleIds(new ArrayList(currentRoles)); - users.set(index, userDTO); - } - currentLogin = userRole[0]; - currentRoles.clear(); - } - currentRoles.add(userRole[1]); - } - int index = users.indexOf(new V1UserDTO(currentLogin)); - V1UserDTO userDTO = users.get(index); - userDTO.setRoleIds(new ArrayList(currentRoles)); - users.set(index, userDTO); - - // get user rights - // login, org id, right id - line = reader.readLine(); - while (line!=null) { - String[] userRight = line.split("\t"); - line = reader.readLine(); - if (!includeIntegrated && isIntegratedUser(integPrefixes, userRight[0])) { - continue; - } - V1OrgRightDTO orgRightDTO = new V1OrgRightDTO(userRight[1], userRight[2]); - index = users.indexOf(new V1UserDTO(userRight[0])); - userDTO = users.get(index); - List orgRights = userDTO.getOrgRights(); - if (orgRights==null) { - orgRights = new ArrayList(); - } - orgRights.add(orgRightDTO); - userDTO.setOrgRights(orgRights); - users.set(index, userDTO); - } - - results.add(users); - results.add(orgs); - - return results; - } - private boolean isIntegratedUser(List integPrefixes, String login) { int underscore = login.indexOf('_'); if (underscore >= 0) {