From f5ebed19e1bcad97e5120f719b32b2d1d38a0a17 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Mon, 7 Nov 2022 17:57:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feature(bff-engine):=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 基础配置 --- .gitignore | 19 ++++++ pom.xml | 135 ++++++++++++++++++++++++++++++++++++++ style/ubml_checkstyle.xml | 135 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 style/ubml_checkstyle.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0683c8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +.idea +.idea/** +.metadata +.settings +.project +.version.properties +filter.properties +logs.zip +/**/target +target +tmp +*.class +*.iml +*.swp +*.log +*.jar +.factorypath +build-target +out/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..81b5a20 --- /dev/null +++ b/pom.xml @@ -0,0 +1,135 @@ + + + + + 4.0.0 + + com.inspur.edp + bff-engine + pom + 0.1.0 + + bff-engine-api + bff-engine-core + + + io.iec.edp + caf-boot-parent + 0.1.2 + + + + 0.2.73 + 0.2.32 + 0.2.16 + 0.3.3 + 0.2.50 + 0.2.15 + + + + + + com.inspur.edp + cef-spi + ${cef.version} + + + com.inspur.edp + cm-engine-api + ${cm.version} + + + com.inspur.edp + cm-engine-core + ${cm.version} + + + com.inspur.edp + bff-api + ${bff.version} + + + com.inspur.edp + bff-core + ${bff.version} + + + com.inspur.edp + formserver-viewmodel + ${bff.designtime.version} + + + com.inspur.edp + cef-designtime-api + ${cef.designtime.version} + + + io.iec.edp + caf-boot-commons-exception + 0.2.4 + + + com.inspur.edp + bef-component + 0.1.0 + + + io.iec.edp + caf-boot-commons-json + 0.3.4 + + + com.inspur.edp + common-component + 0.1.25 + + + com.inspur.edp + lcm-metadata-api + 0.1.34 + + + + + + + + + org.openclover + clover-maven-plugin + 4.3.1 + + false + + + + + + + + gsp-snapshots-repo + https://repos.iec.io/repository/maven-gsp-snapshots/ + + + gsp-releases-repo + https://repos.iec.io/repository/maven-gsp-releases/ + + + diff --git a/style/ubml_checkstyle.xml b/style/ubml_checkstyle.xml new file mode 100644 index 0000000..c63db71 --- /dev/null +++ b/style/ubml_checkstyle.xml @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- Gitee From e18b36b3cab9620776add716a3433193c22fac3f Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Mon, 7 Nov 2022 18:06:18 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feature(bff-engine):=E5=9F=BA=E7=A1=80?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 基础配置 --- bff-engine-api/pom.xml | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 bff-engine-api/pom.xml diff --git a/bff-engine-api/pom.xml b/bff-engine-api/pom.xml new file mode 100644 index 0000000..8b2c873 --- /dev/null +++ b/bff-engine-api/pom.xml @@ -0,0 +1,53 @@ + + + + + + bff-engine + com.inspur.edp + 0.1.0 + + 4.0.0 + + bff-engine-api + + + com.inspur.edp + bef-engine-api + 0.1.13 + + + com.inspur.edp + bff-spi + ${bff.version} + + + com.inspur.edp + cef-spi + 0.2.63 + + + com.inspur.edp + formserver-viewmodel + 0.2.15 + + + + + -- Gitee From 7c5fe9734d8a44018cbeb297b80bdd9936008e39 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Tue, 8 Nov 2022 10:13:46 +0800 Subject: [PATCH 3/3] feature(bff-engine):resourceInfo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 视图模型resourceInfo解析引擎 --- .../resource/BffEngineEntityResourceInfo.java | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 bff-engine-api/src/main/java/com/inspur/edp/bff/engine/api/resource/BffEngineEntityResourceInfo.java diff --git a/bff-engine-api/src/main/java/com/inspur/edp/bff/engine/api/resource/BffEngineEntityResourceInfo.java b/bff-engine-api/src/main/java/com/inspur/edp/bff/engine/api/resource/BffEngineEntityResourceInfo.java new file mode 100644 index 0000000..0cbba7b --- /dev/null +++ b/bff-engine-api/src/main/java/com/inspur/edp/bff/engine/api/resource/BffEngineEntityResourceInfo.java @@ -0,0 +1,130 @@ +/* + * Copyright © OpenAtom Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.inspur.edp.bff.engine.api.resource; + +import com.inspur.edp.bef.bizentity.GspBizEntityElement; +import com.inspur.edp.bef.bizentity.GspBizEntityObject; +import com.inspur.edp.bff.spi.builtin.BffEntityResInfoImpl; +import com.inspur.edp.cef.designtime.api.IGspCommonField; +import com.inspur.edp.cef.designtime.api.element.GspElementObjectType; +import com.inspur.edp.cef.entity.condition.SortCondition; +import com.inspur.edp.cef.spi.entity.resourceInfo.builinImpls.CefModelResInfoImpl; +import com.inspur.edp.das.commonmodel.IGspCommonElement; +import com.inspur.edp.das.commonmodel.IGspCommonObject; +import com.inspur.edp.formserver.viewmodel.GspViewModel; +import com.inspur.edp.formserver.viewmodel.GspViewModelElement; +import com.inspur.edp.formserver.viewmodel.GspViewObject; +import io.iec.edp.caf.common.JSONSerializer; +import org.springframework.util.StringUtils; + +import java.util.List; + +public class BffEngineEntityResourceInfo extends BffEntityResInfoImpl { + + private GspViewObject obj; + private BffEngineModelResInfo modelResInfo; + private GspBizEntityObject beObject; + + public BffEngineEntityResourceInfo(GspViewObject obj,BffEngineModelResInfo modelResInfo, + GspBizEntityObject beObject) { + super(obj.getCode(),obj.getI18nResourceInfoPrefix()+".Name",modelResInfo,modelResInfo.getVo().getID()); + this.obj = obj; + this.modelResInfo = modelResInfo; + this.beObject = beObject; + initColumns1(); + initSorts(); + initChildInfos1(modelResInfo); + } + + private void initSorts() { + if(StringUtils.isEmpty(obj.getOrderbyCondition())) + return; + List sorts; + try { + sorts = JSONSerializer.deserialize(obj.getOrderbyCondition(), List.class, SortCondition.class); + } catch (Exception e) { + throw new RuntimeException( + obj.getBelongModel() != null ? obj.getBelongModel().getCode() + : "" + "节点" + obj.getCode() + "定义的排序条件格式不正确, 请检查", e); + } + if(sorts != null && !sorts.isEmpty()) { + sorts.stream().forEach(sort -> { + IGspCommonElement element = obj.getElementByLabelId(sort.getSortField()); + if(element == null) { + throw new RuntimeException("模型" + obj.getBelongModel().getCode() + "的节点" + obj.getCode() + "上设置的排序字段" + sort.getSortField() + "不存在, 请重新设置排序字段."); + } + if(element.getParentAssociation() != null) { + sort.setSortField(element.getParentAssociation().getBelongElement().getLabelID() + "." + element.getLabelID()); + } + }); + setSorts(sorts); + } + } + + @Override + public boolean isRoot() { + return obj.isRootNode(); + } + + protected void initColumns1() { + super.initColumns(); + for (IGspCommonField field : obj.getContainElements()) { + if(field.getObjectType() == GspElementObjectType.Association && (field.getChildAssociations() ==null + || field.getChildAssociations().size() == 0)){ + continue; + } + GspViewModelElement voElement = (GspViewModelElement)field; + if(field.getIsVirtual() || beObject == null){ + addPropertyInfo(new BffEnginePropInfoGenerator().getDataTypePropertyInfo(voElement, null)); + continue; + } + IGspCommonElement beField = beObject.findElement(voElement.getMapping().getTargetElementId()); + addPropertyInfo(new BffEnginePropInfoGenerator().getDataTypePropertyInfo(voElement, beField == null ? null: (GspBizEntityElement)beField)); + } + } + + @Override + public String getConfigId() { + return obj.getBelongModel().getGeneratedConfigID(); + } + + protected void initChildInfos1(CefModelResInfoImpl modelResInfo) { + if(obj.getContainChildObjects()==null||obj.getContainChildObjects().size()==0) + return; + for(IGspCommonObject childObj:obj.getContainChildObjects()) + { + addChildEntityResInfo(new BffEngineEntityResourceInfo((GspViewObject) childObj, + (BffEngineModelResInfo) modelResInfo,findChildBeObject((GspViewObject)childObj))); + } + } + + private GspBizEntityObject findChildBeObject(GspViewObject childObj) { + if (beObject == null) + return null; + if(childObj.getIsVirtual()) + return null; + return (GspBizEntityObject) beObject.getChildObjectById(childObj.getMapping().getTargetObjId()); + } + public GspViewObject getViewObject() { + return this.obj; + } + + + public GspBizEntityObject getBizEntityObject() { + return this.beObject; + } +} -- Gitee