use of org.apache.ofbiz.entity.config.model.DelegatorElement in project ofbiz-framework by apache.
the class ModelGroupReader method getModelGroupReader.
public static ModelGroupReader getModelGroupReader(String delegatorName) throws GenericEntityConfException {
DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
String tempModelName = delegatorInfo.getEntityGroupReader();
ModelGroupReader reader = readers.get(tempModelName);
if (reader == null) {
reader = readers.putIfAbsentAndGet(tempModelName, new ModelGroupReader(delegatorName, tempModelName));
}
return reader;
}
use of org.apache.ofbiz.entity.config.model.DelegatorElement in project ofbiz-framework by apache.
the class ModelReader method getModelReader.
public static ModelReader getModelReader(String delegatorName) throws GenericEntityException {
DelegatorElement delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorName);
if (delegatorInfo == null) {
throw new GenericEntityConfException("Could not find a delegator with the name " + delegatorName);
}
String tempModelName = delegatorInfo.getEntityModelReader();
ModelReader reader = readers.get(tempModelName);
if (reader == null) {
reader = new ModelReader(tempModelName);
// preload caches...
reader.getEntityCache();
reader = readers.putIfAbsentAndGet(tempModelName, reader);
}
return reader;
}
use of org.apache.ofbiz.entity.config.model.DelegatorElement in project ofbiz-framework by apache.
the class ModelGroupReader method getEntityGroupName.
/**
* Gets a group name based on a definition from the specified XML Entity Group descriptor file.
* @param entityName The entityName of the Entity Group definition to use.
* @return A group name
*/
public String getEntityGroupName(String entityName, String delegatorBaseName) {
Map<String, String> gc = getGroupCache(delegatorBaseName);
if (gc != null) {
String groupName = gc.get(entityName);
if (groupName == null) {
DelegatorElement delegatorInfo = null;
try {
delegatorInfo = EntityConfig.getInstance().getDelegator(delegatorBaseName);
} catch (GenericEntityConfException e) {
Debug.logWarning(e, "Exception thrown while getting delegator config: ", module);
}
if (delegatorInfo == null) {
throw new RuntimeException("Could not find DelegatorInfo for delegatorBaseName [" + delegatorBaseName + "]");
}
groupName = delegatorInfo.getDefaultGroupName();
}
return groupName;
} else {
return null;
}
}
Aggregations