import javax.jcr.Session;
import org.apache.commons.io.IOUtils;
+import org.argeo.connect.ConnectConstants;
import org.argeo.connect.ConnectNames;
import org.argeo.connect.resources.ResourcesNames;
import org.argeo.connect.resources.ResourcesService;
}
// TODO make this configurable
- private final static String IMPORT_ENCODING = "ISO-8859-1";//"UTF-8";
-
+ private final static String IMPORT_ENCODING = "ISO-8859-1";// "UTF-8";
/* DEPENDENCY INJECTION */
private Repository repository;
@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;
userInputPage.setErrorMessage("Please choose an entity type");
return false;
} else if (file == null) {
- userInputPage.setErrorMessage("Please upload a file1");
+ userInputPage.setErrorMessage("Please upload a file");
return false;
} else {
userInputPage.setErrorMessage(null);
tmpPerson.setProperty(PEOPLE_FIRST_NAME, firstName);
if (EclipseUiUtils.notEmpty(lastName))
tmpPerson.setProperty(PEOPLE_LAST_NAME, lastName);
- Node newPersonNode = peopleService.createEntity(targetParent, PeopleTypes.PEOPLE_PERSON, tmpPerson);
+ Node newPersonNode = peopleService.publishEntity(targetParent, PeopleTypes.PEOPLE_PERSON, tmpPerson);
// if (EclipseUiUtils.notEmpty(position))
PersonJcrUtils.addJob(resourcesService, peopleService, newPersonNode, newOrgNode, position, true);
// Save the newly created entity without creating a base version
line = line.trim();
if (line.startsWith("https://www.facebook.com")) {
- PeopleJcrUtils.createSocialMedia(peopleService, resourcesService, contactable, line,
- !hasPrimaryFacebook, null, ContactValueCatalogs.CONTACT_CAT_FACEBOOK, null);
+ PeopleJcrUtils.createSocialMedia(resourcesService, peopleService, contactable, line,
+ !hasPrimaryFacebook, ContactValueCatalogs.CONTACT_CAT_FACEBOOK, null);
hasPrimaryFacebook = true;
} else {
- PeopleJcrUtils.createWebsite(peopleService, resourcesService, contactable, line, !hasPrimary, null,
- null);
+ PeopleJcrUtils.createWebsite(resourcesService, peopleService, contactable, line, !hasPrimary, null);
hasPrimary = true;
}
}
if (EclipseUiUtils.isEmpty(line))
continue loop;
line = line.trim();
- PeopleJcrUtils.createEmail(peopleService, resourcesService, contactable, line, !hasPrimary, null, null,
- null);
+ PeopleJcrUtils.createEmail(resourcesService, peopleService, contactable, line, !hasPrimary, null, null);
hasPrimary = true;
}
}
String stStr = getStringValue(sheet, stIndex, i);
String cStr = getStringValue(sheet, cIndex, i);
if (notEmpty(streetStr) || notEmpty(pcStr) || notEmpty(lStr) || notEmpty(stStr) || notEmpty(cStr))
- PeopleJcrUtils.createAddress(peopleService, resourcesService, tmpOrg, streetStr, null, pcStr, lStr,
- stStr, cStr, true, null, ContactValueCatalogs.CONTACT_CAT_MAIN, null);
+ PeopleJcrUtils.createAddress(resourcesService, peopleService, tmpOrg, streetStr, null, pcStr, lStr,
+ stStr, cStr, true, ContactValueCatalogs.CONTACT_CAT_MAIN, null);
String mobileStr = getStringValue(sheet, mobileIndex, i);
if (notEmpty(mobileStr))
- PeopleJcrUtils.createPhone(peopleService, resourcesService, tmpOrg, mobileStr, true, null,
- ContactValueCatalogs.CONTACT_CAT_MOBILE, null);
+ PeopleJcrUtils.createPhone(resourcesService, peopleService, tmpOrg, mobileStr, true, null, null);
String phoneStr = getStringValue(sheet, telephoneNumberIndex, i);
if (notEmpty(phoneStr))
- PeopleJcrUtils.createPhone(peopleService, resourcesService, tmpOrg, phoneStr, true, null,
+ PeopleJcrUtils.createPhone(resourcesService, peopleService, tmpOrg, phoneStr, true,
ContactValueCatalogs.CONTACT_CAT_DIRECT, null);
String descStr = getStringValue(sheet, descriptionIndex, i);
if (notEmpty(descStr))
if (notEmpty(tagsStr))
tmpOrg.setProperty(ResourcesNames.CONNECT_TAGS, ConnectJcrUtils.parseAndClean(tagsStr, ",", true));
- Node newOrgNode = peopleService.createEntity(targetParent, PeopleTypes.PEOPLE_ORG, tmpOrg);
+ Node newOrgNode = peopleService.publishEntity(targetParent, PeopleTypes.PEOPLE_ORG, tmpOrg);
// Save the newly created entity without creating a base version
newOrgNode = peopleService.saveEntity(newOrgNode, false);
if (notEmpty(contactsStr))
importOrgEmployees(tmpParent, targetParent, newOrgNode, contactsStr);
}
+
+ // Refresh tags and mailing list
+ Node tagParent = resourcesService.getTagLikeResourceParent(session, ConnectConstants.RESOURCE_TAG);
+ resourcesService.refreshKnownTags(tagParent);
+
+ // Create Mailing lists
+ Node mlParent = resourcesService.getTagLikeResourceParent(session, PeopleTypes.PEOPLE_MAILING_LIST);
+ resourcesService.refreshKnownTags(mlParent);
+
} catch (PeopleException | RepositoryException e) {
throw new SuiteException("Cannot import mapping file, error at line: " + (i + 1), e);
} finally {