diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..29f81d812f3e768fa89638d1f72920dbfd1413a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000000000000000000000000000000000000..f9caa0b2eccc930a9d0bb7b40e29c5699a959cc8 --- /dev/null +++ b/README.en.md @@ -0,0 +1,36 @@ +# ui-model + +#### Description +前端UI模型。 + +#### Software Architecture +Software architecture description + +#### Installation + +1. xxxx +2. xxxx +3. xxxx + +#### Instructions + +1. xxxx +2. xxxx +3. xxxx + +#### Contribution + +1. Fork the repository +2. Create Feat_xxx branch +3. Commit your code +4. Create Pull Request + + +#### Gitee Feature + +1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md +2. Gitee blog [blog.gitee.com](https://blog.gitee.com) +3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore) +4. The most valuable open source project [GVP](https://gitee.com/gvp) +5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help) +6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e03e22356684a9684362e64813bd964e084aa363 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# ui-model + +#### 介绍 +前端UI模型。 + +#### 软件架构 +软件架构说明 + + +#### 安装教程 + +1. xxxx +2. xxxx +3. xxxx + +#### 使用说明 + +1. xxxx +2. xxxx +3. xxxx + +#### 参与贡献 + +1. Fork 本仓库 +2. 新建 Feat_xxx 分支 +3. 提交代码 +4. 新建 Pull Request + + +#### 特技 + +1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md +2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) +3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 +4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 +5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) +6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/web-common/src/main/java/com/inspur/edp/web/common/io/FileUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/io/FileUtility.java index 108f2436b09891d0efb34391f5bb4f1ece41c3d3..545c851e7e3288c28993336f8b4abb1390bc908a 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/io/FileUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/io/FileUtility.java @@ -163,7 +163,6 @@ public class FileUtility { } return fileContents; } catch (UnsupportedEncodingException e) { - System.err.println("The OS does not support " + ENCODING); WebLogger.Instance.errorWithCustomMessage(e, "The OS does not support " + ENCODING); return null; } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/logger/WebLogger.java b/web-common/src/main/java/com/inspur/edp/web/common/logger/WebLogger.java index b1d3fcc10c37026dcbb7135d5870900f69dc6840..ab9d629b5b7e5b1ae801aaa0ee560f68abf2f2d3 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/logger/WebLogger.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/logger/WebLogger.java @@ -20,6 +20,7 @@ import com.inspur.edp.web.common.utility.StringUtility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.Arrays; import java.util.function.Function; /** @@ -154,7 +155,7 @@ public enum WebLogger { * @param loggerName */ public void error(Exception ex, String... loggerName) { - this.error(ex.getMessage() + ex.getStackTrace(), loggerName); + this.error(ex.getMessage() + Arrays.toString(ex.getStackTrace()), loggerName); } /** diff --git a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataTypeEnum.java b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataTypeEnum.java index b71444de5edf439bf5972b50bb1098a715d560ae..0b4dadb439da563dead92a087e6c418b02102409 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataTypeEnum.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataTypeEnum.java @@ -18,6 +18,9 @@ package com.inspur.edp.web.common.metadata; import com.inspur.edp.web.common.logger.WebLogger; +import java.util.Arrays; +import java.util.Optional; + /** * 定义元数据类型枚举参数 * @@ -37,6 +40,7 @@ public enum MetadataTypeEnum { public String getName() { return "表单元数据"; } + }, /** * eapi 元数据 @@ -44,7 +48,7 @@ public enum MetadataTypeEnum { Eapi { @Override public String getCode() { - return "Eapi"; + return "ExternalApi"; } @Override @@ -58,7 +62,7 @@ public enum MetadataTypeEnum { Resource { @Override public String getCode() { - return "Resource"; + return "ResourceMetadata"; } @Override @@ -100,7 +104,7 @@ public enum MetadataTypeEnum { Route { @Override public String getCode() { - return "PageFlow"; + return "PageFlowMetadata"; } @Override @@ -136,7 +140,7 @@ public enum MetadataTypeEnum { ViewModel { @Override public String getCode() { - return "ViewModel"; + return "GSPViewModel"; } @Override @@ -165,6 +169,16 @@ public enum MetadataTypeEnum { public abstract String getName(); + /** + * 判断传递的元数据类型是否是对应的枚举类型 + * + * @param metadataType + * @return + */ + public boolean isCurrentMetadataType(String metadataType) { + return this.getCode().equals(metadataType); + } + /** * 执行类型转换 * @@ -173,10 +187,11 @@ public enum MetadataTypeEnum { */ public static MetadataTypeEnum from(String metadataType) { try { - MetadataTypeEnum metadataTypeEnum = MetadataTypeEnum.valueOf(metadataType); - return metadataTypeEnum; + Optional findMetadataType = Arrays.stream(MetadataTypeEnum.values()).filter(t -> t.getCode().equals(metadataType)).findFirst(); + return findMetadataType.orElse(MetadataTypeEnum.Frm); } catch (Exception ex) { WebLogger.Instance.error("元数据类型转换失败,待转换类型为:" + metadataType); + } return MetadataTypeEnum.Frm; } diff --git a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java index 4ee133365ae4648c4983b9ee954d1f201b837e4f..3d62acf6b53650ea612201cb37793381b52aa2e4 100644 --- a/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java +++ b/web-common/src/main/java/com/inspur/edp/web/common/metadata/MetadataUtility.java @@ -237,6 +237,16 @@ public final class MetadataUtility { return MetadataUtilityWithRuntime.getMetadata(metadataId); } + /** + * rtc-viewmodel存在调用 + * 不允许更改对应方法名称 + * @param metadataId + * @return + */ + public GspMetadata getMetadataInRuntime(String metadataId) { + return this.getMetadataWithRuntime(metadataId); + } + /** * 根据元数据相对路径获取工程信息 diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/elements/Schema.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/elements/Schema.java index 251a1f3d57554d06fd93e6abfadbe9f636b9f3c2..496b3a78708e18ccc5d08801748d99439b4c9554 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/elements/Schema.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/elements/Schema.java @@ -23,6 +23,7 @@ import java.util.*; /** * 表单Schema元素 + * * @author guozhiqi */ @Data @@ -77,6 +78,61 @@ public class Schema { SourceType = value; } + private String eapiId; + private String eapiCode; + private String eapiName; + private String eapiNameSpace; + private String voPath; + private String voNameSpace; + + public String getEapiId() { + return eapiId; + } + + public void setEapiId(String eapiId) { + this.eapiId = eapiId; + } + + public String getEapiCode() { + return eapiCode; + } + + public void setEapiCode(String eapiCode) { + this.eapiCode = eapiCode; + } + + public String getEapiName() { + return eapiName; + } + + public void setEapiName(String eapiName) { + this.eapiName = eapiName; + } + + public String getEapiNameSpace() { + return eapiNameSpace; + } + + public void setEapiNameSpace(String eapiNameSpace) { + this.eapiNameSpace = eapiNameSpace; + } + + public String getVoPath() { + return voPath; + } + + public void setVoPath(String voPath) { + this.voPath = voPath; + } + + public String getVoNameSpace() { + return voNameSpace; + } + + public void setVoNameSpace(String voNameSpace) { + this.voNameSpace = voNameSpace; + } + private ArrayList Entities = new ArrayList<>(); public final ArrayList getEntities() { diff --git a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java index 9a980cfee37d0fc973307aac5e4622d45dc6c269..2aac8064fc30f28b73c888f274a9276c4a17cd36 100644 --- a/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java +++ b/web-designschema/src/main/java/com/inspur/edp/web/designschema/synchronization/FormMetadataUpdate.java @@ -25,6 +25,7 @@ import com.inspur.edp.web.common.metadata.MetadataGetterParameter; import com.inspur.edp.web.common.metadata.MetadataTypeEnum; import com.inspur.edp.web.common.metadata.MetadataUtility; import com.inspur.edp.web.common.serialize.SerializeUtility; +import com.inspur.edp.web.common.utility.StringUtility; import com.inspur.edp.web.designschema.elements.Schema; import com.inspur.edp.web.formmetadata.metadata.FormMetadataContent; import io.iec.edp.caf.commons.utils.SpringBeanUtils; @@ -57,7 +58,12 @@ public class FormMetadataUpdate { Synchronizer synchronizer = new Synchronizer(); for (Schema schema : schemaList) { if ("vo".equals(schema.getSourceType())) { - MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(schema.getId(), null, MetadataTypeEnum.ViewModel); + String voPath = StringUtility.getOrDefault(schema.getVoPath(), formMetadata.getRelativePath()); + String voNameSpace = StringUtility.getOrDefault(schema.getVoNameSpace(), formMetadata.getHeader().getNameSpace()); + MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(schema.getId(), voPath, MetadataTypeEnum.ViewModel); + metadataGetterParameter.setTargetMetadataCode(schema.getCode()); + metadataGetterParameter.setTargetMetadataName(schema.getName()); + metadataGetterParameter.setTargetMetadataNamespace(voNameSpace); metadataGetterParameter.setTargetMetadataNotFoundMessage("根据表单元数据获取VO元数据为空,请检查表单元数据module>schemas>id 是否正确,此参数为表单对应VO元数据id参数!"); GspMetadata metadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); diff --git a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java index d692ca09ede0a334ad991e68bff7dc4a0b6a9775..ba2ac03f6150bdbeffd19533623c061c1b201939 100644 --- a/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java +++ b/web-form-jitengine/src/main/java/com/inspur/edp/web/jitengine/JITEngineManager.java @@ -389,13 +389,16 @@ public class JITEngineManager { FormAnalysis formAnalysis = new FormAnalysis(executeEnvironment, isUpdradeTool); AnalysisExternalComponentResult externalVisualDom; - try { + + // 判断是否是弹窗Url形式 + if (item.containsKey("contentType") && item.getOrDefault("type", "").toString().equals("ModalContainer") && item.get("contentType").toString().equals("url")) { + externalVisualDom = null; + // 如果是弹窗URL 那么不解析对应元数据 + } else { externalVisualDom = formAnalysis.analysisExternalComponent(targetStorageBasePath, json.getModule().getCode(), item, webdevpath); - } catch (Exception e) { - WebLogger.Instance.error(e); - return; } + // 如果获取不到对应的表单元数据。针对的是弹窗Url 情况 if (externalVisualDom != null && externalVisualDom.getJson() != null) { // 如果是独立加载表单 那么不再继续执行后续的组合表单文件生成 diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/ComponentUtility.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/ComponentUtility.java index 4fad37cd48dcc95384ffb8ac2d97681bee202686..aeca7c1cc6c82e0a5b1a00303f0c2799f547bc17 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/ComponentUtility.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/ComponentUtility.java @@ -468,7 +468,7 @@ public class ComponentUtility { return this.getValue(component, "control"); } - public HashMap GetListViewContentTemplate(HashMap component) { + public HashMap getContentTemplate(HashMap component) { Object contentTemplate = component.get(Content_Template); // 如果内容模板为字符串 那么不进行提取 @@ -478,6 +478,50 @@ public class ComponentUtility { return GetAttributeObject(component, Content_Template); } + public HashMap getPlaceNameTemplate(HashMap component) { + String placeNameTemplateAttributeName = this.getPlaceNameTemplateAttributeName(); + Object contentTemplate = component.get(placeNameTemplateAttributeName); + + // 如果内容模板为字符串 那么不进行提取 + if (contentTemplate == null || contentTemplate instanceof String) { + return null; + } + return GetAttributeObject(component, placeNameTemplateAttributeName); + } + + public final String getPlaceNameTemplateAttributeName() { + return "placeNameTemplate"; + } + + public HashMap getDetailBadgeTemplate(HashMap component) { + String detailBadgeTemplateAttributeName = this.getDetailBadgeTemplateAttributeName(); + Object contentTemplate = component.get(detailBadgeTemplateAttributeName); + + // 如果内容模板为字符串 那么不进行提取 + if (contentTemplate == null || contentTemplate instanceof String) { + return null; + } + return GetAttributeObject(component, detailBadgeTemplateAttributeName); + } + + public final String getDetailBadgeTemplateAttributeName() { + return "detailBadgeTemplate"; + } + + public HashMap getDetailColumns(HashMap component) { + String detailColumnsAttributeName = this.getDetailColumnsAttributeName(); + Object contentTemplate = component.get(detailColumnsAttributeName); + + // 如果内容模板为字符串 那么不进行提取 + if (contentTemplate == null || contentTemplate instanceof String) { + return null; + } + return GetAttributeObject(component, detailColumnsAttributeName); + } + public final String getDetailColumnsAttributeName() { + return "detailColumns"; + } + public final ArrayList> GetFilterList(HashMap component) { return GetChildComponentCollection(component, "filterList"); @@ -511,6 +555,44 @@ public class ComponentUtility { return GetAttributeObject(component, "groupAggregate"); } + /** + * 获取组件中的alt参数值 + * + * @param component + * @return + */ + public final String getAlt(HashMap component) { + return this.getValue(component, "alt"); + } + + /** + * 获取标签alt的资源key + * + * @return + */ + public final String getAltAttributeName() { + return "alt"; + } + + /** + * 获取imgTitle属性值 + * + * @param component + * @return + */ + public final String getImgTitle(HashMap component) { + return this.getValue(component, "imgTitle"); + } + + /** + * 获取imgTitle的资源项key + * + * @return + */ + public final String getImgTitleAttributeName() { + return "imgTitle"; + } + public final String GetControlAttributeName(HashMap component) { return CONTROL; } diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/I18nResourceStrategyFactory.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/I18nResourceStrategyFactory.java index 4fa328dd9883019162a7f2c2f85461d932251341..f097fe85b95ee3e0a89b8a92746849ff152bdc0d 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/I18nResourceStrategyFactory.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/I18nResourceStrategyFactory.java @@ -103,7 +103,9 @@ public class I18nResourceStrategyFactory { dicComponentStrategies.put(ComponentType.TabToolbarItem, new DefaultComponentI18nResourceStrategy()); dicComponentStrategies.put(ComponentType.DatePicker, new DatePickerI18nResourceStrategy()); dicComponentStrategies.put(ComponentType.RichTextBox, new RichTextBoxI18nResourceStrategy()); - dicComponentStrategies.put(ComponentType.Image, new DefaultComponentI18nResourceStrategy()); + dicComponentStrategies.put(ComponentType.Image, new ImageI18nResourceStrategy()); + + dicComponentStrategies.put(ComponentType.Avatar, new AvatarI18nResourceStrategy()); dicComponentStrategies.put(ComponentType.MultiSelect, new DefaultComponentI18nResourceStrategy()); dicComponentStrategies.put(ComponentType.NumberRange, new NumberRangeI18nResourceStrategy()); diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AbstractI18nResourceStrategy.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AbstractI18nResourceStrategy.java index 88bf4f2888eab6ea2ed49f0684b9d69f22f4d16d..cdab822dd137c9fa66c820d5396b5ddfa85d674a 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AbstractI18nResourceStrategy.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AbstractI18nResourceStrategy.java @@ -19,6 +19,7 @@ package com.inspur.edp.web.formmetadata.i18n.component.strategy.i18nresourcestra import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItem; import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; import com.inspur.edp.web.formmetadata.i18n.I18nResourceItemManager; +import com.inspur.edp.web.formmetadata.i18n.component.ComponentUtility; import com.inspur.edp.web.formmetadata.i18n.component.II18nResourceStrategy; import com.inspur.edp.web.formmetadata.i18n.component.strategy.idstrategy.ComponentIdFactory; import com.inspur.edp.web.formmetadata.i18n.component.strategy.idstrategy.ComponentIdType; @@ -32,6 +33,7 @@ import java.util.HashMap; /** * 组件多语策略抽象类 + * * @author guozhiqi */ public abstract class AbstractI18nResourceStrategy implements II18nResourceStrategy { @@ -60,6 +62,27 @@ public abstract class AbstractI18nResourceStrategy implements II18nResourceStrat return i18nResourceItemCollection; } + /** + * 获取当前参数中的type属性值 + * + * @param currentComponent + * @return + */ + protected String getCurrentComponentType(HashMap currentComponent) { + return ComponentUtility.getInstance().getType(currentComponent); + } + + /** + * 获取当前参数中的id参数值 + * + * @param currentComponent 当前组件实例 + * @return + */ + protected String getCurrentComponentId(HashMap currentComponent) { + return ComponentUtility.getInstance().getId(currentComponent); + } + + /** * 提取组件项 * @@ -67,7 +90,7 @@ public abstract class AbstractI18nResourceStrategy implements II18nResourceStrat * @param currentComponent * @return */ - private I18nResourceItemCollection extractComponentI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) { + private I18nResourceItemCollection extractComponentI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) { // 提取当前组件的Id和Name I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AppointmentCalendarResourceStrategy.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AppointmentCalendarResourceStrategy.java index ee13716bf813348c66499dd36423a7930e51e394..c489254ddd05537d5bc0c89dc71c9e57ce7772bf 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AppointmentCalendarResourceStrategy.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AppointmentCalendarResourceStrategy.java @@ -22,8 +22,10 @@ import com.inspur.edp.web.common.utility.StringUtility; import com.inspur.edp.web.formmetadata.i18n.I18nResourceItemManager; import com.inspur.edp.web.formmetadata.i18n.component.ComponentUtility; import com.inspur.edp.web.formmetadata.i18n.component.I18nResourceUtility; +import com.inspur.edp.web.formmetadata.i18n.constant.I18nResourceConstant; import java.util.HashMap; +import java.util.List; /** * 日历组件参数提取 @@ -61,6 +63,171 @@ public class AppointmentCalendarResourceStrategy extends AbstractI18nResourceStr I18nResourceItem i18nReservationTitleResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedreservationTitleComponentId, reservationTitleValue, reservationTitleValue); i18nResourceItemCollection.add(i18nReservationTitleResourceItem); + // 提取ContentTemplate的国际化参数值 + HashMap contentTemplateComponent = ComponentUtility.getInstance().getContentTemplate(currentComponent); + if (contentTemplateComponent != null && contentTemplateComponent.size() > 0) { + List> contentTemplateFields = ComponentUtility.getInstance().GetFieldsFromContentTemplate(contentTemplateComponent); + String contentTemplateResourceId = ComponentUtility.getInstance().getType(currentComponent) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + + currentComponentId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + "contentTemplate"; + extractTemplateFields(i18nResourceItemBaseId, i18nResourceItemCollection, contentTemplateComponent, contentTemplateFields, contentTemplateResourceId); + } + + // 提取placeNameTemplate + HashMap placeNameTemplateComponent = ComponentUtility.getInstance().getPlaceNameTemplate(currentComponent); + if (placeNameTemplateComponent != null && placeNameTemplateComponent.size() > 0) { + List> placeNameTemplateFields = ComponentUtility.getInstance().GetFieldsFromContentTemplate(placeNameTemplateComponent); + String placeNameTemplateResourceId = ComponentUtility.getInstance().getType(currentComponent) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + + currentComponentId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + ComponentUtility.getInstance().getPlaceNameTemplateAttributeName(); + extractTemplateFields(i18nResourceItemBaseId, i18nResourceItemCollection, placeNameTemplateComponent, placeNameTemplateFields, placeNameTemplateResourceId); + } + + // 提取detailBadgeTemplate + HashMap detailBadgeTemplateComponent = ComponentUtility.getInstance().getDetailBadgeTemplate(currentComponent); + if (detailBadgeTemplateComponent != null && detailBadgeTemplateComponent.size() > 0) { + List> detailBadgeTemplateFields = ComponentUtility.getInstance().GetFieldsFromContentTemplate(detailBadgeTemplateComponent); + String detailBadgeTemplateResourceId = ComponentUtility.getInstance().getType(currentComponent) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + + currentComponentId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + ComponentUtility.getInstance().getDetailBadgeTemplateAttributeName(); + extractTemplateFields(i18nResourceItemBaseId, i18nResourceItemCollection, detailBadgeTemplateComponent, detailBadgeTemplateFields, detailBadgeTemplateResourceId); + } + + + // 提取detailColumns的字段定义 + HashMap detailColumnsComponent = ComponentUtility.getInstance().getDetailColumns(currentComponent); + if (detailColumnsComponent != null && detailColumnsComponent.size() > 0) { + // 提取对应的title标题 + detailColumnsComponent.forEach((key, value) -> { + String detailColumnId = this.getComponentId((HashMap) value); + String detailBadgeTemplateResourceId = ComponentUtility.getInstance().getType(currentComponent) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + + currentComponentId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + ComponentUtility.getInstance().getDetailColumnsAttributeName() + I18nResourceConstant.SECOND_LEVEL_DELIMITER + detailColumnId; + String detailColumnTitleValue = ComponentUtility.getInstance().getTitle((HashMap) value); + I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, detailBadgeTemplateResourceId, detailColumnTitleValue, detailColumnTitleValue); + i18nResourceItemCollection.add(i18nResourceItem); + }); + } + return i18nResourceItemCollection; } + + /** + * 提取Html 模板中的字段定义 + * + * @param i18nResourceItemBaseId + * @param i18nResourceItemCollection + * @param templateComponent + * @param templateFields + * @param templateResourceId + */ + private void extractTemplateFields(String i18nResourceItemBaseId, I18nResourceItemCollection i18nResourceItemCollection, HashMap templateComponent, List> templateFields, String templateResourceId) { + I18nResourceItemCollection resourceItemCollection = extractFieldsI18nResourceItemCollection(i18nResourceItemBaseId, templateResourceId, templateFields); + if (resourceItemCollection != null) { + i18nResourceItemCollection.addRange(resourceItemCollection); + } + HashMap contentTemplateToolbar = ComponentUtility.getInstance().GetAttributeObject(templateComponent, "toolbar"); + if (contentTemplateToolbar != null) { + List> contentTemplateToolbarContents = ComponentUtility.getInstance().GetToolbarContentsFromContentTemplate(contentTemplateToolbar); + if (contentTemplateToolbarContents != null && contentTemplateToolbarContents.size() > 0) { + I18nResourceItemCollection toolbarContentsResourceCollection = extractToolbarContentsI18nResourceItemCollection(i18nResourceItemBaseId, templateResourceId, contentTemplateToolbarContents); + if (toolbarContentsResourceCollection != null) { + i18nResourceItemCollection.addRange(toolbarContentsResourceCollection); + } + } + } + } + + /// + /// 提取枚举属性中多语资源项 + /// + /// + private I18nResourceItemCollection extractToolbarContentsI18nResourceItemCollection(String i18nResourceItemBaseId, + String appointmentCalendarI18nResourceItemBaseId, + List> componentCollection) { + I18nResourceItemCollection templateI18nResourceItemCollection = new I18nResourceItemCollection(); + componentCollection.forEach((component) -> { + String textAtributeValue = ComponentUtility.getInstance().getText(component); + String idAtributeValue = ComponentUtility.getInstance().getId(component); + String typeAttributeValue = ComponentUtility.getInstance().getType(component); + + String generatedComponentId = + appointmentCalendarI18nResourceItemBaseId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + "toobar" + I18nResourceConstant.SECOND_LEVEL_DELIMITER + typeAttributeValue + I18nResourceConstant.SECOND_LEVEL_DELIMITER + idAtributeValue; + + I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedComponentId, textAtributeValue, textAtributeValue); + + if (i18nResourceItem != null) { + templateI18nResourceItemCollection.add(i18nResourceItem); + } + }); + + + return templateI18nResourceItemCollection; + } + + + /// + /// 提取枚举属性中多语资源项 + /// + /// + private I18nResourceItemCollection extractFieldsI18nResourceItemCollection(String i18nResourceItemBaseId, + String appointmentCalendarI18nResourceItemBaseId, + List> componentCollection) { + I18nResourceItemCollection contentTemplateI18nResourceItemCollection = new I18nResourceItemCollection(); + + componentCollection.forEach((component) -> { + com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection i18nResourceItem = getContentTemplateFieldsI18nResourceItem(i18nResourceItemBaseId, appointmentCalendarI18nResourceItemBaseId, component); + if (i18nResourceItem != null) { + contentTemplateI18nResourceItemCollection.addRange(i18nResourceItem); + } + }); + + + return contentTemplateI18nResourceItemCollection; + } + + /// + /// 提取contentTemplate中fields中的具体项 + /// + /// + /// + /// + private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItem(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) { + I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); + String nameAtributeValue = ComponentUtility.getInstance().getName(fieldItemObject); + String idAtributeValue = ComponentUtility.getInstance().getId(fieldItemObject); + String componentId = idAtributeValue; + + String generatedComponentId = enumI18nResourceItemBaseId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + + ComponentUtility.getInstance().getType(fieldItemObject) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + componentId; + + I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedComponentId, nameAtributeValue, nameAtributeValue); + i18nResourceItemCollection.add(i18nResourceItem); + + I18nResourceItemCollection fieldEnumResource = getContentTemplateFieldsI18nResourceItemEnumData(i18nResourceItemBaseId, generatedComponentId, fieldItemObject); + if (fieldEnumResource != null) { + i18nResourceItemCollection.addRange(fieldEnumResource); + } + return i18nResourceItemCollection; + } + + /// + /// 提取contentTemplate中fields中的具体项 + /// + /// + /// + /// + private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItemEnumData(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) { + I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); + + String strValueFieldKey = "value"; + String strTextFieldKey = "name"; + + // 从enumData中提取多语资源项 + List> enumValueCollection = ComponentUtility.getInstance().GetEnumData(fieldItemObject); + String enumDataAttributeName = ComponentUtility.getInstance().GetEnumDataName(fieldItemObject); + + I18nResourceItemCollection enumDataI18nResourceItemCollection = I18nResourceUtility.GetInstance().ExtractEnumDataI18nResourceItemCollection(i18nResourceItemBaseId, enumI18nResourceItemBaseId, enumValueCollection, enumDataAttributeName, strValueFieldKey, strTextFieldKey); + if (enumDataI18nResourceItemCollection != null && enumDataI18nResourceItemCollection.size() > 0) { + i18nResourceItemCollection.addRange(enumDataI18nResourceItemCollection); + } + return i18nResourceItemCollection; + } + } diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AvatarI18nResourceStrategy.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AvatarI18nResourceStrategy.java new file mode 100644 index 0000000000000000000000000000000000000000..e06b49c893ba2bd6bd4f4ca96ec2671ad75a41a3 --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/AvatarI18nResourceStrategy.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd. + * + * 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.web.formmetadata.i18n.component.strategy.i18nresourcestrategy; + +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItem; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; +import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.formmetadata.i18n.I18nResourceItemManager; +import com.inspur.edp.web.formmetadata.i18n.component.ComponentUtility; + +import java.util.HashMap; + +/** + * 头像组件国际化参数提取 + * @author guozhiqi + */ +public class AvatarI18nResourceStrategy extends AbstractI18nResourceStrategy{ + @Override + protected I18nResourceItemCollection extractAttributeI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) { + I18nResourceItemCollection i18nResourceItemCollection=new I18nResourceItemCollection(); + + String currentComponentType = this.getCurrentComponentType(currentComponent); + String currentComponentId = this.getCurrentComponentId(currentComponent); + if (StringUtility.isNullOrEmpty(currentComponentType) || StringUtility.isNullOrEmpty(currentComponentId)) { + return null; + } + + // 使用合并属性的名称作为组件id + // 提取Image的alt属性参数值 + String imgTitleResourceKey = ComponentUtility.getInstance().getImgTitleAttributeName(); + String generatedImgTitleComponentId = currentComponentType + "/" + currentComponentId + "/" + imgTitleResourceKey; + String imgTitleValue = ComponentUtility.getInstance().getImgTitle(currentComponent); + I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedImgTitleComponentId, imgTitleValue, imgTitleValue); + i18nResourceItemCollection.add(i18nResourceItem); + + return i18nResourceItemCollection; + + } +} diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ImageI18nResourceStrategy.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ImageI18nResourceStrategy.java new file mode 100644 index 0000000000000000000000000000000000000000..2d3b6d11e9a730ec3453a507a08b7a1b0586484e --- /dev/null +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ImageI18nResourceStrategy.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd. + * + * 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.web.formmetadata.i18n.component.strategy.i18nresourcestrategy; + +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItem; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; +import com.inspur.edp.web.common.utility.StringUtility; +import com.inspur.edp.web.formmetadata.i18n.I18nResourceItemManager; +import com.inspur.edp.web.formmetadata.i18n.component.ComponentUtility; +import com.inspur.edp.web.formmetadata.i18n.component.strategy.namestrategy.ComponentNameFactory; +import com.inspur.edp.web.formmetadata.i18n.component.strategy.namestrategy.ComponentNameType; +import com.inspur.edp.web.formmetadata.i18n.component.strategy.namestrategy.IComponentNameStrategy; + +import java.util.HashMap; + +public class ImageI18nResourceStrategy extends AbstractI18nResourceStrategy { + /** + * 使用title作为文本 + */ + @Override + protected String getComponentName(HashMap component) { + IComponentNameStrategy componentNameStrategy = ComponentNameFactory.getInstance().creatComponentNameStrategy(ComponentNameType.TITLE); + if (componentNameStrategy == null) { + return null; + } + + return componentNameStrategy.getComponentName(component); + } + @Override + protected I18nResourceItemCollection extractAttributeI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) { + I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); + + String currentComponentType = this.getCurrentComponentType(currentComponent); + String currentComponentId = this.getCurrentComponentId(currentComponent); + if (StringUtility.isNullOrEmpty(currentComponentType) || StringUtility.isNullOrEmpty(currentComponentId)) { + return null; + } + + // 使用合并属性的名称作为组件id + // 提取Image的alt属性参数值 + String altResourceKey = ComponentUtility.getInstance().getAltAttributeName(); + String generatedAltComponentId = currentComponentType + "/" + currentComponentId + "/" + altResourceKey; + String altValue = ComponentUtility.getInstance().getAlt(currentComponent); + I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedAltComponentId, altValue, altValue); + i18nResourceItemCollection.add(i18nResourceItem); + + return i18nResourceItemCollection; + } +} diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ListViewII18nResourceStrategy.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ListViewII18nResourceStrategy.java index fadab406d2d1f843f60538b5ef8c2ce645d9719a..6bb217cbb9e5878c3fd0d28d49b57f5594630f79 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ListViewII18nResourceStrategy.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/i18n/component/strategy/i18nresourcestrategy/ListViewII18nResourceStrategy.java @@ -32,42 +32,36 @@ import java.util.List; * @author Noah Guo * @date 2021/02/26 */ -public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy { +public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy { @Override - protected I18nResourceItemCollection extractAttributeI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) - { + protected I18nResourceItemCollection extractAttributeI18nResourceItemCollection(String i18nResourceItemBaseId, HashMap currentComponent) { I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); // 提取contentTemplate中的fields值 // 从tagData中提取多语资源项 - HashMap listViewContentTemplate = ComponentUtility.getInstance().GetListViewContentTemplate(currentComponent); - if (listViewContentTemplate == null || listViewContentTemplate.size() == 0) - { + HashMap listViewContentTemplate = ComponentUtility.getInstance().getContentTemplate(currentComponent); + if (listViewContentTemplate == null || listViewContentTemplate.size() == 0) { return i18nResourceItemCollection; } String strListViewId = ComponentUtility.getInstance().getId(currentComponent); - List> contentTemplateFields = ComponentUtility.getInstance().GetFieldsFromContentTemplate(listViewContentTemplate); + List> contentTemplateFields = ComponentUtility.getInstance().GetFieldsFromContentTemplate(listViewContentTemplate); String listViewResourceId = ComponentUtility.getInstance().getType(currentComponent) + I18nResourceConstant.SECOND_LEVEL_DELIMITER + strListViewId + I18nResourceConstant.SECOND_LEVEL_DELIMITER + "contentTemplate"; I18nResourceItemCollection resourceItemCollection = extractFieldsI18nResourceItemCollection(i18nResourceItemBaseId, listViewResourceId, contentTemplateFields); - if (resourceItemCollection != null) - { + if (resourceItemCollection != null) { i18nResourceItemCollection.addRange(resourceItemCollection); } HashMap contentTemplateToolbar = ComponentUtility.getInstance().GetAttributeObject(listViewContentTemplate, "toolbar"); - if (contentTemplateToolbar != null) - { + if (contentTemplateToolbar != null) { List> contentTemplateToolbarContents = ComponentUtility.getInstance().GetToolbarContentsFromContentTemplate(contentTemplateToolbar); - if (contentTemplateToolbarContents != null && contentTemplateToolbarContents.size() > 0) - { + if (contentTemplateToolbarContents != null && contentTemplateToolbarContents.size() > 0) { I18nResourceItemCollection toolbarContentsResourceCollection = extractToolbarContentsI18nResourceItemCollection(i18nResourceItemBaseId, listViewResourceId, contentTemplateToolbarContents); - if (toolbarContentsResourceCollection != null) - { + if (toolbarContentsResourceCollection != null) { i18nResourceItemCollection.addRange(toolbarContentsResourceCollection); } } @@ -75,16 +69,16 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy return i18nResourceItemCollection; } + /// /// 提取枚举属性中多语资源项 /// /// private I18nResourceItemCollection extractToolbarContentsI18nResourceItemCollection(String i18nResourceItemBaseId, String listViewI18nResourceItemBaseId, - List> componentCollection) - { + List> componentCollection) { I18nResourceItemCollection contentTemplateI18nResourceItemCollection = new I18nResourceItemCollection(); - componentCollection.forEach((component)->{ + componentCollection.forEach((component) -> { String textAtributeValue = ComponentUtility.getInstance().getText(component); String idAtributeValue = ComponentUtility.getInstance().getId(component); String typeAttributeValue = ComponentUtility.getInstance().getType(component); @@ -94,8 +88,7 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy I18nResourceItem i18nResourceItem = I18nResourceItemManager.createI18nResourceItem(i18nResourceItemBaseId, generatedComponentId, textAtributeValue, textAtributeValue); - if (i18nResourceItem != null) - { + if (i18nResourceItem != null) { contentTemplateI18nResourceItemCollection.add(i18nResourceItem); } }); @@ -111,14 +104,12 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy /// private I18nResourceItemCollection extractFieldsI18nResourceItemCollection(String i18nResourceItemBaseId, String listViewI18nResourceItemBaseId, - List> componentCollection) - { + List> componentCollection) { I18nResourceItemCollection contentTemplateI18nResourceItemCollection = new I18nResourceItemCollection(); - componentCollection.forEach((component)->{ + componentCollection.forEach((component) -> { com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection i18nResourceItem = getContentTemplateFieldsI18nResourceItem(i18nResourceItemBaseId, listViewI18nResourceItemBaseId, component); - if (i18nResourceItem != null) - { + if (i18nResourceItem != null) { contentTemplateI18nResourceItemCollection.addRange(i18nResourceItem); } }); @@ -133,8 +124,7 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy /// /// /// - private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItem(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) - { + private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItem(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) { I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); String nameAtributeValue = ComponentUtility.getInstance().getName(fieldItemObject); String idAtributeValue = ComponentUtility.getInstance().getId(fieldItemObject); @@ -147,8 +137,7 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy i18nResourceItemCollection.add(i18nResourceItem); I18nResourceItemCollection fieldEnumResource = getContentTemplateFieldsI18nResourceItemEnumData(i18nResourceItemBaseId, generatedComponentId, fieldItemObject); - if (fieldEnumResource != null) - { + if (fieldEnumResource != null) { i18nResourceItemCollection.addRange(fieldEnumResource); } return i18nResourceItemCollection; @@ -160,8 +149,7 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy /// /// /// - private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItemEnumData(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) - { + private I18nResourceItemCollection getContentTemplateFieldsI18nResourceItemEnumData(String i18nResourceItemBaseId, String enumI18nResourceItemBaseId, HashMap fieldItemObject) { I18nResourceItemCollection i18nResourceItemCollection = new I18nResourceItemCollection(); String strValueFieldKey = "value"; @@ -172,8 +160,7 @@ public class ListViewII18nResourceStrategy extends AbstractI18nResourceStrategy String enumDataAttributeName = ComponentUtility.getInstance().GetEnumDataName(fieldItemObject); I18nResourceItemCollection enumDataI18nResourceItemCollection = I18nResourceUtility.GetInstance().ExtractEnumDataI18nResourceItemCollection(i18nResourceItemBaseId, enumI18nResourceItemBaseId, enumValueCollection, enumDataAttributeName, strValueFieldKey, strTextFieldKey); - if (enumDataI18nResourceItemCollection != null && enumDataI18nResourceItemCollection.size() > 0) - { + if (enumDataI18nResourceItemCollection != null && enumDataI18nResourceItemCollection.size() > 0) { i18nResourceItemCollection.addRange(enumDataI18nResourceItemCollection); } return i18nResourceItemCollection; diff --git a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/replication/FormMetadataVoManager.java b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/replication/FormMetadataVoManager.java index 1dc9da255f37c238653e2733d883f678c3d8eb8d..c9bbc1069e636a78163cd6add60767531396fb53 100644 --- a/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/replication/FormMetadataVoManager.java +++ b/web-form-metadata/src/main/java/com/inspur/edp/web/formmetadata/replication/FormMetadataVoManager.java @@ -49,7 +49,12 @@ class FormMetadataVoManager { // 如果不存在对应的voId 那么无法进行vo拷贝 continue; } - MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(viewObjectId, sourceFormMetadata.getRelativePath(), MetadataTypeEnum.ViewModel); + String voSpacePath = StringUtility.getOrDefault(schema.getOrDefault("voPath", "").toString(), sourceFormMetadata.getRelativePath()); + String voNameSpace = StringUtility.getOrDefault(schema.getOrDefault("voNameSpace", "").toString(), sourceFormMetadata.getHeader().getNameSpace()); + MetadataGetterParameter metadataGetterParameter = MetadataGetterParameter.getNewInstance(viewObjectId, voSpacePath, MetadataTypeEnum.ViewModel); + metadataGetterParameter.setTargetMetadataCode(schema.getOrDefault("code", "").toString()); + metadataGetterParameter.setTargetMetadataName(schema.getOrDefault("name", "").toString()); + metadataGetterParameter.setTargetMetadataNamespace(voNameSpace); metadataGetterParameter.setSourceMetadata(sourceFormMetadata, MetadataTypeEnum.Frm); GspMetadata viewObjectMetadata = MetadataUtility.getInstance().getMetadataWithDesign(metadataGetterParameter); diff --git a/web-frontendproject-api/src/main/java/com/inspur/edp/web/frontendproject/entity/ChosenFormItem.java b/web-frontendproject-api/src/main/java/com/inspur/edp/web/frontendproject/entity/ChosenFormItem.java index e3e46599730ced69b99bd9e3651f3dab0af3cd2d..ef2cdc86d3dfce35bbb0dd0e25067271d86af059 100644 --- a/web-frontendproject-api/src/main/java/com/inspur/edp/web/frontendproject/entity/ChosenFormItem.java +++ b/web-frontendproject-api/src/main/java/com/inspur/edp/web/frontendproject/entity/ChosenFormItem.java @@ -46,6 +46,11 @@ public class ChosenFormItem { return super.equals(o); } + @Override + public int hashCode() { + return super.hashCode(); + } + @Override public String toString() { return "ChosenFormItem [formCode=" + formCode +", isForceDynamicForm=" diff --git a/web-frontendproject/src/main/java/com/inspur/edp/web/frontendproject/FrontendProjectManager.java b/web-frontendproject/src/main/java/com/inspur/edp/web/frontendproject/FrontendProjectManager.java index 86c4eea72a232d716d19af5832b77d555f3168f8..b208f0de865948fcca109f3770605c03703c43bc 100644 --- a/web-frontendproject/src/main/java/com/inspur/edp/web/frontendproject/FrontendProjectManager.java +++ b/web-frontendproject/src/main/java/com/inspur/edp/web/frontendproject/FrontendProjectManager.java @@ -35,7 +35,7 @@ public class FrontendProjectManager { } private static class FrontendProjectManagerInstance { - public static FrontendProjectManager frontendProjectManager = new FrontendProjectManager(); + public static final FrontendProjectManager frontendProjectManager = new FrontendProjectManager(); } public static FrontendProjectManager getInstance() {