Search in sources :

Example 1 with OrganisationInfo

use of com.haleconnect.api.user.v1.model.OrganisationInfo in project hale by halestudio.

the class HaleConnectServiceImpl method getOrganisationInfo.

/**
 * @see eu.esdihumboldt.hale.io.haleconnect.HaleConnectService#getOrganisationInfo(java.lang.String)
 */
@Override
public HaleConnectOrganisationInfo getOrganisationInfo(String orgId) throws HaleConnectException {
    if (!this.isLoggedIn()) {
        return null;
    }
    if (!orgInfoCache.containsKey(orgId)) {
        OrganisationsApi api = UserServiceHelper.getOrganisationsApi(this, this.getSession().getToken());
        try {
            OrganisationInfo org = api.getOrganisation(orgId);
            orgInfoCache.put(org.getId(), new HaleConnectOrganisationInfo(org.getId(), org.getName()));
        } catch (ApiException e) {
            throw new HaleConnectException(e.getMessage(), e);
        }
    }
    return orgInfoCache.get(orgId);
}
Also used : HaleConnectOrganisationInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectOrganisationInfo) OrganisationInfo(com.haleconnect.api.user.v1.model.OrganisationInfo) HaleConnectOrganisationInfo(eu.esdihumboldt.hale.io.haleconnect.HaleConnectOrganisationInfo) HaleConnectException(eu.esdihumboldt.hale.io.haleconnect.HaleConnectException) OrganisationsApi(com.haleconnect.api.user.v1.api.OrganisationsApi) ApiException(com.haleconnect.api.user.v1.ApiException)

Aggregations

ApiException (com.haleconnect.api.user.v1.ApiException)1 OrganisationsApi (com.haleconnect.api.user.v1.api.OrganisationsApi)1 OrganisationInfo (com.haleconnect.api.user.v1.model.OrganisationInfo)1 HaleConnectException (eu.esdihumboldt.hale.io.haleconnect.HaleConnectException)1 HaleConnectOrganisationInfo (eu.esdihumboldt.hale.io.haleconnect.HaleConnectOrganisationInfo)1