diff --git a/business-entity-framework-api/pom.xml b/business-entity-framework-api/pom.xml index f8831cf9c05959023298e162b740fb255e91aed7..7898eee851ba9a63b4ecfa96cf0f01e952330885 100644 --- a/business-entity-framework-api/pom.xml +++ b/business-entity-framework-api/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/business-entity-framework-builtincompoents/pom.xml b/business-entity-framework-builtincompoents/pom.xml index 751345965ccb7ec0ee7aab2da1724df592915de6..62dc9dc74e56ba18451f94016a29e6480f942e1e 100644 --- a/business-entity-framework-builtincompoents/pom.xml +++ b/business-entity-framework-builtincompoents/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/business-entity-framework-core/pom.xml b/business-entity-framework-core/pom.xml index 322daac588427010e2263f0442a92d1fb92b762e..adbc4360555526cf184ffc65e1aa9237fe0fc47b 100644 --- a/business-entity-framework-core/pom.xml +++ b/business-entity-framework-core/pom.xml @@ -15,15 +15,14 @@ ~ limitations under the License. --> - + 4.0.0 business-entity-framework-core business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/business-entity-framework-entity/pom.xml b/business-entity-framework-entity/pom.xml index 5fee5dc3df1c13cf9094097ff3f603dfd3747c3f..d5cff7daf5856d846aa9183f9b255d56dd03ad7f 100644 --- a/business-entity-framework-entity/pom.xml +++ b/business-entity-framework-entity/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/business-entity-framework-spi/pom.xml b/business-entity-framework-spi/pom.xml index 197af95ef4259f72e2a5d5ddfdcc0f12a2a86c10..1ff700b2a477547662135f85a83d197e0b8f94b7 100644 --- a/business-entity-framework-spi/pom.xml +++ b/business-entity-framework-spi/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefEntityResInfoImpl.java b/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefEntityResInfoImpl.java index 9dc2123b69bae7086fbb1a246108cece030f7bfe..c5aed27409ade4fb8b4bc99ef514bd7bf4f27096 100644 --- a/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefEntityResInfoImpl.java +++ b/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefEntityResInfoImpl.java @@ -59,6 +59,18 @@ public abstract class BefEntityResInfoImpl extends CefEntityResInfoImpl { super(entityCode, displayValueKey, modelResInfo, entityId); } + /** + * 构造函数 + * @param entityCode 实体编码 + * @param displayValueKey 实体名称资源项key + * @param modelResInfo 归属模型 + * @param entityId 实体ID + * @param entityName 实体名称 + */ + public BefEntityResInfoImpl(String entityCode, String displayValueKey, CefModelResInfoImpl modelResInfo, String entityId, String entityName) { + super(entityCode, displayValueKey, modelResInfo, entityId, entityName); + } + public HashMap getAfterCreateCodeRules() { if (afterCreateCodeRules == null) afterCreateCodeRules = new HashMap<>(); diff --git a/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefModelResInfoImpl.java b/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefModelResInfoImpl.java index 60f4e3126db600f4d95e12fb7ef9327eaec75d76..9c4fe6d149be272f50e82967b3d4c304e28956e6 100644 --- a/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefModelResInfoImpl.java +++ b/business-entity-framework-spi/src/main/java/com/inspur/edp/bef/spi/entity/builtinimpls/BefModelResInfoImpl.java @@ -47,6 +47,11 @@ public class BefModelResInfoImpl extends CefModelResInfoImpl { this.lockType = lockType; } + public BefModelResInfoImpl(String currentSu, String resMetadataId, String metaDataId, String displayKey, String metadataName, BefLockType lockType) { + super(currentSu, resMetadataId, metaDataId, displayKey, metadataName); + this.lockType = lockType; + } + public BefLockType getLockType() { return lockType; } diff --git a/cm-entity-framework-api/pom.xml b/cm-entity-framework-api/pom.xml index 8443cbe879f25ad283aa0d22ab298985e077ce8e..773dcfc67e32365a9338736002103a344df4875d 100644 --- a/cm-entity-framework-api/pom.xml +++ b/cm-entity-framework-api/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/cm-entity-framework-core/pom.xml b/cm-entity-framework-core/pom.xml index 1447738cadc8378299873cd65f8f1e57981b5bcc..98bbc666af13de673d2809ff42b324e210c27456 100644 --- a/cm-entity-framework-core/pom.xml +++ b/cm-entity-framework-core/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/cm-entity-framework-spi/pom.xml b/cm-entity-framework-spi/pom.xml index a29dbe0d2633be28511f56861e8697bb19f9839f..3aa717d4fd5d630f0b46dd5ae051ca9838503c7c 100644 --- a/cm-entity-framework-spi/pom.xml +++ b/cm-entity-framework-spi/pom.xml @@ -21,7 +21,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/common-entity-framework-api/pom.xml b/common-entity-framework-api/pom.xml index 0d8a0c97309274bb4da6195fb9745b836c98fbd1..c98141235c663b039211bae70efd0efffbb606e0 100644 --- a/common-entity-framework-api/pom.xml +++ b/common-entity-framework-api/pom.xml @@ -20,7 +20,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT 4.0.0 diff --git a/common-entity-framework-core/pom.xml b/common-entity-framework-core/pom.xml index bae2ea987979c41ca5ba7597688809e17eef3a7a..c5d3b2e31d97a8717a25a40e692947fa9860d8ee 100644 --- a/common-entity-framework-core/pom.xml +++ b/common-entity-framework-core/pom.xml @@ -19,7 +19,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT 4.0.0 common-entity-framework-core diff --git a/common-entity-framework-entity/pom.xml b/common-entity-framework-entity/pom.xml index 5f19f598ea59ef03b01a40cefb872ce54ed4c1a9..7ba31f8d97232401763f4f88526a6303cbe74859 100644 --- a/common-entity-framework-entity/pom.xml +++ b/common-entity-framework-entity/pom.xml @@ -20,7 +20,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT common-entity-framework-entity diff --git a/common-entity-framework-repository/pom.xml b/common-entity-framework-repository/pom.xml index 693ca3029717ee2fe04bd63ba83078bb6921fd51..a6e4ee77fccd3da90dc56fb1dccdeb1fb0f9e356 100644 --- a/common-entity-framework-repository/pom.xml +++ b/common-entity-framework-repository/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/common-entity-framework-spi/pom.xml b/common-entity-framework-spi/pom.xml index e1b60feff8447df4496a0ac5d533e87db259d909..ca12b37addc2c70071af1afac59bece21f380c7a 100644 --- a/common-entity-framework-spi/pom.xml +++ b/common-entity-framework-spi/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/AssociationInfo.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/AssociationInfo.java index 7f7050f08e69b4c12d9ec59d99ebe782a266b15c..2221694b0987ad44a3122fe82ff84248746ad7ce 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/AssociationInfo.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/AssociationInfo.java @@ -24,6 +24,8 @@ import com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls.CefModelResInfoImp import com.inspur.edp.cef.spi.exception.ExceptionCode; import com.inspur.edp.cef.spi.manager.ModelResInfoService; import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import lombok.Getter; +import lombok.Setter; import java.util.ArrayList; import java.util.HashMap; @@ -40,18 +42,30 @@ public class AssociationInfo { /** * 是否启用外键检查 */ + @Setter + @Getter private AssociationEnableState enableState = AssociationEnableState.Enabled; /** * 是否启用删除检查 */ + @Setter + @Getter private DeleteCheckState deleteCheckState = DeleteCheckState.Enabled; + @Setter + @Getter private String privateSourceColumn; + @Setter + @Getter private String privateTargetColumn; private TreeMap refPropInfos; private TreeMap enrichedRefPropInfos; private boolean keepAssoPropertyForExpression = false; private boolean isRefInit = false; + @Setter + @Getter private String where; + @Setter + @Getter private ArrayList assoConditions; /**模型国际化资源信息服务*/ private ModelResInfoService modelResInfoService; @@ -70,33 +84,6 @@ public class AssociationInfo { this.privateSourceColumn = privateSourceColumn; this.privateTargetColumn = privateTargetColumn; } - - public DeleteCheckState getDeleteCheckState() { - return deleteCheckState; - } - - public void setDeleteCheckState(DeleteCheckState deleteCheckState) { - this.deleteCheckState = deleteCheckState; - } - - public ArrayList getAssoConditions() { - return assoConditions; - } - - public void setAssoConditions(ArrayList assoConditions) { - this.assoConditions = assoConditions; - } - - - public String getWhere() { - return where; - } - - public void setWhere(String where) { - this.where = where; - } - - public final String getConfig() { return config; } @@ -121,36 +108,12 @@ public class AssociationInfo { mainCode = value; } - public AssociationEnableState getEnableState() { - return enableState; - } - - public void setEnableState(AssociationEnableState value) { - enableState = value; - } - - public String getPrivateSourceColumn() { - return privateSourceColumn; - } - - public void setPrivateSourceColumn(String privateSourceColumn) { - this.privateSourceColumn = privateSourceColumn; - } - - public String getPrivateTargetColumn() { - return privateTargetColumn; - } - - public void setPrivateTargetColumn(String privateTargetColumn) { - this.privateTargetColumn = privateTargetColumn; - } - /** * 关联带出字段(Key:属性名,Value:typeof(propInfo)) */ - public java.util.HashMap getRefPropInfoTypes() { + public HashMap getRefPropInfoTypes() { if (refPropInfoTypes == null) { - refPropInfoTypes = new java.util.HashMap(); + refPropInfoTypes = new HashMap<>(); } return refPropInfoTypes; } @@ -165,22 +128,25 @@ public class AssociationInfo { * 初始化带出字段 */ private void tryInitRefProperties() { - if (isRefInit == true) + if (isRefInit) { return; + } boolean hasPropNotInit = false; //这个地方为什么是 i<5?,怕并发应该加并发控制 for (int i = 0; i < 5; i++) { hasPropNotInit = false; for (Map.Entry entry : innerGetRefPropInfos().entrySet()) { - if (entry.getValue() instanceof RefDataTypePropertyInfo == false) + if (!(entry.getValue() instanceof RefDataTypePropertyInfo)) { continue; + } RefDataTypePropertyInfo refDataTypePropertyInfo = (RefDataTypePropertyInfo) entry.getValue(); - if (refDataTypePropertyInfo == null || refDataTypePropertyInfo.isRefInit()) + if (refDataTypePropertyInfo.isRefInit()) { continue; + } DataTypePropertyInfo refedDataTypePropertyInfo = getRefedDataTypePropertyInfo(refDataTypePropertyInfo.getRefPropertyName()); if (refedDataTypePropertyInfo instanceof RefDataTypePropertyInfo) { RefDataTypePropertyInfo refDataTypePropertyInfo1 = (RefDataTypePropertyInfo) refedDataTypePropertyInfo; - if (refDataTypePropertyInfo1.isRefInit() == false) { + if (!refDataTypePropertyInfo1.isRefInit()) { hasPropNotInit = true; continue; } @@ -189,15 +155,17 @@ public class AssociationInfo { refDataTypePropertyInfo.setRefInit(true); } for (Map.Entry entry : innerGetEnrichedRefPropInfos().entrySet()) { - if (entry.getValue() instanceof RefDataTypePropertyInfo == false) + if (!(entry.getValue() instanceof RefDataTypePropertyInfo)) { continue; + } RefDataTypePropertyInfo refDataTypePropertyInfo = (RefDataTypePropertyInfo) entry.getValue(); - if (refDataTypePropertyInfo == null || refDataTypePropertyInfo.isRefInit()) + if (refDataTypePropertyInfo.isRefInit()) { continue; + } DataTypePropertyInfo refedDataTypePropertyInfo = getRefedDataTypePropertyInfo(refDataTypePropertyInfo.getRefPropertyName()); if (refedDataTypePropertyInfo instanceof RefDataTypePropertyInfo) { RefDataTypePropertyInfo refDataTypePropertyInfo1 = (RefDataTypePropertyInfo) refedDataTypePropertyInfo; - if (refDataTypePropertyInfo1.isRefInit() == false) { + if (!refDataTypePropertyInfo1.isRefInit()) { hasPropNotInit = true; continue; } @@ -205,19 +173,20 @@ public class AssociationInfo { DataTypePropertyInfo.setPropertyInfoByRefed(refDataTypePropertyInfo, refedDataTypePropertyInfo); refDataTypePropertyInfo.setRefInit(true); } - if (hasPropNotInit == false) + if (!hasPropNotInit) { break; + } } - if (hasPropNotInit) + if (hasPropNotInit) { throw new CefRuntimeBaseException(ExceptionCode.CEF_RUNTIME_3001); - + } isRefInit = true; } private TreeMap innerGetRefPropInfos() { if (refPropInfos == null) { - refPropInfos = new TreeMap(String.CASE_INSENSITIVE_ORDER); + refPropInfos = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } return refPropInfos; @@ -234,7 +203,7 @@ public class AssociationInfo { private TreeMap innerGetEnrichedRefPropInfos() { if (enrichedRefPropInfos == null) { - enrichedRefPropInfos = new TreeMap(String.CASE_INSENSITIVE_ORDER); + enrichedRefPropInfos = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); } return enrichedRefPropInfos; @@ -248,13 +217,11 @@ public class AssociationInfo { addRefProperty(propertyName, "", refPropertyName); } -// public final void addRefProperty(String propertyName,String refPropertyName) - public final void addRefProperty(String propertyName, String propertyDisplayKey, String refPropertyName) { - addRefProp(propertyName, initRefProeprty(propertyName, propertyDisplayKey, refPropertyName)); + addRefProp(propertyName, initRefProperty(propertyName, propertyDisplayKey, refPropertyName)); } - private RefDataTypePropertyInfo initRefProeprty(String propertyName, String propertyDisplayKey, String refPropertyName) { + private RefDataTypePropertyInfo initRefProperty(String propertyName, String propertyDisplayKey, String refPropertyName) { RefDataTypePropertyInfo refDataTypePropertyInfo = new RefDataTypePropertyInfo(propertyName, propertyDisplayKey, false, false, 0, 0, FieldType.String, ObjectType.Normal, null, null, refPropertyName); refDataTypePropertyInfo.setRefInit(false); return refDataTypePropertyInfo; @@ -278,25 +245,23 @@ public class AssociationInfo { } private DataTypePropertyInfo getRefedDataTypePropertyInfo(String refPropertyName) { - //CefModelResInfoImpl modelResInfo = (CefModelResInfoImpl) ((IStandardLcp) LcpFactoryManagerUtils - // .getBefLcpFactory().createCMManager(config)).getModelInfo(); ModelResInfoService modelResInfoService = this.getModelResInfoService(); CefModelResInfoImpl modelResInfo = (CefModelResInfoImpl) modelResInfoService.getModelInfo(config); - CefEntityResInfoImpl entityResInfo = null; + CefEntityResInfoImpl entityResInfo; try { - entityResInfo = (CefEntityResInfoImpl) modelResInfo - .getCustomResource(getNodeCode()); + entityResInfo = (CefEntityResInfoImpl) modelResInfo.getCustomResource(getNodeCode()); } catch (Exception e) { - entityResInfo = (CefEntityResInfoImpl) modelResInfo - .getCustomResource(getMainCode()); + entityResInfo = (CefEntityResInfoImpl) modelResInfo.getCustomResource(getMainCode()); } DataTypePropertyInfo dataTypePropertyInfo = entityResInfo.getEntityTypeInfo() .getPropertyInfoWithoutCache(refPropertyName); - if (dataTypePropertyInfo == null) - dataTypePropertyInfo = getRefPropertyInfo(entityResInfo, refPropertyName); + if (dataTypePropertyInfo == null) { + dataTypePropertyInfo = getRefPropertyInfoFromRefEntity(entityResInfo, refPropertyName); + } - if (dataTypePropertyInfo == null) + if (dataTypePropertyInfo == null) { throw new CefRuntimeBaseException(ExceptionCode.CEF_RUNTIME_3003, refPropertyName, getConfig(), getNodeCode(), getPrivateSourceColumn()); + } return dataTypePropertyInfo; } @@ -310,21 +275,45 @@ public class AssociationInfo { return this.modelResInfoService; } - private DataTypePropertyInfo getRefPropertyInfo(CefEntityResInfoImpl entityResInfo, String refPropertyName) { + /** + * 获取关联带出字段 + * @param refPropertyName 关联带出字段Code + * @return 带出字段信息 + */ + public DataTypePropertyInfo getRefPropertyInfo(String refPropertyName) { + for (Map.Entry refPropertyEntry : this.getRefPropInfos().entrySet()) { + if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) { + return refPropertyEntry.getValue(); + } + } + + if (this.getEnrichedRefPropInfos() != null && !this.getEnrichedRefPropInfos().isEmpty()) { + for (Map.Entry refPropertyEntry : this.getEnrichedRefPropInfos().entrySet()) { + if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) { + return refPropertyEntry.getValue(); + } + } + } + return null; + } + + private DataTypePropertyInfo getRefPropertyInfoFromRefEntity(CefEntityResInfoImpl entityResInfo, String refPropertyName) { for (Map.Entry propertyInfoEntry : entityResInfo.getEntityTypeInfo().getPropertyInfos().entrySet()) { if (refPropertyName.equals(propertyInfoEntry.getValue().getPropertyName())) return propertyInfoEntry.getValue(); if (propertyInfoEntry.getValue().getObjectInfo() instanceof AssocationPropertyInfo) { AssociationInfo associationInfo = ((AssocationPropertyInfo) propertyInfoEntry.getValue().getObjectInfo()).getAssociationInfo(); for (Map.Entry refPropertyEntry : associationInfo.getRefPropInfos().entrySet()) { - if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) + if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) { return refPropertyEntry.getValue(); + } } - if (associationInfo.getEnrichedRefPropInfos() != null && associationInfo.getEnrichedRefPropInfos().size() != 0) { + if (associationInfo.getEnrichedRefPropInfos() != null && !associationInfo.getEnrichedRefPropInfos().isEmpty()) { for (Map.Entry refPropertyEntry : associationInfo.getEnrichedRefPropInfos().entrySet()) { - if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) + if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) { return refPropertyEntry.getValue(); + } } } } @@ -335,7 +324,7 @@ public class AssociationInfo { return refPropertyEntry.getValue(); } - if (associationInfo.getEnrichedRefPropInfos() != null && associationInfo.getEnrichedRefPropInfos().size() != 0) { + if (associationInfo.getEnrichedRefPropInfos() != null && !associationInfo.getEnrichedRefPropInfos().isEmpty()) { for (Map.Entry refPropertyEntry : associationInfo.getEnrichedRefPropInfos().entrySet()) { if (refPropertyEntry.getValue().getPropertyName().equals(refPropertyName)) return refPropertyEntry.getValue(); @@ -351,7 +340,7 @@ public class AssociationInfo { } public final void addEnrichedRefProperty(String propertyName, String propertyDisplayKey, String refPropertyName) { - addEnrichedRefProp(propertyName, initRefProeprty(propertyName, propertyDisplayKey, refPropertyName)); + addEnrichedRefProp(propertyName, initRefProperty(propertyName, propertyDisplayKey, refPropertyName)); } public final boolean isKeepAssoPropertyForExpression() { diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/CefEntityTypeInfo.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/CefEntityTypeInfo.java index 9dbd32343f47ec91bcfda12796053b3b9e989f8c..88ad4a0487aa227076315a5f0d444953cf45947f 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/CefEntityTypeInfo.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/CefEntityTypeInfo.java @@ -16,6 +16,8 @@ package com.inspur.edp.cef.spi.entity.info; +import lombok.Getter; + import java.util.HashMap; import java.util.Map; @@ -25,11 +27,18 @@ import java.util.Map; public final class CefEntityTypeInfo extends CefDataTypeInfo { private final String entityCode; + @Getter + private final String entityName; private Map uniqueConstraintInfos = new HashMap<>(); public CefEntityTypeInfo(String entityCode, String displayValueKey) { + this(entityCode, "", displayValueKey); + } + + public CefEntityTypeInfo(String entityCode, String entityName, String displayValueKey) { super(displayValueKey); this.entityCode = entityCode; + this.entityName = entityName; } public Map getUniqueConstraintInfos() { diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/UniqueConstraintInfo.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/UniqueConstraintInfo.java index 57bcbb990b67e937a6b3ef23605d3d44ce249357..c6efac4159627043f4d68fa8ab18d81e70158955 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/UniqueConstraintInfo.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/UniqueConstraintInfo.java @@ -16,35 +16,19 @@ package com.inspur.edp.cef.spi.entity.info; +import lombok.Getter; +import lombok.Setter; + import java.util.ArrayList; +@Getter +@Setter public class UniqueConstraintInfo { - private String nodeCode; private ArrayList fields; private String displayValueKey; - - public ArrayList getFields() { - return fields; - } - - public void setFields(ArrayList fields) { - this.fields = fields; - } - - public String getNodeCode() { - return nodeCode; - } - - public void setNodeCode(String nodeCode) { - this.nodeCode = nodeCode; - } - - public String getDisplayValueKey() { - return displayValueKey; - } - - public void setDisplayValueKey(String displayValueKey) { - this.displayValueKey = displayValueKey; - } + /** + * 默认显示名称(资源项无法获取名称时使用) + */ + private String defaultDisplayName = ""; } diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/propertyinfo/DataTypePropertyInfo.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/propertyinfo/DataTypePropertyInfo.java index 94e8f12bec0c737c1346199a75da9bd9be18fe2a..4f0639330c434458f3b8f100df80bb484d0c2bf1 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/propertyinfo/DataTypePropertyInfo.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/info/propertyinfo/DataTypePropertyInfo.java @@ -33,6 +33,8 @@ import com.inspur.edp.cef.spi.jsonser.base.StringUtils; import com.inspur.edp.cef.spi.jsonser.util.SerializerUtil; import com.inspur.edp.cef.spi.repository.entity.FieldReposConfigInfo; import com.inspur.edp.cef.spi.repository.entity.TableNameReposConfigInfo; +import lombok.Getter; +import lombok.Setter; import java.io.IOException; import java.math.BigDecimal; @@ -52,6 +54,13 @@ public class DataTypePropertyInfo { private String displayValueKey; + /** + * 字段默认显示名称 + */ + @Getter + @Setter + private String defaultDisplayName; + /** * 是否必填属性 */ diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefEntityResInfoImpl.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefEntityResInfoImpl.java index a1a4d08ccafbe4cccecbf73fa00fd8b84ec0c65b..e79d1b368e7ea3459b87e5606de31a12ac1d3079 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefEntityResInfoImpl.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefEntityResInfoImpl.java @@ -42,10 +42,10 @@ import java.util.concurrent.ConcurrentHashMap; public abstract class CefEntityResInfoImpl extends EntityResInfo { - private CefEntityTypeInfo entityTypeInfo; + private final CefEntityTypeInfo entityTypeInfo; private Map childEntityResInfos; - private CefModelResInfoImpl modelResInfo; - private String entityId; + private final CefModelResInfoImpl modelResInfo; + private final String entityId; private List sorts; private ArrayList propertyNames; @@ -57,8 +57,22 @@ public abstract class CefEntityResInfoImpl extends EntityResInfo { public CefEntityResInfoImpl(String entityCode, String displayValueKey, CefModelResInfoImpl modelResInfo, String entityId) { + this(entityCode, displayValueKey, modelResInfo, entityId, ""); + } + + /** + * 实体对象信息, 携带对象名称 + *

解析型支持传入对象名称,当获取对象展示名称时,若根据资源元数据获取不到则使用指定的对象名称

+ * @param entityCode 实体对象编码 + * @param displayValueKey 实体展示名称资源项Key + * @param modelResInfo 模型对象信息 + * @param entityId 实体对象Id + * @param entityName 对象名称 + */ + public CefEntityResInfoImpl(String entityCode, String displayValueKey, + CefModelResInfoImpl modelResInfo, String entityId, String entityName) { this.entityId = entityId; - entityTypeInfo = new CefEntityTypeInfo(entityCode, displayValueKey); + entityTypeInfo = new CefEntityTypeInfo(entityCode, entityName, displayValueKey); this.modelResInfo = modelResInfo; initColumns(); initUQConstraintInfos(); @@ -188,13 +202,13 @@ public abstract class CefEntityResInfoImpl extends EntityResInfo { @Override public final String getUniqueConstraintMessage(String uniqueConCode) { - return modelResInfo.getResourceItemValue( - entityTypeInfo.getUniqueConstraintInfos().get(uniqueConCode).getDisplayValueKey()); + UniqueConstraintInfo uniqueConstraintInfo = entityTypeInfo.getUniqueConstraintInfos().get(uniqueConCode); + return modelResInfo.getResourceItemValue(uniqueConstraintInfo.getDisplayValueKey(), uniqueConstraintInfo.getDefaultDisplayName()); } @Override - public final String getDisplayName() { - return modelResInfo.getResourceItemValue(entityTypeInfo.getDisplayValueKey()); + public String getDisplayName() { + return modelResInfo.getResourceItemValue(entityTypeInfo.getDisplayValueKey(), entityTypeInfo.getEntityName()); } public final String getI18nPrefix() { @@ -204,8 +218,9 @@ public abstract class CefEntityResInfoImpl extends EntityResInfo { @Override public String getPropertyDispalyName(String labelId) { - String resourceKey = entityTypeInfo.getPropertyInfos().get(labelId).getDisplayValueKey(); - return modelResInfo.getResourceItemValue(resourceKey); + DataTypePropertyInfo propertyInfo = entityTypeInfo.getPropertyInfos().get(labelId); + String resourceKey = propertyInfo.getDisplayValueKey(); + return modelResInfo.getResourceItemValue(resourceKey, propertyInfo.getDefaultDisplayName()); } @Override @@ -213,37 +228,29 @@ public abstract class CefEntityResInfoImpl extends EntityResInfo { DataTypePropertyInfo info = entityTypeInfo.getPropertyInfos().get(labelId); if (info != null) { if (info.getObjectType() == ObjectType.Enum) { - return modelResInfo.getResourceItemValue( - ((EnumPropertyInfo) info.getObjectInfo()).getEnumValueInfo(enumKey) - .getDisplayValueKey()); + EnumValueInfo enumValueInfo = ((EnumPropertyInfo) info.getObjectInfo()).getEnumValueInfo(enumKey); + return modelResInfo.getResourceItemValue(enumValueInfo.getDisplayValueKey(), enumValueInfo.getDefaultName()); } else if (info.getObjectInfo() instanceof SimpleEnumUdtPropertyInfo) { - return modelResInfo.getResourceItemValue( - (((SimpleEnumUdtPropertyInfo) info.getObjectInfo()).getEnumInfo()) - .getEnumValueInfo(enumKey) - .getDisplayValueKey()); + EnumValueInfo enumValueInfo = (((SimpleEnumUdtPropertyInfo) info.getObjectInfo()).getEnumInfo()) + .getEnumValueInfo(enumKey); + return modelResInfo.getResourceItemValue(enumValueInfo.getDisplayValueKey(), enumValueInfo.getDefaultName()); } } throw new CefRuntimeBaseException(ExceptionCode.CEF_RUNTIME_3014, labelId); } @Override - public String getAssoRefEnumPropertyDisplayValue(String labelId, String refEleCode, - String enumKey) { + public String getAssoRefEnumPropertyDisplayValue(String labelId, String refEleCode, String enumKey) { DataTypePropertyInfo dataTypePropertyInfo = entityTypeInfo.getPropertyInfo(labelId); - AssocationPropertyInfo associationPropertyInfo = (AssocationPropertyInfo) dataTypePropertyInfo - .getObjectInfo(); - DataTypePropertyInfo info = associationPropertyInfo.getAssociationInfo().getRefPropInfos() - .get(refEleCode); + AssocationPropertyInfo associationPropertyInfo = (AssocationPropertyInfo) dataTypePropertyInfo.getObjectInfo(); + DataTypePropertyInfo info = associationPropertyInfo.getAssociationInfo().getRefPropInfos().get(refEleCode); if (info.getObjectType() == ObjectType.Enum) { - return modelResInfo.getResourceItemValue( - ((EnumPropertyInfo) info.getObjectInfo()).getEnumValueInfo(enumKey) - .getDisplayValueKey()); + EnumValueInfo enumValueInfo = ((EnumPropertyInfo) info.getObjectInfo()).getEnumValueInfo(enumKey); + return modelResInfo.getResourceItemValue(enumValueInfo.getDisplayValueKey(), enumValueInfo.getDefaultName()); } else if (info.getObjectInfo() instanceof SimpleEnumUdtPropertyInfo) { - return modelResInfo.getResourceItemValue( - (((SimpleEnumUdtPropertyInfo) info.getObjectInfo()).getEnumInfo()) - .getEnumValueInfo(enumKey) - .getDisplayValueKey()); + EnumValueInfo enumValueInfo = (((SimpleEnumUdtPropertyInfo) info.getObjectInfo()).getEnumInfo()).getEnumValueInfo(enumKey); + return modelResInfo.getResourceItemValue(enumValueInfo.getDisplayValueKey(), enumValueInfo.getDefaultName()); } throw new CefRuntimeBaseException(ExceptionCode.CEF_RUNTIME_3014, labelId); } @@ -269,11 +276,10 @@ public abstract class CefEntityResInfoImpl extends EntityResInfo { @Override public String getAssoRefPropertyDisplay(String labelId, String refEleCode) { DataTypePropertyInfo dataTypePropertyInfo = entityTypeInfo.getPropertyInfo(labelId); -// AssocationPropertyInfo associationPropertyInfo = (AssocationPropertyInfo) dataTypePropertyInfo -// .getObjectInfo(); + AssocationPropertyInfo associationPropertyInfo = (AssocationPropertyInfo) dataTypePropertyInfo.getObjectInfo(); + DataTypePropertyInfo refPropertyInfo = associationPropertyInfo.getAssociationInfo().getRefPropertyInfo(refEleCode); //关联带出字段 - String displayKey = this.getDisplayPrefix() + "." + labelId + "." + refEleCode + ".Name"; - return this.modelResInfo.getResourceItemValue(displayKey); + return this.modelResInfo.getResourceItemValue(refPropertyInfo.getDisplayValueKey(), refPropertyInfo.getDefaultDisplayName()); } protected final void addChildEntityResInfo(EntityResInfo info) { diff --git a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefModelResInfoImpl.java b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefModelResInfoImpl.java index 16ac43ebfd68e61fc4304f00223fcb075e00925d..0476a5f78e55e8ed20eb9d0cdc74840155075b5e 100644 --- a/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefModelResInfoImpl.java +++ b/common-entity-framework-spi/src/main/java/com/inspur/edp/cef/spi/entity/resourceInfo/builinImpls/CefModelResInfoImpl.java @@ -17,11 +17,13 @@ package com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls; import com.inspur.edp.cef.api.CefRtBeanUtil; -import com.inspur.edp.cef.api.message.CefException; import com.inspur.edp.cef.entity.exception.CefRuntimeBaseException; import com.inspur.edp.cef.spi.entity.resourceInfo.EntityResInfo; import com.inspur.edp.cef.spi.entity.resourceInfo.ModelResInfo; import com.inspur.edp.cef.spi.exception.ExceptionCode; +import io.iec.edp.caf.commons.utils.StringUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import java.util.HashMap; import java.util.Map; @@ -30,6 +32,7 @@ import java.util.Stack; /** * 模型通用信息 */ +@Slf4j public abstract class CefModelResInfoImpl extends ModelResInfo { /** @@ -54,16 +57,36 @@ public abstract class CefModelResInfoImpl extends ModelResInfo { private EntityResInfo rootEntityResInfo; private Map entityResInfoMap; + /** + * 元数据名称 + */ + @Getter + private final String metadataName; + public CefModelResInfoImpl(String currentSu, String resMetadataId, String displayKey) { this(currentSu, resMetadataId, "", displayKey); } public CefModelResInfoImpl(String currentSu, String resMetadataId, String metaDataId, String displayKey) { + this(currentSu, resMetadataId, metaDataId, displayKey, ""); + } + + /** + * 模型通用信息 + * @param currentSu 当前模型所属SU + * @param resMetadataId 资源元数据ID + * @param metaDataId 元数据ID + * @param displayKey 元数据名称资源项key + * @param metadataName 元数据名称(若资源项无法找到,则使用) + */ + public CefModelResInfoImpl(String currentSu, String resMetadataId, String metaDataId, String displayKey, + String metadataName) { this.currentSu = currentSu; this.resMetadataId = resMetadataId; this.metaDataId = metaDataId; this.displayKey = displayKey; + this.metadataName = metadataName; } @Override @@ -87,12 +110,12 @@ public abstract class CefModelResInfoImpl extends ModelResInfo { /** * 模型名称 - * - * @return + *

根据资源项获取,若资源项中未找到,则使用默认元数据模型名称

+ * @return 模型名称 */ @Override public String getModelDispalyName() { - return getResourceItemValue(displayKey); + return getResourceItemValue(displayKey, metadataName); } /** @@ -120,14 +143,35 @@ public abstract class CefModelResInfoImpl extends ModelResInfo { } public final String getResourceItemValue(String resourceKey) { - String resValue = ""; try { - resValue = CefRtBeanUtil.getResourceItemValue(currentSu, resMetadataId, resourceKey); + return CefRtBeanUtil.getResourceItemValue(currentSu, resMetadataId, resourceKey); } catch (Exception ex) { String[] params = new String[]{currentSu, metaDataId, resMetadataId, resourceKey}; throw new CefRuntimeBaseException(ExceptionCode.CEF_RUNTIME_3032, ex, params); } - return resValue; + } + + /** + * 获取资源项值,若未获取到,则返回默认值 + * @param resourceKey 资源项key + * @param defaultValue 默认值 + * @return 获取资源项值,若未获取到,则返回默认值 + */ + public final String getResourceItemValue(String resourceKey, String defaultValue) { + try { + String resValue = getResourceItemValue(resourceKey); + if (!StringUtils.isEmpty(resValue)) { + return resValue; + } + } catch (Exception ex) { + log.error("根据[{}]未查询到对应的资源内容,使用默认值[{}]", resourceKey, defaultValue, ex); + return defaultValue == null? "" : defaultValue; + } + if (log.isDebugEnabled()) { + // 输出日志, newException以获取堆栈 + log.debug("根据[{}]未查询到对应的资源内容,使用默认值[{}]", resourceKey, defaultValue, new Exception()); + } + return defaultValue == null? "" : defaultValue; } /** diff --git a/common-entity-framework-variable-api/pom.xml b/common-entity-framework-variable-api/pom.xml index 641bff8e8632e1b95b2d7e1f6c056d3a231c3902..11c188e2d4e77fe382743b4795e7762290266804 100644 --- a/common-entity-framework-variable-api/pom.xml +++ b/common-entity-framework-variable-api/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/common-entity-framework-variable-core/pom.xml b/common-entity-framework-variable-core/pom.xml index dc79a7884fff5b688d184e4505371b7d8901bd97..ae48228a21c7f9e83fe081afda97606049cd3914 100644 --- a/common-entity-framework-variable-core/pom.xml +++ b/common-entity-framework-variable-core/pom.xml @@ -22,7 +22,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/common-entity-framework-variable-spi/pom.xml b/common-entity-framework-variable-spi/pom.xml index ed0349fb3cd38a3da40772613a292d30a005ddea..6148885160aee5e5dde843ffe48cba89d38c09c9 100644 --- a/common-entity-framework-variable-spi/pom.xml +++ b/common-entity-framework-variable-spi/pom.xml @@ -23,7 +23,7 @@ com.inspur.edp business-entity-framework - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/pom.xml b/pom.xml index cdc8fb4d54cbe6b721233f64be1040316027b200..1d529773e21a8f72935ad595aa5f5667d9e031f7 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ com.inspur.edp business-entity-framework pom - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT business-entity-framework-api business-entity-framework-spi @@ -176,7 +176,7 @@ io.iec.edp caf-framework-securityentry-api - 3.0.0-rc.1 + 0.2.56 io.iec.edp diff --git a/unified-datatype-api/pom.xml b/unified-datatype-api/pom.xml index f30ea44c1e3a79507ca79db0a134d0ddd0ebeca0..6e071f866009f7dd71161e903eb10969223a2128 100644 --- a/unified-datatype-api/pom.xml +++ b/unified-datatype-api/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/unified-datatype-core/pom.xml b/unified-datatype-core/pom.xml index 7aa69983b4784b121c768e6a56ed83dfecc87dfc..20ec8469d6f53c36c721eea53cd9bf450f656722 100644 --- a/unified-datatype-core/pom.xml +++ b/unified-datatype-core/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT diff --git a/unified-datatype-entity/pom.xml b/unified-datatype-entity/pom.xml index d6bd4a16fede72ccf089f389e6c85d691b5975f6..779e20c0a163a2036bc468dd3a8bdd50f898fe70 100644 --- a/unified-datatype-entity/pom.xml +++ b/unified-datatype-entity/pom.xml @@ -19,7 +19,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT 4.0.0 diff --git a/unified-datatype-spi/pom.xml b/unified-datatype-spi/pom.xml index de5521b3e010c3990c4df80238e0ad504676b4ba..d15aecbbf3cf4691fe78fded1e2dfd9ae908dfa5 100644 --- a/unified-datatype-spi/pom.xml +++ b/unified-datatype-spi/pom.xml @@ -22,7 +22,7 @@ business-entity-framework com.inspur.edp - 0.3.6-SNAPSHOT + 0.3.7-SNAPSHOT