use of org.orcid.core.salesforce.model.OrgId in project ORCID-Source by ORCID.
the class SalesForceAdapterTest method testCreateSalesForceRecordFromOrgId.
@Test
public void testCreateSalesForceRecordFromOrgId() {
OrgId contact = new OrgId();
contact.setAccountId("1234");
JSONObject contactJson = salesForceAdapter.createSaleForceRecordFromOrgId(contact);
assertEquals("{\"Organization__c\":\"1234\"}", contactJson.toString());
}
use of org.orcid.core.salesforce.model.OrgId in project ORCID-Source by ORCID.
the class SalesForceManagerImpl method createOrgId.
@Override
public void createOrgId(OrgId orgId) {
String accountId = orgId.getAccountId();
List<OrgId> existingOrgIds = salesForceDao.retrieveOrgIdsByAccountId(accountId);
Optional<OrgId> existingOrgId = existingOrgIds.stream().filter(o -> {
if (orgId.getOrgIdType().equals(o.getOrgIdType()) && orgId.getOrgIdValue().equals(o.getOrgIdValue())) {
return true;
}
return false;
}).findFirst();
if (!existingOrgId.isPresent()) {
salesForceDao.createOrgId(orgId);
}
salesForceContactsCache.remove(accountId);
}
use of org.orcid.core.salesforce.model.OrgId in project ORCID-Source by ORCID.
the class SalesForceAdapterTest method testCreateOrgIdsFromJson.
@Test
public void testCreateOrgIdsFromJson() throws IOException, JSONException {
String inputString = IOUtils.toString(getClass().getResourceAsStream("/org/orcid/core/salesforce/salesforce_org_ids_list.json"));
JSONObject inputObject = new JSONObject(inputString);
List<OrgId> orgIdsList = salesForceAdapter.createOrgIdsFromJson(inputObject);
assertEquals(2, orgIdsList.size());
OrgId orgId = orgIdsList.get(0);
assertEquals("abcd", orgId.getOrgIdValue());
assertEquals("FundRef ID", orgId.getOrgIdType());
assertFalse(orgId.getInactive());
}
use of org.orcid.core.salesforce.model.OrgId in project ORCID-Source by ORCID.
the class SalesForceAdapterTest method testCreateOrgIdFromJson.
@Test
public void testCreateOrgIdFromJson() throws IOException, JSONException {
String inputString = IOUtils.toString(getClass().getResourceAsStream("/org/orcid/core/salesforce/salesforce_org_ids_list.json"));
JSONObject inputObject = new JSONObject(inputString);
JSONArray records = inputObject.getJSONArray("records");
JSONObject record = records.getJSONObject(0);
OrgId orgId = salesForceAdapter.createOrgIdFromJson(record);
assertEquals("abcd", orgId.getOrgIdValue());
assertEquals("FundRef ID", orgId.getOrgIdType());
assertFalse(orgId.getInactive());
}
Aggregations