📄 entityconfigutil.java
字号:
public static EntityConfigUtil.EntityModelReaderInfo getEntityModelReaderInfo(String name) {
return (EntityConfigUtil.EntityModelReaderInfo) entityModelReaderInfos.get(name);
}
public static EntityConfigUtil.EntityGroupReaderInfo getEntityGroupReaderInfo(String name) {
return (EntityConfigUtil.EntityGroupReaderInfo) entityGroupReaderInfos.get(name);
}
public static EntityConfigUtil.EntityEcaReaderInfo getEntityEcaReaderInfo(String name) {
return (EntityConfigUtil.EntityEcaReaderInfo) entityEcaReaderInfos.get(name);
}
public static EntityConfigUtil.EntityDataReaderInfo getEntityDataReaderInfo(String name) {
return (EntityConfigUtil.EntityDataReaderInfo) entityDataReaderInfos.get(name);
}
public static EntityConfigUtil.FieldTypeInfo getFieldTypeInfo(String name) {
return (EntityConfigUtil.FieldTypeInfo) fieldTypeInfos.get(name);
}
public static EntityConfigUtil.DatasourceInfo getDatasourceInfo(String name) {
return (EntityConfigUtil.DatasourceInfo) datasourceInfos.get(name);
}
public static Map getDatasourceInfos() {
return datasourceInfos;
}
public static class ResourceLoaderInfo {
public String name;
public String className;
public String prependEnv;
public String prefix;
public ResourceLoaderInfo(Element element) {
this.name = element.getAttribute("name");
this.className = element.getAttribute("class");
this.prependEnv = element.getAttribute("prepend-env");
this.prefix = element.getAttribute("prefix");
}
}
public static class DelegatorInfo {
public String name;
public String entityModelReader;
public String entityGroupReader;
public String entityEcaReader;
public boolean useDistributedCacheClear;
public String distributedCacheClearClassName;
public String distributedCacheClearUserLoginId;
public Map groupMap = new HashMap();
public DelegatorInfo(Element element) {
this.name = element.getAttribute("name");
this.entityModelReader = element.getAttribute("entity-model-reader");
this.entityGroupReader = element.getAttribute("entity-group-reader");
this.entityEcaReader = element.getAttribute("entity-eca-reader");
// this defaults to false, ie anything but true is false
this.useDistributedCacheClear = "true".equals(element.getAttribute("distributed-cache-clear-enabled"));
this.distributedCacheClearClassName = element.getAttribute("distributed-cache-clear-class-name");
if (UtilValidate.isEmpty(this.distributedCacheClearClassName)) this.distributedCacheClearClassName = "org.ofbiz.entityext.cache.EntityCacheServices";
this.distributedCacheClearUserLoginId = element.getAttribute("distributed-cache-clear-user-login-id");
if (UtilValidate.isEmpty(this.distributedCacheClearUserLoginId)) this.distributedCacheClearUserLoginId= "admin";
List groupMapList = UtilXml.childElementList(element, "group-map");
Iterator groupMapIter = groupMapList.iterator();
while (groupMapIter.hasNext()) {
Element groupMapElement = (Element) groupMapIter.next();
groupMap.put(groupMapElement.getAttribute("group-name"), groupMapElement.getAttribute("datasource-name"));
}
}
}
public static class EntityModelReaderInfo {
public String name;
public List resourceElements;
public EntityModelReaderInfo(Element element) {
this.name = element.getAttribute("name");
resourceElements = UtilXml.childElementList(element, "resource");
}
}
public static class EntityGroupReaderInfo {
public String name;
public List resourceElements;
public EntityGroupReaderInfo(Element element) {
this.name = element.getAttribute("name");
String loader = element.getAttribute("loader");
String location = element.getAttribute("location");
resourceElements = new LinkedList();
if (loader != null && loader.length() > 0 && location != null && location.length() > 0) {
resourceElements.add(element);
}
resourceElements.addAll(UtilXml.childElementList(element, "resource"));
}
}
public static class EntityEcaReaderInfo {
public String name;
public List resourceElements;
public EntityEcaReaderInfo(Element element) {
this.name = element.getAttribute("name");
resourceElements = UtilXml.childElementList(element, "resource");
}
}
public static class EntityDataReaderInfo {
public String name;
public List resourceElements;
public EntityDataReaderInfo(Element element) {
this.name = element.getAttribute("name");
resourceElements = UtilXml.childElementList(element, "resource");
}
}
public static class FieldTypeInfo {
public String name;
public Element resourceElement;
public FieldTypeInfo(Element element) {
this.name = element.getAttribute("name");
resourceElement = element;
}
}
public static class DatasourceInfo {
public String name;
public String helperClass;
public String fieldTypeName;
public List sqlLoadPaths = new LinkedList();
public List readDatas = new LinkedList();
public Element datasourceElement;
public static final int TYPE_JNDI_JDBC = 1;
public static final int TYPE_INLINE_JDBC = 2;
public static final int TYPE_TYREX_DATA_SOURCE = 3;
public static final int TYPE_OTHER = 4;
public Element jndiJdbcElement;
public Element tyrexDataSourceElement;
public Element inlineJdbcElement;
public String schemaName = null;
public boolean checkOnStart = true;
public boolean addMissingOnStart = false;
public boolean useFks = true;
public boolean useFkIndices = true;
public boolean checkForeignKeysOnStart = false;
public boolean checkFkIndicesOnStart = false;
public boolean usePkConstraintNames = true;
public int constraintNameClipLength = 30;
public String fkStyle = null;
public boolean useFkInitiallyDeferred = true;
public boolean useIndices = true;
public boolean checkIndicesOnStart = false;
public String joinStyle = null;
public boolean aliasViews = true;
public DatasourceInfo(Element element) {
this.name = element.getAttribute("name");
this.helperClass = element.getAttribute("helper-class");
this.fieldTypeName = element.getAttribute("field-type-name");
sqlLoadPaths = UtilXml.childElementList(element, "sql-load-path");
readDatas = UtilXml.childElementList(element, "read-data");
datasourceElement = element;
if (datasourceElement == null) {
Debug.logWarning("datasource def not found with name " + this.name + ", using default for schema-name (none)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for check-on-start (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for add-missing-on-start (false)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for use-foreign-keys (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default use-foreign-key-indices (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for check-fks-on-start (false)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for check-fk-indices-on-start (false)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for use-pk-constraint-names (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for constraint-name-clip-length (30)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for fk-style (name_constraint)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for use-fk-initially-deferred (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for use-indices (true)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for check-indices-on-start (false)", module);
Debug.logWarning("datasource def not found with name " + this.name + ", using default for join-style (ansi)", module);
} else {
schemaName = datasourceElement.getAttribute("schema-name");
// anything but false is true
checkOnStart = !"false".equals(datasourceElement.getAttribute("check-on-start"));
// anything but true is false
addMissingOnStart = "true".equals(datasourceElement.getAttribute("add-missing-on-start"));
// anything but false is true
useFks = !"false".equals(datasourceElement.getAttribute("use-foreign-keys"));
// anything but false is true
useFkIndices = !"false".equals(datasourceElement.getAttribute("use-foreign-key-indices"));
// anything but true is false
checkForeignKeysOnStart = "true".equals(datasourceElement.getAttribute("check-fks-on-start"));
// anything but true is false
checkFkIndicesOnStart = "true".equals(datasourceElement.getAttribute("check-fk-indices-on-start"));
// anything but false is true
usePkConstraintNames = !"false".equals(datasourceElement.getAttribute("use-pk-constraint-names"));
try {
constraintNameClipLength = Integer.parseInt(datasourceElement.getAttribute("constraint-name-clip-length"));
} catch (Exception e) {
Debug.logError("Could not parse constraint-name-clip-length value for datasource with name " + this.name + ", using default value of 30", module);
}
fkStyle = datasourceElement.getAttribute("fk-style");
// anything but true is false
useFkInitiallyDeferred = "true".equals(datasourceElement.getAttribute("use-fk-initially-deferred"));
// anything but false is true
useIndices = !"false".equals(datasourceElement.getAttribute("use-indices"));
// anything but true is false
checkIndicesOnStart = "true".equals(datasourceElement.getAttribute("check-indices-on-start"));
joinStyle = datasourceElement.getAttribute("join-style");
aliasViews = !"false".equals(datasourceElement.getAttribute("alias-view-columns"));
}
if (fkStyle == null || fkStyle.length() == 0) fkStyle = "name_constraint";
if (joinStyle == null || joinStyle.length() == 0) joinStyle = "ansi";
jndiJdbcElement = UtilXml.firstChildElement(datasourceElement, "jndi-jdbc");
tyrexDataSourceElement = UtilXml.firstChildElement(datasourceElement, "tyrex-dataSource");
inlineJdbcElement = UtilXml.firstChildElement(datasourceElement, "inline-jdbc");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -