From: bsinou Date: Fri, 3 Mar 2017 18:38:36 +0000 (+0100) Subject: Fix bugs in import processes X-Git-Tag: argeo-suite-0.1.5~9 X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=commitdiff_plain;h=361d28871743756fa4f12e4e50edaef8ead8c566 Fix bugs in import processes --- diff --git a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/ImportEntities.java b/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/ImportEntities.java index a267df5..8f679be 100644 --- a/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/ImportEntities.java +++ b/org.argeo.suite.workbench.rap/src/org/argeo/suite/workbench/commands/ImportEntities.java @@ -82,7 +82,8 @@ public class ImportEntities extends AbstractHandler implements PeopleNames { } // TODO make this configurable - private final static String IMPORT_ENCODING = "ISO-8859-1"; + private final static String IMPORT_ENCODING = "ISO-8859-1";//"UTF-8"; + /* DEPENDENCY INJECTION */ private Repository repository; @@ -130,11 +131,9 @@ public class ImportEntities extends AbstractHandler implements PeopleNames { @Override public boolean performFinish() { // Session session = null; - String templateName = resourceTypeCombo.getItem(resourceTypeCombo.getSelectionIndex()); + // String templateName = resourceTypeCombo.getItem(resourceTypeCombo.getSelectionIndex()); // String type = KNOWN_TEMPLATES.get(templateName); - importDefaultOrgFile(file); - return true; } @@ -182,6 +181,7 @@ public class ImportEntities extends AbstractHandler implements PeopleNames { } }); resourceTypeCombo.setItems(KNOWN_TEMPLATES.keySet().toArray(new String[0])); + resourceTypeCombo.select(0); // File upload Label lbl = new Label(composite, SWT.NONE); @@ -345,10 +345,10 @@ public class ImportEntities extends AbstractHandler implements PeopleNames { if (EclipseUiUtils.notEmpty(lastName)) tmpPerson.setProperty(PEOPLE_LAST_NAME, lastName); Node newPersonNode = peopleService.createEntity(targetParent, PeopleTypes.PEOPLE_PERSON, tmpPerson); - if (EclipseUiUtils.notEmpty(position)) - PersonJcrUtils.addJob(newPersonNode, newOrgNode, position, true); + // if (EclipseUiUtils.notEmpty(position)) + PersonJcrUtils.addJob(resourcesService, peopleService, newPersonNode, newOrgNode, position, true); // Save the newly created entity without creating a base version - newOrgNode = peopleService.saveEntity(newOrgNode, false); + newPersonNode = peopleService.saveEntity(newPersonNode, false); } } @@ -467,7 +467,6 @@ public class ImportEntities extends AbstractHandler implements PeopleNames { String contactsStr = getStringValue(sheet, contactsIndex, i); if (notEmpty(contactsStr)) importOrgEmployees(tmpParent, targetParent, newOrgNode, contactsStr); - } } catch (PeopleException | RepositoryException e) { throw new SuiteException("Cannot import mapping file, error at line: " + (i + 1), e);