use of org.orcid.core.salesforce.model.Integration in project ORCID-Source by ORCID.
the class SalesForceAdapter method createIntegrationFromSalesForceRecord.
private Integration createIntegrationFromSalesForceRecord(JSONObject integrationRecord) throws JSONException {
Integration integration = new Integration();
String name = extractString(integrationRecord, "Name");
integration.setName(name);
integration.setDescription(extractString(integrationRecord, "Description__c"));
integration.setStage(extractString(integrationRecord, "Integration_Stage__c"));
try {
integration.setResourceUrl(extractURL(integrationRecord, "Integration_URL__c"));
} catch (MalformedURLException e) {
LOGGER.info("Malformed resource URL for member: {}", name, e);
}
return integration;
}
use of org.orcid.core.salesforce.model.Integration in project ORCID-Source by ORCID.
the class SalesForceAdapter method createIntegrationsListFromJson.
public List<Integration> createIntegrationsListFromJson(JSONObject results) {
List<Integration> integrations = new ArrayList<>();
try {
JSONArray records = results.getJSONArray("records");
if (records.length() > 0) {
JSONObject firstRecord = records.getJSONObject(0);
JSONObject integrationsObject = extractObject(firstRecord, "Integrations__r");
if (integrationsObject != null) {
JSONArray integrationRecords = integrationsObject.getJSONArray("records");
for (int i = 0; i < integrationRecords.length(); i++) {
integrations.add(createIntegrationFromSalesForceRecord(integrationRecords.getJSONObject(i)));
}
}
}
} catch (JSONException e) {
throw new RuntimeException("Error getting integrations records from SalesForce JSON", e);
}
return integrations;
}
Aggregations