use of org.broadleafcommerce.common.config.domain.SystemProperty in project BroadleafCommerce by BroadleafCommerce.
the class SystemPropertiesServiceImpl method resolveSystemProperty.
@Override
public String resolveSystemProperty(String name) {
if (extensionManager != null) {
ExtensionResultHolder holder = new ExtensionResultHolder();
extensionManager.getProxy().resolveProperty(name, holder);
if (holder.getResult() != null) {
return holder.getResult().toString();
}
}
String result;
// We don't want to utilize this cache for sandboxes
if (BroadleafRequestContext.getBroadleafRequestContext() == null || BroadleafRequestContext.getBroadleafRequestContext().getSandBox() == null) {
result = getPropertyFromCache(name);
} else {
result = null;
}
if (result != null) {
return result.equals(NULL_RESPONSE) ? null : result;
}
SystemProperty property = systemPropertiesDao.readSystemPropertyByName(name);
boolean envOrigination = BooleanUtils.isTrue(originatedFromEnvironment.get());
if (property == null || StringUtils.isEmpty(property.getValue())) {
if (envOrigination) {
result = null;
} else {
result = getPropertyFromCache(name);
if (result == null) {
result = env.getProperty(name);
}
}
} else {
if ("_blank_".equals(property.getValue())) {
result = "";
} else {
result = property.getValue();
}
}
if (result == null) {
result = NULL_RESPONSE;
}
addPropertyToCache(name, result);
return result.equals(NULL_RESPONSE) ? null : result;
}
Aggregations