public GenericHelperInfo getGroupHelperInfo(String entityGroupName) {
if (entityGroupName == null) return null;
String helperBaseName = this.getGroupHelperName(entityGroupName);
if (helperBaseName == null) return null;
GenericHelperInfo helperInfo = new GenericHelperInfo(entityGroupName, helperBaseName);
// to avoid infinite recursion, and to behave right for shared org.ofbiz.tenant entities, do nothing with the tenantId if the entityGroupName=org.ofbiz.tenant
if (UtilValidate.isNotEmpty(this.delegatorTenantId) && !"org.ofbiz.tenant".equals(entityGroupName)) {
helperInfo.setTenantId(this.delegatorTenantId);
// get the JDBC parameters from the DB for the entityGroupName and tenantId
try {
// NOTE: instead of caching the GenericHelpInfo object do a cached query here and create a new object each time, will avoid issues when the database data changes during run time
// NOTE: always use the base delegator for this to avoid problems when this is being initialized
Delegator baseDelegator = DelegatorFactory.getDelegator(this.delegatorBaseName);
GenericValue tenantDataSource = baseDelegator.findOne("TenantDataSource", true, "tenantId", this.delegatorTenantId, "entityGroupName", entityGroupName);
if (tenantDataSource != null) {
helperInfo.setOverrideJdbcUri(tenantDataSource.getString("jdbcUri"));
helperInfo.setOverrideUsername(tenantDataSource.getString("jdbcUsername"));
helperInfo.setOverridePassword(tenantDataSource.getString("jdbcPassword"));
} else {
// don't log this, happens too many times: if (Debug.warningOn()) Debug.logWarning("Could not find TenantDataSource information for tenantId=[" + this.delegatorTenantId + "] and entityGroupName=[" + entityGroupName + "] in delegator [" + this.delegatorFullName + "]; will be defaulting to settings for the base delegator name [" + this.delegatorBaseName + "]", module);
}
} catch (GenericEntityException e) {
// don't complain about this too much, just log the error if there is one