Search in sources :

Example 1 with SalesForceConnectionEntity

use of org.orcid.persistence.jpa.entities.SalesForceConnectionEntity in project ORCID-Source by ORCID.

the class SalesForceManagerImpl method enableAccess.

@Override
public void enableAccess(String accountId, List<Contact> contactsList) {
    contactsList.forEach(c -> {
        String orcid = c.getOrcid();
        if (orcid == null) {
            return;
        }
        SalesForceConnectionEntity connection = salesForceConnectionDao.findByOrcidAndAccountId(orcid, accountId);
        if (connection == null) {
            connection = new SalesForceConnectionEntity();
            connection.setOrcid(orcid);
            connection.setSalesForceAccountId(accountId);
            connection.setEmail(c.getEmail());
            salesForceConnectionDao.persist(connection);
        }
    });
}
Also used : SalesForceConnectionEntity(org.orcid.persistence.jpa.entities.SalesForceConnectionEntity)

Example 2 with SalesForceConnectionEntity

use of org.orcid.persistence.jpa.entities.SalesForceConnectionEntity in project ORCID-Source by ORCID.

the class SalesForceManagerImplTest method setUpUser.

private void setUpUser() {
    when(sourceManager.retrieveRealUserOrcid()).thenReturn(TEST_ORCID);
    SalesForceConnectionEntity connection = new SalesForceConnectionEntity();
    connection.setSalesForceAccountId("account1Id");
    when(salesForceConnectionDao.findByOrcid(TEST_ORCID)).thenReturn(connection);
}
Also used : SalesForceConnectionEntity(org.orcid.persistence.jpa.entities.SalesForceConnectionEntity)

Aggregations

SalesForceConnectionEntity (org.orcid.persistence.jpa.entities.SalesForceConnectionEntity)2