diff --git a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md b/.gitee/ISSUE_TEMPLATE.en.md similarity index 58% rename from .gitee/ISSUE_TEMPLATE/BUG_REPORT.md rename to .gitee/ISSUE_TEMPLATE.en.md index 19012cbf0f9a7033ea13af1a80a904749b024834..9621fe3a9e31658d9474dad0fa2fb503b08fd4fd 100644 --- a/.gitee/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.gitee/ISSUE_TEMPLATE.en.md @@ -1,11 +1,9 @@ ---- -name: Bug Report -about: If you would like to report a issue to Seata, please use this template. +- [ ] I have searched the [issues](https://gitee.com/ubml/ubml-impl/issues) of this repository and believe that this is not a duplicate. ---- +**For English Issue titles, Please start with `bug:` if you want to report bugs, `feature:` for features as well.** -- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate. +**Please choose right tags for this issue.** ### Ⅰ. Issue Description diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..9057e6acb8e7e0fdf02ac227cc116585f2721341 --- /dev/null +++ b/.gitee/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,36 @@ + +- [ ] 请确认已经搜索[issues](https://gitee.com/ubml/ubml-impl/issues)并且没有发现重复的问题 + +**中文Issue标题, 如果反馈Bug,请以`bug:`开头。反馈特性请以`特性:`开头。** + +**请选择恰当的Issue标签** + +### Ⅰ. Issue描述 + + +### Ⅱ. 请描述发生了什么 + + 如果存在异常,请贴出异常堆栈信息: + +``` +请将异常堆栈信息粘贴在此处! +``` + + +### Ⅲ. 请描述你的期望 + + +### Ⅳ. 如何复现 (请尽可能的精确和细致) + +1. xxx +2. xxx +3. xxx + +### Ⅴ. 还有什么我们需要了解的? + + +### Ⅵ. 环境信息: + +- JDK version : +- OS : +- Others: \ No newline at end of file diff --git a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md deleted file mode 100644 index b386516a53a1704182b07122b6b38059eb036a87..0000000000000000000000000000000000000000 --- a/.gitee/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: Feature Request -about: Suggest an idea for Seata - ---- - -## Why you need it? - Is your feature request related to a problem? Please describe in details - - -## How it could be? -A clear and concise description of what you want to happen. You can explain more about input of the feature, and output of it. - - -## Other related information -Add any other context or screenshots about the feature request here. \ No newline at end of file diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.en.md similarity index 41% rename from .gitee/PULL_REQUEST_TEMPLATE.md rename to .gitee/PULL_REQUEST_TEMPLATE.en.md index d773ccbc865175fdc70965768393920e85ca9b3e..e6a2542c70b7d0c1d92d9c5249dacd99d6564b1f 100644 --- a/.gitee/PULL_REQUEST_TEMPLATE.md +++ b/.gitee/PULL_REQUEST_TEMPLATE.en.md @@ -1,5 +1,7 @@ +For English PR titles, **Please start with one of the following prefixes**: `feature:`/`bugfix:`/`optimize:`/`docs:`/`test:`/`refactor:` + ### Ⅰ. Describe what this PR did @@ -7,11 +9,18 @@ -### Ⅲ. Why don't you add test cases (unit test/integration test)? +### Ⅲ. Change type +- [ ] feature +- [ ] bugfix +- [ ] optimize +- [ ] docs +- [ ] test +- [ ] refactor +### Ⅳ. Why don't you add test cases (unit test/integration test)? -### Ⅳ. Describe how to verify it +### Ⅴ. Describe how to verify it -### Ⅴ. Special notes for reviews +### Ⅵ. Special notes for reviews diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..2925fd42b420b80738e2a09a1e94261388487994 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md @@ -0,0 +1,26 @@ + + +**中文PR标题**,**必须以**`特性:`、`修复:`、`优化:`、`文档:`、`测试:`、`重构:`**开头** + +### Ⅰ. 请描述本地提交所做内容 + + +### Ⅱ. 本次提交是否修复了某个Issue? + + + +### Ⅲ. 本次修改类型 +- [ ] 特性 +- [ ] 修复 +- [ ] 优化 +- [ ] 文档 +- [ ] 测试 +- [ ] 重构 + +### Ⅲ. 为什么没有添加测试用例 (单元测试/集成测试)? + + +### Ⅳ. 请描述如何验证提交内容 + + +### Ⅴ. 特殊备注 diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 43d9d3970d5ab9c20e3bd710a0c72b8b7f859f89..64af177bf536c5d2466c11e61fb1b060d0cfa847 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,18 @@ +# +# 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. +# + # distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip distributionUrl=http://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a119810d607c9274d6174d0b0304e3ec5f6007df..a76991219ece4c8507619a9e91bd7c29e8d1b0c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,88 +1,87 @@ -# Contributing to UBML +# 为UBML做出贡献 -It is warmly welcomed if you have interest to hack on UBML. First, we encourage this kind of willing very much. And here is a list of contributing guide for you. +首先,热烈欢迎对UBML感兴趣的你。我们非常鼓励这种意愿。这里有一份对你有帮助的指南。 -## Topics +## 主题 -* [Reporting security issues](#reporting-security-issues) -* [Reporting general issues](#reporting-general-issues) -* [Code and doc contribution](#code-and-doc-contribution) -* [Test case contribution](#test-case-contribution) -* [Engage to help anything](#engage-to-help-anything) -* [Code Style](#code-style) +* [报告安全性问题](#reporting-security-issues) +* [报告一般性问题](#reporting-general-issues) +* [贡献文档和代码](#code-and-doc-contribution) +* [贡献测试用例](#test-case-contribution) +* [参与任何有帮助的事请](#engage-to-help-anything) +* [的艾玛书写风格](#code-style) -## Reporting security issues +## 报告安全性问题 -Security issues are always treated seriously. As our usual principle, we discourage anyone to spread security issues. If you find a security issue of UBML, please do not discuss it in public and even do not open a public issue. Instead we encourage you to send us a private email to [ubml_user@groups.163.com](mailto:ubml_user@groups.163.com) or [ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)to report this. +安全问题永远会被认真对待。按照我们一贯的原则,我们不鼓励任何人传播安全问题。如果你发现了一个UBML的安全问题,请不要公开讨论它,并且不要放到公共问题中。我们鼓励您向[ubml_user@groups.163.com](mailto:ubml_user@groups.163.com)或[ubml_dev@groups.163.com](mailto:ubml_dev@groups.163.com)发送私人电子邮件报告此事。 -## Reporting general issues +## 报告一般性问题 -To be honest, we regard every user of UBML as a very kind contributor. After experiencing UBML, you may have some feedback for the project. Then feel free to open an issue via [NEW ISSUE](http://open.inspur.com/open-igix/ubml/issues/new). +平心而论,我们认为UBML的每一个用户都是非常友善的贡献者。在体验过UBML之后,您可能会对项目有一些反馈。然后通过[新建问题](http://open.inspur.com/open-igix/ubml/issues/new)自由地创建一个问题。 -Since we collaborate project UBML in a distributed way, we appreciate **WELL-WRITTEN**, **DETAILED**, **EXPLICIT** issue reports. To make the communication more efficient, we wish everyone could search if your issue is an existing one in the searching list. If you find it existing, please add your details in comments under the existing issue instead of opening a brand new one. +因为我们是以分布式的方式协作项目UBML,所以我们青睐**写得很好的**,**详细的**,**明确的**问题报告。为了使交流更有效率,我们希望每个人都可以提问前先搜索你的问题是否存在于列表中。如果您发现它存在,请在现有问题下的评论中添加您的详细信息,而不是开一个全新的问题。 -To make the issue details as standard as possible, we setup an [ISSUE TEMPLATE](./.gitee/ISSUE_TEMPLATE) for issue - reporters. Please **BE SURE** to follow the instructions to fill fields in template. +为了使问题细节尽可能标准化,我们为问题设置了一个[问题模板](./.gitee/ISSUE_TEMPLATE) +记者。请**确保**按照说明填写模板中的字段。 -There are a lot of cases when you could open an issue: +很多情况下,你可以开启一个提问: -* bug report -* feature request -* performance issues -* feature proposal -* feature design -* help wanted -* doc incomplete -* test improvement -* any questions on project -* and so on +*错误报告 +*功能要求 +*性能问题 +*功能建议 +*功能设计 +*寻求帮助 +*文档缺失 +*测试改进 +*任何项目中的问题 +*等等 -Also we must remind that when filling a new issue, please remember to remove the sensitive data from your post. Sensitive data could be password, secret key, network locations, private business data and so on. +我们也必须提醒您,当填写一个新的问题时,请记得从您的帖子中删除敏感数据。敏感数据包含密码、密钥、网络位置、私有业务数据等等。 -## Code and doc contribution +## 贡献文档和代码 -Every action to make project UBML better is encouraged. On GitHub, every improvement for UBML could be via a PR (short for pull request). +我们鼓励每一个使UBML项目更好的行为。在GitHub上,UBML的每一个改进都可以通过一个PR (pull request的缩写)实现。 -* If you find a typo, try to fix it! -* If you find a bug, try to fix it! -* If you find some redundant codes, try to remove them! -* If you find some test cases missing, try to add them! -* If you could enhance a feature, please **DO NOT** hesitate! -* If you find code implicit, try to add comments to make it clear! -* If you find code ugly, try to refactor that! -* If you can help to improve documents, it could not be better! -* If you find document incorrect, just do it and fix that! -* ... +*如果你发现一个拼写错误,试着修复它! +*如果你发现一个bug,试着修复它! +*如果你发现一些多余的代码,试着删除它们! +*如果你发现一些测试用例缺失,尝试添加它们! +*如果您可以增强一个功能,请**不要**犹豫! +*如果你发现代码是不易理解的,试着添加注释使它更明确! +*如果你发现代码很丑,试着重构它! +*如果你能帮助改进文档,那就再好不过了! +*如果你发现文档不正确,请立刻修复它! +*…… -Actually it is impossible to list them completely. Just remember one principle: +实际上,我们不可能把它们全部列出来。只要记住一个原则: -> WE ARE LOOKING FORWARD TO ANY PR FROM YOU. +> 我们期待着你的任何PR。 -Since you are ready to improve UBML with a PR, we suggest you could take a look at the PR rules here. +既然您已经准备好用PR来改进UBML,我们建议您可以在这里查看一下PR规则。 -* [Workspace Preparation](#workspace-preparation) -* [Branch Definition](#branch-definition) -* [Commit Rules](#commit-rules) -* [PR Description](#pr-description) +*(准备工作区)(# workspace-preparation) +*(定义分支)(# branch-definition) +*(提交规则) (# commit-rules) +*(PR说明)(# pr-description) -### Workspace Preparation +### 工作区准备 -To put forward a PR, we assume you have registered a GitHub ID. Then you could finish the preparation in the following steps: +为了提一个PR,如果您已经注册了GitHub ID,那么您可以按照以下步骤进行准备: -1. **FORK** UBML to your repository. To make this work, you just need to click the button Fork in right-left of [ubml -/ubml-standard](https://gitee.com/ubml/ubml-standard) main page. Then you will end up with your repository in `https -://gitee.com//ubml-standard`, in which `your-username` is your Gitee username. +1. **FORK** UBML到你的本地代码库。要做到这一点,您只需要单击[ubml +/ubml-standard](https://gitee.com/ubml/ubml-standard)主页右侧的Fork按钮。然后您将在 `https://gitee.com//ubml-standard`获取到,其中`your-username`是你的Gitee用户名。 -1. **CLONE** your own repository to develop locally. Use `git clone git@gitee.com:/ubml-impl.git` to clone repository to your local machine. Then you can create new branches to finish the change you wish to make. +1. **克隆**到本地自己的开发仓库。使用`git clone git@gitee.com:/ubml-impl.git`将代码库克隆到本地。然后,您可以创建新的分支来完成您希望进行的更改。 -1. **Set Remote** upstream to be `git@gitee.com:ubml/ubml-impl.git` using the following two commands: +1. **设置远程仓库地址** 使用如下两条命令更新远程链接为`git@gitee.com:ubml/ubml-impl.git`: ``` git remote add upstream git@giteee.com:ubml/ubml-impl.git git remote set-url --push upstream no-pushing ``` -With this remote setting, you can check your git remote configuration like this: +完成这个远程设置,你可以像这样检查你的git远程配置: ``` $ git remote -v @@ -92,105 +91,100 @@ upstream git@gitee.com:ubml/ubml-impl.git (fetch) upstream no-pushing (push) ``` -Adding this, we can easily synchronize local branches with upstream branches. +通过添加这个功能,我们可以很容易地同步本地分支和远程分支。 -### Branch Definition +### 分支合并 -Right now we assume every contribution via pull request is for [branch develop](https://gitee.com/ubml/ubml-standard -/tree/develop) in UBML. Before contributing, be aware of branch definition would help a lot. +现在,我们假设每个通过pull请求的贡献都是为了UBML[分支发展](https://gitee.com/ubml/ubml-standard/tree/develop)。在做出贡献之前,了解分支定义将会有很大帮助。 -As a contributor, keep in mind again that every contribution via pull request is for branch develop. While in project - UBML, there are several other branches, we generally call them release branches(such as 0.9.0,0.9.1), feature branches, hotfix branches and master branch. +作为贡献者,再次记住,通过pull请求的每个提交都是为了分支开发。而在UBML项目 +,还有其他几个分支,我们通常称之为发布分支(比如0.9.0,0.9.1),特性分支,热修复分支和主分支。 -When officially releasing a version, there will be a release branch and named with the version number. +当正式发布一个版本时,会有一个发布分支并以版本号命名。 -After the release, we will merge the commit of the release branch into the master branch. +在发布之后,我们将把发布分支的提交合并到主分支中。 -When we find that there is a bug in a certain version, we will decide to fix it in a later version or fix it in a specific hotfix version. When we decide to fix the hotfix version, we will checkout the hotfix branch based on the corresponding release branch, perform code repair and verification, and merge it into the develop branch and the master branch. +当我们发现某个版本有bug时,我们会决定在以后的版本中修复它,或者在特定的热修复版本中修复它。当我们决定修复热修复版本时,我们将基于相应的发布分支检出热修复分支,执行代码修复和验证,并将其合并到开发分支和主分支中。 -For larger features, we will pull out the feature branch for development and verification. +对于更大的特性,我们将抽出特性分支进行开发和验证。 -### Commit Rules +### 提交规则 -Actually in UBML, we take two rules serious when committing: +实际上,在UBML中,我们在提交时会参考两个原则: -* [Commit Message](#commit-message) -* [Commit Content](#commit-content) +* [提交消息](#commit-message) +* [提交内容](#commit-content) -#### Commit Message +#### 提交消息 -Commit message could help reviewers better understand what is the purpose of submitted PR. It could help accelerate the code review procedure as well. We encourage contributors to use **EXPLICIT** commit message rather than ambiguous message. In general, we advocate the following commit message type: +提交消息可以帮助审稿人更好地理解提交的PR的目的。 它还可以帮助加快代码审查过程。 我们鼓励贡献者使用** EXPLICIT **提交消息而不是模棱两可的消息。 一方面,我们通常提倡以下提交消息类型: -* docs: xxxx. For example, "docs: add docs about ubml-models introduction". -* feature: xxxx.For example, "feature: support VO customization". -* bugfix: xxxx. For example, "bugfix: fix panic when input nil parameter". -* refactor: xxxx. For example, "refactor: simplify to make codes more readable". -* test: xxx. For example, "test: add unit test case for func InsertIntoArray". -* other readable and explicit expression ways. +* docs: xxxx. 例如, "docs: add docs about ubml-models introduction". +* feature: xxxx.例如, "feature: support VO customization". +* bugfix: xxxx. 例如, "bugfix: fix panic when input nil parameter". +* refactor: xxxx. 例如, "refactor: simplify to make codes more readable". +* test: xxx. 例如, "test: add unit test case for func InsertIntoArray". +* 其他可读和显式的表达方式. -On the other side, we discourage contributors from committing message like the following ways: +另一方面,我们不鼓励贡献者像以下方式提交消息: * ~~fix bug~~ * ~~update~~ * ~~add doc~~ -If you get lost, please see [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) for a start. +如果你现在有点懵, 请参考 [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/) 从头开始学习^^. -#### Commit Content +#### 提交内容 -Commit content represents all content changes included in one commit. We had better include things in one single commit which could support reviewer's complete review without any other commits' help. In another word, contents in one single commit can pass the CI to avoid code mess. In brief, there are three minor rules for us to keep in mind: +提交内容表示一次提交中包含的所有内容更改。 我们最好将所有内容包含在一个提交中,这样可以在没有任何其他提交帮助的情况下支持审阅者的完整审阅。 换句话说,一次提交中的内容(应当)是可以通过CI的,以避免代码混乱。 简而言之,我们要记住三个小规则: -* avoid very large change in a commit; -* complete and reviewable for each commit. -* check git config(`user.name`, `user.email`) when committing to ensure that it is associated with your github ID. +* 一次提交避免特别大的修改; +* 每次提交均应当完整且可审查. +* 提交时,检查git配置项(`user.name`, `user.email`) ,确保它与您的github ID相匹配. -In addition, in the code change part, we suggest that all contributors should read the [code style of UBML](#code-style). +另外,在代码更改部分,我们建议所有贡献者都应阅读UBML的 [代码样式](#代码样式). -No matter commit message, or commit content, we do take more emphasis on code review. +无论提交消息还是提交内容,我们都更加注重代码审查. -### PR Description +### PR 说明 -PR is the only way to make change to UBML project files. To help reviewers better get your purpose, PR description - could not be too detailed. We encourage contributors to follow the [PR template](./.gitee/PULL_REQUEST_TEMPLATE.md - ) to finish the pull request. +PR是更改UBML项目文件的唯一方法。 为了帮助审稿人更好地达到目标,PR说明不能太详细. 我们鼓励贡献者遵循 [PR 模板](./.gitee/PULL_REQUEST_TEMPLATE.md) 完成拉取请求. -## Test case contribution +## 测试用例贡献 -Any test case would be welcomed. Currently, UBML function test cases are high priority. +欢迎任何测试用例. 当前, UBML 功能性测试的优先级是最高的. -* For unit test, you need to create a test file named `xxxTest.java` in the test directory of the same module. Recommend you to use the junit5 UT framework +* 对于单元测试,您需要在同一模块的测试目录中创建一个名为`xxxTest.java` . 推荐您使用 junit5 UT 框架 +* 对于集成测试,可以将集成测试放在测试目录或UBML-test模块中。 建议使用模仿测试框架. -* For integration test, you can put the integration test in the test directory or the UBML-test module. It is recommended to use the mockito test framework. +## 致力于帮助任何事情 -## Engage to help anything +我们选择Gitee作为UBML合作的主要场所。 所以这里是UBML最新更新的.虽然通过PR贡献是一种明确的帮助方式,我们仍然鼓励其他方式. -We choose Gitee as the primary place for UBML to collaborate. So the latest updates of UBML are always here. Although - contributions via PR is an explicit way to help, we still call for any other ways. +* 如果可以的话,回复他人的问题; +* 帮助解决其他用户的问题; +* 帮助审查他人的PR设计; +* 帮助查看PR中其他人的代码; +* 讨论有关UBML的问题,以使事情更加明确; +* 在GitHub之外倡导UBML技术; +* 在UBML上撰写博客,等等. -* reply to other's issues if you could; -* help solve other user's problems; -* help review other's PR design; -* help review other's codes in PR; -* discuss about UBML to make things clearer; -* advocate UBML technology beyond GitHub; -* write blogs on UBML and so on. +## 代码样式 -## Code Style +UBML代码样式符合阿里巴巴Java编码准则. -UBML code style Comply with Alibaba Java Coding Guidelines. - -### Guidelines +### 指导方针 [Alibaba-Java-Coding-Guidelines](https://alibaba.github.io/Alibaba-Java-Coding-Guidelines/) -### IDE Plugin Install(not necessary) +### IDE插件安装(非必须) -*It is not necessary to install, if you want to find a problem when you are coding.* +*如果要在编码时发现问题,则无需安装.* #### idea IDE @@ -200,4 +194,4 @@ UBML code style Comply with Alibaba Java Coding Guidelines. [p3c-eclipse-plugin-install](https://github.com/alibaba/p3c/blob/master/eclipse-plugin/README.md) -In a word, **ANY HELP IS CONTRIBUTION.** \ No newline at end of file +总之几句话, **任何帮助都是贡献.** \ No newline at end of file diff --git a/README.md b/README.md index fe29efadecfb53571c0b03719254bb1666070ad0..f969cada25bbaf5d5b571991375af138df983c53 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,11 @@ - - -# UBML: Unified Business Modeling Language(统一业务建模语言) - +# UBML SDK +UBML模型的开发工具包 [![Build Status](https://ubml.openatom.org/ci/job/ubml-imp/badge/icon)](https://ubml.openatom.org/ci/job/ubml-imp/) [![license](https://img.shields.io/github/license/seata/seata.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) ## 简介 -UBML是一种基于领域特定语言(Domain-Specific Language DSL)的、用于**快速构建**应用软件的**低代码建模语言**。内容包括模型标准及其默认实现、SDK、运行时框架等组件。UBML定位于APaaS -(应用程序平台即服务)领域,是低代码开发平台(Low-Code-Development-Platform)的**核心基础**,致力于在低代码领域建立应用软件建模开发的事实标准 - -### 架构图 - -UBML架构图如下 - - - -### 特性 -- 微内核可扩展的开放架构:模型标准与实现解耦,模型种类可以**按行业类型/应用类型持续扩展** -- 开发语言无关性:通过建模,可适配**多种技术栈实现** -- 全栈模型刻画能力:建模范围可涵盖UI、API、流程、领域服务、持久化等**全栈开发**的各个层级 -- 支持Hybrid模式:开发模式上,提供**模型生成代码**与**模型动态解析**两种开发技术 -- 模型工程化:视模型为源码,提供模型**生命周期管理**与**工程化管理**能力,可与主流研发工具融合,支持DevOps - -### 价值 -- 显著提升软件开发效率 -- 最大程度减少人工编码的不规范性与出错率,促进软件开发标准化 -- 降低开发门槛,促进软件开发平民化 -- 丰富工业应用软件生态,赋能企业数字化创新转型 - -### 核心设计策略 - -有关UBML当前及后续的设计策略,详见 [设计策略](https://gitee.com/ubml/ubml-standard/blob/master/docs/design/design_strategy.md)。 - - -### 历史 - -##### GSP -2004-2019,浪潮上一代低代码开发平台GSP采用了模型驱动的低代码开发技术,其内置的模型体系是UBML的前身 -##### iGIX -2019年,浪潮基于云原生、前后端分离、领域驱动设计、跨平台等架构与设计理念,形成UBML低代码建模体系,并应用于浪潮新一代企业数字化能力平台iGIX -#### UBML -2020年,浪潮将UBML低代码建模体系从iGIX剥离,启动开源进程,旨在将UBML打造成低代码领域的标准 - -## 如何使用 - -### 快速入门 -有关UBML的快速入门教程,详见 [快速入门](https://gitee.com/ubml/ubml-standard/blob/master/docs/design/overview.md) - -### 新建Issue - -请按照 [Issue模板](./.gitee/ISSUE_TEMPLATE/BUG_REPORT.md) 反馈您遇到的任何问题. - -## 贡献 -欢迎贡献者加入UBML项目!关于如何为UBML做出贡献,请参阅 [如何参与贡献](./CONTRIBUTING.md)。 - -## 许可证 +工程化是UBML低代码建模的一大特点,UBML将模型视为源码,模型可存储为文件,以工程化结构组织,并提供SDK,可以与流行的源代码管理工具、CI/CD工具进行集成,融入现代化的开发模式。 +UBML SDK提供cli和IDE两种使用形式: +cli主要用于CI脚本中,IDE(Web)则提供图形化工具入口,cli和IDE复用一套公共类库,二者仅提供不同的入口封装。IDE(Web)模式支持多人协同开发,SDK的类库会加载到Server进程中,需要考虑多人并发的支持。 -UBML采用的开源许可证是Apache License 2.0,有关协议细节,请参阅 [LICENSE](./LICENSE) +![UBML SDK 概览](design/overview/ubml-sdk-overviewv1.png#pic_center) \ No newline at end of file diff --git a/all/pom.xml b/all/pom.xml index 1847d8014fc10f0edc4a6c028fcdde98c55103e7..d7843778ea337f6a8034a729514dba100d3b2a36 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -1,4 +1,20 @@ + + @@ -18,7 +34,7 @@ ubml-common ${project.version} - + org.openatom.ubml ubml-model-common-definition @@ -54,7 +70,7 @@ ubml-model-common-generator ${project.version} - + org.openatom.ubml ubml-model-framework-devtime-api diff --git a/bom/pom.xml b/bom/pom.xml index abd6d1a0c991f4d2a708d7726e82ea2e41cdc3c8..621797778aa3939fe09d78b9c76d24a8123e3daf 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -1,4 +1,20 @@ + + @@ -230,7 +246,7 @@ - + org.sonatype.plugins nexus-staging-maven-plugin @@ -258,7 +274,7 @@ --> - + org.apache.maven.plugins maven-release-plugin diff --git a/common/pom.xml b/common/pom.xml index 904ed3f2c5b241eab4df000603e17b5192a7345a..8f13d812d19ec0d4d43fbd036f2807357a75b054 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -1,4 +1,20 @@ + + @@ -33,7 +49,6 @@ org.springframework spring-core - \ No newline at end of file diff --git a/common/src/main/java/org/openatom/ubml/common/Constants.java b/common/src/main/java/org/openatom/ubml/common/Constants.java index d200e19db0dc688be8a87517e642d6aa921f59e3..25da64b60ce076daf2753eda7ccb7532c5903569 100644 --- a/common/src/main/java/org/openatom/ubml/common/Constants.java +++ b/common/src/main/java/org/openatom/ubml/common/Constants.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/enums/EnumValueParsable.java b/common/src/main/java/org/openatom/ubml/common/enums/EnumValueParsable.java index e0fac864077a994695239597bae072d7c6616c02..47bbfeb532cb90cd3133e630b60c8d686724ff35 100644 --- a/common/src/main/java/org/openatom/ubml/common/enums/EnumValueParsable.java +++ b/common/src/main/java/org/openatom/ubml/common/enums/EnumValueParsable.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/exception/ShouldNeverHappenException.java b/common/src/main/java/org/openatom/ubml/common/exception/ShouldNeverHappenException.java index 166a8e14b8ab737259b6bc094c592b06ada91b6c..f184675df2238ae0a1ead8c508f41b2176082e45 100644 --- a/common/src/main/java/org/openatom/ubml/common/exception/ShouldNeverHappenException.java +++ b/common/src/main/java/org/openatom/ubml/common/exception/ShouldNeverHappenException.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/spring/AnnotationScanner.java b/common/src/main/java/org/openatom/ubml/common/spring/AnnotationScanner.java index bb1aa76c2409c977ad87aa51df7b8ce247c626fa..d506265ea2fc470356db501327648fda24e9fab2 100644 --- a/common/src/main/java/org/openatom/ubml/common/spring/AnnotationScanner.java +++ b/common/src/main/java/org/openatom/ubml/common/spring/AnnotationScanner.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/spring/FullyQualifiedAnnotationBeanNameGenerator.java b/common/src/main/java/org/openatom/ubml/common/spring/FullyQualifiedAnnotationBeanNameGenerator.java index 80440286b0b65734704212513eab591ebcd242cf..0324e1774b3ec73a1b7711a4daaf7cb97ea124b2 100644 --- a/common/src/main/java/org/openatom/ubml/common/spring/FullyQualifiedAnnotationBeanNameGenerator.java +++ b/common/src/main/java/org/openatom/ubml/common/spring/FullyQualifiedAnnotationBeanNameGenerator.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/spring/SpringUtils.java b/common/src/main/java/org/openatom/ubml/common/spring/SpringUtils.java index c27afc1efde6a06fefba5f8515426625ce80c837..0673a01a8b073999741af4db8bb7cc832628fa42 100644 --- a/common/src/main/java/org/openatom/ubml/common/spring/SpringUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/spring/SpringUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java b/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java index 9648065d1b0fbefe03ef26066dc20458777fb7d7..00959521cd24e5f4bad5be10a996e62f370a1ab7 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/BlobUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -62,7 +62,7 @@ public class BlobUtils { } try { - return new String(blob.getBytes((long)1, (int)blob.length()), Constants.DEFAULT_CHARSET); + return new String(blob.getBytes((long) 1, (int) blob.length()), Constants.DEFAULT_CHARSET); } catch (Exception e) { throw new ShouldNeverHappenException(e); } @@ -98,7 +98,7 @@ public class BlobUtils { } try { - return blob.getBytes((long)1, (int)blob.length()); + return blob.getBytes((long) 1, (int) blob.length()); } catch (Exception e) { throw new ShouldNeverHappenException(e); } diff --git a/common/src/main/java/org/openatom/ubml/common/util/CollectionUtils.java b/common/src/main/java/org/openatom/ubml/common/util/CollectionUtils.java index fdddb49c701c495cf61bed1ea3fded2baa6333ed..976c3aaffc559f294ef31f9a94dfa1fc739ee5b2 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/CollectionUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/CollectionUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/util/Holder.java b/common/src/main/java/org/openatom/ubml/common/util/Holder.java index 46dd54c5dad5c9d44bc1c754eb8649288c14f000..f6d06d711d67215975f9a9035e92c9370e088177 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/Holder.java +++ b/common/src/main/java/org/openatom/ubml/common/util/Holder.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/util/IOUtils.java b/common/src/main/java/org/openatom/ubml/common/util/IOUtils.java index 0d176a5ec4248823752c32125f4fc39f09ca9890..2769de0259043f704a2f32b0a055b65cdb737fae 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/IOUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/IOUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java b/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java index 42a295b8cd14d87973912d591aa5829f8e5f758b..26f1fad9eb801670f8056b46b1de8a0a5f0fa7df 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java +++ b/common/src/main/java/org/openatom/ubml/common/util/JacksonJsonUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -40,35 +40,35 @@ public class JacksonJsonUtil { // 忽略不识别的字段 MAPPER.configure(Feature.IGNORE_UNKNOWN, true); LOG.info( - "MapperFeature {}: {}. Unknown properties will be quietly ignored.", - Feature.IGNORE_UNKNOWN, - true); + "MapperFeature {}: {}. Unknown properties will be quietly ignored.", + Feature.IGNORE_UNKNOWN, + true); // 允许没有引号包裹的字段 MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true); LOG.info( - "JsonParser.Feature {}: {}. Allow use of unquoted field names.", - JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, - true); + "JsonParser.Feature {}: {}. Allow use of unquoted field names.", + JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, + true); // 当遇到不能识别的属性时,正常执行 MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); LOG.info( - "MapperFeature {}: {}. It will not result in a failure if an unknown property is encountered.", - DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, - false); + "MapperFeature {}: {}. It will not result in a failure if an unknown property is encountered.", + DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, + false); // 忽略字段大小写 MAPPER.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); LOG.info( - "MapperFeature {}: {}. The bean properties will be matched using their lower-case equivalents, any case-combination should work.", - MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, - true); + "MapperFeature {}: {}. The bean properties will be matched using their lower-case equivalents, any case-combination should work.", + MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, + true); // 允许JSON字符串包含非JSON标准控制字符 MAPPER.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); LOG.info( - "JsonParser.Feature {}: {}. allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not.", - JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, - true); + "JsonParser.Feature {}: {}. allow JSON Strings to contain unquoted control characters (ASCII characters with value less than 32, including tab and line feed characters) or not.", + JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, + true); } private JacksonJsonUtil() { @@ -82,10 +82,10 @@ public class JacksonJsonUtil { return MAPPER.writeValueAsString(object); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to serialize the object {0} which belong to class {1}.", - object, object.getClass().getCanonicalName()), - e); + MessageFormat.format( + "Failed to serialize the object {0} which belong to class {1}.", + object, object.getClass().getCanonicalName()), + e); } } @@ -94,10 +94,10 @@ public class JacksonJsonUtil { return MAPPER.readValue(json, clazz); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to deserialize from json string to class object {}.", - clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to deserialize from json string to class object {}.", + clazz.getCanonicalName()), + e); } } @@ -106,9 +106,9 @@ public class JacksonJsonUtil { return MAPPER.treeToValue(jsonNode, clazz); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format( - "Failed to parse JsonNode to class object {0}.", clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to parse JsonNode to class object {0}.", clazz.getCanonicalName()), + e); } } @@ -117,14 +117,14 @@ public class JacksonJsonUtil { return MAPPER.readValue(in, clazz); } catch (Exception e) { LOG.error( - "Failed to deserialize from input stream to class object {0}.", - clazz.getCanonicalName(), - e); + "Failed to deserialize from input stream to class object {0}.", + clazz.getCanonicalName(), + e); throw new JsonParseException( - MessageFormat.format( - "Failed to deserialize from input stream to class object {0}.", - clazz.getCanonicalName()), - e); + MessageFormat.format( + "Failed to deserialize from input stream to class object {0}.", + clazz.getCanonicalName()), + e); } } @@ -133,7 +133,7 @@ public class JacksonJsonUtil { return MAPPER.readTree(json); } catch (Exception e) { throw new JsonParseException( - MessageFormat.format("Failed to read json tree from string \n{0}\n", json), e); + MessageFormat.format("Failed to read json tree from string \n{0}\n", json), e); } } @@ -170,7 +170,7 @@ public class JacksonJsonUtil { } public JsonParseException( - String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } diff --git a/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java b/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java index 5fefd22a262bcd3d4c7a4a7906af36855ef3abab..002b293ecb1fd2dc2399a9e232eb1bf7b1cdd66e 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/ReflectionUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -59,7 +59,7 @@ public class ReflectionUtils { * @throws IllegalAccessException the illegal access exception */ public static Object getFieldValue(Object target, String fieldName) - throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { + throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -87,8 +87,8 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeMethod(Object target, String methodName) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -118,8 +118,8 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeMethod(Object target, String methodName, Class[] parameterTypes, Object[] args) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { Class cl = target.getClass(); int i = 0; while ((i++) < MAX_NEST_DEPTH && cl != null) { @@ -149,9 +149,9 @@ public class ReflectionUtils { * @throws InvocationTargetException the invocation target exception */ public static Object invokeStaticMethod(Class targetClass, String methodName, Class[] parameterTypes, - Object[] parameterValues) - throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, - InvocationTargetException { + Object[] parameterValues) + throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, + InvocationTargetException { int i = 0; while ((i++) < MAX_NEST_DEPTH && targetClass != null) { try { @@ -175,7 +175,7 @@ public class ReflectionUtils { * @throws SecurityException the security exception */ public static Method getMethod(Class classType, String methodName, Class[] parameterTypes) - throws NoSuchMethodException, SecurityException { + throws NoSuchMethodException, SecurityException { return classType.getMethod(methodName, parameterTypes); } @@ -218,14 +218,11 @@ public class ReflectionUtils { } /** - * Gets a value indicates whether the sub class is or inheriting or implementing the base class. - * that means: - * 1.while the sub class is a class and the base class is a class too,the value indicates whether the sub class - * inherits from base class; - * 2.while the sub class is an interface and the base class is an interface too,the value indicates whether the sub - * class inherits from the base class; - * 3.while the sub class is a class and the base class is an interface,the value indicates whether the sub class - * implements the base class; + * Gets a value indicates whether the sub class is or inheriting or implementing the base class. that means: 1.while + * the sub class is a class and the base class is a class too,the value indicates whether the sub class inherits + * from base class; 2.while the sub class is an interface and the base class is an interface too,the value indicates + * whether the sub class inherits from the base class; 3.while the sub class is a class and the base class is an + * interface,the value indicates whether the sub class implements the base class; * * @param subClass can be a concrete class or an interface * @param baseClass an abstract class or an interface diff --git a/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java b/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java index 94fa09d9aeaabce2849329f6b65336cc00c3aec5..7b9fbab670e462c908456e0e254cddbc2daec669 100644 --- a/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java +++ b/common/src/main/java/org/openatom/ubml/common/util/StringUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -178,7 +178,7 @@ public class StringUtils { return String.valueOf(obj); } if (obj instanceof String) { - return (String)obj; + return (String) obj; } if (obj instanceof Number || obj instanceof Character || obj instanceof Boolean) { return String.valueOf(obj); @@ -189,8 +189,8 @@ public class StringUtils { if (obj instanceof Collection) { StringBuilder sb = new StringBuilder(); sb.append("["); - if (!((Collection)obj).isEmpty()) { - for (Object o : (Collection)obj) { + if (!((Collection) obj).isEmpty()) { + for (Object o : (Collection) obj) { sb.append(toString(o)).append(","); } sb.deleteCharAt(sb.length() - 1); @@ -201,9 +201,9 @@ public class StringUtils { if (obj instanceof Map) { StringBuilder sb = new StringBuilder(); sb.append("{"); - if (!((Map)obj).isEmpty()) { - for (Object k : ((Map)obj).keySet()) { - Object v = ((Map)obj).get(k); + if (!((Map) obj).isEmpty()) { + for (Object k : ((Map) obj).keySet()) { + Object v = ((Map) obj).get(k); sb.append(toString(k)).append("->").append(toString(v)).append(","); } sb.deleteCharAt(sb.length() - 1); @@ -312,9 +312,8 @@ public class StringUtils { return fixLenthString.substring(1, strLength + 1); } - public static String join(Object[] array, String separator) { - return array == null ? null : join((Object[])array, separator, 0, array.length); + return array == null ? null : join((Object[]) array, separator, 0, array.length); } public static String join(Object[] array, String separator, int startIndex, int endIndex) { @@ -351,7 +350,7 @@ public class StringUtils { } private static boolean CheckSeparator(char cha) { - char[] separator = new char[]{' ', ' ', '\u2028', '\u2029', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\u200b', '\u2028', '\u2029', ' ', ' '}; + char[] separator = new char[] {' ', ' ', '\u2028', '\u2029', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\u200b', '\u2028', '\u2029', ' ', ' '}; char[] var2 = separator; int var3 = separator.length; diff --git a/design/.keep b/design/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/design/overview/.keep b/design/overview/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/design/overview/ubml-sdk-overviewv1.png b/design/overview/ubml-sdk-overviewv1.png new file mode 100644 index 0000000000000000000000000000000000000000..5d17cd20503f7ac207692ae850717a5f47dc3e65 Binary files /dev/null and b/design/overview/ubml-sdk-overviewv1.png differ diff --git a/model/be/definition/pom.xml b/model/be/definition/pom.xml index ccb7e4585e8d538d1825ba4ad0a3a39ac3a5a866..150ed41771a89f7c870a60a089b4de6dc2c67c6a 100644 --- a/model/be/definition/pom.xml +++ b/model/be/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java index a5218bf0cef90ea50e706b797bdfc57acfb99159..5b068dbf13d2a720cc58ec640407acd9d4b69bef 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityElement.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -39,7 +39,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspC public class GspBizEntityElement extends GspCommonElement implements Cloneable { private transient RequiredCheckOccasion requiredCheckOccasion = RequiredCheckOccasion.All; - // region 属性 + // 属性 /** * 是否默认为空值 */ @@ -152,21 +152,22 @@ public class GspBizEntityElement extends GspCommonElement implements Cloneable { return; } for (GspAssociation childAssociation : getChildAssociations()) { - GspCommonAssociation dependentAssociation = (GspCommonAssociation)(dependentElement.getChildAssociations() - .getItem(childAssociation.getId())); - mergeChildAssociation((GspCommonAssociation)childAssociation, dependentAssociation, isRef); + GspCommonAssociation dependentAssociation = (GspCommonAssociation) (dependentElement.getChildAssociations() + .getItem(childAssociation.getId())); + mergeChildAssociation((GspCommonAssociation) childAssociation, dependentAssociation, isRef); } } private void mergeChildAssociation(GspCommonAssociation childAssociation, GspCommonAssociation dependentAssociation, - boolean isRef) { + boolean isRef) { if (isRef) { mergeAssociationBaseInfo(childAssociation, dependentAssociation); } mergeRefElements(childAssociation, dependentAssociation); } - private void mergeAssociationBaseInfo(GspCommonAssociation childAssociation, GspCommonAssociation dependentAssociation) { + private void mergeAssociationBaseInfo(GspCommonAssociation childAssociation, + GspCommonAssociation dependentAssociation) { childAssociation.setRefModelID(dependentAssociation.getRefModelID()); childAssociation.setRefModelCode(dependentAssociation.getRefModelCode()); childAssociation.setRefModelName(dependentAssociation.getRefModelName()); @@ -185,9 +186,9 @@ public class GspBizEntityElement extends GspCommonElement implements Cloneable { return; } for (IGspCommonField refElement : childAssociation.getRefElementCollection()) { - GspBizEntityElement dependentRefElement = (GspBizEntityElement)dependentAssociation.getRefElementCollection() - .getItem(refElement.getID()); - ((GspBizEntityElement)refElement).mergeWithDependentElement(dependentRefElement); + GspBizEntityElement dependentRefElement = (GspBizEntityElement) dependentAssociation.getRefElementCollection() + .getItem(refElement.getID()); + ((GspBizEntityElement) refElement).mergeWithDependentElement(dependentRefElement); } } -} \ No newline at end of file +} diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java index d54619ada53cb2572e854268a128c45a94006fc2..972ce7f549ed975f9173a7a86e7e282026352b3a 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBizEntityObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,8 +15,6 @@ */ package org.openatom.ubml.model.be.definition; -// import Inspur.Gsp.Bef.BizEntity.Authority.*; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import org.openatom.ubml.model.be.definition.beenum.BETriggerTimePointType; @@ -57,7 +55,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo @JsonSerialize(using = BizObjectSerializer.class) public class GspBizEntityObject extends GspCommonObject implements Cloneable { - // region 私有属性 + // 私有属性 private DeterminationCollection determinations; private ValidationCollection validations; private BizActionCollection bizActions; @@ -151,23 +149,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { super.setParentObject(value); } - // // region 权限 - // private java.util.ArrayList authFieldInfos; - - // /** - // * 关联的数据授权对象信息 - // * - // */ - // public java.util.ArrayList getAuthFieldInfos() { - // return authFieldInfos; - // } - - // void setAuthFieldInfos(java.util.ArrayList value) - - // endregion - - // region CommonDataType - /** * [保存前]联动计算 */ @@ -258,12 +239,6 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { // throw new RuntimeException("业务实体中无法赋值属性[ValAfterModify]"); } - // endregion - - // endregion - - // region 方法 - /** * 克隆 * @@ -302,7 +277,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { return new GspBizEntityElement(); } - // region 依赖实体 + // 依赖实体 public final void mergeWithDependentObject(GspBizEntityObject dependentObject, boolean isInit) { if (!getIsRef()) { return; @@ -473,7 +448,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { } } - // endregion + public final void initMainObject() { setObjectType(GspCommonObjectType.MainObject); @@ -482,7 +457,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { getBizActions().add(new RetrieveBEAction()); } - // region 创建BE子节点 + // 创建BE子节点 /** * 根据BE父节点生成子节点 @@ -567,7 +542,7 @@ public class GspBizEntityObject extends GspCommonObject implements Cloneable { return idElement; } - // endregion - // endregion + + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java index 114ce1a157fe2d8b1f0c265743e1aabca8b1a84b..03052e139cda56a2ec6bdcc0f193fb1f349f71cf 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/GspBusinessEntity.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -34,7 +34,7 @@ import org.openatom.ubml.model.be.definition.operation.internalmgraction.Retriev import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonModel; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; /** * The Definition Of Business Entity Metadata @@ -47,7 +47,7 @@ import org.openatom.ubml.model.common.definition.entity.IMetadataContent; @JsonSerialize(using = BizEntitySerializer.class) @JsonDeserialize(using = BizEntityDeserializer.class) public class GspBusinessEntity extends GspCommonModel implements IMetadataContent { - // region 属性 + // 属性 boolean isUsingTimeStamp; boolean enableCaching = false; @@ -70,7 +70,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten private String cacheConfiguration = ""; private BizMgrActionCollection beMgrActions; - // region Ctor + // Ctor public GspBusinessEntity() { getBizMgrActions().add(new QueryMgrAction()); getBizMgrActions().add(new RetrieveDefaultMgrAction()); @@ -98,6 +98,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten /** * BE根节点 */ + @Override public final GspBizEntityObject getMainObject() { return (GspBizEntityObject)super.getMainObject(); } @@ -164,16 +165,6 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten return beMgrActions; } - // private java.util.ArrayList authorizations; - - /** - * BE关联的权限对象ID集合 - * - */ - // java.util.ArrayList getAuthorizations() - - // public void setAuthorizations(java.util.ArrayList value) - public final void setBizMgrActions(BizMgrActionCollection value) { beMgrActions = value; beMgrActions.setOwner(this.getMainObject()); @@ -219,7 +210,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten return enableTreeDtm; } - // endregion + public void setEnableTreeDtm(boolean value) { enableTreeDtm = value; @@ -354,9 +345,7 @@ public class GspBusinessEntity extends GspCommonModel implements IMetadataConten * * @return */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new object clone() + @Override public GspBusinessEntity clone() { GspBusinessEntity be = (GspBusinessEntity)super.clone(); if (be == null) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/LogicDeleteControlInfo.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/LogicDeleteControlInfo.java index 4aaf20835568bf5c83ba2ab2b7f99d2598ef3440..8694dd4248d08f4b235d08aaf9be3d35fcce326d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/LogicDeleteControlInfo.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/LogicDeleteControlInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java index f40e1d8a5a4168a58d217c7554b6052a3f0f7543..acda177d95324d94b693a5956a3813364c423a19 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/AuthType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -45,7 +45,7 @@ public enum AuthType { private synchronized static java.util.HashMap getMappings() { if (mappings == null) { - mappings = new java.util.HashMap(); + mappings = new java.util.HashMap<>(); } return mappings; } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BECategory.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BECategory.java index 9e57391ed81ca9547c61c6b3131bb0e47fc05ed7..fcc16e53ddf20072633c5ad0185bce05db1f97d1 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BECategory.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BECategory.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEDeterminationType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEDeterminationType.java index 2ab091bc928afffba6657178dedac7f37e30f479..1531979eb85f15820b1fbe4f8d4b25349d8963c5 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEDeterminationType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEDeterminationType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEOperationType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEOperationType.java index e99197c2a6c321567912b3c461e72b9f50933bd8..107c8fdfca992886c767733a632ac42201e74e42 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEOperationType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEOperationType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BETriggerTimePointType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BETriggerTimePointType.java index b3a034283f9d09dd9c331b4ede0e966d01fb7c09..a6cf3b8df7e6949f66e23fe68823bee4c836bfd8 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BETriggerTimePointType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BETriggerTimePointType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEValidationType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEValidationType.java index 8328177e28d64e57c030a70ac7c47997a8f76b57..0e946e7b14858f6a456930c17f7a00eb490fd0a4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEValidationType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/BEValidationType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/GspDataLockType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/GspDataLockType.java index fb8f9b9066eb5c866dae48b810bad087220acc80..d3dc13288fc39e4f84016284767bc689d73229b5 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/GspDataLockType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/GspDataLockType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequestNodeTriggerType.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequestNodeTriggerType.java index ccee3d92fe8b71e010f1b27b3f7ce5a92cb9ea02..03fdc6facdd4dfbdb20282eb7a6fbae7e85d81e9 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequestNodeTriggerType.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequestNodeTriggerType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequiredCheckOccasion.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequiredCheckOccasion.java index baaa45e374cf0dab818eddebeefdbb8c66fab434..9bdbfdf2c4d37e2ad12e58dab3b57f15efc621bb 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequiredCheckOccasion.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/beenum/RequiredCheckOccasion.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/DtmElementCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/DtmElementCollection.java index 974d05d2153178ccaae4a56a1be67c6abf50bf22..4abf7cb28954c348e060ee4caf17aaa2269206c1 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/DtmElementCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/DtmElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/ValidationElementCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/ValidationElementCollection.java index a5bac19f8f8043e212d860ddcd2aea3137654712..7ddff7d4bc59329504819e49c9a938307e95e27f 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/ValidationElementCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/collection/ValidationElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java index 902ecdbd4143cf419794d5515d8b9f2dae01f9a9..b153a283fbccb9f256f1c7b76312209a2f7ae7cd 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BEConst.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -25,7 +25,7 @@ package org.openatom.ubml.model.be.definition.common; */ public final class BEConst { - //#region ElementName + //ElementName /** * BOEntity */ @@ -171,12 +171,12 @@ public final class BEConst { */ public static final String BE_EXTIONSION_ITEM = "BOExtionsionItem"; - //#endregion - //#region AttributeNames - //#region Common + //AttributeNames + + //Common public static final String ID = "ID"; public static final String CODE = "Code"; public static final String NAME = "Name"; @@ -185,10 +185,10 @@ public final class BEConst { public static final String ORDER = "Order"; public static final String GENCOMP = "IsGenerateComponent"; - //#endregion - //#region BE + + //BE /** * BEDataLockType */ @@ -199,10 +199,10 @@ public final class BEConst { */ public static final String BE_CMP_SSEMBLY_NAME = "ComponentAssemblyName"; - //#endregion - //#region Element + + //Element /** * BEElementExpression */ @@ -210,19 +210,19 @@ public final class BEConst { public static final String BE_EXPRESS_TARGET_ELEMENT = "ExpressionTargetElement"; - //#endregion - //#region Object + + //Object /** * BEObjectIsRootNode */ public static final String BE_OBJECT_IS_ROOT_NODE = "IsRootNode"; - //#endregion - //#region Operation + + //Operation /** * MethodId */ @@ -236,7 +236,7 @@ public final class BEConst { /** * ComponentName */ - public static final String BE_OP_COMPONENT_Name = "ComponentName"; + public static final String BE_OP_COMPONENT_NAME = "ComponentName"; /** * ComponentPkgName @@ -323,10 +323,10 @@ public final class BEConst { public static final String BE_OP_VALIDATIONTRIGGERPOINT_KEY = "ValidationTriggerPointKey"; public static final String BE_OP_VALIDATIONTRIGGERPOINT_VALUE = "ValidationTriggerPointValue"; - //#endregion - //#region Authority + + //Authority public static final String BE_AUTH_INFOS = "AuthorizationInfos"; public static final String BE_AUTH_INFO = "AuthorizationInfo"; @@ -345,8 +345,8 @@ public final class BEConst { public static final String BE_AUTH_ACTION_OP_NAME = "AuthActionOpName"; - //#endregion - //#endregion + + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java index 6244f630dd9003fa5a9f432d7252bcc407577cc3..763766c03659c57ecfaa9bc719f2ef6afe3b2326 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityEnumConst.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -24,10 +24,20 @@ package org.openatom.ubml.model.be.definition.common; * @Version: V1.0 */ public class BizEntityEnumConst { - //RequiredCheckOccasion - public static final String RequiredCheckOccasionSave = "Save"; - public static final String RequiredCheckOccasionModify = "Modify"; - public static final String RequiredCheckOccasionAll = "All"; + /** + * The Const RequiredCheckOccasion + */ + public static final String REQUIRED_CHECK_OCCASION_SAVE = "Save"; + + /** + * The Const REQUIRED_CHECK_OCCASION_MODIFY + */ + public static final String REQUIRED_CHECK_OCCASION_MODIFY = "Modify"; + + /** + * The Const REQUIRED_CHECK_OCCASION_ALL + */ + public static final String REQUIRED_CHECK_OCCASION_ALL = "All"; } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java index c110a8be8db5eaf773084789b3dc5d5681f264e7..1507f4fec003c5fd1c17cddb5ccbd0c7f3d523d7 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BizEntityJsonConst.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -24,113 +24,127 @@ package org.openatom.ubml.model.be.definition.common; * @Version: V1.0 */ public class BizEntityJsonConst { + //业务实体 - public static final String Category = "Category"; - public static final String SourceEntity = "SourceEntity"; - public static final String DataLockType = "DataLockType"; - public static final String ExtendType = "ExtendType"; - public static final String DependentEntityId = "DependentEntityId"; - public static final String DependentEntityName = "DependentEntityName"; - public static final String DependentEntityPackageName = "DependentEntityPackageName"; - public static final String IsUsingTimeStamp = "IsUsingTimeStamp"; - public static final String BizMgrActions = "BizMgrActions"; - public static final String BizMgrAction = "BizMgrAction"; - public static final String ComponentAssemblyName = "ComponentAssemblyName"; - public static final String AssemblyName = "AssemblyName"; - public static final String CacheConfiguration = "CacheConfiguration"; - public static final String EnableCaching = "EnableCaching"; - public static final String EnableTreeDtm = "EnableTreeDtm"; - public static final String IsDefaultNull = "IsDefaultNull"; + public static final String CATEGORY = "Category"; + public static final String SOURCE_ENTITY = "SourceEntity"; + public static final String DATA_LOCK_TYPE = "DataLockType"; + public static final String EXTEND_TYPE = "ExtendType"; + public static final String DEPENDENT_ENTITY_ID = "DependentEntityId"; + public static final String DEPENDENT_ENTITY_NAME = "DependentEntityName"; + public static final String ENTITY_PACKAGE_NAME = "DependentEntityPackageName"; + public static final String IS_USING_TIME_STAMP = "IsUsingTimeStamp"; + public static final String BIZ_MGR_ACTIONS = "BizMgrActions"; + public static final String BIZ_MGR_ACTION = "BizMgrAction"; + public static final String COMPONENT_ASSEMBLY_NAME = "ComponentAssemblyName"; + public static final String ASSEMBLY_NAME = "AssemblyName"; + public static final String CACHE_CONFIGURATION = "CacheConfiguration"; + public static final String ENABLE_CACHING = "EnableCaching"; + public static final String ENABLE_TREE_DTM = "EnableTreeDtm"; + public static final String IS_DEFAULT_NULL = "IsDefaultNull"; //业务实体对象 - public static final String Determinations = "Determinations"; - public static final String Validations = "Validations"; - public static final String BizActions = "BizActions"; - public static final String BelongModel = "BelongModel"; - public static final String ParentObject = "ParentObject"; - public static final String ParentObjectID = "ParentObjectID"; - public static final String LogicDeleteControlInfo = "LogicDeleteControlInfo"; + public static final String DETERMINATIONS = "Determinations"; + public static final String VALIDATIONS = "Validations"; + public static final String BIZ_ACTIONS = "BizActions"; + public static final String BELONG_MODEL = "BelongModel"; + public static final String PARENT_OBJECT = "ParentObject"; + public static final String PARENT_OBJECT_ID = "ParentObjectID"; + public static final String LOGIC_DELETE_CONTROL_INFO = "LogicDeleteControlInfo"; //业务实体字段 - public static final String CalculationExpress = "CalculationExpress"; - public static final String ValidationExpress = "ValidationExpress"; - public static final String RtElementConfigId = "RtElementConfigId"; - public static final String Readonly = "Readonly"; - public static final String RequiredCheckOccasion = "RequiredCheckOccasion"; - public static final String UnifiedDataType = "UnifiedDataType"; + /** + * + */ + public static final String CALCULATION_EXPRESS = "CalculationExpress"; + public static final String VALIDATION_EXPRESS = "ValidationExpress"; + public static final String ELEMENT_CONFIG_ID = "RtElementConfigId"; + public static final String READONLY = "Readonly"; + public static final String REQUIRED_CHECK_OCCASION = "RequiredCheckOccasion"; + public static final String UNIFIED_DATA_TYPE = "UnifiedDataType"; - //操作 - public static final String Description = "Description"; - public static final String ComponentId = "ComponentId"; - public static final String ComponentPkgName = "ComponentPkgName"; - public static final String ComponentName = "ComponentName"; - public static final String IsVisible = "IsVisible"; - public static final String OpType = "OpType"; - public static final String Owner = "Owner"; - public static final String BelongModelId = "BelongModelID"; - public static final String IsRef = "IsRef"; - public static final String IsGenerateComponent = "IsGenerateComponent"; + /** + * Operation + */ + public static final String DESCRIPTION = "Description"; + public static final String COMPONENT_ID = "ComponentId"; + public static final String COMPONENT_PKG_NAME = "ComponentPkgName"; + public static final String COMPONENT_NAME = "ComponentName"; + public static final String IS_VISIBLE = "IsVisible"; + public static final String OP_TYPE = "OpType"; + public static final String OWNER = "Owner"; + public static final String BELONG_MODEL_ID = "BelongModelID"; + public static final String IS_REF = "IsRef"; + public static final String IS_GENERATE_COMPONENT = "IsGenerateComponent"; - //BizActionBase - public static final String CurentAuthType = "CurentAuthType"; - public static final String Parameters = "Parameters"; + /** + * BizActionBase + */ + public static final String CURENT_AUTH_TYPE = "CurentAuthType"; + public static final String PARAMETERS = "Parameters"; public static final String ReturnValue = "ReturnValue"; - public static final String OpIdList = "OpIdList"; - public static final String ParamCode = "ParamCode"; - public static final String ParamName = "ParamName"; - public static final String ParameterType = "ParameterType"; - public static final String CollectionParameterType = "CollectionParameterType"; - public static final String Assembly = "Assembly"; - public static final String ClassName = "ClassName"; - public static final String JavaClassName = "JavaClassName"; - public static final String Mode = "Mode"; - public static final String ParamDescription = "ParamDescription"; + public static final String OP_ID_LIST = "OpIdList"; + public static final String PARAM_CODE = "ParamCode"; + public static final String PARAM_NAME = "ParamName"; + public static final String PARAMETER_TYPE = "ParameterType"; + public static final String COLLECTION_PARAMETER_TYPE = "CollectionParameterType"; + public static final String ASSEMBLY = "Assembly"; + public static final String CLASS_NAME = "ClassName"; + public static final String JAVA_CLASS_NAME = "JavaClassName"; + public static final String MODE = "Mode"; + public static final String PARAM_DESCRIPTION = "ParamDescription"; - //determination - public static final String DeterminationType = "DeterminationType"; - public static final String TriggerTimePointType = "TriggerTimePointType"; - public static final String RequestNodeTriggerType = "RequestNodeTriggerType"; - public static final String RequestElements = "RequestElements"; - public static final String RequestChildElements = "RequestChildElements"; - public static final String RequestChildElementKey = "RequestChildElementKey"; - public static final String RequestChildElementValue = "RequestChildElementValue"; - public static final String PreDtmId = "PreDtmId"; - public static final String Determination = "Determination"; + /** + * determination + */ + public static final String DETERMINATION_TYPE = "DeterminationType"; + public static final String TRIGGER_TIME_POINT_TYPE = "TriggerTimePointType"; + public static final String REQUEST_NODE_TRIGGER_TYPE = "RequestNodeTriggerType"; + public static final String REQUEST_ELEMENTS = "RequestElements"; + public static final String REQUEST_CHILD_ELEMENTS = "RequestChildElements"; + public static final String REQUEST_CHILD_ELEMENT_KEY = "RequestChildElementKey"; + public static final String REQUEST_CHILD_ELEMENT_VALUE = "RequestChildElementValue"; + public static final String PRE_DTM_ID = "PreDtmId"; + public static final String DETERMINATION = "Determination"; //validation - public static final String ValidationType = "ValidationType"; - public static final String Order = "Order"; - public static final String Precedings = "Precedings"; - public static final String Succeedings = "Succeedings"; - public static final String PrecedingIds = "PrecedingIds"; - public static final String SucceedingIds = "SucceedingIds"; - public static final String ValidationTriggerPoints = "ValidationTriggerPoints"; - public static final String ValidationTriggerPointKey = "ValidationTriggerPointKey"; - public static final String ValidationTriggerPointValue = "ValidationTriggerPointValue"; - public static final String ValidationAfterSave = "ValAfterSave"; - public static final String Validation = "Validation"; -//RequestNodeTriggerType + public static final String VALIDATION_TYPE = "ValidationType"; + public static final String ORDER = "Order"; + public static final String PRECEDINGS = "Precedings"; + public static final String SUCCEEDINGS = "Succeedings"; + public static final String PRECEDING_IDS = "PrecedingIds"; + public static final String SUCCEEDING_IDS = "SucceedingIds"; + public static final String VALIDATION_TRIGGER_POINTS = "ValidationTriggerPoints"; + public static final String VALIDATION_TRIGGER_POINT_KEY = "ValidationTriggerPointKey"; + public static final String VALIDATION_TRIGGER_POINT_VALUE = "ValidationTriggerPointValue"; + public static final String VALIDATION_AFTER_SAVE = "ValAfterSave"; + public static final String VALIDATION = "Validation"; + + /** + * Authority + */ + public static final String AUTHORIZATIONS = "Authorizations"; + public static final String AUTH_FIELD_INFOS = "AuthFieldInfos"; + public static final String AUTH_FIELD_ID = "AuthFieldID"; + public static final String AUTH_FIELD_NAME = "AuthFieldName"; + public static final String AUTHORIZATION_ID = "AuthorizationID"; + public static final String AUTH_ID = "AuthID"; + public static final String ELEMENT_ID = "ElementID"; - //Authority - public static final String Authorizations = "Authorizations"; - public static final String AuthFieldInfos = "AuthFieldInfos"; - public static final String AuthFieldID = "AuthFieldID"; - public static final String AuthFieldName = "AuthFieldName"; - public static final String AuthorizationID = "AuthorizationID"; - public static final String AuthID = "AuthID"; - public static final String ElementID = "ElementID"; + public static final String ACTION_INFOS = "ActionInfos"; - public static final String ActionInfos = "ActionInfos"; + public static final String AUTH_ACTION_ID = "AuthActionID"; + public static final String AUTH_ACTION_OP_ID = "AuthActionOpID"; + public static final String AUTH_ACTION_OP_NAME = "AuthActionOpName"; - public static final String AuthActionID = "AuthActionID"; - public static final String AuthActionOpID = "AuthActionOpID"; - public static final String AuthActionOpName = "AuthActionOpName"; - public static final String FuncOperationID = "FuncOperationID"; - public static final String FuncOperationName = "FuncOperationName"; + public static final String FUNC_OPERATION_ID = "FuncOperationID"; + public static final String FUNC_OPERATION_NAME = "FuncOperationName"; - //Increment - public static final String AddedAction = "AddedAction"; - public static final String ModifyAction = "ModifyAction"; + /** + * Increment + */ + public static final String ADDED_ACTION = "AddedAction"; + public static final String MODIFY_ACTION = "ModifyAction"; } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/GspBusinessEntityExtend.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/GspBusinessEntityExtend.java index 670c092707355879c80209bd19ee539f6a07e568..aac5bb6798b4f3cc22684002ce7341a13dac010b 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/GspBusinessEntityExtend.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/GspBusinessEntityExtend.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/InternalActionUtil.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/InternalActionUtil.java index 6c35edf7da75c3b77a8497893d0bdc068c9a74c7..2765a6094a3bb94161076adf9ae745c4d9a13829 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/InternalActionUtil.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/InternalActionUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java index 46a1e8df4f569a32bc561e8c78c71ec63f61bdf8..5fea32c75f52f1335a2276bb0f6605e99f96415a 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/OperationConvertUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -74,7 +74,7 @@ public class OperationConvertUtils { return cVals; } - // region 私有方法 + // 私有方法 public static CommonDetermination convertToCommonDtm(Determination dtm) { CommonDetermination cDtm = new CommonDetermination(); convertToCommonOperation(cDtm, dtm); @@ -138,5 +138,5 @@ public class OperationConvertUtils { commonOp.setComponentName(bizOp.getComponentName()); commonOp.setComponentPkgName(bizOp.getComponentPkgName()); } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java deleted file mode 100644 index 919bc2b8eae3f46220ec846f05d9157459afd270..0000000000000000000000000000000000000000 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/SysnDboUtils.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * 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 org.openatom.ubml.model.be.definition.common; -// -//import org.openatom.ubml.model.be.definition.GspBizEntityElement; -//import org.openatom.ubml.model.be.definition.GspBizEntityObject; -//import com.inspur.edp.cef.designtime.api.util.Guid; -//import com.inspur.edp.das.commonmodel.entity.object.GspCommonObjectType; -//import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; -//import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -//import io.iec.edp.caf.databaseobject.api.entity.DataType; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectColumn; -//import io.iec.edp.caf.databaseobject.api.entity.DatabaseObjectTable; -// -// -///** -// * The Tools To Sysn Be To Database Object -// * -// * @ClassName: SysnDboUtils -// * @Author: Benjamin Gong -// * @Date: 2021/1/11 17:13 -// * @Version: V1.0 -// */ -//public class SysnDboUtils { -// -// //region createDbo -// public static DatabaseObjectTable createDbo(GspBizEntityObject bizObject, String boId, Boolean isUsingTimeStamp){ -// DatabaseObjectTable table = generateDboFromBizObject(bizObject, boId, bizObject.getRefObjectName(), isUsingTimeStamp); -// bizObject.setRefObjectName(table.getId()); -// return table; -// } -// -// private static DatabaseObjectTable generateDboFromBizObject(GspBizEntityObject bizObject, String boId, String dboID, Boolean usingTimeStamp) { -// //20180802修改_由于外层已确认设计时/运行时均无此dbo,故仅使用原dboID新建 -// String dboCode = getDboNameWithAppCode(bizObject.getCode(), boId); -// String dboName = bizObject.getName(); -// -// //20180817 dbo添加[是否生成时间戳][是否年度表] -// boolean isFiscalTable = false; -// boolean isUsingTimeStamp = getIsUsingTimeStamp(bizObject, usingTimeStamp); -// -//// //新建dbo时,检查dbo文件名/表名 -//// CheckDboFileNameRepeat(path, dboCode); -//// CheckDboTableNameRepeat(path, dboCode); -// -// DatabaseObjectTable table = new DatabaseObjectTable(dboCode, dboName, false, false, isUsingTimeStamp, isFiscalTable, boId, dboID); -// -// for (var ele : -// bizObject.getContainElements()) { -// if (ele.getIsVirtual()) -// continue; -// addDboColumn((GspBizEntityElement)ele, table, bizObject.getIDElement().getID()); -// } -// return table; -// } -// -// private static String getDboNameWithAppCode(String objCode, String boId) { -// DevBasicBoInfo boInfo = SpringBeanUtils.getBean(DevBasicInfoService.class).getDevBasicBoInfo(boId); -// if(boInfo == null) -// throw new RuntimeException("没有获取到业务对象["+boId+"]的相关信息"); -// String appCode = boInfo.getAppCode(); -// return appCode+objCode; -// } -// -// private static boolean getIsUsingTimeStamp(GspBizEntityObject bizObject, boolean isUsingTimeStamp) -// { -// if (bizObject.getObjectType() == GspCommonObjectType.MainObject) { -// return isUsingTimeStamp; -// } -// return false; -// } -// -// //endregion -// -// //region addBboColumn -// public static void addDboColumn(GspBizEntityElement beElement, DatabaseObjectTable table, String primaryKeyID) { -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// -// var info = getLengthPrecisionScale(beElement); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// beElement.getLabelID(), -// beElement.getName(), -// getDataTypeByMDataType(beElement), -// info.length, -// info.precision, -// info.scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// } -// -// public static DatabaseObjectColumn addDboColumn( -// GspBizEntityElement beElement, -// DatabaseObjectTable table, -// String primaryKeyID, -// String code, -// String name, -// int length, -// int precision, -// int scale){ -// String refEleID = Guid.newGuid().toString(); -// beElement.setColumnID(refEleID); -// boolean isPrimaryKey = beElement.getID().equals(primaryKeyID); -// //字段唯一则非空 -// table.addColumn( -// refEleID, -// code, -// name, -// getDataTypeByMDataType(beElement), -// length, -// precision, -// scale, -// null, -// isPrimaryKey, -// isPrimaryKey, -// !isPrimaryKey, -// beElement.getIsMultiLanguage()); -// -// return table.getColumnById(refEleID); -// } -// public static DataType getDataTypeByMDataType(GspBizEntityElement ele) { -// var mDataType = ele.getMDataType(); -// -// //多语字段的控制 -// if (ele.getIsMultiLanguage()) { -// switch (mDataType) { -// case String: -// return DataType.NVarchar; -// case Text: -// return DataType.NClob; -// default: -// throw new RuntimeException("字段'" + ele.getName() + "'为多语字段,其数据类型应为[字符串]或[备注]。"); -// } -// } -// -// //字段数据类型转换为列数据类型 -// switch (mDataType) { -// case Integer: -// return DataType.Int; -// case Decimal: -// return DataType.Decimal; -// case String: -// return DataType.Varchar; -// case Boolean: -// return DataType.Char; -// case Text: -// return DataType.Clob; -// case Date: -// return DataType.DateTime; -// case DateTime: -// return DataType.TimeStamp; -// case Binary: -// return DataType.Blob; -// default: -// throw new RuntimeException("未定义的字段数据类型'" + mDataType + "',无法转换为数据库对象字段类型。"); -// } -// } -// -// private static ElementLengthInfo getLengthPrecisionScale(GspBizEntityElement element) { -// int length = 0; -// int precision = 0; -// int scale = 0; -// -// // 解决lcm的长度精度小数位数与beElementDataType中长度精度小数位数中表达不一致问题 -// switch (element.getMDataType()) { -// //整型,赋值长度 -// case Integer: -// length = 0; -// precision = 0; -// scale = 0; -// break; -// //字符串,赋值长度 -// case String: -// length = element.getLength(); -// precision = 0; -// scale = 0; -// break; -// //浮点数字,赋值精度,小数位数 -// case Decimal: -// length = 0; -// precision = element.getLength(); -// scale = element.getPrecision(); -// break; -// //布尔型 -// case Boolean: -// length = 1; -// precision = 0; -// scale = 0; -// break; -// //其他,0,0,0 -// } -// -// return new ElementLengthInfo(length, precision, scale); -// } -// -// static class ElementLengthInfo { -// private int length; -// private int precision; -// private int scale; -// -// ElementLengthInfo(int length, int precision, int scale) { -// this.length = length; -// this.precision = precision; -// this.scale = scale; -// } -// } -// //endregion -//} diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java index 4f426f545c87e7080e9bb8e822838d9003033085..031bcd3754e50e86f548dce00dcd5ddc0f6a7e4f 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -42,23 +42,23 @@ public class BizElementDeserializer extends CmElementDeserializer { boolean result = true; GspBizEntityElement field = (GspBizEntityElement)item; switch (propName) { - case BizEntityJsonConst.CalculationExpress: + case BizEntityJsonConst.CALCULATION_EXPRESS: field.setCalculationExpress(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ValidationExpress: + case BizEntityJsonConst.VALIDATION_EXPRESS: field.setValidationExpress(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.RequiredCheckOccasion: + case BizEntityJsonConst.REQUIRED_CHECK_OCCASION: field.setRequiredCheckOccasion(SerializerUtils.readPropertyValue_Enum(jsonParser, RequiredCheckOccasion.class, RequiredCheckOccasion.values())); break; - case BizEntityJsonConst.IsDefaultNull: + case BizEntityJsonConst.IS_DEFAULT_NULL: field.setIsDefaultNull(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.UnifiedDataType: + case BizEntityJsonConst.UNIFIED_DATA_TYPE: //todo:json-文件中无Udt信息,为null SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.RtElementConfigId: + case BizEntityJsonConst.ELEMENT_CONFIG_ID: field.setRtElementConfigId(SerializerUtils.readPropertyValue_String(jsonParser)); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java index f183dea8e710766e87e02cd34b34926c5c766523..f94a59983de39ba022c7a46eeb018e1e31fdcfca 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/element/BizElementSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -41,10 +41,10 @@ public class BizElementSerializer extends CmElementSerializer { @Override protected void writeExtendElementSelfProperty(JsonGenerator writer, IGspCommonElement commonElement) { GspBizEntityElement bizElement = (GspBizEntityElement)commonElement; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CalculationExpress, bizElement.getCalculationExpress()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationExpress, bizElement.getValidationExpress()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RtElementConfigId, bizElement.getRtElementConfigId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsDefaultNull, bizElement.getIsDefaultNull()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CALCULATION_EXPRESS, bizElement.getCalculationExpress()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_EXPRESS, bizElement.getValidationExpress()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ELEMENT_CONFIG_ID, bizElement.getRtElementConfigId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_DEFAULT_NULL, bizElement.getIsDefaultNull()); writeUnifiedDataTypeDef(writer, bizElement); writeReqireCheckOccasion(writer, bizElement); } @@ -70,17 +70,17 @@ public class BizElementSerializer extends CmElementSerializer { } private void writeReqireCheckOccasion(JsonGenerator writer, GspBizEntityElement bizElement) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequiredCheckOccasion); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUIRED_CHECK_OCCASION); String value; switch (bizElement.getRequiredCheckOccasion()) { case All: - value = BizEntityEnumConst.RequiredCheckOccasionAll; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_ALL; break; case Save: - value = BizEntityEnumConst.RequiredCheckOccasionSave; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_SAVE; break; case Modify: - value = BizEntityEnumConst.RequiredCheckOccasionModify; + value = BizEntityEnumConst.REQUIRED_CHECK_OCCASION_MODIFY; break; default: throw new RuntimeException("未定义的枚举值:" + bizElement.getRequiredCheckOccasion()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java index 6b57ce378b2afb1298768a90813dea22ad984a40..f8354da4ebc23e17514363f88bbdef06c35f3ff2 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntityDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -45,46 +45,46 @@ public class BizEntityDeserializer extends CommonModelDeserializer { GspBusinessEntity be = (GspBusinessEntity)cm; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.Category: + case BizEntityJsonConst.CATEGORY: be.setCategory(SerializerUtils.readPropertyValue_Enum(reader, BECategory.class, BECategory.values())); break; - case BizEntityJsonConst.DataLockType: + case BizEntityJsonConst.DATA_LOCK_TYPE: be.setDataLockType(SerializerUtils.readPropertyValue_Enum(reader, GspDataLockType.class, GspDataLockType.values())); break; - case BizEntityJsonConst.ExtendType: + case BizEntityJsonConst.EXTEND_TYPE: SerializerUtils.readPropertyValue_String(reader); break; - case BizEntityJsonConst.DependentEntityId: + case BizEntityJsonConst.DEPENDENT_ENTITY_ID: be.setDependentEntityId(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.DependentEntityName: + case BizEntityJsonConst.DEPENDENT_ENTITY_NAME: be.setDependentEntityName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.CacheConfiguration: + case BizEntityJsonConst.CACHE_CONFIGURATION: be.setCacheConfiguration(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.DependentEntityPackageName: + case BizEntityJsonConst.ENTITY_PACKAGE_NAME: be.setDependentEntityPackageName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.EnableCaching: + case BizEntityJsonConst.ENABLE_CACHING: be.setEnableCaching(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.EnableTreeDtm: + case BizEntityJsonConst.ENABLE_TREE_DTM: be.setEnableTreeDtm(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.IsUsingTimeStamp: + case BizEntityJsonConst.IS_USING_TIME_STAMP: be.setIsUsingTimeStamp(SerializerUtils.readPropertyValue_boolean(reader)); break; - case BizEntityJsonConst.BizMgrActions: + case BizEntityJsonConst.BIZ_MGR_ACTIONS: readBizMgrActions(reader, be); break; - case BizEntityJsonConst.ComponentAssemblyName: + case BizEntityJsonConst.COMPONENT_ASSEMBLY_NAME: be.setComponentAssemblyName(SerializerUtils.readPropertyValue_String(reader)); break; - case BizEntityJsonConst.AssemblyName: + case BizEntityJsonConst.ASSEMBLY_NAME: SerializerUtils.readPropertyValue_String(reader); break; - case BizEntityJsonConst.Authorizations: + case BizEntityJsonConst.AUTHORIZATIONS: readAuthorizations(reader, be); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java index a9fff89b8da574ad12d205f6177ecf4740253920..d9b4773f4c2dfe59d497664f15ca4fb0bea74428 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/model/BizEntitySerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -37,28 +37,28 @@ import org.openatom.ubml.model.common.definition.commonmodel.json.object.CmObjec */ public class BizEntitySerializer extends CommonModelSerializer { - //region BaseProp + //BaseProp @Override protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspBusinessEntity be = (GspBusinessEntity)commonModel; writeBizActions(writer, be); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityId, be.getDependentEntityId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityName, be.getDependentEntityName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DependentEntityPackageName, be.getDependentEntityPackageName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CacheConfiguration, be.getCacheConfiguration()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EnableCaching, be.getEnableCaching()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EnableTreeDtm, be.getEnableTreeDtm()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DEPENDENT_ENTITY_ID, be.getDependentEntityId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DEPENDENT_ENTITY_NAME, be.getDependentEntityName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENTITY_PACKAGE_NAME, be.getDependentEntityPackageName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CACHE_CONFIGURATION, be.getCacheConfiguration()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENABLE_CACHING, be.getEnableCaching()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ENABLE_TREE_DTM, be.getEnableTreeDtm()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentAssemblyName, be.getComponentAssemblyName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Category, be.getCategory().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DataLockType, be.getDataLockType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ExtendType, be.getExtendType()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsUsingTimeStamp, be.getIsUsingTimeStamp()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_ASSEMBLY_NAME, be.getComponentAssemblyName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CATEGORY, be.getCategory().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DATA_LOCK_TYPE, be.getDataLockType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.EXTEND_TYPE, be.getExtendType()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_USING_TIME_STAMP, be.getIsUsingTimeStamp()); // SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Authorizations, be.getAuthorizations()); } private void writeBizActions(JsonGenerator writer, GspBusinessEntity be) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BizMgrActions); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BIZ_MGR_ACTIONS); BizMgrActionCollection actionList = be.getBizMgrActions(); BizMgrActionCollectionSerializer operationsConvertor = getMgrActionsConverter(); try { @@ -71,7 +71,7 @@ public class BizEntitySerializer extends CommonModelSerializer { private BizMgrActionCollectionSerializer getMgrActionsConverter() { return new BizMgrActionCollectionSerializer(); } - //endregion + @Override protected void writeExtendModelSelfProperty(IGspCommonModel iGspCommonModel, JsonGenerator jsonGenerator) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java index ac8efc5828d8c317ac3f616586946ce8bd6b56c0..c7c9855b89064fb6a6edfeff81d7cee2879dbc46 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -56,24 +56,24 @@ public class BizObjectDeserializer extends CmObjectDeserializer { boolean result = true; GspBizEntityObject object = (GspBizEntityObject)commonObject; switch (propName) { - case BizEntityJsonConst.Determinations: + case BizEntityJsonConst.DETERMINATIONS: readDeterminations(jsonParser, object); break; - case BizEntityJsonConst.Validations: + case BizEntityJsonConst.VALIDATIONS: readValidations(jsonParser, object); break; - case BizEntityJsonConst.BizActions: + case BizEntityJsonConst.BIZ_ACTIONS: readBizActions(jsonParser, object); break; - case BizEntityJsonConst.AuthFieldInfos: + case BizEntityJsonConst.AUTH_FIELD_INFOS: readAuthFieldInfos(jsonParser, object); break; - case BizEntityJsonConst.ValidationAfterSave: + case BizEntityJsonConst.VALIDATION_AFTER_SAVE: CommonValCollection collection = new CommonValCollection(); CommonValDeserializer der = new CommonValDeserializer(); SerializerUtils.readArray(jsonParser, der, collection); break; - case BizEntityJsonConst.LogicDeleteControlInfo: + case BizEntityJsonConst.LOGIC_DELETE_CONTROL_INFO: object.setLogicDeleteControlInfo(SerializerUtils.readPropertyValue_Object(LogicDeleteControlInfo.class, jsonParser)); try { jsonParser.nextToken(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java index 4583a2e4e024aacde8eda5488d97481698841e67..9bd8185b7fb3682b0d7db2b491e082961401c77a 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/object/BizObjectSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -46,7 +46,7 @@ public class BizObjectSerializer extends CmObjectSerializer { private ValCollectionSerializer valCollectionSerializer = new ValCollectionSerializer(); private BizActionCollectionSeriallizer actionCollectionSeriallizer = new BizActionCollectionSeriallizer(); - //region BaseProp + //BaseProp @Override protected void writeExtendObjectBaseProperty(JsonGenerator writer, IGspCommonObject commonObject) { GspBizEntityObject bizObject = (GspBizEntityObject)commonObject; @@ -54,7 +54,7 @@ public class BizObjectSerializer extends CmObjectSerializer { writeValidations(writer, bizObject); WriteBizActions(writer, bizObject); if (bizObject.getLogicDeleteControlInfo() != null) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.LogicDeleteControlInfo); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.LOGIC_DELETE_CONTROL_INFO); SerializerUtils.writePropertyValue_Object(writer, bizObject.getLogicDeleteControlInfo()); } @@ -62,7 +62,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void writeDeterminations(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.Determinations); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.DETERMINATIONS); DeterminationCollection dtms = bizObject.getDeterminations(); try { dtmCollectionSerializer.serialize(dtms, writer, null); @@ -72,7 +72,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void writeValidations(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.Validations); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.VALIDATIONS); ValidationCollection actionList = bizObject.getValidations(); try { valCollectionSerializer.serialize(actionList, writer, null); @@ -82,7 +82,7 @@ public class BizObjectSerializer extends CmObjectSerializer { } private void WriteBizActions(JsonGenerator writer, GspBizEntityObject bizObject) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BizActions); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.BIZ_ACTIONS); BizActionCollection actionList = bizObject.getBizActions(); try { actionCollectionSeriallizer.serialize(actionList, writer, null); @@ -110,7 +110,7 @@ public class BizObjectSerializer extends CmObjectSerializer { // SerializerUtils.WriteEndArray(writer); // } - //endregion + @Override diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java index db45140e86241f27ebfca12cdef0554f8c01ff27..4ddaf376a412a719728fcff8480d9589f6fd8057 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -45,13 +45,13 @@ public abstract class BizActionBaseDeserializer extends BizOperationDeserializer BizActionBase action = (BizActionBase)op; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.CurentAuthType: + case BizEntityJsonConst.CURENT_AUTH_TYPE: SerializerUtils.readPropertyValue_Enum(jsonParser, AuthType.class, AuthType.values()); break; - case BizEntityJsonConst.OpIdList: + case BizEntityJsonConst.OP_ID_LIST: action.setOpIdList(SerializerUtils.readStringArray(jsonParser)); break; - case BizEntityJsonConst.Parameters: + case BizEntityJsonConst.PARAMETERS: readParameters(jsonParser, action); break; case BizEntityJsonConst.ReturnValue: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java index 7f705d1139f8e21f9a04bb3b4849cc5eceacb875..422f1fe29a46369a886642ae2096aecc829379a6 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionBaseSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -50,7 +50,7 @@ public abstract class BizActionBaseSerializer extends BizOperationSerializer 0) { @@ -63,7 +63,7 @@ public abstract class BizActionBaseSerializer extends BizOperationSerializer 0) { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionDeserializer.java index 35b7e29885209b60387f2fb22ba9484841375005..f77095e8ad913bd1c27a3e4af10b9bccf3131d1d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionSeriallizer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionSeriallizer.java index 447e359a00ff579cabd0c5b89d997d10f509cba1..f15812e15da72924afbff8b49d9d5eff64040917 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionSeriallizer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionCollectionSeriallizer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionDeserializer.java index 7d44b8fd29a38046cb810ea4a8e8b925c76d9153..63acc55c34cb261ded8874f015845e4e41dade06 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionParaDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionParaDeserializer.java index fc78d4fcdeaa74a17bd97bde020e381c5b025e56..9b247e32dd8f3816eacf45a01f65b4f3e9f46c7a 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionParaDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionParaDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionSerializer.java index 7f1cce2c71aed885baba30dcf234c61db276cbf6..1cbc6f02c3d12640b8ab647b5c734ca6b4d01495 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizActionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java index dd1d65da2dd8ea7546f3d7d90db072b202c8c472..39c8c77b94b974847f65f09900051babb803812c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizDeterminationDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -44,22 +44,22 @@ public class BizDeterminationDeserializer extends BizOperationDeserializer dic = dtm.getRequestChildElements(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestChildElementKey, item.getKey()); - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElementValue); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY, item.getKey()); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE); writeDtmElementCollection(writer, item.getValue()); SerializerUtils.writeEndObject(writer); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionDeserializer.java index ba0b8e061a8d78c7a0fd65bd5c2ea30c0c5e0976..1322c058b55e1065cbddc75603bdede9ef8fe2c6 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionSerializer.java index a3e263f2d021acd7727a020403470e305e190e6d..0c627e2ed1a2c68e82fa568aa2dc6408829ff025 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionCollectionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java index c6bf32d2897acbbf971b7acc189f85d19902a2bb..32ab873f42629e237c080f0681cdc35b3cd84db1 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -38,10 +38,10 @@ public class BizMgrActionDeserializer extends BizActionBaseDeserializer { BizMgrAction action = (BizMgrAction)op; boolean hasProperty = true; switch (propName) { - case BizEntityJsonConst.FuncOperationID: + case BizEntityJsonConst.FUNC_OPERATION_ID: action.setFuncOperationID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.FuncOperationName: + case BizEntityJsonConst.FUNC_OPERATION_NAME: action.setFuncOperationName(SerializerUtils.readPropertyValue_String(jsonParser)); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionParaDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionParaDeserializer.java index b4367a3c7b6d417fd20afeecfd72dc497842f58e..2a5d3420590cd1e26a167c9c5069a500240f5876 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionParaDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionParaDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java index c862dd4f405fb0423ba2a6df9ebefee828431a30..32d96af9bcf3cf965d5f1ed0076d5e6c5accab7c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizMgrActionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -38,8 +38,8 @@ public class BizMgrActionSerializer extends BizActionBaseSerializer { @Override protected void writeExtendActionBaseProperty(JsonGenerator writer, BizActionBase action) { - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FuncOperationID, ((BizMgrAction)action).getFuncOperationID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FuncOperationName, ((BizMgrAction)action).getFuncOperationName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FUNC_OPERATION_ID, ((BizMgrAction)action).getFuncOperationID()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.FUNC_OPERATION_NAME, ((BizMgrAction)action).getFuncOperationName()); } @Override diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionDeserializer.java index daa1eebff514218528dfeea66e586942ef84559f..1786f59981d9ac1945c86652d30475ec6f21eca6 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionSerializer.java index 535a2e63d2121615d4afee1958e32e79975e1b7d..6a16455b8af2925cd224ee8a1d742a9b9c86d204 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationCollectionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java index 35e0f7c7b4829217eb23d1221c32df423674951e..03c02b06fcfbe544dc5414ed7edf3fba02c1cc90 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -99,31 +99,31 @@ public abstract class BizOperationDeserializer extends J case CommonModelNames.NAME: op.setName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.Description: + case BizEntityJsonConst.DESCRIPTION: op.setDescription(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentId: + case BizEntityJsonConst.COMPONENT_ID: op.setComponentId(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentName: + case BizEntityJsonConst.COMPONENT_NAME: op.setComponentName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ComponentPkgName: + case BizEntityJsonConst.COMPONENT_PKG_NAME: op.setComponentPkgName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.IsVisible: + case BizEntityJsonConst.IS_VISIBLE: op.setIsVisible(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.OpType: + case BizEntityJsonConst.OP_TYPE: SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.BelongModelId: + case BizEntityJsonConst.BELONG_MODEL_ID: op.setBelongModelID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.IsRef: + case BizEntityJsonConst.IS_REF: op.setIsRef(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case BizEntityJsonConst.IsGenerateComponent: + case BizEntityJsonConst.IS_GENERATE_COMPONENT: op.setIsGenerateComponent(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; case CefNames.CUSTOMIZATION_INFO: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java index 94f180e1ac6d2af00a2965bb504483bfe6cf63b2..f4556b535ea1905d281d7e4a778d6c3bb716939b 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizOperationSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -44,7 +44,7 @@ public abstract class BizOperationSerializer extends Jso SerializerUtils.writeEndObject(gen); } - //region BaseProp + //BaseProp private void writeBaseProperty(BizOperation op, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CommonModelNames.ID, op.getID()); @@ -52,7 +52,7 @@ public abstract class BizOperationSerializer extends Jso // 若为内置操作,则只序列化基本信息 if (isInternalAction(op.getID())) return; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsRef, op.getIsRef()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_REF, op.getIsRef()); writeExtendOperationBaseProperty(writer, op); } @@ -63,21 +63,21 @@ public abstract class BizOperationSerializer extends Jso } return false; } - //endregion - //region SelfProp + + //SelfProp private void writeSelfProperty(BizOperation op, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CommonModelNames.CODE, op.getCode()); SerializerUtils.writePropertyValue(writer, CommonModelNames.NAME, op.getName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Description, op.getDescription()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentId, op.getComponentId()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentName, op.getComponentName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ComponentPkgName, op.getComponentPkgName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsVisible, op.getIsVisible()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.DESCRIPTION, op.getDescription()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_ID, op.getComponentId()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_NAME, op.getComponentName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COMPONENT_PKG_NAME, op.getComponentPkgName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_VISIBLE, op.getIsVisible()); //SerializerUtils.writePropertyValue(writer, BizEntityConst.OpType, op.OpType);//子类赋值 //Owner不序列化 - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.BelongModelId, op.getBelongModelID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IsGenerateComponent, op.getIsGenerateComponent()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.BELONG_MODEL_ID, op.getBelongModelID()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.IS_GENERATE_COMPONENT, op.getIsGenerateComponent()); SerializerUtils.writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO, op.getCustomizationInfo()); // 若为内置操作,则只序列化基本信息 if (isInternalAction(op.getID())) { @@ -87,11 +87,11 @@ public abstract class BizOperationSerializer extends Jso writeExtendOperationSelfProperty(writer, op); } - //endregion - //region 抽象方法 + + //抽象方法 protected abstract void writeExtendOperationBaseProperty(JsonGenerator writer, BizOperation op); protected abstract void writeExtendOperationSelfProperty(JsonGenerator writer, BizOperation op); - //endregion + } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java index 09b9b6839d554a7cba74eeb4840487e6543098e6..12a9f3d3783e3fac3272d7096745a6b7faf7f2d4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParaDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -60,31 +60,31 @@ public abstract class BizParaDeserializer extends JsonDe case CommonModelNames.ID: para.setID(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParamCode: + case BizEntityJsonConst.PARAM_CODE: para.setParamCode(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParamName: + case BizEntityJsonConst.PARAM_NAME: para.setParamName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ParameterType: + case BizEntityJsonConst.PARAMETER_TYPE: para.setParameterType(SerializerUtils.readPropertyValue_Enum(jsonParser, BizParameterType.class, BizParameterType.values())); break; - case BizEntityJsonConst.Assembly: + case BizEntityJsonConst.ASSEMBLY: para.setAssembly(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.ClassName: + case BizEntityJsonConst.CLASS_NAME: para.setNetClassName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.JavaClassName: + case BizEntityJsonConst.JAVA_CLASS_NAME: para.setClassName(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.Mode: + case BizEntityJsonConst.MODE: para.setMode(SerializerUtils.readPropertyValue_Enum(jsonParser, BizParameterMode.class, BizParameterMode.values())); break; - case BizEntityJsonConst.ParamDescription: + case BizEntityJsonConst.PARAM_DESCRIPTION: para.setParamDescription(SerializerUtils.readPropertyValue_String(jsonParser)); break; - case BizEntityJsonConst.CollectionParameterType: + case BizEntityJsonConst.COLLECTION_PARAMETER_TYPE: para.setCollectionParameterType(SerializerUtils.readPropertyValue_Enum(jsonParser, BizCollectionParameterType.class, BizCollectionParameterType.values())); break; default: diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java index e7ef02858e37c442ba8eddb557bf0b94d92cac0d..b6ebf203d95f66ac079ced699fac95ae392e9649 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizParameterSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -42,15 +42,15 @@ public class BizParameterSerializer extends JsonSerializ //{ SerializerUtils.writeStartObject(writer); SerializerUtils.writePropertyValue(writer, CommonModelNames.ID, para.getID()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamCode, para.getParamCode()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamName, para.getParamName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParameterType, para.getParameterType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CollectionParameterType, para.getCollectionParameterType().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Assembly, para.getAssembly()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ClassName, para.getNetClassName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.JavaClassName, para.getClassName()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Mode, para.getMode().getValue()); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ParamDescription, para.getParamDescription()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_CODE, para.getParamCode()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_NAME, para.getParamName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAMETER_TYPE, para.getParameterType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.COLLECTION_PARAMETER_TYPE, para.getCollectionParameterType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ASSEMBLY, para.getAssembly()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.CLASS_NAME, para.getNetClassName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.JAVA_CLASS_NAME, para.getClassName()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.MODE, para.getMode().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.PARAM_DESCRIPTION, para.getParamDescription()); //} SerializerUtils.writeEndObject(writer); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java index 329d0f9e965b8d87c1da6596b0e5bde65666f4ce..599d978afefa3170f37a19651e32094e007beb8c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizReturnValueDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -33,8 +33,8 @@ public class BizReturnValueDeserializer extends BizParaDeserializer { @Override public final BizReturnValue deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) { BizReturnValue rez = (BizReturnValue)super.deserialize(jsonParser, null); - if (BizVoidReturnType.assembly.equals(rez.getAssembly()) - && BizVoidReturnType.className.equals(rez.getClassName())) { + if (BizVoidReturnType.ASSEMBLY.equals(rez.getAssembly()) + && BizVoidReturnType.CLASS_NAME.equals(rez.getClassName())) { BizReturnValue newRez = new BizVoidReturnType(); newRez.setID(rez.getID()); newRez.setParamCode(rez.getParamCode()); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java index cbaeb0fb57989aa16640216723ea12c66447e705..de6b2bdf3dacd6f4809febf12926d1a92b386e9d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/BizValidationDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -47,31 +47,31 @@ public class BizValidationDeserializer extends BizOperationDeserializer @Override protected void writeExtendOperationSelfProperty(JsonGenerator writer, BizOperation op) { Validation validation = (Validation)op; - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationType, validation.getValidationType().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TYPE, validation.getValidationType().getValue()); int triggerTimePointType = 0; for (BETriggerTimePointType timePointType : validation.getTriggerTimePointType()) { triggerTimePointType += timePointType.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.TriggerTimePointType, triggerTimePointType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.TRIGGER_TIME_POINT_TYPE, triggerTimePointType); // SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.Order, validation.getOrder()); // WritePrecedingIds(writer, validation); // WriteSucceedingIds(writer, validation); @@ -57,7 +57,7 @@ public class BizValidationSerializer extends BizOperationSerializer for (RequestNodeTriggerType requestNodeTrigger : validation.getRequestNodeTriggerType()) { requestNodeTriggerType += requestNodeTrigger.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestNodeTriggerType, requestNodeTriggerType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_NODE_TRIGGER_TYPE, requestNodeTriggerType); writeRequestElements(writer, validation); writeRequestChildElements(writer, validation); @@ -65,7 +65,7 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeRequestElements(JsonGenerator writer, Validation dtm) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestElements); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_ELEMENTS); writeValidationElementCollection(writer, dtm.getRequestElements()); } @@ -82,14 +82,14 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeRequestChildElements(JsonGenerator writer, Validation dtm) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElements); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENTS); HashMap dic = dtm.getRequestChildElements(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.RequestChildElementKey, item.getKey()); - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.RequestChildElementValue); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY, item.getKey()); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE); writeValidationElementCollection(writer, item.getValue()); SerializerUtils.writeEndObject(writer); } @@ -98,18 +98,18 @@ public class BizValidationSerializer extends BizOperationSerializer } private void writeValidationTriggerPoints(JsonGenerator writer, Validation val) { - SerializerUtils.writePropertyName(writer, BizEntityJsonConst.ValidationTriggerPoints); + SerializerUtils.writePropertyName(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINTS); HashMap> dic = val.getValidationTriggerPoints(); SerializerUtils.WriteStartArray(writer); if (dic != null && dic.size() > 0) { for (Map.Entry> item : dic.entrySet()) { SerializerUtils.writeStartObject(writer); - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationTriggerPointKey, item.getKey().getValue()); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINT_KEY, item.getKey().getValue()); int requestNodeTriggerType = 0; for (RequestNodeTriggerType trigger : item.getValue()) { requestNodeTriggerType += trigger.getValue(); } - SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.ValidationTriggerPointValue, requestNodeTriggerType); + SerializerUtils.writePropertyValue(writer, BizEntityJsonConst.VALIDATION_TRIGGER_POINT_VALUE, requestNodeTriggerType); SerializerUtils.writeEndObject(writer); } } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionDeserializer.java index 87da39fcc16fc0256c817ece7f493de0183b6b94..da097968aab150be68b05e9b79c89371bec4baed 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionSerializer.java index 82d98a8d8451cc0ef31634a2cdedf877cdf4b85a..4c04aef239e629852e908140dbc3ea7b6d2a3a59 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmCollectionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmRequestChildElementsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmRequestChildElementsDeserializer.java index 251e7c530bf91d9aefd40cf86928cb4176a7c9a4..fd738f713d85e93e23e79d255b395252a11071a4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmRequestChildElementsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/DtmRequestChildElementsDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java index 62ab9ffbf6f4fb68834b0a9796606e7694385cb6..002d8defef7ecd773b6e8d9d30df1773e4c2830e 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/RequestChildElementsDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -68,10 +68,10 @@ public abstract class RequestChildElementsDeserializer hashMap, String propName, JsonParser jsonParser) { switch (propName) { - case BizEntityJsonConst.RequestChildElementKey: + case BizEntityJsonConst.REQUEST_CHILD_ELEMENT_KEY: currentKey = SerializerUtils.readPropertyValue_String(jsonParser); break; - case BizEntityJsonConst.RequestChildElementValue: + case BizEntityJsonConst.REQUEST_CHILD_ELEMENT_VALUE: T collection = createValueType(); SerializerUtils.readArray(jsonParser, new StringDeserializer(), collection, true); hashMap.put(currentKey, collection); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionDeserializer.java index d99a513198b81b2c0e17d318b8320bb1f80125bf..d418511dd32438eb0c60e8b33b8bb486e5d99481 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionSerializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionSerializer.java index b9147d02bd08e6b6cb3c0d9d7fbe175a6e3b4b0f..282e213ece4d856f05949fa9974587f78292e312 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionSerializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValCollectionSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValRequestChildElementsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValRequestChildElementsDeserializer.java index 0dde1f22eb5e9618065edfb801549dc5138ed984..92d1fbf5097e4c5ba2a8815463a3fd2ead20b166 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValRequestChildElementsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValRequestChildElementsDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java index d380684c9e32be17037fdfb374c9a8e880ee345f..235030241f9e145df8a17caac103a5ad879d6358 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/json/operation/ValidatoinTriggerPointsDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -69,10 +69,10 @@ public class ValidatoinTriggerPointsDeserializer extends JsonDeserializer> hashMap, String propName, JsonParser jsonParser) { switch (propName) { - case BizEntityJsonConst.ValidationTriggerPointKey: + case BizEntityJsonConst.VALIDATION_TRIGGER_POINT_KEY: currentKey = (BETriggerTimePointType)BizOperationDeserializer.readBETriggerTimePointType(jsonParser).toArray()[0]; break; - case BizEntityJsonConst.ValidationTriggerPointValue: + case BizEntityJsonConst.VALIDATION_TRIGGER_POINT_VALUE: EnumSet currentValue = BizOperationDeserializer.readRequestNodeTriggerType(jsonParser); hashMap.put(currentKey, currentValue); break; diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BEOperationFactory.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BEOperationFactory.java index 86be13249a9de433af135e55e1c10b8a64a08d46..c94e07ccc5c9d6899b377bbbf5a9989c63b91fb2 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BEOperationFactory.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BEOperationFactory.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizAction.java index 650fe1e7fdcda0c9f20258f5bd56e2fd221f7e8b..40ee2f3f1d27e04a7838502f7da71d2e3a110905 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java index 824ec0bc5b39456cf633a0629d0c541e7ff2cf63..9b926bce63e4422c09b47ad05c007c6743304e28 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizActionBase.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -28,7 +28,7 @@ import org.openatom.ubml.model.be.definition.operation.componentinterface.IBizPa */ public abstract class BizActionBase extends BizOperation implements Cloneable { - // region 属性 + // 属性 private java.util.ArrayList opIdList = new java.util.ArrayList(); // private AuthType authType = AuthType.TransAuth; @@ -67,9 +67,9 @@ public abstract class BizActionBase extends BizOperation implements Cloneable { privateReturnValue = value; } - // endregion - // region 方法 + + // 方法 public java.util.ArrayList getOpIdList() { return (opIdList != null) ? opIdList : (opIdList = new java.util.ArrayList()); @@ -97,5 +97,5 @@ public abstract class BizActionBase extends BizOperation implements Cloneable { } } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizMgrAction.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizMgrAction.java index 4e334af069caff8f531a22d1a98dbffbfe225eb5..a2177272e39962819a553231726b28e0abafa026 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizMgrAction.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizMgrAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java index db13757f8f64d0a13fe1767d897dcc13f0ff5d26..f915a84c415e532ecaec9448171538a6b7ffca5e 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -186,9 +186,9 @@ public abstract class BizOperation implements Cloneable { this.customizationInfo = customizationInfo; } - // endregion - // region ���� + + // ���� /** * Equals���� @@ -310,5 +310,5 @@ public abstract class BizOperation implements Cloneable { setIsVisible(dependentOperation.getIsVisible()); } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java index 5e99630641afd9b492c08f278f495e8fab3d5624..2be775c85ce659d2c596dc3fc66b24611fd91a8c 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/BizOperationCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -37,7 +37,7 @@ public class BizOperationCollection extends BaseList implements Cl public BizOperationCollection() { } - // endregion + @Override public boolean add(BizOperation op) { return super.add(op); } diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java index 199abc9adcac463d6ad75fc740161066991c60b2..a48c77627b0d02675fb6cb108084023c8d16e3b4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Determination.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -32,24 +32,24 @@ import org.openatom.ubml.model.be.definition.collection.DtmElementCollection; */ public class Determination extends BizOperation implements Cloneable { - // region 字段 + // 字段 private DtmElementCollection rqtElements; private java.util.HashMap requestChildElements; // private java.util.HashMap preDtmId; - // endregion - // region 构造函数 + + // 构造函数 /** * Determination类型 */ private BEDeterminationType privateDeterminationType = BEDeterminationType.forValue(0); - // endregion - // region 属性 + + // 属性 /** * 触发时机的类型 */ @@ -136,9 +136,9 @@ public class Determination extends BizOperation implements Cloneable { // return preDtmId; // } - // endregion - // region 方法 + + // 方法 /** * 判断是否相等 @@ -216,6 +216,6 @@ public class Determination extends BizOperation implements Cloneable { // } } - // endregion + } \ No newline at end of file diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java index 1bc818fe8aee8114212912e2b1d6b15235ea46e4..4dcaa2618acbdc5c509a321aee4761e728257075 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/Validation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -103,38 +103,6 @@ public class Validation extends BizOperation implements Cloneable { validationTriggerPoints = value; } - // endregion - - // //#region Private Methods - - // private java.util.List InitSucceedings() - // { - - // succeedings = InitValidationsById(getSucceedingIds()); - // return succeedings; - // } - - // private java.util.List InitPrecedings() - // { - // precedings = InitValidationsById(getPrecedingIds()); - // return precedings; - // } - - // private java.util.List InitValidationsById(java.util.List - // idList) - // { - // //������� - // Object tempVar = getOwner().getValidations().firstOrDefault(item { return - // item.getID(id.equals())); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // return idList.select(id { return (Validation)((tempVar instanceof Validation) - // ? tempVar : null)).toList(); - // } - - // //#endregion - - // region ���� /** * �ж���� @@ -149,10 +117,10 @@ public class Validation extends BizOperation implements Cloneable { } /** - * ��дEquals + * Equals * - * @param other �����뵱ǰУ�����Ƚϵ�У������� - * @return ��ȷ���true + * @param other + * @return true */ protected final boolean equals(Validation other) { // return super.equals(other) && getOrder() == other.getOrder() && @@ -162,7 +130,7 @@ public class Validation extends BizOperation implements Cloneable { } /** - * ��д GetHashCode + * GetHashCode * * @return */ @@ -171,7 +139,7 @@ public class Validation extends BizOperation implements Cloneable { { // int hashCode = (super.hashCode() * 397) ^ (new // Integer(getOrder())).hashCode(); - int hashCode = (super.hashCode() * 397); + int hashCode = super.hashCode() * 397; hashCode = (hashCode * 397) ^ getValidationType().hashCode(); hashCode = (hashCode * 397) ^ getRequestNodeTriggerType().hashCode(); return hashCode; @@ -187,7 +155,7 @@ public class Validation extends BizOperation implements Cloneable { } /** - * Clone���� + * Clone * * @param isGenerateId * @return @@ -219,10 +187,9 @@ public class Validation extends BizOperation implements Cloneable { // setPrecedingIds(dependentValidation.getPrecedingIds()); } - // endregion /** - * �������� + * */ @Override public BEOperationType getOpType() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParamCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParamCollection.java index 0aecb23c7555f6d18e187ee493d39002aa04836e..41d2b01c4cece518e2ba8d8664f486d6d875ad86 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParamCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParamCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParameter.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParameter.java index a13ee9774b0327c7ecfda6435b079d0221289bd0..b6530ad42e176f09b0ac729b0be5cad6becb7543 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParameter.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/bemgrcomponent/BizMgrActionParameter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParamCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParamCollection.java index dff01b156a5cb535fbd27bf8f3a04781e6a1f6c7..6d14625c48383cab22c52f9d96bef7b9f55f0adf 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParamCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParamCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParameter.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParameter.java index 678d76a4840835341a8e39441b0d8a4cd502bb82..e0041a32db365095435524327b20ab7c0c1430c4 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParameter.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/beomponent/BizActionParameter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java index b0540eac7a1ac5677f523dc88ba6057a5a97d971..8df2e78dbb89eedd2e8da8f8fa7e74812f5a3ba5 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizActionCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -30,6 +30,7 @@ import org.openatom.ubml.model.be.definition.operation.BizOperationCollection; public class BizActionCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; + @Override public final boolean add(BizOperation operation) { if (operation instanceof BizAction) { operation.setOwner(getOwner()); @@ -38,36 +39,6 @@ public class BizActionCollection extends BizOperationCollection { throw new RuntimeException("错误的Action类型"); } - // /** - // 克隆BEAction动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final BizActionCollection clone(boolean isGenerateId) - // { - // BizActionCollection col = new BizActionCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return (BizAction)item.clone(isGenerateId))); - // return col; - // } - - // /** - // * 克隆BEAction动作集合 - // * - // * @return 返回动作集合 - // */ - // // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s - // shadowing - // // via the 'new' keyword: - // // ORIGINAL LINE: public new object clone() - // public final Object clone() { - // return clone(false); - // } @Override public BizActionCollection clone() { return (BizActionCollection)super.clone(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java index 98db55c94c36bc5e77fd0d6dbef6858337ced5b4..2c805f977efe5f5bb53811cb427118b3e228bae8 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/BizMgrActionCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -30,9 +30,8 @@ import org.openatom.ubml.model.be.definition.operation.BizOperationCollection; public class BizMgrActionCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new void add(BizOperation operation) + + @Override public final boolean add(BizOperation operation) { if (operation instanceof BizMgrAction) { return super.add(operation); @@ -40,37 +39,6 @@ public class BizMgrActionCollection extends BizOperationCollection { throw new RuntimeException("错误的Action类型"); } - // /** - // 克隆BEMgrAction动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final Object clone(boolean isGenerateId) - // { - // BizMgrActionCollection col = new BizMgrActionCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (BizMgrAction)item.clone(isGenerateId))); - // return col; - // } - - // /** - // * 克隆BEMgrAction动作集合 - // * - // * @return 返回动作集合 - // */ - // // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s - // shadowing - // // via the 'new' keyword: - // // ORIGINAL LINE: public new object clone() - // public final Object clone() { - // return clone(false); - // } @Override public BizMgrActionCollection clone() { return (BizMgrActionCollection)super.clone(); diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java index 37ca1e0817b67238745718d232957ea21d5d7e0b..3a56b3c38de094962214dd9f6ac3caca91170436 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/DeterminationCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -32,9 +32,7 @@ import org.openatom.ubml.model.be.definition.operation.Determination; public class DeterminationCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new void add(BizOperation operation) + @Override public final boolean add(BizOperation operation) { if (operation instanceof Determination) { operation.setOwner(getOwner()); @@ -43,37 +41,6 @@ public class DeterminationCollection extends BizOperationCollection { throw new RuntimeException("错误的Determination类型"); } - // /** - // 克隆BE Determinations动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final DeterminationCollection clone(boolean isGenerateId) - // { - // DeterminationCollection col = new DeterminationCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (Determination)item.clone(isGenerateId))); - // return col; - // } - - // /** - // 克隆BE Determinations动作集合 - - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone() - // public final Object clone() - // { - // return clone(false); - // } @Override public DeterminationCollection clone() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java index bc44c08f86b2096b06b5652d26a7d9045be8930b..d836345f5fa2c33695246a5daacf7a3df4ba3f49 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/collection/ValidationCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -30,6 +30,7 @@ import org.openatom.ubml.model.be.definition.operation.Validation; public class ValidationCollection extends BizOperationCollection { private static final long serialVersionUID = 1L; + @Override public final boolean add(BizOperation operation) { if (operation instanceof Validation) { operation.setOwner(getOwner()); @@ -38,37 +39,6 @@ public class ValidationCollection extends BizOperationCollection { throw new RuntimeException("错误的Validation类型"); } - // /** - // 克隆BE Validations动作集合 - - // @param isGenerateId 是否生成Id - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone(bool isGenerateId) - // public final Object clone(boolean isGenerateId) - // { - // ValidationCollection col = new ValidationCollection(); - // //C# TO JAVA CONVERTER TODO TASK: Lambda expressions and anonymous methods - // are not converted by C# to Java Converter: - // col.addRange(this.select(item { return - // (Validation)item.clone(isGenerateId))); - // return col; - // } - - // /** - // 克隆BE Validations动作集合 - - // @return 返回动作集合 - // */ - // //C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // //ORIGINAL LINE: public new object clone() - // public final Object clone() - // { - // return clone(false); - // } @Override public ValidationCollection clone() { diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameter.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameter.java index c7d2a3a966e42c5646d4ab69f7aa6188fd955d8a..753948b4877406faadf27c6aab97980bd8651a1d 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameter.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java index b883903e338806a6b4eba50d92b2a1e79ee032d5..41b78e8df77483b0ec49985eda508d6d5d902eff 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java +++ b/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/operation/componentbase/BizParameterCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -35,7 +35,7 @@ public class BizParameterCollection extends ArrayList -1 && index < getCount()) { return compParameters.get(index); @@ -110,20 +110,20 @@ public class BizParameterCollection extends ArrayList GetEnumerator() // { // for (IBizParameter item : compParameters) @@ -137,7 +137,7 @@ public class BizParameterCollection extends ArrayList + + diff --git a/model/common/definition/pom.xml b/model/common/definition/pom.xml index e7490d14c5865f07445638843483911784b61ca5..5f006871ac227bb359bb790be06220e75c9c8c1b 100644 --- a/model/common/definition/pom.xml +++ b/model/common/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java similarity index 77% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java index c401a49eecbd1c2427f7eea32fc31315f98cca7b..f8fbd9f8aac844a14790e45bdf965222398977f6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/AbstractMetadataContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/AbstractMetadataContent.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type AbstractMetadataContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java similarity index 64% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java index 753cd458a5fc1b73e102feaf5629e05ad496b519..1a5992b7bbb5bfb96bcbc5388320bc4b312c691e 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMdExtRuleContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMdExtRuleContent.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type IMdExtRuleContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java similarity index 64% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java index 69ef98506ef169b1d29f67197e946eb0809a7d4d..c34c7cf98fa2f3a3e17e5d94558117edc15457a2 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/IMetadataContent.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/IMetadataContent.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api; /** * The type IMetadataContent diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java similarity index 90% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java index d56f33632202fc9f0785a56aa9fed03ca6186bad..f95f2ea94d92a14ecd707951ae6af2a4f4102a38 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/GspMetadata.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspMetadata.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; @@ -148,6 +150,14 @@ public class GspMetadata { this.properties = properties; } + public String getPreviousVersion() { + return previousVersion; + } + + public String getVersion() { + return version; + } + @Override public Object clone() { GspMetadata metadata = new GspMetadata(); diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java similarity index 67% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java index 116dc58081b7ee07a20d74288db80a30d0b9400f..3d1f6a10473644b73a5bd328391c98f850ca0b5f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItem.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItem.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class I18nResourceItem { @@ -65,15 +65,20 @@ public class I18nResourceItem { @Override public boolean equals(Object obj) { - if (obj instanceof I18nResourceItem) { - return this.key.equals(((I18nResourceItem)obj).key); - } else { + if (this == obj) { + return true; + } + if (!(obj instanceof I18nResourceItem)) { return false; } + I18nResourceItem item = (I18nResourceItem) obj; + return key == null ? item.getKey() == null : key.equals(item.getKey()); } @Override public int hashCode() { - return super.hashCode(); + int result = 17; + result = 31 * result + (key == null ? 0 : key.hashCode()); + return result; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java similarity index 88% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java index bbd1233a1b6b8365bd4b898d6d7e711a4890e67d..d3c6cb36db245cfce66a8b2e2ed18c484a4613a6 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResourceItemCollection.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResourceItemCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.ArrayList; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java similarity index 92% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java index 7dfacd14ceda07ed03f8a7632de5493291bb2af6..9f69fa5aacc187247b46358a3aef06e530e7774c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataHeader.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataHeader.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java similarity index 77% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java index 144d1515f2f9ae17dbb2da062ac0d31271063555..98bb8d3899802c3eb0eba6fc9515daeefeeb0d6a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataProperties.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProperties.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * The type MetadataProperties diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java similarity index 88% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java index e190adaa09a542e5e9188c0c1d7a63d2ebbd44ca..44564296552d79cf0f84284505a75766a987473f 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReference.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReference.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.ArrayList; import java.util.List; diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java similarity index 82% rename from model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java rename to model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java index 9e75b522ef6b516d2ec28aaa449a3d1c101e5558..9ce8065f4fb41455538cbf6fe0e4a7781dfbab93 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/entity/MetadataReferenceDetail.java +++ b/model/common/definition/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataReferenceDetail.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.common.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * The type MetadataReferenceDetail diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IFieldCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IFieldCollection.java index 985ad20001f6758647a4aa5c841918f9a264c8b7..d66ed93082f5e253ec2d3332c3029391c179714a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IFieldCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IFieldCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonDataType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonDataType.java index dbd31dd517f44ddd2a6b2626b878ad52500ad7eb..d7c14b8ee918ae269b71e0beaf8a4943d4c89f7c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonDataType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonDataType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -229,5 +229,5 @@ public interface IGspCommonDataType { * @return */ IGspCommonField findElement(String elementId); - // endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonField.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonField.java index 14b09e089d78cf8032246415f6b66ade656c1217..f02eac2db24acb1836a3c45855f0a0e4a44913ac 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonField.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/IGspCommonField.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -430,6 +430,6 @@ public interface IGspCommonField extends Cloneable { * @return The New Field Cloned By This Field */ IGspCommonField clone(IGspCommonDataType absObject, GspAssociation parentAssociation); - // endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/BaseList.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/BaseList.java index d3bb1b86af082914d60d88a3d990a2f012319511..3e717ccb2b98cf4ed652c4e68acfa6d9d6087bfe 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/BaseList.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/BaseList.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -30,10 +30,6 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis private static final long serialVersionUID = 1L; - /** - * 操作的数组 - */ -// protected ArrayList _list = new ArrayList(); /** * 构造一个新的列表 @@ -41,8 +37,6 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis public BaseList() { } - // region IList 成员 - /** * 获取、设置指定位置的项目 */ @@ -114,51 +108,13 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis * @param value * @return */ + @Override public boolean contains(Object value) { return super.contains(value); } -// /** -// * 清除所有的内容 -// * -// */ -// public void clear() { -// _list.clear(); -// } - - /** - * 返回指定项目的索引 - * - * @param value 当前列表的任意一项 - * @return 位置 - */ -// public int indexOf(Object value) { -// for (int i = 0; i < _list.size(); i++) { -// if (_list.get(i) == value) { -// return i; -// } -// } -// return -1; -// } - - /** - * 添加新项目 - * - * @param value 新项目 - * @return 添加到的位置 - */ -// public void add(T value) { -// _list.add(value); -// } - - /** - * 是否固定尺寸 - */ - // public boolean IsFixedSize => _list.IsFixedSize; - - // endregion - // region ICollection 成员 + // ICollection 成员 public final boolean getIsSynchronized() { // TODO: 添加 BaseList.IsSynchronized getter 实现 return false; @@ -168,84 +124,9 @@ public class BaseList extends java.util.ArrayList implements java.util.Lis return super.size(); } - // public final void CopyTo(ArrayList array, int index) { - // _list.subList(array, index); - // } - - // public Object getSyncRoot(){ _list.SyncRoot;} - - // endregion - - // region IEnumerable 成员 - - // public final Iterable getEnumerator() { - // return _list.iterator(); - // } - - // endregion - - // /** - // * 列表的枚举器类 - // * - // */ - // // C# TO JAVA CONVERTER TODO TASK: The interface type was changed to the - // closest - // // equivalent Java type, but the methods implemented will need adjustment: - // public static class ListEnumerator implements java.util.Iterable { - // public BaseList _base = null; - // private int index = -1; - - // public ListEnumerator(BaseList list) { - // _base = list; - // } - - // // region IEnumerator 成员 - - // /** - // * 重置 - // * - // */ - // public final void reset() { - // index = -1; - // } - - // /** - // 获取当前项 - - // */ - // public Object Current - // { - // return _base._list[index]; - // } - - // /** - // * 是否有下一个项目 - // * - // * @return - // */ - // public final boolean moveNext() { - // return (++index) < _base.size(); - // } - - // @Override - // public boolean hasNext() { - // return false; - // } - - // @Override - // public Object next() { - // return null; - // } - - // // C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // // endregion - - // } - - // region Clonenable + @Override @SuppressWarnings("unchecked") public BaseList clone() { return (BaseList)super.clone(); } - //// endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonDtmCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonDtmCollection.java index 3cdd7e8207ac83e92e6e0346e6db3dddd9d7f27e..625b3fb66ea09c330c385e62b2d86bad79377a17 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonDtmCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonDtmCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonValCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonValCollection.java index 9500232a7ea48f37dc7da25d5e51a6b5342950c9..b0edf8501abdcc263f8f814dba5f51ba6f62bfba 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonValCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/CommonValCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/DtmElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/DtmElementCollection.java index 7a92969329b1df5cd2ffcc85c1fbd673d2d4ba19..8849a8f6c0bed49d9042b0405f457df8bc70ac6d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/DtmElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/DtmElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationCollection.java index b1408a55d8fed587c211b0b7583131baad566bc8..4b68a898f857bda19bd83887714deefb1324d8f1 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java index 0e511c48f67e3dfceb5d1ae41b97ef3c78fac0f9..c204206fc7c57d270457665a8d9f8747497d7777 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspAssociationKeyCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -59,6 +59,7 @@ public class GspAssociationKeyCollection extends BaseList imp * * @param index */ + @Override public void removeAt(int index) { remove(index); } @@ -69,46 +70,9 @@ public class GspAssociationKeyCollection extends BaseList imp * @param index * @param associationKey */ + @Override public final void insert(int index, GspAssociationKey associationKey) { super.insert(index, associationKey); } - /** - * Index - * - */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new GspAssociationKey this[int index] => - // (GspAssociationKey)((_list[index] instanceof GspAssociationKey) ? - // _list[index] : null); - // public GspAssociationKey this[int index] => - // (GspAssociationKey)((_list.get(index) instanceof GspAssociationKey) ? - // _list.get(index) : null); - - // //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // //#region ICloneable Members - - // /** - // 克隆 - - // @return - // */ - // public Object clone() - // { - // Object tempVar = Memberwiseclone(); - // GspAssociationKeyCollection newObj = (GspAssociationKeyCollection)((tempVar - // instanceof GspAssociationKeyCollection) ? tempVar : null); - // newObj._list = new java.util.arrayList(); - // for (GspAssociationKey item : this) - // { - // Object tempVar2 = item.clone(); - // newObj.add((GspAssociationKey)((tempVar2 instanceof GspAssociationKey) ? - // tempVar2 : null)); - // } - // return newObj; - // } - - // //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - // //#endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java index 22227bba8fa5cee8f72271743c95c5a391926545..2e609877b4ff5f04a42c774a5c4eff86eab3db81 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspEnumValueCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -63,6 +63,7 @@ public class GspEnumValueCollection extends BaseList implements Cl * * @param index */ + @Override public void removeAt(int index) { remove(index); } @@ -73,38 +74,11 @@ public class GspEnumValueCollection extends BaseList implements Cl * @param index * @param element */ + @Override public final void insert(int index, GspEnumValue element) { super.insert(index, element); } - /** - * Index[int] - * - */ - // C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing - // via the 'new' keyword: - // ORIGINAL LINE: public new GspEnumValue this[int index] => - // (GspEnumValue)((_list[index] instanceof GspEnumValue) ? _list[index] : null); - // public GspEnumValue this[int index] => (GspEnumValue)((_list.get(index) - // instanceof GspEnumValue) ? _list.get(index) : null); - - // /// - // /// Index[string] - // /// - // public Element this[string id] - // { - // get - // { - // foreach(Element _elem in _list) - // { - // if(id.equals(_elem.ID)) - // return _elem; - // } - // return null; - // } - // } - - // region ICloneable Members /** * 克隆 @@ -115,5 +89,5 @@ public class GspEnumValueCollection extends BaseList implements Cl return (GspEnumValueCollection)super.clone(); } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java index 2e815590e1373cdfe3dab9ab9af80b809eb37b4e..4b8ff8895206bbbd5711f511501a152715a5a093 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/GspFieldCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -132,6 +132,7 @@ public class GspFieldCollection extends BaseList implements IFi } } + @Override public IGspCommonField getItem(int index) { return super.get(index); } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/ValElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/ValElementCollection.java index 45dcedb13a6952fdcca4c8758237ce476955bad4..da9bcdbc47df90ed929cebc58ce8ba1fbf9ad20f 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/ValElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/collection/ValElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/AssoModelInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/AssoModelInfo.java index b2fc1dfcaea09195e38057a84029aaf1b54f34e3..6c81a2e570b36c3319c611c4ac6d8af7c4e5ca89 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/AssoModelInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/AssoModelInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ElementDefaultVauleType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ElementDefaultVauleType.java index 45c68f7e0edce3717fdd2a771f5a44e1f17415f1..4d6f97be1f37a412a7ad442b0278c2ba587ae9cb 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ElementDefaultVauleType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ElementDefaultVauleType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/EnumIndexType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/EnumIndexType.java index 7e3d7026dc33ce3c9a0f15dadc226b4049d03b71..3be891f0d19d7d218462c9b81177e6338a8905cb 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/EnumIndexType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/EnumIndexType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/FieldCollectionType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/FieldCollectionType.java index dc4dc778c86594305130d7ed162dd1cef509fdea..0bd3e7cce938fd8a6df18e4852ba478655d5028e 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/FieldCollectionType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/FieldCollectionType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ForeignKeyConstraintType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ForeignKeyConstraintType.java index 1c23fe8ae29573e976496eea9aa4807723fb28d9..e8ad0af4091cbf0d686c71162b3812ccb34daf96 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ForeignKeyConstraintType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/ForeignKeyConstraintType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociation.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociation.java index 07384b23a7ef81c45642ac8d7151ed947dc5eeef..c1b652efe8ccd2918d0b953982bfc03fde86df33 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociation.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java index 61ae966bb890416fee0889ca78759985cb534b11..a10e67d8da55231db297f20d25b438e97713b535 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspAssociationKey.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -100,14 +100,13 @@ public class GspAssociationKey implements Cloneable { refdataModelName = value; } - /// region ICloneable Members - /** * 克隆 * * @return * @throws CloneNotSupportedException */ + @Override public final GspAssociationKey clone() { Object tempVar; try { @@ -124,5 +123,4 @@ public class GspAssociationKey implements Cloneable { return newAssKey; } - /// endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspDeleteRuleType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspDeleteRuleType.java index e4b0820ba491892e1eafb0de235ae35c583d356c..052da589e442a1ba51af143cf0ada0df84999feb 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspDeleteRuleType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspDeleteRuleType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementDataType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementDataType.java index 49fce9716a4dede8bd29b225dd0c1345041ccfbf..61d0bd5e1f2dc5353e4aaa791153a9286ee75043 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementDataType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementDataType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementObjectType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementObjectType.java index 1767dc9a8d59ed5b96594a6d09dc1ee10732628e..f7d6f856fd477f92e17633c1198eeade1e76ca21 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementObjectType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspElementObjectType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java index 74d43134d514d8b9abade9b8254052a3afbe86ca..d1bf078f914f04a4fb87f969640b080fa91eaed6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/GspEnumValue.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -118,14 +118,13 @@ public class GspEnumValue implements Cloneable { privateI18nResourceInfoPrefix = value; } -//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - //#region ICloneable Members /** * 克隆 * * @return */ + @Override public final GspEnumValue clone() { GspEnumValue newEnumValue = new GspEnumValue(); newEnumValue.val = this.val; @@ -137,6 +136,4 @@ public class GspEnumValue implements Cloneable { return newEnumValue; } -//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: - //#endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/JoinMode.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/JoinMode.java index 89a6533dbdd2ee9ab6b4e80b0bce04533115762c..d40012408dd61b10bea517e2845566e53332c48c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/JoinMode.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/element/JoinMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/ClassInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/ClassInfo.java index d57b13edef574797aac6fc517c28791b422b5056..661d4ddfef0d5afbb0f8c065a672859e8ccacbcf 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/ClassInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/ClassInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/CustomizationInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/CustomizationInfo.java index 63b49dc872a3973c734fa26ac5fc9f25385944c0..08c9c60c3a444447443cd67cdb997a2f1d8301bc 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/CustomizationInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/CustomizationInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DataTypeAssemblyInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DataTypeAssemblyInfo.java index 141257fef0e8d4723703d432b382cc4c59d9d4f1..1b101bb7d386696f97f6c0585be16c73f6708997 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DataTypeAssemblyInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DataTypeAssemblyInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DimensionInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DimensionInfo.java index 927a49024a87aca9705e6cf5da2055e916fb54b4..674eba8238702deae4c91e4e287c83e3f30194a6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DimensionInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DimensionInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DynamicPropSetInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DynamicPropSetInfo.java index 0fbb5ef55342b6d56fa1dc7c9f97161fb3a9da67..2a30b4164eca07c67db621a762d7b0af20e54a27 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DynamicPropSetInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/DynamicPropSetInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java index 6eb932fd56253c01a657fcca305f9e7959a75b09..cd7759ea88617ce300da57b7391766e3d030babf 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonDataType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -33,9 +33,8 @@ import org.openatom.ubml.model.common.definition.cef.util.Guid; * @Version: V1.0 */ public abstract class GspCommonDataType implements IGspCommonDataType { - // region 私有属性 + // 私有属性 private String id = Guid.newGuid().toString(); - ; private String code = ""; private String name = ""; private CommonDtmCollection dtmBeforeSave = new CommonDtmCollection(); @@ -49,20 +48,20 @@ public abstract class GspCommonDataType implements IGspCommonDataType { private List bizTagIds; private Boolean bigNumber; - // endregion + /** * 是否引用对象 */ private boolean privateIsRef; - // endregion - // region 公共属性 + + // 公共属性 /** * 国际化项前缀 */ private String privateI18nResourceInfoPrefix; - // region 构造函数 + // 构造函数 protected GspCommonDataType() { setContainElements(new GspFieldCollection()); // DynamicPropSerializerComps = new List(); @@ -247,14 +246,14 @@ public abstract class GspCommonDataType implements IGspCommonDataType { public void setCustomizationInfo(CustomizationInfo customizationInfo) { this.customizationInfo = customizationInfo; } - // endregion - // region 方法 + + // 方法 public abstract IGspCommonField findElement(String id); public abstract ClassInfo getGeneratedEntityClassInfo(); - // endregion + /** * 根据标签获取字段列表 diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java index 71dd35a68e6dddc587e0b780920aca5df29269f7..72256204fa7af40e2f6c1f849392682f2bfd2d98 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/GspCommonField.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -42,7 +42,7 @@ import org.openatom.ubml.model.common.definition.cef.util.Guid; * @Version: V1.0 */ public class GspCommonField implements IGspCommonField { - // region 私有属性 + // 私有属性 @JsonProperty(CefNames.ID) private String id = Guid.newGuid().toString(); @JsonProperty(CefNames.CODE) @@ -67,7 +67,7 @@ public class GspCommonField implements IGspCommonField { private boolean isRequire = true; @JsonProperty(CefNames.IS_MULTI_LANGUAGE) private boolean isMultilLanguage; - @JsonProperty(CefNames.IS_VIRTUAL) + @JsonProperty(CefNames.BELONG_OBJECT) private transient IGspCommonDataType belongObject; @JsonProperty(CefNames.CHILD_ELEMENTS) //todo:j-json @@ -104,7 +104,7 @@ public class GspCommonField implements IGspCommonField { private boolean bigNumber = false; private boolean privateIsRef; - // region 公共属性 + // 公共属性 /** * 是否启用业务字段 */ @@ -135,25 +135,29 @@ public class GspCommonField implements IGspCommonField { */ private DynamicPropSetInfo privateDynamicPropSetInfo = new DynamicPropSetInfo(); - // endregion + public GspCommonField() { setIsRef(false); setCollectionType(FieldCollectionType.None); setEnumIndexType(EnumIndexType.Integer); } + @Override public String getID() { return id; } + @Override public void setID(String value) { id = value; } + @Override public String getCode() { return code; } + @Override public void setCode(String value) { code = value; } @@ -170,10 +174,12 @@ public class GspCommonField implements IGspCommonField { return labelId; } + @Override public void setLabelID(String value) { labelId = value; } + @Override public List getBeLabel() { if (beLabel == null) { beLabel = new ArrayList(); @@ -182,10 +188,12 @@ public class GspCommonField implements IGspCommonField { return beLabel; } + @Override public void setBeLabel(List value) { beLabel = value; } + @Override public List getBizTagIds() { if (this.bizTagIds == null) { bizTagIds = new ArrayList(); @@ -194,22 +202,27 @@ public class GspCommonField implements IGspCommonField { return bizTagIds; } + @Override public void setBizTagIds(List value) { bizTagIds = value; } + @Override public GspElementDataType getMDataType() { return dataType; } + @Override public void setMDataType(GspElementDataType value) { dataType = value; } + @Override public String getDefaultValue() { return defaultValue; } + @Override public void setDefaultValue(String value) { defaultValue = value; } @@ -229,54 +242,67 @@ public class GspCommonField implements IGspCommonField { return objectType; } + @Override public void setObjectType(GspElementObjectType value) { objectType = value; } + @Override public int getLength() { return length; } + @Override public void setLength(int value) { length = value; } + @Override public int getPrecision() { return precision; } + @Override public void setPrecision(int value) { precision = value; } + @Override public boolean getIsVirtual() { return isVirtual; } + @Override public void setIsVirtual(boolean value) { isVirtual = value; } + @Override public boolean getIsRequire() { return isRequire; } + @Override public void setIsRequire(boolean value) { isRequire = value; } + @Override public boolean getIsMultiLanguage() { return isMultilLanguage; } + @Override public void setIsMultiLanguage(boolean value) { isMultilLanguage = value; } + @Override public boolean getIsRef() { return privateIsRef; } + @Override public void setIsRef(boolean value) { privateIsRef = value; } @@ -284,14 +310,17 @@ public class GspCommonField implements IGspCommonField { /** * bigNumber */ + @Override public boolean isBigNumber() { return this.bigNumber; } + @Override public void setIsBigNumber(boolean value) { this.bigNumber = value; } + @Override public IGspCommonDataType getBelongObject() { if (this.getIsRefElement() && belongObject == null) { return this.getParentAssociation().getBelongElement().getBelongObject(); @@ -299,10 +328,12 @@ public class GspCommonField implements IGspCommonField { return belongObject; } + @Override public void setBelongObject(IGspCommonDataType value) { belongObject = value; } + @Override public GspFieldCollection getChildElements() { if (childElements == null) { childElements = new GspFieldCollection(); @@ -314,6 +345,7 @@ public class GspCommonField implements IGspCommonField { childElements = value; } + @Override public MappingRelation getMappingRelation() { if (mappingRelation == null) { mappingRelation = new MappingRelation(); @@ -328,14 +360,17 @@ public class GspCommonField implements IGspCommonField { /** * /////关联引用 */ + @Override public GspAssociationCollection getChildAssociations() { return childAssociations; } + @Override public void setChildAssociations(GspAssociationCollection value) { childAssociations = value; } + @Override public final boolean getHasAssociation() { if (getChildAssociations() == null || getChildAssociations().size() == 0) { return false; @@ -343,107 +378,133 @@ public class GspCommonField implements IGspCommonField { return true; } + @Override public GspEnumValueCollection getContainEnumValues() { return enumValueCollection; } + @Override public void setContainEnumValues(GspEnumValueCollection value) { enumValueCollection = value; } + @Override public boolean getIsRefElement() { return isRefElement; } + @Override public void setIsRefElement(boolean value) { isRefElement = value; } + @Override public String getRefElementId() { return refelementId; } + @Override public void setRefElementId(String value) { refelementId = value; } + @Override public GspAssociation getParentAssociation() { return parentAssociation; } + @Override public void setParentAssociation(GspAssociation value) { parentAssociation = value; } + @Override public boolean getIsUdt() { return privateIsUdt; } + @Override public void setIsUdt(boolean value) { privateIsUdt = value; } + @Override public String getUdtPkgName() { return privateUdtPkgName; } + @Override public void setUdtPkgName(String value) { privateUdtPkgName = value; } + @Override public String getUdtID() { return privateUdtID; } + @Override public void setUdtID(String value) { privateUdtID = value; } + @Override public final String getUdtName() { return privateUdtName; } + @Override public final void setUdtName(String value) { privateUdtName = value; } + @Override public FieldCollectionType getCollectionType() { return privateCollectionType; } + @Override public final void setCollectionType(FieldCollectionType value) { privateCollectionType = value; } + @Override public final boolean getIsFromAssoUdt() { return privateIsFromAssoUdt; } + @Override public final void setIsFromAssoUdt(boolean value) { privateIsFromAssoUdt = value; } + @Override public final String getI18nResourceInfoPrefix() { return privateI18nResourceInfoPrefix; } + @Override public final void setI18nResourceInfoPrefix(String value) { privateI18nResourceInfoPrefix = value; } + @Override public final DynamicPropSetInfo getDynamicPropSetInfo() { return privateDynamicPropSetInfo; } + @Override public final void setDynamicPropSetInfo(DynamicPropSetInfo value) { privateDynamicPropSetInfo = value; } + @Override public CustomizationInfo getCustomizationInfo() { return customizationInfo; } + @Override public void setCustomizationInfo(CustomizationInfo customizationInfo) { this.customizationInfo = customizationInfo; } @@ -451,18 +512,21 @@ public class GspCommonField implements IGspCommonField { /** * 索引类型 */ + @Override public final EnumIndexType getEnumIndexType() { return enumIndexType; } + @Override public final void setEnumIndexType(EnumIndexType value) { enumIndexType = value; } - // endregion - // region 方法 + + // 方法 + @Override public final boolean hasNoneRefElementInAssociation() { - if (getHasAssociation() == false) { + if (!getHasAssociation()) { return false; } @@ -474,6 +538,7 @@ public class GspCommonField implements IGspCommonField { * * @return */ + @Override public final boolean containRefElementNotFromAssoUdt() { if (!getIsUdt() || getObjectType() != GspElementObjectType.Association) { throw new RuntimeException("#GspBefError#" + "字段" + getCode() @@ -520,10 +585,12 @@ public class GspCommonField implements IGspCommonField { return newObj; } + @Override public boolean isEnableRtrim() { return enableRtrim; } + @Override public void setEnableRtrim(boolean value) { this.enableRtrim = value; } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingInfo.java index ca64956af490ccd3ba64a60c01a874b019f4f184..f20002ac4fda97e63762e6021a7ac9b8d54478ad 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java index 591f8cc9563357f016167e84c81edee69b711195..51b6c3ed3c624db2e93d1d5e5d603380c841d7e8 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MappingRelation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -51,20 +51,6 @@ public class MappingRelation implements Iterable, Cloneable { return new ArrayList(dic.values()); } - // public final java.util.Iterable GetEnumerator() - // { - // //C# TO JAVA CONVERTER TODO TASK: There is no equivalent to implicit typing - // in Java: - // for (var item : dic) - // { - // MappingInfo tempVar = new MappingInfo(); - // tempVar.setKeyInfo(item.getKey()); - // tempVar.setValueInfo(item.getValue()); - // //C# TO JAVA CONVERTER TODO TASK: Java does not have an equivalent to the C# - // 'yield' keyword: - // yield return tempVar; - // } - // } public final void clear() { dic.clear(); @@ -111,12 +97,6 @@ public class MappingRelation implements Iterable, Cloneable { return dic.containsKey(key); } - // public final String getItem(String key) { - // } - - // public final void setItem(String key, String value) { - // } - public final Object clone() { MappingRelation mappingRelation = new MappingRelation(); if (dic.size() > 0) { @@ -139,20 +119,23 @@ public class MappingRelation implements Iterable, Cloneable { } return list.iterator(); } -// -// @Override -// public Iterable iterator() { -// return null; -// } + @Override public boolean equals(Object obj) { MappingRelation relation = (MappingRelation)obj; boolean equals = super.equals(obj); - if (equals) + if (equals) { return equals; - if ((dic == null || dic.size() < 1) && (relation.dic == null || relation.dic.size() < 1)) + } + if ((dic == null || dic.size() < 1) && (relation.dic == null || relation.dic.size() < 1)) { return true; + } return false; } + + @Override + public int hashCode() { + return super.hashCode(); + } } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MdRefInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MdRefInfo.java index 744809a69e59dfde6b27c324e8b37e947bcba494..4c7dde3efe9ceba801ae6e52019a997299a6be42 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MdRefInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/entity/MdRefInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java new file mode 100644 index 0000000000000000000000000000000000000000..d037cd93ec68fe82ad14c0bd3911877ffb725e14 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceExtractContext.java @@ -0,0 +1,67 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItem; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; + +/** + * 多语资源项抽取上下文 + */ +public class CefResourceExtractContext implements ICefResourceExtractContext { + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceExtractContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + /** + * 获取前缀 + * + * @return + */ + public final String getKeyPrefix() { + return metaPrefix; + } + + /** + * 新增/修改 + * + * @param info + */ + public final void setResourceItem(CefResourceInfo info) { + String key = info.getResourceKey(); + String value = info.getResourceValue(); + String description = info.getDescription(); + + I18nResourceItem resource = GetNewResource(key, value, description); + + resourceItems.add(resource); + } + + private I18nResourceItem GetNewResource(String key, String value, String description) { + I18nResourceItem resourceItem = new I18nResourceItem(); + resourceItem.setKey(key); + resourceItem.setValue(value); + resourceItem.setComment(description); + return resourceItem; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..93c4a056811be7e8a99ac5b728bb16aec832f916 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceInfo.java @@ -0,0 +1,78 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; + +public class CefResourceInfo { + + public CefResourceInfo(CefResourcePrefixInfo prefixInfo, String resourceKeyPropName, String descriptionPropName, + String resourceValue) { + DataValidator.checkForNullReference(prefixInfo, "PrefixInfo"); + DataValidator.checkForEmptyString(prefixInfo.getDescriptionPrefix(), "DescriptionPrefix"); + DataValidator.checkForEmptyString(prefixInfo.getResourceKeyPrefix(), "ResourceKeyPrefix"); + + DataValidator.checkForEmptyString(resourceKeyPropName, "ResourceKeyPropName"); + DataValidator.checkForEmptyString(descriptionPropName, "DescriptionPropName"); + DataValidator.checkForEmptyString(resourceValue, "ResourceValue"); + + this.prefixInfo = prefixInfo; + this.resourceKeyPropName = resourceKeyPropName; + this.descriptionPropName = descriptionPropName; + this.resourceValue = resourceValue; + } + + private CefResourcePrefixInfo prefixInfo; + + public final CefResourcePrefixInfo getPrefixInfo() { + return prefixInfo; + } + + /** + * 属性名 e.g. NAME + */ + private String resourceKeyPropName; + + public final String getResourceKeyPropName() { + return resourceKeyPropName; + } + + /** + * 描述中属性名 e.g. 名称 + */ + private String descriptionPropName; + + public final String getDescriptionPropName() { + return descriptionPropName; + } + + /** + * 默认语言的值 + */ + private String resourceValue; + + public final String getResourceValue() { + return resourceValue; + } + + public String getResourceKey() { + return getPrefixInfo().getResourceKeyPrefix() + "." + getResourceKeyPropName(); + } + + public String getDescription() { + return getPrefixInfo().getDescriptionPrefix() + "的" + getDescriptionPropName(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java new file mode 100644 index 0000000000000000000000000000000000000000..3b1bedf8aacef55b4985339817f9de3656177acf --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourceMergeContext.java @@ -0,0 +1,47 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import org.openatom.ubml.model.common.definition.cef.util.DataValidator; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; + +public class CefResourceMergeContext implements ICefResourceMergeContext { + + private String metaPrefix; + private I18nResourceItemCollection resourceItems; + + public CefResourceMergeContext(String metaPrefix, I18nResourceItemCollection items) { + DataValidator.checkForEmptyString(metaPrefix, "元数据前缀"); + DataValidator.checkForNullReference(items, "国际化资源项"); + this.metaPrefix = metaPrefix; + this.resourceItems = items; + } + + @Override + public String getKeyPrefix() { + return this.metaPrefix; + } + + @Override + public void setKeyPrefix(String keyPrefix) { + this.metaPrefix = keyPrefix; + } + + public I18nResourceItemCollection getResourceItems() { + return this.resourceItems; + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..a06c7b0b37945e45f787e41a2f50cb5f10c4ea28 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/CefResourcePrefixInfo.java @@ -0,0 +1,38 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public class CefResourcePrefixInfo { + private String resourceKeyPrefix; + private String descriptionPrefix; + + public String getResourceKeyPrefix() { + return resourceKeyPrefix; + } + + public void setResourceKeyPrefix(String resourceKeyPrefix) { + this.resourceKeyPrefix = resourceKeyPrefix; + } + + public String getDescriptionPrefix() { + return descriptionPrefix; + } + + public void setDescriptionPrefix(String descriptionPrefix) { + this.descriptionPrefix = descriptionPrefix; + } +} + diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java new file mode 100644 index 0000000000000000000000000000000000000000..a0b067f8732f63e7f9fca0f1ec67c266aa37cb9b --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceExtractContext.java @@ -0,0 +1,32 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +public interface ICefResourceExtractContext { + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + /** + * 新增/修改 + * + * @param info + */ + void setResourceItem(CefResourceInfo info); +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java new file mode 100644 index 0000000000000000000000000000000000000000..e8f6711f53ec4f6722e9a4aefafca4e71e53f899 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/context/ICefResourceMergeContext.java @@ -0,0 +1,37 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.context; + +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; + +public interface ICefResourceMergeContext { + + /** + * 获取前缀 + * + * @return + */ + String getKeyPrefix(); + + void setKeyPrefix(String keyPrefix); + + /** + * 获取资源项 + * + * @return + */ + I18nResourceItemCollection getResourceItems(); +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java new file mode 100644 index 0000000000000000000000000000000000000000..99f4e7aa1422ced7af4ec154bd56144d2620f82a --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AbstractResourceExtractor.java @@ -0,0 +1,112 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourceInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +/** + * 国际化抽取器基类 + */ +public abstract class AbstractResourceExtractor { + /** + * 国际化抽取器基类 + * + * @param context 上下文 + * @param parentResourceInfo 父抽取器的前缀信息 + */ + protected AbstractResourceExtractor(ICefResourceExtractContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceExtractor(ICefResourceExtractContext context) { + this(context, null); + } + + /** + * 国际化抽取上下文 + */ + private ICefResourceExtractContext context; + + protected final ICefResourceExtractContext getContext() { + return context; + } + + /** + * 父抽取器的前缀信息 + */ + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + /** + * 当前抽取器的前缀信息 + */ + private CefResourcePrefixInfo currentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getCurrentResourcePrefixInfo() { + return currentResourcePrefixInfo; + } + + private void setCurrentResourcePrefixInfo(CefResourcePrefixInfo value) { + currentResourcePrefixInfo = value; + } + + //#endregion + + /** + * 抽取国际化项入口方法 + */ + public final void extract() { + setCurrentResourcePrefixInfo(buildCurrentPrefix()); + setPrefixInfo(); + extractItems(); + } + + /** + * 抽取 + */ + protected abstract void extractItems(); + + /** + * 构造前缀 + * + * @return + */ + protected abstract CefResourcePrefixInfo buildCurrentPrefix(); + + /** + * 赋值前缀 + */ + protected abstract void setPrefixInfo(); + + /** + * 新增抽取资源项 + * + * @param propName 属性名 + * @param value 值 + * @param descriptionPropName 描述中属性名 + */ + protected final void addResourceInfo(String propName, String value, String descriptionPropName) { + CefResourceInfo info = new CefResourceInfo(getCurrentResourcePrefixInfo(), propName, descriptionPropName, value); + getContext().setResourceItem(info); + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java new file mode 100644 index 0000000000000000000000000000000000000000..330e3c4102fa4083d1bbc7dfc390d9ca14a928eb --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoRefFieldResourceExtractor.java @@ -0,0 +1,44 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoRefFieldResourceExtractor extends CefFieldResourceExtractor { + private IGspCommonField commonField; + + public AssoRefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(field, context, parentResourceInfo); + commonField = field; + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (!commonField.getIsRefElement()) { + throw new RuntimeException("[多语项抽取]非关联带出字段,不应使用AssoRefFieldResourceExtractor进行抽取。"); + + } + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段关联信息" + commonField.getParentAssociation() + "无对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "的关联带出属性'" + commonField.getName() + "'"); + return fieldResourceInfo; + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java new file mode 100644 index 0000000000000000000000000000000000000000..f7c0a5f631780447eb3f09eb02f6ca19ab4bf2fd --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/AssoResourceExtractor.java @@ -0,0 +1,57 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; + +public abstract class AssoResourceExtractor extends AbstractResourceExtractor { + private GspAssociation asso; + + protected AssoResourceExtractor(GspAssociation asso, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + this.asso = asso; + } + + protected void extractItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_字段" + asso.getBelongElement().getName() + "无对应的多语前缀信息。"); + } + return getParentResourcePrefixInfo(); + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + asso.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected abstract AssoRefFieldResourceExtractor getAssoRefFieldResourceExtractor( + ICefResourceExtractContext context, CefResourcePrefixInfo assoPrefixInfo, IGspCommonField field); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java new file mode 100644 index 0000000000000000000000000000000000000000..64a7e928cf60ec78ed0845aeb344178a9d4c4600 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/CefFieldResourceExtractor.java @@ -0,0 +1,102 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class CefFieldResourceExtractor extends AbstractResourceExtractor { + private IGspCommonField commonField; + + protected CefFieldResourceExtractor(IGspCommonField field, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + commonField = field; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, commonField.getName(), CefResourceDescriptionNames.NAME); + + //关联枚举 + switch (commonField.getObjectType()) { + case Association: + extractAssoInfo(commonField.getChildAssociations()); + break; + case Enum: + extractEnumValue(commonField.getContainEnumValues()); + break; + case None: + break; + } + + //扩展 + extractExtendProperties(commonField); + } + + /** + * 赋值字段的国际化项前缀 + */ + protected final void setPrefixInfo() { + commonField.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + protected CefResourcePrefixInfo buildCurrentPrefix() { + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + commonField.getBelongObject().getName() + "中字段" + commonField.getName() + ",无节点对应的多语前缀信息。"); + } + CefResourcePrefixInfo fieldResourceInfo = new CefResourcePrefixInfo(); + fieldResourceInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + commonField.getLabelID()); + fieldResourceInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + commonField.getName() + "'属性"); + return fieldResourceInfo; + } + + private void extractAssoInfo(GspAssociationCollection assos) { + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), item).extract(); + } + } + } + + private void extractEnumValue(GspEnumValueCollection enumValues) { + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String keyPropName = item.getValue() + "." + CefResourceKeyNames.DISPLAY_VALUE; + String value = item.getName(); + String descriptionPropName = "枚举信息'" + item.getName() + "'的" + CefResourceDescriptionNames.DISPLAY_VALUE; + addResourceInfo(keyPropName, value, descriptionPropName); + + String enumKey = getCurrentResourcePrefixInfo().getResourceKeyPrefix() + "." + item.getValue(); + item.setI18nResourceInfoPrefix(enumKey); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceExtractor getAssoResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo fieldPrefixInfo, GspAssociation asso); + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java new file mode 100644 index 0000000000000000000000000000000000000000..d885619500e52cc8bab79da8e5d9de7ab3186eb0 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/extractor/DataTypeResourceExtractor.java @@ -0,0 +1,88 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.extractor; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceExtractContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceDescriptionNames; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; + +public abstract class DataTypeResourceExtractor extends AbstractResourceExtractor { + + private IGspCommonDataType dataType; + + protected DataTypeResourceExtractor(IGspCommonDataType commonDataType, ICefResourceExtractContext context, + CefResourcePrefixInfo parentResourceInfo) { + super(context, parentResourceInfo); + dataType = commonDataType; + } + + protected final void extractItems() { + + addResourceInfo(CefResourceKeyNames.NAME, dataType.getName(), CefResourceDescriptionNames.NAME); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + protected final CefResourcePrefixInfo buildCurrentPrefix() { + CefResourcePrefixInfo prefixInfo = new CefResourcePrefixInfo(); + if (getParentResourcePrefixInfo() == null) { + throw new RuntimeException("多语项抽取_节点" + dataType.getName() + "所属模型,无对应的多语前缀信息。"); + } + prefixInfo.setResourceKeyPrefix(getParentResourcePrefixInfo().getResourceKeyPrefix() + "." + dataType.getCode()); + prefixInfo.setDescriptionPrefix(getParentResourcePrefixInfo().getDescriptionPrefix() + "中'" + dataType.getName() + "'实体"); + return prefixInfo; + } + + /** + * 赋值节点的国际化项前缀 + */ + protected final void setPrefixInfo() { + dataType.setI18nResourceInfoPrefix(getCurrentResourcePrefixInfo().getResourceKeyPrefix()); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceExtractor extractor = getCefFieldResourceExtractor(getContext(), getCurrentResourcePrefixInfo(), field); + extractor.extract(); + } + + } + + /** + * 获取字段抽取器 + * + * @param context + * @return + */ + protected abstract CefFieldResourceExtractor getCefFieldResourceExtractor(ICefResourceExtractContext context, + CefResourcePrefixInfo objPrefixInfo, IGspCommonField field); + + /** + * 抽取扩展项 + * + * @param dataType + */ + protected void extractExtendProperties(IGspCommonDataType dataType) { + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java new file mode 100644 index 0000000000000000000000000000000000000000..280a3da04e11d1608086b4a77f0beb3731974c14 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AbstractResourceMerger.java @@ -0,0 +1,50 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.i18n.context.CefResourcePrefixInfo; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AbstractResourceMerger { + protected AbstractResourceMerger( + ICefResourceMergeContext context, CefResourcePrefixInfo parentResourceInfo) { + this.context = context; + this.parentResourcePrefixInfo = parentResourceInfo; + } + + protected AbstractResourceMerger(ICefResourceMergeContext context) { + this.context = context; + } + + private ICefResourceMergeContext context; + + protected final ICefResourceMergeContext getContext() { + return context; + } + + private CefResourcePrefixInfo parentResourcePrefixInfo; + + protected final CefResourcePrefixInfo getParentResourcePrefixInfo() { + return parentResourcePrefixInfo; + } + + public void merge() { + mergeItems(); + } + + protected abstract void mergeItems(); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java new file mode 100644 index 0000000000000000000000000000000000000000..75f73fc1ecaeafc6630b633f66b69893d898e053 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoRefFieldResourceMerger.java @@ -0,0 +1,29 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +public abstract class AssoRefFieldResourceMerger extends CefFieldResourceMerger { + private IGspCommonField commonField; + + protected AssoRefFieldResourceMerger(IGspCommonField commonField, + ICefResourceMergeContext context) { + super(commonField, context); + this.commonField = commonField; + } +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java new file mode 100644 index 0000000000000000000000000000000000000000..670b989cc0d46202dc82f2582da2883a29cc8e99 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/AssoResourceMerger.java @@ -0,0 +1,45 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; + +; + +public abstract class AssoResourceMerger extends AbstractResourceMerger { + private GspAssociation asso; + + protected AssoResourceMerger(GspAssociation asso, + ICefResourceMergeContext context) { + super(context); + this.asso = asso; + } + + @Override + protected void mergeItems() { + if (asso.getRefElementCollection() != null && asso.getRefElementCollection().size() > 0) { + for (IGspCommonField item : asso.getRefElementCollection()) { + getAssoRefFieldResourceMerger(getContext(), item).merge(); + } + } + } + + protected abstract AssoRefFieldResourceMerger getAssoRefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java new file mode 100644 index 0000000000000000000000000000000000000000..fad6a0dd125f8151da456246ef28792c6bb38a81 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/CefFieldResourceMerger.java @@ -0,0 +1,98 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.collection.GspAssociationCollection; +import org.openatom.ubml.model.common.definition.cef.collection.GspEnumValueCollection; +import org.openatom.ubml.model.common.definition.cef.element.GspAssociation; +import org.openatom.ubml.model.common.definition.cef.element.GspEnumValue; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; + +public abstract class CefFieldResourceMerger extends AbstractResourceMerger { + + private IGspCommonField field; + + protected CefFieldResourceMerger(IGspCommonField field, + ICefResourceMergeContext context) { + super(context); + this.field = field; + } + + @Override + protected void mergeItems() { + + //关联枚举 + + switch (field.getObjectType()) { + case Association: + mergeAssoInfo(field); + break; + case Enum: + mergeEnum(field); + break; + case None: + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils.getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + break; + default: + throw new RuntimeException("暂不支持" + field.getObjectType() + "类型字段的多语合并"); + } + + //扩展 + extractExtendProperties(field); + } + + private void mergeEnum(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + GspEnumValueCollection enumValues = field.getContainEnumValues(); + if (enumValues != null && enumValues.size() > 0) { + for (GspEnumValue item : enumValues) { + String enumValueKeyPrefix = MergeUtils + .getKeyPrefix(item.getI18nResourceInfoPrefix(), CefResourceKeyNames.DISPLAY_VALUE); + item.setName(resourceItems.getResourceItemByKey(enumValueKeyPrefix).getValue()); + + } + } + } + + private void mergeAssoInfo(IGspCommonField field) { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = MergeUtils + .getKeyPrefix(this.field.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + field.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + + GspAssociationCollection assos = field.getChildAssociations(); + if (assos != null && assos.size() > 0) { + for (GspAssociation item : assos) { + getAssoResourceMerger(getContext(), item).merge(); + } + } + } + + protected void extractExtendProperties(IGspCommonField commonField) { + } + + protected abstract AssoResourceMerger getAssoResourceMerger(ICefResourceMergeContext context, GspAssociation asso); + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java new file mode 100644 index 0000000000000000000000000000000000000000..1d242529493574173ea8f95fd9c8717f0ff86046 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/merger/DataTypeResourceMerger.java @@ -0,0 +1,62 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.merger; + +import org.openatom.ubml.model.common.definition.cef.IFieldCollection; +import org.openatom.ubml.model.common.definition.cef.IGspCommonDataType; +import org.openatom.ubml.model.common.definition.cef.IGspCommonField; +import org.openatom.ubml.model.common.definition.cef.i18n.context.ICefResourceMergeContext; +import org.openatom.ubml.model.common.definition.cef.i18n.names.CefResourceKeyNames; +import com.inspur.edp.lcm.metadata.api.entity.I18nResourceItemCollection; + +import static org.openatom.ubml.model.common.definition.cef.increment.merger.MergeUtils.getKeyPrefix; + +public abstract class DataTypeResourceMerger extends AbstractResourceMerger { + + private IGspCommonDataType dataType; + + protected DataTypeResourceMerger(IGspCommonDataType commonDataType, ICefResourceMergeContext context) { + super(context); + this.dataType = commonDataType; + } + + @Override + protected void mergeItems() { + I18nResourceItemCollection resourceItems = getContext().getResourceItems(); + String keyPrefix = getKeyPrefix(dataType.getI18nResourceInfoPrefix(), CefResourceKeyNames.NAME); + dataType.setName(resourceItems.getResourceItemByKey(keyPrefix).getValue()); + extractDataTypeFields(dataType.getContainElements()); + //扩展 + extractExtendProperties(dataType); + } + + private void extractDataTypeFields(IFieldCollection fields) { + if (fields == null || fields.size() == 0) { + return; + } + for (IGspCommonField field : fields) { + CefFieldResourceMerger merger = getCefFieldResourceMerger(getContext(), field); + merger.merge(); + } + } + + protected abstract CefFieldResourceMerger getCefFieldResourceMerger( + ICefResourceMergeContext context, IGspCommonField field); + + protected void extractExtendProperties(IGspCommonDataType dataType) { + } + +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java new file mode 100644 index 0000000000000000000000000000000000000000..008efeca42442e5991e94ee281b5baf3a473f9a3 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceDescriptionNames.java @@ -0,0 +1,22 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceDescriptionNames { + public static final String NAME = "名称"; + + public static final String DISPLAY_VALUE = "枚举显示值"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java new file mode 100644 index 0000000000000000000000000000000000000000..ff53c8d3bfe638c6b3fbc1a53640a2dc4997f483 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/i18n/names/CefResourceKeyNames.java @@ -0,0 +1,23 @@ +/* + * 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 org.openatom.ubml.model.common.definition.cef.i18n.names; + +public final class CefResourceKeyNames { + + public static final String NAME = "Name"; + + public static final String DISPLAY_VALUE = "DisplayValue"; +} \ No newline at end of file diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java similarity index 51% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java rename to model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java index 111d3e84c7b321f7082b1bc572f6b6161bb6c493..2135dabf834bbed04483b4ad0dbe0fc03fcb361e 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerator.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/extractor/ExtractUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,12 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package org.openatom.ubml.model.common.definition.cef.increment.extractor; + +public class ExtractUtils { -/** - * The type ModuleGenerator - * - * @author: Jack Lee - */ -public class ModuleGenerator { } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java similarity index 45% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java rename to model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java index c17ee0249444a6acc27131de2dbeab8b0b424264..d32432a25945f9cb5cf23f8dc7e45186290e13ff 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/EnvironmentUtil.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/increment/merger/MergeUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,15 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package org.openatom.ubml.model.common.definition.cef.increment.merger; -/** - * The type EnvironmentUtil - * - * @author: Jack Lee - */ -public class EnvironmentUtil { - public static String getServerRTPath() { - return "jstack"; +public class MergeUtils { + + public static String getKeyPrefix(String currentKey, String preFix) { + return String.format("%1$s.%2$s", currentKey, preFix); } } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java index 9d67b2763068eca1fabed9c76d19306394a0b867..b7aa5760ef81d5241ca0a92759a011e1da01d467 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/CefNames.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -153,7 +153,6 @@ public class CefNames { //原节点上的动态属性-已废弃 public static final String DYNAMIC_PROP_SERIALIZER_COMPS = "DynamicPropSerializerComps"; - //region Increment public static final String INCREMENT_TYPE = "IncrementType"; public static final String ADDED_DATA_TYPE = "AddedDataType"; public static final String DELETED_ID = "DeletedId"; @@ -168,8 +167,5 @@ public class CefNames { public static final String CHILD_INCREMENTS = "ChildIncrements"; public static final String ELEMENT = "Element"; public static final String CHILD_INCREMENT = "ChildIncrement"; - public static final String CustomizationInfo = "CustomizationInfo"; - //endregion - } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java index 7d1a442d754612c1a5a8e4cd2cde0d49eb482d64..2074e39bb3ebb2124c520b0aa79d859988027482 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/SerializerUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -50,7 +50,7 @@ import static com.fasterxml.jackson.core.JsonToken.VALUE_TRUE; * @Version: V1.0 */ public class SerializerUtils { - //#region 读取Token + //读取Token public static void readStartObject(JsonParser parser) { JsonToken tokenType = parser.getCurrentToken(); try { @@ -132,9 +132,9 @@ public class SerializerUtils { } return false; } - //#endregion - //#region 读取基本类型 + + //读取基本类型 public static String readPropertyName(JsonParser parser) { JsonToken tokenType = parser.getCurrentToken(); if (tokenType != FIELD_NAME) { @@ -299,40 +299,7 @@ public class SerializerUtils { } return propValue; } - //#endregion - -// public static > EnumSet readEnumSet(JsonParser parser, Class type) { -// EnumSetDeserializer der = new EnumSetDeserializer(SimpleType.constructUnsafe(type), new CefEnumDeserializer(type)); -// -// EnumSet propValue = EnumSet.noneOf(type); -// try { -// EnumSet result = der.deserialize(parser, null); -// Object[] array = result.(); -// for (int i = 0; i < array.length; i++) { -// propValue.add(Array); -// } -// propValue = der.deserialize(parser, null); -// } catch (IOException e) { -// e.printStackTrace(); -// } -// return propValue; -// } -// -// EnumSet反序列化供参考,json中存int - -// private EnumSet readGetExecutingDataStatus(JsonParser jsonParser) { -// EnumSet result = EnumSet.noneOf(ExecutingDataStatus.class); -// int intValueSum = SerializerUtils.readPropertyValue_Integer(jsonParser); -// ExecutingDataStatus[] values = ExecutingDataStatus.values(); -// for (int i = values.length - 1; i >= 0; i--) { -// ExecutingDataStatus value = values[i]; -// if (intValueSum > value.getValue()) { -// result.add(value); -// intValueSum -= value.getValue(); -// } -// } -// return result; -// } + public static ArrayList readStringArray(JsonParser parser) { StringDeserializer der = new StringDeserializer(); @@ -341,11 +308,11 @@ public class SerializerUtils { return propValue; } - public static > void readArray(JsonParser parser, JsonDeserializer deserializer, tArray array) { + public static > void readArray(JsonParser parser, JsonDeserializer deserializer, A array) { readArray(parser, deserializer, array, false); } - public static > void readArray(JsonParser parser, JsonDeserializer deserializer, tArray array, boolean next) { + public static > void readArray(JsonParser parser, JsonDeserializer deserializer, A array, boolean next) { if (readNullObject(parser)) { return; } @@ -366,11 +333,11 @@ public class SerializerUtils { readEndArray(parser); } - //#region 私有方法 + //私有方法 private static void throwJsonTokenException(String validateType, String currentType) { throw new RuntimeException(String.format("当前JsonToken应为'$1%s',实际为'$1%s'", validateType, currentType)); } - //#endregion + /** * 序列化:写数组开始 @@ -545,7 +512,8 @@ public class SerializerUtils { } } - public static > void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, tList list) { + public static > void writeArray(JsonGenerator jsonGenerator, + JsonSerializer serializer, L list) { //void writeArray(JsonGenerator jsonGenerator, JsonSerializer serializer, TArray array){ SerializerUtils.WriteStartArray(jsonGenerator); for (T item : list) { diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableDeserializer.java index 63fe011732f9a737272a7a2b5142212146bbddd1..399d10ecab2ba757576388dfa10ef9cf6c40a442 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntityDeseriazlier.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntityDeseriazlier.java index 106139d454908890657f408671f4f8ab3ad39f45..d0270c44f464fc883c4f2e9556cc66e3b8437014 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntityDeseriazlier.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntityDeseriazlier.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntitySeriazlier.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntitySeriazlier.java index 5baca2bfeec1d5812480e378b57594faca866252..6e0cc83285e3c5dd4a446afcb049287be52607ae 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntitySeriazlier.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableEntitySeriazlier.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableSerializer.java index e25e72a111c377e801980cc11d5b33d1625f6cd5..5fa593c0b7a2fbd95c2cfe7fc466befa79a4852b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/Variable/CommonVariableSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefEnumDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefEnumDeserializer.java index cf6cdea26d47dbc6f1aa818c6373f31e18150d54..80ce300bef2fc962a107ca027343428fe3c72ecd 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefEnumDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefEnumDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldDeserializer.java index 7f30b54d86a189f1e7788b8ef33ae7b4df05a69d..0860f4a74b4d90fbda6aec4843dffd9985d1502b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java index 4e2dd4f9a99ca6773dbbdb280ac0373d2e90bd52..c8c71291a594e4588731aba9751f7fb63efc9832 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/CefFieldSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -43,7 +43,7 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.writeEndObject(jsonGenerator); } - //region BaseProp + //BaseProp public void writeBaseProperty(JsonGenerator writer, IGspCommonField value) { GspCommonField field = (GspCommonField)value; SerializerUtils.writePropertyValue(writer, CefNames.ID, field.getID()); @@ -94,13 +94,13 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.WriteEndArray(writer); } - //region 抽象方法 + //抽象方法 protected void writeExtendFieldBaseProperty(JsonGenerator writer, IGspCommonField field) { } - //endregion - //endregion - //region SelfProp + + + //SelfProp public void writeSelfProperty(JsonGenerator writer, IGspCommonField value) { GspCommonField field = (GspCommonField)value; SerializerUtils.writePropertyValue(writer, CefNames.CODE, field.getCode()); @@ -168,9 +168,9 @@ public class CefFieldSerializer extends JsonSerializer { SerializerUtils.WriteEndArray(writer); } - //region 抽象方法 + //抽象方法 protected void writeExtendFieldSelfProperty(JsonGenerator writer, IGspCommonField field) { } - //endregion - //endregion + + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/DynamicPropSetInfoDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/DynamicPropSetInfoDeserializer.java index 4a43a3efc2ec9b2fb23b09a6d223db89b4f0119e..6df5ee4e44441571a55bf9b18bd33da29eac2ba5 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/DynamicPropSetInfoDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/DynamicPropSetInfoDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssoKeyDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssoKeyDeserializer.java index 0c74a1e3780102cd85e22a7231511ffeb532384e..d3b419b94f548f63294595121a13ce44b1aa709b 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssoKeyDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssoKeyDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationDeserializer.java index c3ada3a1c4c113c9c8920e4678813e525bd46a72..aabf3521902023ecbdee418872962f1ce409d466 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java index 5bc4320dee1869cb3515a81d3770bd512a0b4dd0..67b30e262f91fd7fcc0ae0cf2f39df63b0db853c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspAssociationSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -53,7 +53,7 @@ public class GspAssociationSerializer extends JsonSerializer { } - //region BaseProp + //BaseProp private void writeBaseProperty(GspAssociation value, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CefNames.ID, value.getId()); SerializerUtils.writePropertyValue(writer, CefNames.I18N_RESOURCE_INFO_PREFIX, value.getI18nResourceInfoPrefix()); @@ -74,9 +74,9 @@ public class GspAssociationSerializer extends JsonSerializer { protected void writeExtendAssoBaseProperty(GspAssociation association, JsonGenerator writer) { } - //endregion - //region SelfProp + + //SelfProp private void writeSelfProperty(GspAssociation association, JsonGenerator writer) { SerializerUtils.writePropertyValue(writer, CefNames.REF_MODEL_ID, association.getRefModelID()); SerializerUtils.writePropertyValue(writer, CefNames.REF_MODEL_NAME, association.getRefModelName()); @@ -106,5 +106,5 @@ public class GspAssociationSerializer extends JsonSerializer { protected void writeExtendAssoSelfProperty(JsonGenerator writer, GspAssociation bizElement) { } - //endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspEnumValueDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspEnumValueDeserializer.java index ab836ca57133bd0b511f4b1d3a72909520303ba5..12693c534ef9624dbe7e7e7af5e66c960103acc0 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspEnumValueDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/GspEnumValueDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/MappingInfoDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/MappingInfoDeserializer.java index 89ead8bd82243c344ff5f18454ec0f571f94eab8..d8919f2c18fda62ddfe64c4425981c42e5702e42 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/MappingInfoDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/element/MappingInfoDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java index 6a64de76c1c3981d27e14acf4eaf9b690291a920..b9341737cb70aec180ab67893a47b3232e554de1 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/json/object/GspCommonDataTypeDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -66,7 +66,7 @@ public abstract class GspCommonDataTypeDeserializer extends JsonDeserializer dicElements; /** * 元数据Entity程序集 */ @@ -45,28 +44,6 @@ public class CommonVariableEntity extends GspCommonDataType { */ private DataTypeAssemblyInfo privateParentCoreAssemblyInfo; - // Jban迁移,原在FindElement()中使用,有必要创建字典吗? - // private void createDictionary() { - // // _dicElements = new Dictionary(); - // java.util.HashMap tempDict = new java.util.HashMap(); - - // // 查找当前的元素是否包含 - // for (int i = 0; i < getContainElements().size(); i++) { - // createDictionary()(getContainElements().getItem(i), tempDict); - // } - // dicElements = tempDict; - // } - - // private void createDictionary()(CommonVariable element, java.util.HashMap dict) { - // try { - // dict.put(element.getID(), element); - // } catch (java.lang.Exception e) { - // if (dict.containsKey(element.getID())) { - // throw new RuntimeException(String.format("变量实体%1$s上面存在多个id为%2$s的变量", this.getName(), element.getID())); - // } - // throw e; - // } - // } public CommonVariableEntity() { setContainElements(new CommonVariableCollection(this)); diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/variable/VariableSourceType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/variable/VariableSourceType.java index f88638eef7062cbf34cc532fbc5f2554c0c720ad..86f9f0aebb14f37d5c8eb18641149d9531c038e6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/variable/VariableSourceType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/cef/variable/VariableSourceType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IElementCollection.java index c7260e42af4fb0017024c5104cf66d9809796fb9..44db241847b5b77141fa1178a1a62612b17ccef6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java index 862d8ff685040f5a84350bffe4052f32771ac17b..5e6aecc7dfbc668805ec95369d84e77aa63e8599 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonElement.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -70,6 +70,7 @@ public interface IGspCommonElement extends IGspCommonField { /** * @return Belong Object Of The Element */ + @Override IGspCommonObject getBelongObject(); /** @@ -107,6 +108,6 @@ public interface IGspCommonElement extends IGspCommonField { * @return The Enum Type Name Of The Element */ String getEnumTypeName(); - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java index dad7861952d76bbb2a629a3f62d10792aec12570..85a2414861265b627a3b8dba9b5e5dd220e4ad64 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonModel.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -161,7 +161,7 @@ public interface IGspCommonModel extends Cloneable { * @param value Wether Use Namespace Config In The Runtime */ void setIsUseNamespaceConfig(boolean value); - // endregion + /** * @param elementID The Id Of Element To Find @@ -220,6 +220,6 @@ public interface IGspCommonModel extends Cloneable { * @return The Version Control Info Of The Model */ VersionControlInfo getVersionContronInfo(); - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonObject.java index a019c4b86f83267128ca7f63ea5c4409a0beeb4a..52ec27131190cd36632bce6f68069eb226917309 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IGspCommonObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IObjectCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IObjectCollection.java index a7e966a8877b8788febbee15178af1548c7b01d3..4e6b6fc5ec41e3a9994388ec427a6e3831a6bbb5 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IObjectCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/IObjectCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java index 6b396fdbe0c83aede1a8414ecc8b083efb99b115..f9e4c7de075837d5f2ccbbf1d6d269dab1a7f439 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspElementCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,8 +15,6 @@ */ package org.openatom.ubml.model.common.definition.commonmodel.collection; -// import Inspur.Ecp.Caf.Common.*; - import org.openatom.ubml.model.common.definition.cef.IGspCommonField; import org.openatom.ubml.model.common.definition.cef.collection.GspFieldCollection; import org.openatom.ubml.model.common.definition.cef.util.DataValidator; @@ -61,10 +59,6 @@ public class GspElementCollection extends GspFieldCollection implements IElement } } -// private void inneradd(IGspCommonElement element) { -// super.add(element); -// } - /** * 克隆 * @@ -83,20 +77,22 @@ public class GspElementCollection extends GspFieldCollection implements IElement /** * Index[string] */ + @Override public IGspCommonElement getItem(String id) { Object tempVar = super.getByID(id); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } + @Override public final IGspCommonElement getItem(int index) { Object tempVar = super.getByIndex(index); - return (IGspCommonElement)((tempVar instanceof IGspCommonElement) ? tempVar : null); + return (IGspCommonElement) ((tempVar instanceof IGspCommonElement) ? tempVar : null); } /** * 所属结点 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public IGspCommonObject getParentObject() { return parentObject; @@ -106,7 +102,7 @@ public class GspElementCollection extends GspFieldCollection implements IElement if (parentObject != value) { parentObject = value; for (IGspCommonField item : this) { - GspCommonElement ele = (GspCommonElement)item; + GspCommonElement ele = (GspCommonElement) item; ele.setBelongObject(value); } } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java index a5aed9bbcdf1ca8bba4f97c928aa7333b6388b96..f92dac163a43fa2fc3063e0fd05fbc9682fb3781 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspObjectCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -42,7 +42,7 @@ public class GspObjectCollection extends BaseList implements I this.parentObject = parentObject; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -58,7 +58,7 @@ public class GspObjectCollection extends BaseList implements I return newObj; } - // endregion + /** * 集合所属父节点 diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java index 89f78aa6a9cf363db1a2f8b7390fc193821ad768..25948202e9191aacf3c233f9fabce7634c0d5d29 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/collection/GspUniqueConstraintCollection.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -35,6 +35,7 @@ public class GspUniqueConstraintCollection extends BaseList * * @param constraint */ + @Override public final boolean add(GspUniqueConstraint constraint) { return super.add(constraint); } @@ -66,19 +67,11 @@ public class GspUniqueConstraintCollection extends BaseList * @param index 插入的索引 * @param constraint 约束定义 */ + @Override public final void insert(int index, GspUniqueConstraint constraint) { super.insert(index, constraint); } - /** - 按照索引序号访问集合中的约束 - - @param index 索引 - @return - */ -//C# TO JAVA CONVERTER WARNING: There is no Java equivalent to C#'s shadowing via the 'new' keyword: -//ORIGINAL LINE: public new GspUniqueConstraint this[int index] => (GspUniqueConstraint)((_list[index] instanceof GspUniqueConstraint) ? _list[index] : null); - // public GspUniqueConstraint this.setItem(int index, > (GspUniqueConstraint)((_list.get(index) instanceof GspUniqueConstraint) ? _list.get(index) : null)); /** * 根据Id访问约束 @@ -100,6 +93,7 @@ public class GspUniqueConstraintCollection extends BaseList * * @return */ + @Override public final GspUniqueConstraintCollection clone() { return clone(null); } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java new file mode 100644 index 0000000000000000000000000000000000000000..db375c6188722eb527b8d7ec3f778d5f89360e61 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmEntityRuleNames.java @@ -0,0 +1,22 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmEntityRuleNames { + public static String CM_ENTITY_RULE_OBJECT_TYPE = "GspCommonModelEntity"; + public static String ADD_CHILD_ENTITY = "AddChildEntity"; + public static String MODIFY_CHILD_ENTITIES = "ModifyChildEntities"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java new file mode 100644 index 0000000000000000000000000000000000000000..ad05d43301559fea0a6ee036e99e0946650cf2f6 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmFieldRuleNames.java @@ -0,0 +1,20 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmFieldRuleNames { + public static String CM_FIELD_RULE_OBJECT_TYPE_NAME ="GspCommonModelField"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java new file mode 100644 index 0000000000000000000000000000000000000000..d4bb320b9645f540bc1a277f087d63292cd6a84e --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/controlruledef/entity/CmRuleNames.java @@ -0,0 +1,22 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.controlruledef.entity; + +public class CmRuleNames { + public static String CODE ="CODE"; + public static String CM_RULE_OBJECT_TYPE="CommonModel"; + public static String NAME ="Name"; +} diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java index 7f224226dec007e94adc4565b5c0add884caff3d..3e063e0a67cec5d7b4bee4cb86e1819de2ac7e2d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonElement.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -34,17 +34,11 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspC */ public class GspCommonElement extends GspCommonField implements IGspCommonElement { // 基础信息 - // private GspElementDataType mDataType = GspElementDataType.String; private transient ElementCodeRuleConfig billCodeConfig = new ElementCodeRuleConfig(); - // region 成员字段 + // 成员字段 @JsonIgnore -// private transient GspAssociationCollection childAssociations = new GspAssociationCollection(); - // private GspEnumValueCollection enumValueCollection; private transient String columnid = ""; - // private GspCommonAssociation parentAssociation; - // private IGspCommonObject belongObject; - // private String refelementId = ""; private transient String belongModelId = ""; private transient boolean readOnly; // 维护信息 @@ -57,10 +51,6 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen setIsCustomItem(false); } - // endregion 成员字段 - - // region 公有属性 - /** * 编码规则配置 */ @@ -76,10 +66,12 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 对应的数据对象的列ID */ + @Override public String getColumnID() { return columnid; } + @Override public void setColumnID(String value) { columnid = value; } @@ -87,22 +79,25 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 是否自定义项 */ + @Override public boolean getIsCustomItem() { return isCustomItem; } + @Override public void setIsCustomItem(boolean value) { - + this.isCustomItem = value; } /** * 当前属性所属结点 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public IGspCommonObject getBelongObject() { return (IGspCommonObject)super.getBelongObject(); } + @Override public void setBelongObject(IGspCommonObject value) { super.setBelongObject(value); } @@ -110,42 +105,26 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen /** * 所属数据模型metadataId */ + @Override public String getBelongModelID() { return belongModelId; } + @Override public void setBelongModelID(String value) { value = belongModelId; } + @Override public boolean getReadonly() { return readOnly; } + @Override public void setReadonly(boolean value) { readOnly = value; } - // endregion - - // region 外部方法 - // - // public bool hasNoneRefElementInAssociation() - // { - // if (HasAssociation == false) - // return false; - // foreach (var association in ChildAssociations) - // { - // foreach (var refElement in association.RefElementCollection) - // { - // if (refElement.IsRef == false) - // return true; - // } - // } - // - // return false; - // } - // /** * 克隆 @@ -154,6 +133,7 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen * @param association * @return */ + @Override public final IGspCommonElement clone(IGspCommonObject absObj, GspCommonAssociation association) { Object tempVar = super.clone(absObj, association); GspCommonElement newObj = (GspCommonElement)((tempVar instanceof GspCommonElement) ? tempVar : null); @@ -179,6 +159,7 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen setParentAssociation(value); } + @Override @JsonIgnore public final String getAssociationTypeName() { if (getBelongObject().getParentObject() == null) { @@ -195,5 +176,5 @@ public class GspCommonElement extends GspCommonField implements IGspCommonElemen } return getBelongObject().getCode() + getLabelID() + "Enum"; } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java index 04bfcd67c4fd4082f5e9c19a4c21196fdad6e3d7..e9a43cc59fe51f6d67942f5629b6d93ef66f5448 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonModel.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -26,7 +26,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.element.GspCommonAssociation; -import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; /** * The Definition Of Common Model @@ -37,51 +37,53 @@ import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; * @Version: V1.0 */ public class GspCommonModel extends AbstractMetadataContent implements IGspCommonModel, Cloneable { - private static final String coreNamespaceSuffix = "core"; - private static final String entityNamespaceSuffix = "entity"; - private static final String apiNamespaceSuffix = "api"; + + private static final String CORE_NAMESPACE_SUFFIX = "core"; + + private static final String ENTITY_NAMESPACE_SUFFIX = "entity"; + + private static final String API_NAMESPACE_SUFFIX = "api"; + private final java.util.HashMap extendNodeList = new java.util.HashMap(); - // region 字段和属性 -// private String recordHistoryTable = "GspDATALOG"; -// private boolean isRecord; + + // 字段和属性 private boolean isVirtual; + private GspCommonObject mainObject; - // private java.util.ArrayList fkConstraints = new java.util.ArrayList(); + private CommonVariableEntity variables; - // C# TO JAVA CONVERTER TODO TASK: Java annotations will not correspond to .NET - // attributes: - // [NonSerialized] + private java.util.Map extProperties; -// private boolean isAllowDerive; -// private boolean isAllowExtend; -// private String dimension = ""; -// private String hierarchy = ""; + private String extendType = ""; - private String privateID; + + private String privateId; + private String privateCode; + private String privateName; + /** * 标签 */ private List beLabel; + /** * 模型实体类型,表示不同模型实例的类型 */ private String privateEntityType; - /** - * 外键约束 - */ - // public java.util.ArrayList getFkConstraints() { - // return fkConstraints; - // } private String generatingAssembly = ""; + private String generatingDotnetAssembly = ""; + /** * 是否使用命名空间+编号的ConfigId 以前建的为false,保证原有代码可用 新建元数据为true,保证后续元数据ConfigId唯一 */ private boolean privateIsUseNamespaceConfig = false; + private VersionControlInfo privateVersionContronInfo; + /** * 国际化项前缀 */ @@ -95,41 +97,45 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - // [Newtonsoft.Json.jsonIgnore()] public java.util.Map getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new HashMap()); } + @Override public final String getID() { -// this.privateID = super.getId(); - return privateID; + return privateId; } + @Override public final void setID(String value) { - privateID = value; -// super.setId(value); + privateId = value; } + @Override public final String getCode() { this.privateCode = super.getCode(); return privateCode; } + @Override public final void setCode(String value) { privateCode = value; super.setCode(value); } + @Override public final String getName() { this.privateName = super.getName(); return privateName; } + @Override public final void setName(String value) { privateName = value; super.setName(value); } + @Override public List getBeLabel() { if (beLabel == null) { beLabel = new ArrayList(); @@ -138,6 +144,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return beLabel; } + @Override public void setBeLabel(List value) { beLabel = value; } @@ -145,10 +152,12 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 是否虚拟 */ + @Override public boolean getIsVirtual() { return isVirtual; } + @Override public void setIsVirtual(boolean value) { isVirtual = value; } @@ -156,6 +165,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展类型 */ + @Override public String getExtendType() { return extendType; } @@ -164,10 +174,12 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo extendType = value; } + @Override public final String getEntityType() { return privateEntityType; } + @Override public final void setEntityType(String value) { privateEntityType = value; } @@ -175,7 +187,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 扩展结点列表 */ - // [Newtonsoft.Json.jsonIgnore()] + @Override public java.util.HashMap getExtendNodeList() { return extendNodeList; } @@ -206,6 +218,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 主节点主键字段Id */ + @Override public final String getPrimayKeyID() { String result; if (getMainObject() == null || getMainObject().getColumnGenerateID() == null) { @@ -221,14 +234,17 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } + @Override public String getGeneratingAssembly() { return generatingAssembly; } + @Override public void setGeneratingAssembly(String value) { generatingAssembly = value; } + @Override public String getDotnetGeneratingAssembly() { return generatingDotnetAssembly; } @@ -240,22 +256,27 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo /** * 变量实体 */ + @Override public CommonVariableEntity getVariables() { return variables; } + @Override public void setVariables(CommonVariableEntity value) { variables = value; } + @Override public final boolean getIsUseNamespaceConfig() { return privateIsUseNamespaceConfig; } + @Override public final void setIsUseNamespaceConfig(boolean value) { privateIsUseNamespaceConfig = value; } + @Override public final VersionControlInfo getVersionContronInfo() { if (privateVersionContronInfo == null) { privateVersionContronInfo = new VersionControlInfo(); @@ -263,16 +284,16 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return privateVersionContronInfo; } - // endregion - // region 方法 + // 方法 - // region 获取字段 + // 获取字段 public final void setVersionContronInfo(VersionControlInfo value) { privateVersionContronInfo = value; } + @Override public final String getI18nResourceInfoPrefix() { return privateI18nResourceInfoPrefix; } @@ -287,6 +308,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param elementId * @return */ + @Override public final IGspCommonElement findElementById(String elementId) { if (getMainObject().getContainElements() != null && getMainObject().getContainElements().size() > 0) { for (int i = 0; i < getMainObject().getContainElements().size(); i++) { @@ -339,28 +361,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return result; } - // /** - // * 重新获取字段缓存 - // * - // * VM联动后,可能增加一些字段,需要重新获取字段缓存列表 - // */ - // public final void reGetObjectElements() { - // final String elementDicKey = "NodeElementDic"; - // for (IGspCommonObject objItem : GetAllObjectList()) { - // GspCommonObject objectItem = (GspCommonObject) objItem; - // if (objectItem == null) { - // throw new RuntimeException("错误的Object类型"); - // } - - // if (objectItem.ExtProperties.containsKey(elementDicKey)) { - // objectItem.ExtProperties.remove(elementDicKey); - // } - // objectItem.getElements(); - // } - // } - // endregion - - // region 获取节点 private IGspCommonElement findEleInChildObject(IGspCommonObject absObject, String elementId) { if (absObject.getContainChildObjects() != null && absObject.getContainChildObjects().size() > 0) { @@ -401,6 +401,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public final java.util.ArrayList getAllObjectElementList() { java.util.ArrayList elementList = new java.util.ArrayList(); java.util.ArrayList objects = getAllObjectList(); @@ -409,13 +410,14 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo } return elementList; } - // endregion + /** * 使用先根方式获取素有结点 * * @return */ + @Override public final java.util.ArrayList getAllObjectList() { // 通过堆栈递归取子孙节点,有空测一下复杂的场景对不对 ZhangJ2015年12月17日 java.util.Stack stack = new java.util.Stack(); @@ -446,6 +448,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * @param code * @return */ + @Override public final IGspCommonObject findObjectByCode(String code) { for (IGspCommonObject obj : getAllObjectList()) { if (code.equals(obj.getCode())) { @@ -470,7 +473,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return null; } - // region Schema + // Schema // public final String getModelSchema() { // CommonModelSchemaBuilder builder = new CommonModelSchemaBuilder(this); @@ -503,6 +506,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo * * @return */ + @Override public GspCommonModel clone() { GspCommonModel tempVar; try { @@ -532,12 +536,6 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return be; } - // public final CMAssemblyInfo getEntityAssemblyInfo() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), -// entityNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } -// private String getLowerCaseModelCode() { return getCode().toLowerCase(); } @@ -545,34 +543,24 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo @Override public DataTypeAssemblyInfo getCoreAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - coreNamespaceSuffix); + CORE_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } - // public DataTypeAssemblyInfo getEntityAssemblyInfo() - // { - // string assName = string.format("{0}.{1}.{2}", GeneratingAssembly, this.getCode(), - // entityNamespaceSuffix); - // return new DataTypeAssemblyInfo(assName, assName); - // } -// public final CMAssemblyInfo getApiNamespace() { -// String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getCode(), apiNamespaceSuffix); -// return new CMAssemblyInfo(assName, assName); -// } - @Override public DataTypeAssemblyInfo getEntityAssemblyInfo() { String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), - entityNamespaceSuffix); + ENTITY_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } @Override public DataTypeAssemblyInfo getApiNamespace() { - String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), apiNamespaceSuffix); + String assName = String.format("%1$s.%2$s.%3$s", getGeneratingAssembly(), this.getLowerCaseModelCode(), API_NAMESPACE_SUFFIX); return new DataTypeAssemblyInfo(assName, assName); } + @Override public final String getGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getGeneratingAssembly() + "." + getCode(); @@ -580,6 +568,7 @@ public class GspCommonModel extends AbstractMetadataContent implements IGspCommo return getCode(); } + @Override public final String getDotnetGeneratedConfigID() { if (getIsUseNamespaceConfig()) { return getDotnetGeneratingAssembly() + "." + getCode(); diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java index a5bb22f3cbe5c0802120806a95868d0ec1ecaed6..cd964b492ae996e88770ca7cc1fe04ed154377fd 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/GspCommonObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -36,8 +36,6 @@ import org.openatom.ubml.model.common.definition.commonmodel.collection.GspUniqu import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspColumnGenerate; import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCommonObjectType; -// import Inspur.Gsp.CommonModel.Api.*; - /** * The Definition Of Common Object,It`s The Abstract Definition Of BeObject、VoObject. @@ -48,9 +46,8 @@ import org.openatom.ubml.model.common.definition.commonmodel.entity.object.GspCo * @Version: V1.0 */ public class GspCommonObject extends GspCommonDataType implements IGspCommonObject, Cloneable { - // region 私有变量 + // 私有变量 // private boolean logicDelete; -// private String refDataObjectId = ""; private GspCommonObjectType objectType = GspCommonObjectType.MainObject; private GspColumnGenerate columnGenerateId = new GspColumnGenerate(); @@ -61,22 +58,17 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje private GspObjectCollection containChildObjects; private String orderbyCondition = ""; private String filterCondition = ""; - // private String modifierElementId = ""; -// private String modifiedDateElementId = ""; -// private String creatorElementId = ""; -// private String createdDateElementId = ""; -// private boolean recordDelData; private boolean isVirtual; private boolean isReadOnly; - // private GspDataTable dataTable; + private java.util.HashMap dicElements; - // internal IGspCommonModel parentModel;//? + private GspAssociationKeyCollection keys; private String belongModelId = ""; private java.util.HashMap extProperties; - // endregion - // region 构造函数 + + // 构造函数 /** * 持久化构件 */ @@ -94,9 +86,8 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje * //} */ - // endregion - // region 公有属性 + // 公有属性 /** * 当前结点所属的模型 */ @@ -376,12 +367,12 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje public String getPropertyName() { return String.format("$1", getCode(), "s"); } - // endregion + /** * 扩展成员,用于扩展方法暂存运行时临时数据 */ - // [Newtonsoft.Json.jsonIgnore()] + public java.util.HashMap getExtProperties() { return (extProperties != null) ? extProperties : (extProperties = new java.util.HashMap()); } @@ -474,11 +465,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje * @return */ private IGspCommonElement getCommonObjIDElement() { -// for (IGspCommonField field : getContainElements()) { -// if (columnGenerateId.getElementID().equals(field.getID())) { -// return (IGspCommonElement) field; -// } -// } if (columnGenerateId != null) { IGspCommonField tempVar = findElement(columnGenerateId.getElementID()); @@ -505,7 +491,7 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje public final boolean hasNoneRefElement(boolean withChild) { if (getContainElements() != null && getContainElements().size() > 0) { for (IGspCommonField element : getContainElements()) { - if (element.getIsRef() == false) { + if (!element.getIsRef()) { return true; } if (element.hasNoneRefElementInAssociation()) { @@ -542,11 +528,11 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje for (IGspCommonField item : getContainElements()) { IGspCommonElement element = (IGspCommonElement)item; elementList.add(element); - if (element.getHasAssociation() == false || containRef == false) { + if (!element.getHasAssociation() || !containRef) { continue; } for (GspAssociation association : element.getChildAssociations()) { - for (IGspCommonField refElement : (association).getRefElementCollection()) { + for (IGspCommonField refElement : association.getRefElementCollection()) { elementList.add((IGspCommonElement)refElement); } } @@ -629,6 +615,6 @@ public class GspCommonObject extends GspCommonDataType implements IGspCommonObje return dicElements.get(elementId); } - return (!dicElements.containsKey(elementId) ? null : dicElements.get(elementId)); + return dicElements.getOrDefault(elementId, null); } } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/VersionControlInfo.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/VersionControlInfo.java index 8c046481e30d55a08f63215e980eb8090c70df19..9c41b1bb1789244d669ba8772a43b5057f7b4bf6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/VersionControlInfo.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/VersionControlInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementCodeRuleConfig.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementCodeRuleConfig.java index 482edf2810aa4c448d9384be8f5d2a262076b5b0..ee9f94f4ded0584672229042afe5acb2715f4bb1 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementCodeRuleConfig.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementCodeRuleConfig.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementPathGenerateType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementPathGenerateType.java index 994a5b1926638bb0a4edb61717aa60d772f2c2bc..a1e5a318a0f9582ac1300eb6b1d85483e80eb58d 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementPathGenerateType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/ElementPathGenerateType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateOccasion.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateOccasion.java index 350b572013ecd6c13fad64b55dcd0475300c2148..76ac5c2b38da468e509c331af8023fb0f8d1304f 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateOccasion.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateOccasion.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateType.java index b4ea0c87b74441fc7566f6c2abd16f6c71f6da87..841b2af3af706af860f030d97e0a1bb7ad106eff 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspBillCodeGenerateType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java index f919dc09804aa9b204704d2d718cdcc4d4ca5828..bf3695c042aaecfc722110274923b30d29f279a3 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/element/GspCommonAssociation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -46,7 +46,7 @@ public class GspCommonAssociation extends GspAssociation implements Cloneable { refModel = value; } - // region ICloneable Members + // ICloneable Members + - // endregion } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/ConstraintType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/ConstraintType.java index ebca54702f6a0415be38c8b07e79bcb42b321fbe..13b9ff69ec219062d23b082140555ddc39b20f4e 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/ConstraintType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/ConstraintType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java index 18b8bdee8a49ceaa5cfde3fb7bf4c53fce320b95..c9afd22b7b8fa3b96449197230ea8db6713e7cb9 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspColumnGenerate.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -60,7 +60,7 @@ public class GspColumnGenerate implements Cloneable { this.generateType = value; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -77,5 +77,5 @@ public class GspColumnGenerate implements Cloneable { } } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspCommonObjectType.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspCommonObjectType.java index dbf3e6fe9c20d7b71a8d8c7ac17daa5a791c7825..79b7a4d76949e2a2b715ced4c122e374fc60d49a 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspCommonObjectType.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspCommonObjectType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java index f85809ff721bdd7c27d7c8bee7baa007cbaef698..2ec34e6e2add630455a46d2058655bb5d7ef8ddf 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/entity/object/GspUniqueConstraint.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -102,6 +102,9 @@ public class GspUniqueConstraint implements Cloneable { * 约束包含的字段列表 */ public final BaseList getElementList() { + if (elementList == null) { + elementList = new BaseList<>(); + } return this.elementList; } @@ -117,7 +120,7 @@ public class GspUniqueConstraint implements Cloneable { privateI18nResourceInfoPrefix = value; } - // region ICloneable Members + // ICloneable Members /** * 克隆 @@ -131,8 +134,10 @@ public class GspUniqueConstraint implements Cloneable { } catch (CloneNotSupportedException e) { return null; } - GspUniqueConstraint newConstraint = (GspUniqueConstraint)((tempVar instanceof GspUniqueConstraint) ? tempVar - : null); + if (!(tempVar instanceof GspUniqueConstraint)) { + return null; + } + GspUniqueConstraint newConstraint = (GspUniqueConstraint) tempVar; newConstraint.id = this.id; newConstraint.code = this.getCode(); newConstraint.name = this.name; @@ -151,5 +156,5 @@ public class GspUniqueConstraint implements Cloneable { } return newObj; } - // endregion + } \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java new file mode 100644 index 0000000000000000000000000000000000000000..f9dd3635838cba26bff8ecbd9c67945357b5a445 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceDescriptionNames.java @@ -0,0 +1,20 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.i18n.names; + +public final class CmResourceDescriptionNames { + public static final String TIP_INFO = "唯一性约束提示信息"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java new file mode 100644 index 0000000000000000000000000000000000000000..91590003bd1e1ba149df5e000f1afdd3305b6eb1 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/i18n/names/CmResourceKeyNames.java @@ -0,0 +1,20 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.i18n.names; + +public final class CmResourceKeyNames { + public static final String TIP_INFO = "TipInfo"; +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/CommonModelNames.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/CommonModelNames.java index 69f525ab76356aa7a2203218a92f7c62f1479128..25042f4fa01c61a392c3a48546c45493eeea61e7 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/CommonModelNames.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/CommonModelNames.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementDeserializer.java index 1d31c24138d5f34986ca62052748a51753b0e766..4ecc30a6bcfe72cc6b3796e0644142b6d403bdec 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java index ed710b90bc05c395ff9689e65dd749b7842c535a..aa29f5a60ef29edff08d8ff36f5a94a2c56adce3 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/CmElementSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -33,7 +33,7 @@ import org.openatom.ubml.model.common.definition.commonmodel.json.CommonModelNam */ public abstract class CmElementSerializer extends CefFieldSerializer { - //region BaseProp + //BaseProp @Override protected void writeExtendFieldBaseProperty(JsonGenerator writer, IGspCommonField value) { @@ -42,9 +42,9 @@ public abstract class CmElementSerializer extends CefFieldSerializer { SerializerUtils.writePropertyValue(writer, CommonModelNames.BELONG_MODEL_ID, field.getBelongModelID()); writeExtendElementBaseProperty(writer, field); } - //endregion - //region SelfProp + + //SelfProp @Override protected void writeExtendFieldSelfProperty(JsonGenerator writer, IGspCommonField value) { IGspCommonElement field = (IGspCommonElement)value; @@ -74,12 +74,12 @@ public abstract class CmElementSerializer extends CefFieldSerializer { SerializerUtils.writePropertyValue(writer, CommonModelNames.BILL_CODE_ID, config.getBillCodeID()); SerializerUtils.writeEndObject(writer); } - //endregion - //region 抽象方法 + + //抽象方法 protected abstract void writeExtendElementBaseProperty(JsonGenerator writer, IGspCommonElement element); protected abstract void writeExtendElementSelfProperty(JsonGenerator writer, IGspCommonElement element); - //endregion + } diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/GspCommonAssociationDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/GspCommonAssociationDeserializer.java index 6826a5d967a9339c3f2c39ea135d1bfb118bb155..589aed792df6abe63dc3a9bfa33368b4978f36cd 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/GspCommonAssociationDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/element/GspCommonAssociationDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelDeserializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelDeserializer.java index fae5d7829a527268fc9a687a7a8082c0470517ad..063e741675974dc1cb561a9dddd6cb9ab09d7b0c 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelDeserializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java index 6e856398556a80bc2999f6b2f56199b07b724db5..c8b1d7a58a3ba063ca125117cad126de74a65d84 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/json/model/CommonModelSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -44,7 +44,7 @@ public abstract class CommonModelSerializer extends JsonSerializer getElements(IGspCommonObject node) { + final String elementDicKey = "NodeElementDic"; + + if (node == null || node.getContainElements() == null) { + return null; + } + GspCommonObject co = (GspCommonObject) ((node instanceof GspCommonObject) ? node : null); + if (co != null) { + if (co.getExtProperties().containsKey(elementDicKey)) { + // (java.util.HashMap) + Object result = co.getExtProperties().get(elementDicKey); + return (HashMap) result; + } + } + + HashMap rez = ((GspCommonObject) node).getAllElementDic(); + if (co != null) { + co.getExtProperties().put(elementDicKey, rez); + } + return rez; + } + + private static void getNodes(IGspCommonObject bizEntityObject, java.util.Map rez) { + if (bizEntityObject.getContainChildObjects() == null) { + return; + } + if (bizEntityObject.getContainChildObjects().size() == 0) { + return; + } + // Java: + for (IGspCommonObject obj : bizEntityObject.getContainChildObjects()) { + getNodes(obj, rez); + rez.put(obj.getCode(), obj); + } + } + + /** + * 递归取所有子Node + * + * @param model + * @return 返回结果集为字典类型,不保证遍历顺序 + */ + public static HashMap getNodes(IGspCommonModel model) { + final String nodeDicKey = "ModelNodesDic"; + + if (model == null || model.getMainObject() == null) { + return null; + } + HashMap result = getExtProperty(model, nodeDicKey); + if (result != null) { + return result; + } + + HashMap rez = new HashMap<>(); + getNodes(model.getMainObject(), rez); + rez.put(model.getMainObject().getCode(), model.getMainObject()); + result = new HashMap<>(rez); + setExtProperty(model, nodeDicKey, result); + return result; + } + + static boolean HasCodeNumberColumn(IGspCommonModel model) { + DataValidator.checkForNullReference(model, "model"); + + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + final String key = "HasCodeNumberColumn"; + if (cm != null && cm.getExtProperties().containsKey(key)) { + return (boolean) cm.getExtProperties().get(key); + } + boolean result = false; + for (IGspCommonField item : ((GspCommonObject) model.getMainObject()).getContainElements()) { + GspCommonElement element = (GspCommonElement) item; + if (element.getBillCodeConfig() != null && element.getBillCodeConfig().getCanBillCode() + && !element.getBillCodeConfig().getBillCodeID().isEmpty()) { + result = true; + break; + } + } + if (cm != null) { + cm.getExtProperties().put(key, result); + } + return result; + } + + /** + * 按照层次遍历的BE结点列表 + * + * @return 结果集使用先根后子方式排序 + */ + public static ArrayList getLevelOrderedNodes(IGspCommonModel model) { + + final String nodesListkey = "ModelLevelOrderedNodes"; + ArrayList nodes = getExtProperty(model, nodesListkey); + if (nodes != null) { + return nodes; + } + + nodes = new ArrayList<>(); + java.util.LinkedList nodeQueue = new java.util.LinkedList<>(); + nodeQueue.offer(model.getMainObject()); + + while (nodeQueue.size() > 0) { + IGspCommonObject node = nodeQueue.poll(); + if (node == null) // TODO ERROR? + { + continue; + } + + nodes.add(node); + if (node.getContainChildObjects().size() <= 0) { + continue; + } + + for (IGspCommonObject child : node.getContainChildObjects()) { + nodeQueue.offer(child); + } + } + setExtProperty(model, nodesListkey, nodes); + return nodes; + } + + @SuppressWarnings("unchecked") + private static T getExtProperty(IGspCommonModel model, String key) { + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + if (cm == null) { + return null; + } + if (cm.getExtProperties().containsKey(key)) { + return (T) cm.getExtProperties().get(key); + } + return null; + } + + private static void setExtProperty(IGspCommonModel model, String key, T value) { + GspCommonModel cm = (GspCommonModel) ((model instanceof GspCommonModel) ? model : null); + if (cm == null) { + return; + } + + cm.getExtProperties().put(key, value); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/HandleAssemblyNameUtil.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/HandleAssemblyNameUtil.java index 8c6cc68ca455c0395e0175fd528dda798341fc73..d2d026d24f2d0e8beb00893a7cb45810185bdcf6 100644 --- a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/HandleAssemblyNameUtil.java +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/HandleAssemblyNameUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..42d3a699d8f43df23c50bb1f08133734f87d991a --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/CommonObjectGenUtils.java @@ -0,0 +1,26 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; + +public class CommonObjectGenUtils +{ + public static String getGeneratedInterfaceName(IGspCommonObject node) + { + return GeneratingUtils.INTERFACE_PREFIX + node.getCode(); + } +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..ea1af63e5b6d56776477e47bceb4005e6073ae9d --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/ElementGeneratingUtils.java @@ -0,0 +1,43 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.cef.element.GspElementDataType; + +public final class ElementGeneratingUtils { + @SuppressWarnings("rawtypes") + public static Class getNativeType(GspElementDataType elementType) { + switch (elementType) { + case String: + case Text: + return String.class; + case Boolean: + return Boolean.class; + case Integer: + return Integer.class; + case Decimal: + return java.math.BigDecimal.class; + case Date: + case DateTime: + return java.util.Date.class; + case Binary: + return byte[].class; + default: + return null; + } + } + +} \ No newline at end of file diff --git a/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..8461323ea655bd1e05549d4ebd8e0d337837b173 --- /dev/null +++ b/model/common/definition/src/main/java/org/openatom/ubml/model/common/definition/commonmodel/util/generate/GeneratingUtils.java @@ -0,0 +1,31 @@ +/* + * 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 org.openatom.ubml.model.common.definition.commonmodel.util.generate; + +import org.openatom.ubml.model.common.definition.cef.entity.DataTypeAssemblyInfo; +import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; + +public final class GeneratingUtils { + public static final String INTERFACE_PREFIX = "I"; + + public static DataTypeAssemblyInfo getGeneratingEntityAss(IGspCommonModel cm) { + return cm.getEntityAssemblyInfo(); + } + + public static DataTypeAssemblyInfo getGeneratingApiAssInfo(IGspCommonModel cm) { + return cm.getApiNamespace(); + } +} \ No newline at end of file diff --git a/model/common/engine/pom.xml b/model/common/engine/pom.xml index 90a59f29a774fa2138330e13761d3e003a7f4ad0..bc7f4102f82deb85da8d8203ac01dfb4eff54748 100644 --- a/model/common/engine/pom.xml +++ b/model/common/engine/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/generator/pom.xml b/model/common/generator/pom.xml index fed417abd42f9bd8b51c47a8e52073c772eb9944..2680efa7261e89c925a51d5f5ce44883a4b3b568 100644 --- a/model/common/generator/pom.xml +++ b/model/common/generator/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/pom.xml b/model/common/pom.xml index bdabf5ac9128ab39e8e7a453cdfe1fd91ef8630c..f32df2d3cf2860589dd24b74f9b132824d88599e 100644 --- a/model/common/pom.xml +++ b/model/common/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-api/pom.xml b/model/common/runtime-api/pom.xml index 0574640f100c5007972db6f419d554768961dbfe..e71e6a5adbad579f7465932f43e4d1dd2a09e59d 100644 --- a/model/common/runtime-api/pom.xml +++ b/model/common/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-core/pom.xml b/model/common/runtime-core/pom.xml index f6c913e0e3ecb3734d64593445ab32d1782ae3b7..86594ea28745c075e8ee5c6fff756e40f66274e2 100644 --- a/model/common/runtime-core/pom.xml +++ b/model/common/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-repo/pom.xml b/model/common/runtime-repo/pom.xml index c31a4e540e492a570e2b3edee29377a13052eb73..80abe70c519e8b2719f5e396b1f0326c9cf51dd8 100644 --- a/model/common/runtime-repo/pom.xml +++ b/model/common/runtime-repo/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/common/runtime-spi/pom.xml b/model/common/runtime-spi/pom.xml index 1be9c947387cbe800859cf16e705c35ccb53ab14..97a9e0e12caea2b98c67f38bd60e6b7fc4d02655 100644 --- a/model/common/runtime-spi/pom.xml +++ b/model/common/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/definition/pom.xml b/model/externalapi/definition/pom.xml index f1ce094f5e311a5d401654d363e53bb715f0ff8c..4137f2ccf1892dda5f7348f0f4ea8165f9334e07 100644 --- a/model/externalapi/definition/pom.xml +++ b/model/externalapi/definition/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/Constants.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/Constants.java index 84962dd1399ffc6ca3a145ca8b6719bf1df11499..417030b7f79a1dde4c58c8e7eb085d21dfb47068 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/Constants.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/Constants.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/annotation/ExternalApiService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/annotation/ExternalApiService.java index a5ac4cc6fc3b6042059d6411c2f414ed88ac7d9e..0e3d4ac490aee0cc4e1aa08263fd4331167cce8d 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/annotation/ExternalApiService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/annotation/ExternalApiService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/config/ExternalApiOperationConfig.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/config/ExternalApiOperationConfig.java index 04502a92176134b1a00c98cd2c95af6d1fea67dc..7d672e8c3e08b1ff049057fbee16e0498bba04e5 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/config/ExternalApiOperationConfig.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/config/ExternalApiOperationConfig.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/ExternalApiSummary.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/ExternalApiSummary.java index cbf60cf47329e0b4e2705780a0195f546e90dfd1..3441b8504f87a61817bb0e8ddc6a5c233ef1337e 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/ExternalApiSummary.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/ExternalApiSummary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/Summary.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/Summary.java index 0a30fec6d45670ae5e84d5ed72a2a40cf20cfdd5..3111894ec5e5d6c1a5955da2519afd1816dad6c7 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/Summary.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/dto/Summary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java index 4e10badf2f28ea3d6f2c9421e08528177ab6ce51..76013313e0060695e5d764aef62a3db53fd1e707 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ExternalApi.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.definition.entity; import java.text.MessageFormat; import java.util.ArrayList; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; /** * The Definition of ExternalApi. diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Model.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Model.java index c911e017b6bb076c922e7f072332ecdec82bdb7b..ee607b4dfc3b07514fde326997a37758d2ad4ffe 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Model.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Model.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ModelType.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ModelType.java index 7f21c14af9d8a770174c2d1027c7d414c21481e3..24a87f63d7cd5f9a9040c0e728f1f803a3d60950 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ModelType.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ModelType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Operation.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Operation.java index 8b76bf8ba196f69aa45a1508a692ac370bf380fc..0ff2c32019fc3442f7c02933c0e4beda338d768d 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Operation.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Operation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Parameter.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Parameter.java index 402c383424ccbb8596facfddd70196ebe7c46c2f..d295f0176fd2e5b3763d4005ebd18e0b593ec2d6 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Parameter.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Parameter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ProviderType.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ProviderType.java index 99023568afa980100a0ec1ab1a5355b0e017c3c1..01f4ebe2db01fa286535e8bf0e0d4f61fc6a1b4a 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ProviderType.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/ProviderType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Service.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Service.java index 7f6812af2b34c8f9e2b77071cd6f3eb0e117dc00..e6edd5f960a44b69300e228ff216fded9e759b68 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Service.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/entity/Service.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/AfterGeneratorAction.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/AfterGeneratorAction.java index 99ffeef961f15fa85b66da59a1b39dbdcab604e0..25773334a406e0f00d4ef2c6bff7ebdffa24a08b 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/AfterGeneratorAction.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/AfterGeneratorAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java index b846a9869a08bd91c28b84e9e0c9411df275d9b3..e5edee0161b63af24952517157568ceeace0a764 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationRtService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type CustomizationRtService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java index c2428baa69c8fef83f50469e84f4499bc7e4a9c1..ed839394b7254dce93fcdf69276793c86e64c139 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/CustomizationService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type CustomizationService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java index edd24b39a05eab1d57dc8cd406fbe0729770ad30..45c139441fcd4c0001b2931746ee4af6fd3aaa0f 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/DimensionExtendEntity.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type DimensionExtendEntity diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/FileService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/FileService.java index f630d3a5d373fd3158936f3f2ad360fa6ab887ea..4e57b5fd3b6408620d35b6d05d4bbf9d63fb2f8c 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/FileService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/FileService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/GenerateService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/GenerateService.java index 851957b91b8c75d6e6dba35ec958987263a162be..279299455e6f677678314942d000114d017872e1 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/GenerateService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/GenerateService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java index 3a637165c38f5fcb1dd4528193ac51838bf0ed2a..a802d3d62b26f2747a46559d9e9b4a646e7ad9ba 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataCacheExtService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type IMetadataCacheExtService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java index a6f6961a41648e2041a5c6977c91a020418ba0b8..f8d9e2110cd87d65cfd524e20bfa295801bdf88a 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataReferenceManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; /** * The type IMetadataReferenceManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java index 8eb5d5c4e7a6c9b0fb09e54daf9b58baa46cb674..0d1e5f3b4505f2797e2854c2790d2706412730d5 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/IMetadataRtReferenceManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; /** * The type IMetadataRtReferenceManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitAction.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitAction.java index cc02954c2ac26dd1d4228012a693a9c8ffe6b764..709c9c99885b41ebd6a3d6509c1dc4535ca44c36 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitAction.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java index 0196d166936d38d88c325d6629aa47255cb103af..0e2fd5de34a107ff6f24cf4b4602b0065a91cbff 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/JitContext.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.Map; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * The type JitContext diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MavenDependency.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MavenDependency.java index 2b1da81eb85431837260158827eacbb83f2ef66b..9e9f54804eb22e645e00f8a8948b69cd068214a1 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MavenDependency.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MavenDependency.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java index d5c94f4976ad269303780786db322f33286e523d..4d80e680fd5c47a9d22eda4e0386a6779fee03c8 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedArgs.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; /** * The type MdPkgChangedArgs diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedEventListener.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedEventListener.java index 03cf3e01bd9375a3584a5e8f8cd7500c11fc471e..0ae4fec36e3c4af1bef239ab6d9bbae2a2c66fd0 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedEventListener.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MdPkgChangedEventListener.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java index 940b3783c9835f6dcf5dbc1537a4ab1d112df741..42cfb39e5adfb334c78a3d0a793d23ebb4c80fb4 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataContentManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type MetadataContentManager diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java index 6851172bb5519157313547aa41d1746a22999e9d..761e42117d0537145276c407e3fe3ce717cf44af 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/MetadataService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,7 +16,7 @@ package org.openatom.ubml.model.externalapi.definition.temp.lcm; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type MetadataService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java index a725d04122de81178605e04193ae85ee77275b64..d8336a2a8807575dd7aa6c24259fd4be3fce0cea 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/lcm/RefCommonService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.model.externalapi.definition.temp.lcm; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * The type RefCommonService diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/DimensionInfo.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/DimensionInfo.java index 082857030f03cafd25295777b5b2a138ba728b23..ea3fb80ca4ae592d6caa112157b22b27693a06c3 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/DimensionInfo.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/DimensionInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewModel.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewModel.java index 67d59b4850262be9ab9f6521f109dabd6b9f10f7..9ab7fab6219eaad15cd4ecf33200da0321a6ac8f 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewModel.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewModel.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewObject.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewObject.java index 9512d095c00e2e924e40952dbd102cb15d082e4b..4f6935501f346db34de60e75629f5a48b4cd73ea 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewObject.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/GspViewObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IGspCommonObject.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IGspCommonObject.java index 66d695ba269a7db8e786a7bc80c16f7ac0e2cabf..1b11beae3a24fb419be79ddd727558d4597bbd48 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IGspCommonObject.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IGspCommonObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IViewModelParameter.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IViewModelParameter.java index 794cf880597d598b169c69d9688de1d27d60ae06..ad087f385928f819b07e3faeb26dec2d4514e4b3 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IViewModelParameter.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/IViewModelParameter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMCollectionParameterType.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMCollectionParameterType.java index 429b08c56ece5b5dadfaa7cebb9aa96f124def8b..10160f95639687e5eb024663c4f90a51ff2adc6b 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMCollectionParameterType.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMCollectionParameterType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMParameterType.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMParameterType.java index 80802e71726869f26021d2ac1bf06a9eb7fbd451..7c228ec9f10f6754bc3cf14d556c8981ca63e70a 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMParameterType.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/VMParameterType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/ViewModelAction.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/ViewModelAction.java index 574509cf8b4ab542037a874d571dac1986d6f691..c5e9345c3d960d65b841998fe9f45561b7867e92 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/ViewModelAction.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/temp/vo/ViewModelAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/JavaIdentifierValidator.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/JavaIdentifierValidator.java index d923fee733eb67485ea36981ce0f12200914d087..acd028c850d9215600a6aeba481c1fdd346ad52b 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/JavaIdentifierValidator.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/JavaIdentifierValidator.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java index ba09d1fe154f3d3f674c02cab01838617b1286c6..b8be2b3b6dab277cf9681b82053eb1d28870b88d 100644 --- a/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java +++ b/model/externalapi/definition/src/main/java/org/openatom/ubml/model/externalapi/definition/util/MetadataUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.definition.util; import java.util.HashMap; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; /** diff --git a/model/externalapi/devtime-api/pom.xml b/model/externalapi/devtime-api/pom.xml index 4104175280a216fdf29dbb5f7bbbd759fe477c47..3b62cf03749804e0aab993bdcc2cb3e8f62d5056 100644 --- a/model/externalapi/devtime-api/pom.xml +++ b/model/externalapi/devtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java b/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java index 2c90dd149e339b42b3f585bae6427343c3a43a7c..01f423ac5f618152d58ef09b15dacdb6d8701232 100644 --- a/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java +++ b/model/externalapi/devtime-api/src/main/java/org/openatom/ubml/externalapi/devtime/api/ExternalApiMetadataService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,7 +15,7 @@ */ package org.openatom.ubml.externalapi.devtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ProviderType; /** diff --git a/model/externalapi/devtime-core/pom.xml b/model/externalapi/devtime-core/pom.xml index fa47be1982fed6e59fb7db9dbb35260b86ba0965..2ab5adf19848326e8c5af2304bfd043c1d3391b3 100644 --- a/model/externalapi/devtime-core/pom.xml +++ b/model/externalapi/devtime-core/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/cache/ResourceProviderCache.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/cache/ResourceProviderCache.java index 3aa547b0947bd26e411ce2b217d80a6962d8285a..18fcfc3f8d0a8005b7ed62df434be8fc3090fe6a 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/cache/ResourceProviderCache.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/cache/ResourceProviderCache.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/common/ExternalApiDefintionVO.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/common/ExternalApiDefintionVO.java index 73afe3edb99b3a22ade46ba9972ef4c399f5bc6a..4cc6b786a717ab95208d5f56fb284cc810f8e366 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/common/ExternalApiDefintionVO.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/common/ExternalApiDefintionVO.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java index ade603ca6e83d7443efd2827c1226d19bd7e9039..add39778d1c0c638fe55f026cf6163a73f5042a2 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/initializer/ExternalApiInitializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,8 +15,8 @@ */ package org.openatom.ubml.model.externalapi.devtime.core.initializer; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import java.util.UUID; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MetadataContentManager; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java index 0cf16c556e4360740764ca8e3cfe02cd71ba9047..ceaed99fe8d7873a2d0422b77286f8188103455c 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/manager/ExternalApiProviderManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.List; import java.util.Objects; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.devtime.core.cache.ResourceProviderCache; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java index b7f87d2d016da2dd5a08af2eb1b5ce6729493a7d..b2a210c7464fdb86b6da6174f9f7fd4b178b6994 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ExternalApiMetadataBuilder.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -22,8 +22,8 @@ import java.util.UUID; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; @@ -36,7 +36,7 @@ import org.openatom.ubml.model.externalapi.definition.temp.lcm.MetadataService; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.provider.viewmodel.utils.SimpleViewModelUtils; import org.openatom.ubml.model.externalapi.provider.viewmodel.utils.ViewModelUtils; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * EapiBuilder @@ -69,7 +69,7 @@ public class ExternalApiMetadataBuilder { if (metadataList != null && metadataList.size() > 0) { String metadataCode = eApi.getHeader().getCode(); boolean exist = metadataList.stream() - .anyMatch(x -> metadataCode.equalsIgnoreCase(x.getHeader().getCode())); + .anyMatch(x -> metadataCode.equalsIgnoreCase(x.getHeader().getCode())); if (exist) { metadataService.deleteMetadata(relativePath, eApi.getHeader().getCode() + EAPI_SUFFIX_NAME); } @@ -133,9 +133,9 @@ public class ExternalApiMetadataBuilder { models.add(model); } else { long count = - eapiContent.getModels().stream() - .filter(x -> x.getId().equalsIgnoreCase(model.getId())) - .count(); + eapiContent.getModels().stream() + .filter(x -> x.getId().equalsIgnoreCase(model.getId())) + .count(); if (count <= 0) { models.add(model); } @@ -156,7 +156,7 @@ public class ExternalApiMetadataBuilder { service.setId(UUID.randomUUID().toString()); service.setResourceId(vo.getHeader().getId()); service.setResourceType(getResourceType(resourceType)); - service.setResourceCode(((GspViewModel)vo.getContent()).getGeneratedConfigID()); + service.setResourceCode(((GspViewModel) vo.getContent()).getGeneratedConfigID()); service.setResourceName(vo.getHeader().getName()); service.setOperations(new ArrayList<>()); switch (resourceType) { @@ -181,7 +181,7 @@ public class ExternalApiMetadataBuilder { metadata.getHeader().setExtendable(vo.getHeader().isExtendable()); if (StringUtils.isBlank(vo.getHeader().getBizObjectId())) { throw new RuntimeException( - String.format("VO元数据【%s(ID:%s)】的业务对象不能为空", vo.getHeader().getCode(), vo.getHeader().getId())); + String.format("VO元数据【%s(ID:%s)】的业务对象不能为空", vo.getHeader().getCode(), vo.getHeader().getId())); } metadata.getHeader().setBizObjectId(vo.getHeader().getBizObjectId()); metadata.getHeader().setType(Constants.EXTERNAL_API_METADATA_TYPE); diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java index dfa15f790ab7ea76c5b1fe51dda57bcbb32a5600..fa984a7b8674181397c371808d1c6fa3bd90a3ed 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/MetadataUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,12 +18,12 @@ package org.openatom.ubml.model.externalapi.devtime.core.provider; import java.io.IOException; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.metamodel.framework.designtime.api.GspProjectService; -import org.openatom.ubml.metamodel.framework.designtime.api.MetadataProjectService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; /** * MetadataUtils diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java index 6f67b3439fbddb555cc554c0882b06ff6ebdca80..815cff82db3618909f8a18212221ac3f5c6f5519 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/SimpleViewModelProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -21,7 +21,7 @@ import java.util.stream.Collectors; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.mode.externalapi.devtime.spi.ExternalApiResourceProvider; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java index 76513cd95f778e49b1574883c787c4d797fc5c3a..e6de0d58087b76c3ddeed202d9aca0e45e608744 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/provider/ViewModelProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,7 +19,7 @@ import java.util.List; import java.util.stream.Collectors; import org.openatom.ubml.mode.externalapi.devtime.spi.ExternalApiResourceProvider; import org.openatom.ubml.mode.externalapi.devtime.spi.ResourceProvider; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java index 73676aadce1b76c6657d112f8f196ed4ed6bbcb2..52c953c4af0a62b4e1b1323b5492e19ff92146a1 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/refer/ExternalApiReferenceConstraint.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,8 +16,8 @@ package org.openatom.ubml.model.externalapi.devtime.core.refer; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; import org.openatom.ubml.model.externalapi.definition.temp.lcm.IMetadataReferenceManager; /** diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionService.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionService.java index 68cda5a26e976c0e0ebc20cc41f68beb86dffbae..8e1980cdca00135fccd78e07c2071920fd78f437 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionService.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionServiceImpl.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionServiceImpl.java index 49ff7634cfdfa18fa79418473492d10b59a2eb67..44ea60fed4a5e8681362554e60ec67c94f40bc8f 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionServiceImpl.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/rest/ExternalApiDefinitionServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java index b363efa1919fa7015d17a1902a7fe4fe63ebfe20..880c6463a8893736bd8081c9bd9c3142ef5f5ad9 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/service/ExternalApiMetadataServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,7 +19,7 @@ import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; import org.openatom.ubml.externalapi.devtime.api.ExternalApiMetadataService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; diff --git a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java index 76214a926f47659b50019cd773197a9675c97fdd..4f201b15e8b3ce2fd9f9269f018da8ed9f6b9f9b 100644 --- a/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java +++ b/model/externalapi/devtime-core/src/main/java/org/openatom/ubml/model/externalapi/devtime/core/utils/MetadataProjectUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,10 +18,10 @@ package org.openatom.ubml.model.externalapi.devtime.core.utils; import java.io.IOException; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.metamodel.framework.designtime.api.GspProjectService; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; /** * MetadataProjectUtils diff --git a/model/externalapi/devtime-spi/pom.xml b/model/externalapi/devtime-spi/pom.xml index 6015308a34f204c04b21cd2c2239d4807ae70d47..3d8cb80e1ec988bff2fb2636dd01d5732957ec8f 100644 --- a/model/externalapi/devtime-spi/pom.xml +++ b/model/externalapi/devtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ExternalApiResourceProvider.java b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ExternalApiResourceProvider.java index 4daad928a4807685469da264c3769075924443ce..92d41e6f1eec3aa28a7634035deec51dc8a8b6bc 100644 --- a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ExternalApiResourceProvider.java +++ b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ExternalApiResourceProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java index 7eb7b0d0d244277169f3e7a05c0e5b2f359d699d..6c3b955baea4b8a03c16cb0caca82ee9f830bf68 100644 --- a/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java +++ b/model/externalapi/devtime-spi/src/main/java/org/openatom/ubml/mode/externalapi/devtime/spi/ResourceProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -16,7 +16,7 @@ package org.openatom.ubml.mode.externalapi.devtime.spi; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/extension/pom.xml b/model/externalapi/extension/pom.xml index 92c4ca57696d3c08e628db69f62cd0433c1bf445..c31267e40f9efe4dcfa12f197da84b01c6ae75c4 100644 --- a/model/externalapi/extension/pom.xml +++ b/model/externalapi/extension/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java index 4690853980b44974ad7a43f091c4b1ec74ac2777..8095369cec39a0ce4e12590cb2c01141114511b7 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java index 184ec5d6e460a9578cfe70e6fa81c3c2a337a52c..df5c99add6abb1ea8555a3cd687340cdf0694869 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/BasicActionSummary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,7 +19,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewObject; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java index b17f82ef854f7fed4a809bafca2c8b4abc23c502..6e2c7771e41724464fb296462d86276cbbe489c8 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,14 +15,9 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import jdk.nashorn.internal.runtime.PropertyMap; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; @@ -31,6 +26,11 @@ import org.openatom.ubml.model.externalapi.definition.temp.vo.VMCollectionParame import org.openatom.ubml.model.externalapi.definition.temp.vo.VMParameterType; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * CustomActionProvider * diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java index 603a5f0ab9dab2df847511048f599b8a790c29d4..103e1a703e871fba3a38b1f595fbff62b5b82bd0 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/CustomActionSummary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java index ed189f5837394485d0292f85e5544e4c158c83ed..d7b3f856c204aa5ab2c51709c0c4a0f08f39e79d 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,16 +15,16 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.List; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + /** * 功能描述: * diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java index d9869402de3ba6740d478044cda745a43b8b41eb..8034f2af819a9f75e4ffb6783488c81d0683e177 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleBasicActionSummary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; /** diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java index 19e50303d9e619a3087671ab5d51a155fde4eb2f..ba7314d504c00fb6fd2d139d5a04cfba6d0e5c80 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionProvider.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -15,12 +15,7 @@ */ package org.openatom.ubml.model.externalapi.provider.viewmodel; -import java.text.MessageFormat; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.externalapi.definition.entity.ModelType; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.definition.entity.Parameter; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; @@ -29,6 +24,11 @@ import org.openatom.ubml.model.externalapi.definition.temp.vo.VMCollectionParame import org.openatom.ubml.model.externalapi.definition.temp.vo.VMParameterType; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + /** * SimpleCustomActionProvider * diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java index 393cf39e1b3dda182e06ab1624a5cbac23372c4b..e2f42138b93101e93ba0be011f27dc17a5c4e493 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/SimpleCustomActionSummary.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,7 +18,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel; import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.temp.vo.GspViewModel; import org.openatom.ubml.model.externalapi.definition.temp.vo.ViewModelAction; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java index fb9b6067c94c40ddcd31c43a7a5f688c0fbc308a..3c121507d6ecd9f49db3c02faa327ced0d3b55d4 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/SimpleViewModelUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel.utils; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.provider.viewmodel.SimpleBasicActionProvider; diff --git a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java index 67b1b016b3ebfce13f8287db07384901077bcbd7..c091319a69a1eed0980bb91d8a487c7a09873437 100644 --- a/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java +++ b/model/externalapi/extension/src/main/java/org/openatom/ubml/model/externalapi/provider/viewmodel/utils/ViewModelUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,7 +17,7 @@ package org.openatom.ubml.model.externalapi.provider.viewmodel.utils; import java.util.ArrayList; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.dto.Summary; import org.openatom.ubml.model.externalapi.definition.entity.Operation; import org.openatom.ubml.model.externalapi.provider.viewmodel.BasicActionProvider; diff --git a/model/externalapi/generator/pom.xml b/model/externalapi/generator/pom.xml index 95d910a4d22327b878b9b13ef656ddbb5f5b359a..74a103f7a96a5d5e4487d62671af1a4526646b15 100644 --- a/model/externalapi/generator/pom.xml +++ b/model/externalapi/generator/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiChecker.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiChecker.java index 6bd3362a84af4ecb2c678f8698716883028b6474..4a56c145d7bf958b22a7f83ec99366e17dd43b4b 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiChecker.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiChecker.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClass.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClass.java index b6bad1e56a7700d8ab563705732ea6f57f814283..73b4a27aa22f37e1233364e7116aa7cfae321634 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClass.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClass.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClassAnnotation.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClassAnnotation.java index 8dbba9bc7d1997020bf6727002ac5fd1225b5bc0..e9a2d390f7033dc8349e117e143c37054d895c8f 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClassAnnotation.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiClassAnnotation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCode.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCode.java index 7237affad6c6b32603885fed67f21372246e006e..302891b70da71ab8d2bf45567f9dfd062dbfdc88 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCode.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCompileUtils.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCompileUtils.java index d4b1358f64852cafdf60e35b079264bf9119199e..78a0aa3eec28b781e2c028b04eda2602f895ac6d 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCompileUtils.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiCompileUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiExtension.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiExtension.java index 2500261637a0191d77cbf02ea200d36dae320c98..537da4b2a56d992c00a8df897c2d76f0bd05f5dc 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiExtension.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiExtension.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiImports.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiImports.java index c1633502b43fc5f0c0d34da47184a6e94d21e708..d3accafa7cdb2f87ae382d30603c8d110163796a 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiImports.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiImports.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiMethod.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiMethod.java index 4a9e00c4ce2c7d2a12163e9efac651e2cd9a8a15..b62bc32eb3258b9833f4b77380fb39f152c3f67a 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiMethod.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiMethod.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiPackage.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiPackage.java index f9143ff7478c172fed325a4b4fd7e2458189889a..cdf8dab184773636bf9e40124d710b9172eec654 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiPackage.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiPackage.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtCodeGenerator.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtCodeGenerator.java index abc118fb6079bebcd4d1e347e97da0cee94330f7..18f5ae3e8bc1c9dc470d4351e93d22fbcf1423a9 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtCodeGenerator.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtCodeGenerator.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java index 6666c8bd624ba231a0d90faa569d13ab9b368207..3cd28e1cfe5be18967ac992914bcceb7c32081ea 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/ExternalApiRtHandler.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -24,8 +24,8 @@ import java.util.Objects; import java.util.stream.Collectors; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/AfterGenerateHook.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/AfterGenerateHook.java index 716da55a15b654b1475b1984c6fa481fef2520e8..7cf3fa9c7d5daed9cdedc22bc0cfa1f4cfde73ee 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/AfterGenerateHook.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/AfterGenerateHook.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtCodeGenerator.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtCodeGenerator.java index 5777f696faae78a8088824f6794d5292f7a51f9d..c0f5fc5466c1d79fe2b984b902690e0ba5cc9706 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtCodeGenerator.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtCodeGenerator.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java index 8e4efcd3636a06edd27690b0cbc2efc07af20277..5ca57d26520382adab5f236721b48b2ae3388154 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiDtHandler.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -22,8 +22,8 @@ import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Operation; diff --git a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java index 6c577cb81b698c983957f5fb8c26f93c6c833e76..2ceb2318d717a648e2edf2ab48c32b5f9e33d3e6 100644 --- a/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java +++ b/model/externalapi/generator/src/main/java/org/openatom/ubml/model/externalapi/generator/dt/ExternalApiJavaCodeGenerator.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -20,7 +20,7 @@ import java.text.MessageFormat; import java.util.Objects; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.generator.ExternalApiCompileUtils; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.FileService; diff --git a/model/externalapi/pom.xml b/model/externalapi/pom.xml index fb159eca062e4d0a593cb5f3dfbd4f2e9cd6c7a1..e67b5b33b689ad58ed705130c7d63dfb906ebd17 100644 --- a/model/externalapi/pom.xml +++ b/model/externalapi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-api/pom.xml b/model/externalapi/runtime-api/pom.xml index 43b38ddb9db315e4d8600e652b9ccc768c052752..9baaa0d20f9c39def7d86d9570c0b9c3e17180e8 100644 --- a/model/externalapi/runtime-api/pom.xml +++ b/model/externalapi/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java index 9083281c0587af6a6af151fdaa2637648d351c7a..b39188b7489d0078cd67e03c5535e7e7e8aec613 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/EndpointInfo.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java index 06091629c9eef0f932370675e68abd63c188a1fc..55c21f17960097c9a9aa002fd6f0200d7394bea3 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedMetadataService.java @@ -1,6 +1,21 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * 运行时元数据服务接口 diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java index 4fcc276ab0ea90cf5593b3b95694a05516d2799a..ddc5184e7c8dc64a5d0adf1fd46ee2fbfdccff17 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiCustomizedPublishService.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; import java.util.List; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java index 4a0bc085902ba4dc26643aab7623ae333c25f620..ae295b2cb647309d484633f23e1d0fff9f83f439 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiEngine.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; import com.fasterxml.jackson.databind.JsonNode; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java index b294324418094c2fb8a5d304e2e6fb6e7177daf8..d6b8e38c2b59b0fca2e5cad17318b893ba3aa11d 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiInvokeAgent.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; import com.fasterxml.jackson.databind.JsonNode; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java index 67bfd9d3586dfa5de1fac9c1d9d0ea5f7ef3986c..06b7cf576b3fecd7c8fb26df078e3a88ebb4696a 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiMetadataService.java @@ -1,6 +1,21 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.vo.DimensionInfo; diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java index bf958ab3bcfe2dcfd819e7fda14bc332e5b011be..2dc3a5c5df7356dff34bee68df47fdf7db557853 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/ExternalApiPublishService.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; /** diff --git a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java index d4923528601d3f9ee69a7c9629487d0fe9aaf908..95d81e96d6bb36279a8d8e35f16c18f2045469c5 100644 --- a/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java +++ b/model/externalapi/runtime-api/src/main/java/org/opeantom/ubml/externalapi/runtime/api/PublishedExternalApiInfo.java @@ -1,3 +1,18 @@ +/* + * 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 org.opeantom.ubml.externalapi.runtime.api; diff --git a/model/externalapi/runtime-core/pom.xml b/model/externalapi/runtime-core/pom.xml index b6844d18e30f24165fe6b92a3d050286a73f7ab0..0e934b7f4c81539de81c2f7cdd79b615c12a4387 100644 --- a/model/externalapi/runtime-core/pom.xml +++ b/model/externalapi/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -50,6 +66,12 @@ ubml-model-framework-common 0.9.0-SNAPSHOT compile + + + lcm-metadata-api + com.inspur.edp + + diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseService.java index 9a31e81ecd792613615620df626e7fc63350c08e..c0ab04f74db36d1e55fd1f5cd9bdce588fa0b976 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseServiceImpl.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseServiceImpl.java index 6ae20c2fc1933f08dfc3577e3f60672089591c92..070cc70abebd5bd4765ce17cb6e1e24f32525b4a 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseServiceImpl.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/VoBaseServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseService.java index 2139898c9141fe58d743fa5eea09836f2ee89109..275cc218015a07b83e80d2902baab3715d25a24a 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseServiceImpl.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseServiceImpl.java index 6a98c5668e706f4f792cd7e971bfbeb192375caf..097b8cc4ee00a692788924e86dacc17bcb372be5 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseServiceImpl.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/base/simple/SimpleVoBaseServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/cache/ResourceInvokerCache.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/cache/ResourceInvokerCache.java index c44f83a70d8be1a37191e317df450269d4dc893c..4cfa2dfb5b1eb18572e8359ff4b20e0381169c40 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/cache/ResourceInvokerCache.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/cache/ResourceInvokerCache.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/config/ExternalApiSpringBeanConfig.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/config/ExternalApiSpringBeanConfig.java index e6f28fcc94805b671c90be8e5f184919aefc89d9..b7784822cb9d184b71ca4da9e0926f3d1238e1d9 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/config/ExternalApiSpringBeanConfig.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/config/ExternalApiSpringBeanConfig.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java index 4bf617f8e0e9f13131e2937fedb94d346450110e..68d279e5db31f949dba8a69f9ecfd925cf3eba62 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/constraint/ExternalApiRTRefConstraint.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -19,8 +19,8 @@ import java.util.ArrayList; import java.util.List; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationService; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/compile/CustomizeUnitCompiler.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/compile/CustomizeUnitCompiler.java index c1fd13d2ef75741e0ae5a0545ff34f2f4cb8025a..a8b5abbccf69cb1183061459dc8535a262744a6f 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/compile/CustomizeUnitCompiler.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/compile/CustomizeUnitCompiler.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/config/SgfRuntimeCustomizeCoreConfiguration.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/config/SgfRuntimeCustomizeCoreConfiguration.java index 939d26a65ad7d7e75a6c9f5b318f40ce6a0d4b41..182abcd8d74abc4d9872c7e3845aa8e53dcc3bdc 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/config/SgfRuntimeCustomizeCoreConfiguration.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/config/SgfRuntimeCustomizeCoreConfiguration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/deploy/CustomizeDeploy.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/deploy/CustomizeDeploy.java index 673297f71c0b07fefd5171f1c03a35a855d3596b..6153c80cb9bf304c9053d142d67646cb92fcba97 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/deploy/CustomizeDeploy.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/deploy/CustomizeDeploy.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnit.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnit.java index 780ed644a3fa9b92e833ce40c556c77c1fc37f52..0fda9a3d92620f386a818a683d41af151c45a4f4 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnit.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnit.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java index e78f74e0eba75fdc6d5c7243c9f6eafd37839cc1..7a662dcba3232bd2e6403430e1b96bcbfbc4b0a0 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitGetter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -22,7 +22,7 @@ import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.externalapi.runtime.core.jit.compile.JavaSourceCode; import org.openatom.ubml.externalapi.runtime.core.service.ExternalApiJavaCodeHandler; import org.openatom.ubml.externalapi.runtime.core.service.JavaCodeInfo; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationRtService; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitUtil.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitUtil.java index 0e86383b8d5fef85feeb2b53f60b3fbb211b2466..caa89d51a5c0e75fc71e99b92c0bfcd9708ad169 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitUtil.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/entity/CustomizeUnitUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java index 84a5d909d0571f1eb34820968038dbff8ba2982f..6855653b1e51a9103c50c02f3e23e4763af85821 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMdPkgChangedEventListener.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -28,12 +28,12 @@ import org.openatom.ubml.externalapi.runtime.core.customize.deploy.CustomizeDepl import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnit; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitGetter; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitUtil; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedArgs; import org.openatom.ubml.model.externalapi.definition.temp.lcm.MdPkgChangedEventListener; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; -import org.openatom.ubml.model.framework.definition.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,7 +60,7 @@ public class SgfMdPkgChangedEventListener implements MdPkgChangedEventListener { private void handleMdPkg(MetadataPackage metadataPackage) { try { - if (!ProcessMode.interpretation.equals(metadataPackage.getHeader().getProcessMode())) { + if (!ProcessMode.INTERPRETATION.equals(metadataPackage.getHeader().getProcessMode())) { //如果不是无需生成代码的元数据包,直接忽略 return; } diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java index 103198c4a8a8e8271d0ef2557137d3a4863e34b1..ba2ebdb4890a0d70ddc5df2d14f423d25f9c55f6 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/customize/listener/SgfMetadataCacheExtServiceListener.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,7 +18,7 @@ package org.openatom.ubml.externalapi.runtime.core.customize.listener; import org.openatom.ubml.externalapi.runtime.core.customize.deploy.CustomizeDeploy; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnit; import org.openatom.ubml.externalapi.runtime.core.customize.entity.CustomizeUnitGetter; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.definition.temp.lcm.IMetadataCacheExtService; import org.openatom.ubml.model.externalapi.definition.util.MetadataUtil; import org.slf4j.Logger; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/DirectoryManager.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/DirectoryManager.java index db51a7d5d66937d980ba3717266e4f7c015a176f..7cc072e5aae9937bda3685bccd70871b16ace928 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/DirectoryManager.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/DirectoryManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/StartManager.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/StartManager.java index 8933bb40975e276a31bdfb59917cb3cc19700c18..0882b1c8e7d5a5875bc00e561282cf1ede29a730 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/StartManager.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/StartManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/UnZipManager.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/UnZipManager.java index 7fd3eb109257cca0957913b2cd9a8eea0fd23854..0126933318bffb1f5ba4e9f247914c2f23435c10 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/UnZipManager.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/common/UnZipManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileContext.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileContext.java index 6789a1a6e61821e6c4d66f523b2609ef91ddebd8..211b9113999cf1cd5fa9958e5eeddcb4106252a4 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileContext.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileContext.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileService.java index 3b64ed4232b7a46b1683274ba965e4f84ace7b73..f2638ca1c6a32b520e832d706b46f7d821aa2c0a 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileServiceImpl.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileServiceImpl.java index 5d82b003761d3cbfe871b71716569e496ac945c1..d69725a195584f2f8a9d53119a7363792cd1e57f 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileServiceImpl.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/CompileServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/JavaSourceCode.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/JavaSourceCode.java index 0703cce9d081f2192a3789291cde1e110ea08abd..ba983041558ace689cf2eb2d73f344e3c7ff708d 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/JavaSourceCode.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/JavaSourceCode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/Manifest.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/Manifest.java index 261c37a8086cc4af4971b4b5c90e0b6232c8e6a3..f75b81e9ec7c5b557be38e1c8b19578bcfc693f4 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/Manifest.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/Manifest.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/ManifestUtil.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/ManifestUtil.java index 65624ebb2547a209f39310ade2309774f71ff040..beaaaa62c9e728a38609cc33e999e4ae8d68b2df 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/ManifestUtil.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/ManifestUtil.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/StringJavaFileObject.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/StringJavaFileObject.java index fd0ce6940964ba7ed793a4b622c4a3293b14c02b..ef6e043d436529bcd32a2d744c30ed9492694178 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/StringJavaFileObject.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/compile/StringJavaFileObject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEvent.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEvent.java index 41d0c1d5069dae8e9f5d85fe2a5a3e8d1140e227..6f6b89d66d6acdf2d9d486edeee54fd115bb57d5 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEvent.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEvent.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEventArgs.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEventArgs.java index bcd132ac787cc25f4fdd893d35f9b75d82186f8a..2ffd8e19adbc7da4ab53b10b211e12bffbbf918d 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEventArgs.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/extension/StartEventArgs.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoadServiceImpl.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoadServiceImpl.java index 7a757e6027a2ff35bb85dbb21be566c5f9c7f5d2..7a7c37aa861424cc911cec733b77136317147caf 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoadServiceImpl.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoadServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoaderManager.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoaderManager.java index 5eddf429f57a5cda120e7deea5717845e1c2486a..f21a0bd623535493f6bd976c8e874dde89201f6b 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoaderManager.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassLoaderManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassloaderService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassloaderService.java index b8c09d16752122707532571828fa57413e71842b..dad113c169579f27c1ba6e94fc78af0a2f70adcc 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassloaderService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/ClassloaderService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/JitClassLoader.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/JitClassLoader.java index c9e86b197c59fefdcb15a57fc0d3f4b93fbbcf5a..ec861fd433b5db8d64fa69c577af46165b8d2ff7 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/JitClassLoader.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/load/JitClassLoader.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/FunctionSummaryInfo.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/FunctionSummaryInfo.java index db343cfd13741a16ed5491e076f8fcbd7a02c54c..482f0e7b4880566c0b74b057aa5a04405e2544b7 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/FunctionSummaryInfo.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/FunctionSummaryInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryService.java index 5f9aab6e7924646e46b742b6a207c621eb4a6825..03091aadb395a01b9f6bfe493558b0bb3f170387 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryServiceImpl.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryServiceImpl.java index 50032127a4af6bcd56e725758675737e44ed3458..b616f8be99f55a2277a9179fc358257de57ef269 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryServiceImpl.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/jit/query/QueryServiceImpl.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/manager/ExternalApiInvokeManager.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/manager/ExternalApiInvokeManager.java index 5b3f20de4bc0360ef98191c4164a1cc95db6e6a2..523fb6f7c9c84449e0fcfc984b94e39b8ced0c63 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/manager/ExternalApiInvokeManager.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/manager/ExternalApiInvokeManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java index 3b5bf3816dfee8a54121c28aa25cf86dc988d45f..12da2b5d95de6ac6b7795324f0d6008f623c2f19 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/JsonSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -18,9 +18,9 @@ package org.openatom.ubml.externalapi.runtime.core.serializer; import com.fasterxml.jackson.databind.JsonNode; import java.util.Objects; import org.openatom.ubml.common.util.JacksonJsonUtil; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; -import org.openatom.ubml.model.framework.spi.MetadataContentSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; /** * JsonSerializer @@ -38,7 +38,7 @@ public class JsonSerializer implements MetadataContentSerializer { * @return */ @Override - public JsonNode Serialize(IMetadataContent iMetadataContent) { + public JsonNode serialize(IMetadataContent iMetadataContent) { if (Objects.isNull(iMetadataContent)) { return null; } @@ -54,7 +54,7 @@ public class JsonSerializer implements MetadataContentSerializer { * @return */ @Override - public IMetadataContent DeSerialize(JsonNode jsonNode) { + public IMetadataContent deSerialize(JsonNode jsonNode) { if (Objects.isNull(jsonNode)) { return null; } diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java index 9ab2c1fdf1f9a70674ed61142f14ad9f2c6d0ea0..a46d3a5b6913ae0256beb15398f238986f40eaf8 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/serializer/TransferSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,9 +17,9 @@ package org.openatom.ubml.externalapi.runtime.core.serializer; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; -import org.openatom.ubml.model.framework.spi.MetadataTransferSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; /** * TransferSerializer diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java index 889e80096aec2735cfeba588d314912e73b6bd1c..1429245c23cf7be2a07185a78cec896b2724f322 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedMetadataService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -24,8 +24,8 @@ import org.opeantom.ubml.externalapi.runtime.api.ExternalApiCustomizedMetadataSe import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedPublishService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedPublishService.java index f0ab155a4a7407df99d5dc28a400073e0fa6c21b..cd38e278e5cf062ddf28f074f6f2feb51886d0bd 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedPublishService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiCustomizedPublishService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiEngine.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiEngine.java index 9295e6c15d33e6c2b2ca6000b2b679dd0ed566cd..4dba897f604b4b2a86b092b98fa8c2cb60e5ff76 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiEngine.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiEngine.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java index c96165ebc829b9a0b7cb8f510d7e28ca2176a8d6..1358d6a178b9a14cd1ec868653e74b5a58058e19 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiMetadataService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -24,8 +24,8 @@ import org.opeantom.ubml.externalapi.runtime.api.ExternalApiMetadataService; import org.openatom.ubml.common.spring.SpringUtils; import org.openatom.ubml.common.util.JacksonJsonUtil; import org.openatom.ubml.common.util.StringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; import org.openatom.ubml.model.externalapi.definition.Constants; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.entity.Model; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiPublishService.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiPublishService.java index 48e80fa458449966f447a0db48e23fd364d006bc..4fd4313f533aac389f1d944f42d5e298472e69b4 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiPublishService.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/DefaultExternalApiPublishService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java index 886532d9ea2cfe84d645d35e6c597cfa36b20c91..481e784a7970514eda3e687c2a4268070ebba03f 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/ExternalApiJavaCodeHandler.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -17,7 +17,7 @@ package org.openatom.ubml.externalapi.runtime.core.service; import java.text.MessageFormat; import org.openatom.ubml.common.spring.SpringUtils; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; import org.openatom.ubml.model.externalapi.generator.ExternalApiRtCodeGenerator; import org.openatom.ubml.model.externalapi.definition.entity.ExternalApi; import org.openatom.ubml.model.externalapi.definition.temp.lcm.CustomizationRtService; diff --git a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/JavaCodeInfo.java b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/JavaCodeInfo.java index 97813274b2d258ce3db9248ad4bccc55d33856b6..f4595d1a0acc007696f0cd0363454541a78af256 100644 --- a/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/JavaCodeInfo.java +++ b/model/externalapi/runtime-core/src/main/java/org/openatom/ubml/externalapi/runtime/core/service/JavaCodeInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-spi/pom.xml b/model/externalapi/runtime-spi/pom.xml index 21305ecab31b1832935386c10632db6186c39730..7714198c43f281d446e1334b85ec7df973d64800 100644 --- a/model/externalapi/runtime-spi/pom.xml +++ b/model/externalapi/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ExternalApiResourceInvoker.java b/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ExternalApiResourceInvoker.java index 36f6b573cfa410ab27926c6ec45bb6274e933b1b..794797f15cbecb72741f273f9760902f851096c1 100644 --- a/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ExternalApiResourceInvoker.java +++ b/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ExternalApiResourceInvoker.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ResourceInvoker.java b/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ResourceInvoker.java index f11602cbba8745d81604f1bbd00a69c2956bc84c..7f3ca8b8821329265fa3bb3bacc048509fccfab6 100644 --- a/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ResourceInvoker.java +++ b/model/externalapi/runtime-spi/src/main/java/org/openatom/ubml/model/externalapi/runtime/spi/ResourceInvoker.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * diff --git a/model/framework/common/pom.xml b/model/framework/common/pom.xml index 9412f6e704fc8f91c1bb0404dcf6b5cb0dd310aa..b08fe6703e5a2f685093e0dbb839a45154085532 100644 --- a/model/framework/common/pom.xml +++ b/model/framework/common/pom.xml @@ -1,4 +1,20 @@ + + @@ -8,22 +24,91 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-common ${project.version} - ubml-model-framework-common + + + 8 + 8 + + + + com.alibaba + fastjson + + + + io.iec.edp + caf-boot-commons-environment + + + io.iec.edp + caf-boot-commons-layeringcache + + + io.iec.edp + caf-boot-starter-context + + + lombok + org.projectlombok + + + + + + com.inspur.edp + lcm-logging-service + + + com.inspur.edp + lcm-project-deployer-spi + + + lcm-metadata-api + com.inspur.edp + + + + + org.apache.maven + maven-settings + + + com.inspur.edp + workspace-api + + org.openatom.ubml ubml-model-common-definition - 0.9.0-SNAPSHOT + ${project.version} + + + org.openatom.ubml + ubml-model-framework-devtime-api + ${project.version} + + + + org.apache.maven + maven-model + 3.6.1 + compile + + + org.apache.maven.shared + maven-invoker + 3.0.1 + compile + + + net.java.dev.jna + jna + 4.1.0 compile - - 8 - 8 - - \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..dba45c146c7374fc315ea4037e87da5532536c3f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/FileSystemServiceImp.java @@ -0,0 +1,73 @@ +/* + * 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.lcm.file.system; + +import com.inspur.edp.lcm.file.system.monitor.FileAltMonitorImpl; +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import com.inspur.edp.lcm.metadata.api.service.FileAltMonitor; +import com.inspur.edp.lcm.metadata.api.service.FileSystemService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.core.session.WebSession; +import java.awt.Desktop; +import java.io.File; +import java.io.IOException; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +public class FileSystemServiceImp implements FileSystemService { + FileServiceImp fileServiceImp = new FileServiceImp(); + + @Override + public void showInExplorer(String path) throws IOException { + WebSession webSession = (WebSession) CAFContext.current.getCurrentSession(); + if (!webSession.getRemoteAddress().equals("127.0.0.1") && !webSession.getRemoteAddress().equals("0:0:0:0:0:0:0:1")) { + throw new RuntimeException("不支持访问远程路径。"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + absolutePath = fileServiceImp.isFileExist(absolutePath) ? fileServiceImp.getDirectoryName(absolutePath) : absolutePath; + if (!fileServiceImp.isDirectoryExist(absolutePath)) { + throw new RuntimeException("路径不存在:" + path + "。"); + } + + File file = new File(absolutePath); + try { + System.setProperty("java.awt.headless", "false"); + Desktop.getDesktop().open(file); + } catch (Exception e) { + openDirectoryByShell(absolutePath); + } + } + + @Override + public FileAltMonitor createFileMonitor(String path, FileType type, FileAlterationListenerAdaptor adaptor) { + return new FileAltMonitorImpl(path, type, adaptor); + } + + private void openDirectoryByShell(String path) throws IOException { + if (System.getProperty("os.name").toLowerCase().contains("win")) { + String[] cmd = new String[5]; + cmd[0] = "cmd"; + cmd[1] = "/c"; + cmd[2] = "start"; + cmd[3] = " "; + cmd[4] = new File(path).getAbsolutePath(); + Runtime.getRuntime().exec(cmd); + } else { + throw new RuntimeException("仅支持windows系统"); + } + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..139e695406b90560e0935ccc428a9a418a8bdbeb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorFactory.java @@ -0,0 +1,24 @@ +/* + * 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.lcm.file.system.monitor; + +import org.apache.commons.io.monitor.FileAlterationMonitor; + +class FileAltMonitorFactory { + static FileAlterationMonitor create(Long interval) { + return new FileAlterationMonitor(interval); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..c373deebda9a35e9116d2d18b68789e441f98db5 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/file/system/monitor/FileAltMonitorImpl.java @@ -0,0 +1,147 @@ +/* + * 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.lcm.file.system.monitor; + +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import com.inspur.edp.lcm.metadata.api.service.FileAltMonitor; +import org.apache.commons.io.filefilter.FileFilterUtils; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; + +public class FileAltMonitorImpl implements FileAltMonitor { + private String path; // 文件夹目录 + + private String fileSuffix; // 需要监听的文件名后缀 + + private long interval; // 监听间隔 + + private FileAlterationMonitor monitor; // 监视器 + + private static final long DEFAULT_INTERVAL = 5 * 1000; // 默认监听间隔10s + + private boolean running = false; + + private FileAlterationListenerAdaptor listener; // 事件处理类对象 + + public FileAltMonitorImpl(String path, String fileSuffix, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, fileSuffix, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, long interval, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, "", interval, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, String fileSuffix, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = interval; + this.listener = listenerAdaptor; + init(); + } + + public FileAltMonitorImpl(String path, FileType fileType, FileAlterationListenerAdaptor listenerAdaptor) { + this(path, fileType, DEFAULT_INTERVAL, listenerAdaptor); + } + + public FileAltMonitorImpl(String path, FileType fileType, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this(path, parseToString(fileType), interval, listenerAdaptor); + } + + private static String parseToString(FileType fileType) { + switch (fileType) { + case MDPKG: + return ".mdpkg"; + case JAR: + return ".jar"; + default: + return null; + } + } + + private void init() { + if (path == null || "".equals(path)) { + throw new IllegalStateException("Listen path must not be null"); + } + if (listener == null) { + throw new IllegalStateException("Listener must not be null"); + } + + // 设定观察者,监听文件 + FileAlterationObserver observer; + if (fileSuffix == null || "".equals(fileSuffix)) { + observer = new FileAlterationObserver(path); + } else { + observer = new FileAlterationObserver(path, + FileFilterUtils.suffixFileFilter(fileSuffix)); + } + + // 给观察者添加监听事件 + observer.addListener(listener); + + // FileAlterationMonitor本身实现了 Runnable,是单独的一个线程,按照设定的时间间隔运行,默认间隔是 10s + monitor = FileAltMonitorFactory.create(interval); + + monitor.addObserver(observer); + } + + /*** + * 开启监听 + */ + public void start() { + try { + monitor.start(); + running = true; + } catch (Exception e) { + throw new RuntimeException("monitor start error", e); + } + } + + public void stop() { + try { + monitor.stop(); + running = false; + } catch (Exception e) { + throw new RuntimeException("monitor stop error", e); + } + } + + public void checkAndNotify() { + if (running) { + for (FileAlterationObserver observer : this.monitor.getObservers()) { + observer.checkAndNotify(); + } + } + } + + public void setPath(String path) { + this.path = path; + } + + public void setFileSuffix(String fileSuffix) { + this.fileSuffix = fileSuffix; + } + + public void setAdaptor(FileAlterationListenerAdaptor listenerAdaptor) { + this.listener = listenerAdaptor; + } +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java index 86494dc2cfa44155986c00406b58ad802653b11d..30c11fed428551f9fd1f7a94cc440e6d91f86a83 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/CommonConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/CommonConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname CommonMetaData @@ -22,13 +22,13 @@ package org.openatom.ubml.model.framework.definition.entity; * @Created by zhongchq * @Version 1.0 */ -public class CommonConfigData { +public class CommonConfigData { private String type; private String assembly; private String typeCode; private String typeName; - private boolean isCreatingResourceMetadata; + private boolean creatingResourceMetadata; public String getType() { return type; @@ -63,11 +63,11 @@ public class CommonConfigData { } public boolean isCreatingResourceMetadata() { - return isCreatingResourceMetadata; + return creatingResourceMetadata; } public void setCreatingResourceMetadata(boolean creatingResourceMetadata) { - isCreatingResourceMetadata = creatingResourceMetadata; + this.creatingResourceMetadata = creatingResourceMetadata; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java similarity index 68% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java index 2de7285c4becbd0d1c841bedfc663b15ef3e6b1f..a40c644c56993be056f964b860ff62c24a3bd44e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FilterConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/FilterConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; import java.io.Serializable; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java index 8673fd89021dc9183e52108e2ea6384a172caa9a..1286e4a322d3503b416fa1ed4a280c50c0261853 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/I18nConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname I18nConfigData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java index c3b20ebd0371806fa611394ffb09754d28b00754..65c2d157c3cfb7a3deffb91f4919becab1bc5649 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ManagerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ManagerConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname ManagerMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java similarity index 72% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java index e2ba8242ffd7c8d02f6cfda536d12cd3e9f1bce5..bd661271c537de8f7db35dcc4d9ad9e26192399c 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdExtRuleSerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MdExtRuleSerializerConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; public class MdExtRuleSerializerConfigData { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java similarity index 86% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java index f2a5484e98cae1e7716acfd0d3e617df4a81d02d..1f45f84ea02c78774a8d30479a3d4a74b12d27ba 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataConfiguration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataConfiguration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; import java.io.Serializable; @@ -68,7 +68,7 @@ public class MetadataConfiguration implements Serializable { } public void setTransferSerializer( - TransferSerializerConfigData transferSerializer) { + TransferSerializerConfigData transferSerializer) { this.transferSerializer = transferSerializer; } @@ -101,7 +101,7 @@ public class MetadataConfiguration implements Serializable { } public void setMdExtRuleSerializer( - MdExtRuleSerializerConfigData mdExtRuleSerializer) { + MdExtRuleSerializerConfigData mdExtRuleSerializer) { this.mdExtRuleSerializer = mdExtRuleSerializer; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java similarity index 88% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java index c74fa20c92ae6b40859cc81652d78559191b98b5..8c9a0e1d4c20aa10fae4422b23f25e3661210b53 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataTypeConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/MetadataTypeConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * Classname MetadataTypeConfigData Description 元数据类型实体 Date 2019/11/26 19:41 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java index 0320e377cda57c0feaee30d7995f8537156ad943..c63d12c2c8085ab6a2dc21430b394e704c2e70a4 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ReferenceConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/ReferenceConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname ReferenceMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java index dba839a9bbbaa408d379eacc6b02fd3e3e09113d..ef97b97c0ae86812f52064f44e6d394082644e9e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/SerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/SerializerConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname SerializerMetaData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java similarity index 75% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java index 29ad89e34ed7d915fb9e153f47a955194cc8377c..a9d7ace3a67be06ce9eaed93390e6dc24c4fd5c2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/TransferSerializerConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/TransferSerializerConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname TransferSerializerMetaData diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..a95e5d2fab4b2726169b2341f34d0d32c3c02d0e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/AdvancedFunctionConfiguration.java @@ -0,0 +1,45 @@ +/* + * 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.lcm.metadata.api.entity; + +public class AdvancedFunctionConfiguration { + private boolean maven; + private boolean menu; + + public boolean isMaven() { + return maven; + } + + public void setMaven(boolean maven) { + this.maven = maven; + } + + public boolean isMenu() { + return menu; + } + + public void setMenu(boolean menu) { + this.menu = menu; + } + + @Override + public String toString() { + return "AdvancedFunctionConfiguration{" + + "maven=" + maven + + ", menu=" + menu + + '}'; + } +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java similarity index 81% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java index 093c5af4b52757ea17b45cf94086aaaec08f06f7..2687e62e8977fad45311e55031045a2fdd13292d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ApiModuleInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ApiModuleInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname ApiModuleInfo Description Api Date 2019/11/26 10:49 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..d20f717dfc8c09f16d1d5a21f33baa58bcb515d0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DbConnectionInfo.java @@ -0,0 +1,112 @@ +/* + * 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.lcm.metadata.api.entity; + +import io.iec.edp.caf.commons.dataaccess.DbType; + +public class DbConnectionInfo { + private String dbServerIP; + private String dbPort; + private String dbName; + private String dbUserName; + private String dbPassword; + private DbType dbType; + + public String getDbServerIP() { + return dbServerIP; + } + + public void setDbServerIP(String dbServerIP) { + this.dbServerIP = dbServerIP; + } + + public String getDbPort() { + return dbPort; + } + + public void setDbPort(String dbPort) { + this.dbPort = dbPort; + } + + public String getDbName() { + return dbName; + } + + public void setDbName(String dbName) { + this.dbName = dbName; + } + + public String getDbUserName() { + return dbUserName; + } + + public void setDbUserName(String dbUserName) { + this.dbUserName = dbUserName; + } + + public String getDbPassword() { + return dbPassword; + } + + public void setDbPassword(String dbPassword) { + this.dbPassword = dbPassword; + } + + public DbType getDbType() { + return dbType; + } + + public void setDbType(DbType dbType) { + this.dbType = dbType; + } + + private String url; + + public String getUrl() { + if (url == null || url.length() <= 0) { + switch (dbType) { + case DM: + url = "jdbc:dm://" + getDbServerIP() + ":" + dbPort + "/DMSERVER?schema=" + dbName; + break; + case PgSQL: + url = "jdbc:postgresql://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case Oracle: + url = "jdbc:oracle:thin:@//" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case SQLServer: + url = "jdbc:sqlserver://" + getDbServerIP() + "\\" + dbName + ":" + dbPort + ";database=" + dbName; + break; + case HighGo: + url = "jdbc:highgo://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + case MySQL: + url = "jdbc:mysql://" + getDbServerIP() + ":" + dbPort + "/" + dbName + "?characterEncoding=utf8&serverTimezone=UTC&useSSL=false"; + break; + case Oscar: + url = "jdbc:oscar://" + getDbServerIP() + ":" + dbPort + "/" + dbName; + break; + default: + throw new RuntimeException("数据库类型不正确"); + } + } + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java new file mode 100644 index 0000000000000000000000000000000000000000..312e5c2ccd2d5bcff9c75013bb6b1c74137018c1 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DebugEnvironment.java @@ -0,0 +1,73 @@ +/* + * 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.lcm.metadata.api.entity; + +public class DebugEnvironment { + private String serverPath; + private String language; + private String deployPath; + private String deployConfigPath; + private DbConnectionInfo dbConnectionInfo; + private DbConnectionInfo centralDbConnectionInfo; + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getServerPath() { + return serverPath; + } + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } + + public String getDeployPath() { + return deployPath; + } + + public void setDeployPath(String deployPath) { + this.deployPath = deployPath; + } + + public String getDeployConfigPath() { + return deployConfigPath; + } + + public void setDeployConfigPath(String deployConfigPath) { + this.deployConfigPath = deployConfigPath; + } + + public DbConnectionInfo getDbConnectionInfo() { + return dbConnectionInfo; + } + + public void setDbConnectionInfo(DbConnectionInfo dbConnectionInfo) { + this.dbConnectionInfo = dbConnectionInfo; + } + + public DbConnectionInfo getCentralDbConnectionInfo() { + return centralDbConnectionInfo; + } + + public void setCentralDbConnectionInfo(DbConnectionInfo centralDbConnectionInfo) { + this.centralDbConnectionInfo = centralDbConnectionInfo; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java new file mode 100644 index 0000000000000000000000000000000000000000..5242da43732c46876a0efee7dc77e1849695d5c9 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/DeploymentContext.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata.api.entity; + +public class DeploymentContext { + private DebugEnvironment debugEnvironment; + + public DebugEnvironment getDebugEnvironment() { + return debugEnvironment; + } + + public void setDebugEnvironment(DebugEnvironment debugEnvironment) { + this.debugEnvironment = debugEnvironment; + } + + public String getPublishPath() { + return publishPath; + } + + public void setPublishPath(String publishPath) { + this.publishPath = publishPath; + } + + private String publishPath; +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java similarity index 72% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java index 796fd280dad5efd8dde4ac454087a45d27c93fcf..ad7c987628b63198c447243826523fe144d6e1ab 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ExtractContext.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class ExtractContext { @@ -21,6 +21,15 @@ public class ExtractContext { private String deployPath; private String deployConfigPath; private String webModulePath; + private String deployType; + + public String getDeployType() { + return deployType; + } + + public void setDeployType(String deployType) { + this.deployType = deployType; + } public String getProjectPath() { return projectPath; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java similarity index 60% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java index 8e86584e976c68d3b186bb0c8551dcd8dd2c5750..f05c35e65b53185e33a3ad13845af63ba0d01dc5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/FileType.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/FileType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum FileType { MDPKG, diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java similarity index 86% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java index 030f83537a6ad86193df0bb59015c9fb68f58e64..91a201736edcb4f35e4137cdc6d7e770b76505ae 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/I18nResource.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/I18nResource.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class I18nResource { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java similarity index 84% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java index 074d693fd3eef999bdc4ccfd701f361daa31979f..b9f95545bc6810dfb47ac1f8ba44c1517b25085a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalRepoPkg.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/LocalRepoPkg.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java similarity index 80% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java index c886803e5053ed378cd971424463c6e0e9a69f44..a74f3cb29184083d55ba3c0ab8fe402f8383c88d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MdPkg.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MdPkg.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.HashSet; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java similarity index 69% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java index 3d47feedae98c333c22b2579bc33ee91a65f0e55..4f0772c9ce5d69c281781369f239f6a547fd47c2 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCompilerContext.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCompilerContext.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataCompilerContext { private String projectPath; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java similarity index 76% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java index 386ff44a7678f566cdd471bb39f228fc49f28b72..22e005ca74f5d2db55682d04f41e1c2f1e422763 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataCustomizationFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataCustomizationFilter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 运行时定制元数据过滤器 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java similarity index 81% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java index 499d02c7a414af50cccfa0cb3ca96f0cbf3aaf24..405f3bb3ca6e69cd1110c56977512ce5367406a1 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataPackageDto { private String packageName; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java similarity index 86% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java index 4cc2c892b28c50d95357032e06d9d20e27cff227..3d6387afd5d15f9061ee6f50d47ad0fa07af1d3d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageForIndex.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageForIndex.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; import java.util.Map; @@ -97,7 +97,7 @@ public class MetadataPackageForIndex { } public void setDepMetadataPackages( - Map depMetadataPackages) { + Map depMetadataPackages) { this.depMetadataPackages = depMetadataPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java index 9952fc0d455e30e6e893a5a1483642143c2cb090..b3322373e118b25863800b3b8380d4c33e547a78 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProjectDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProjectDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataProjectDto { private String projectPath; diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..d9c5cf78df47f3317a287b4870b9606ee181c251 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataRTFilter.java @@ -0,0 +1,99 @@ +/* + * 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.lcm.metadata.api.entity; + +import java.util.List; + +/** + * Classname MetadataRTFilter Description 过滤条件实体类 Date 2019/11/18 15:21 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataRTFilter { + //关键应用编号 + public String appCode; + //服务单元编号 + public String serviceUnitCode; + //业务对象ID + public List bizobjectId; + + public String type; + + public String code; + + public String nameSpace; + + public String getAppCode() { + return appCode; + } + + public void setAppCode(String appCode) { + this.appCode = appCode; + } + + public String getServiceUnitCode() { + return serviceUnitCode; + } + + public void setServiceUnitCode(String serviceUnitCode) { + this.serviceUnitCode = serviceUnitCode; + } + + public List getBizobjectId() { + return bizobjectId; + } + + public void setBizobjectId(List bizobjectId) { + this.bizobjectId = bizobjectId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getNameSpace() { + return nameSpace; + } + + public void setNameSpace(String nameSpace) { + this.nameSpace = nameSpace; + } + + @Override + public String toString() { + return "MetadataRTFilter{" + + "appCode='" + appCode + '\'' + + ", serviceUnitCode='" + serviceUnitCode + '\'' + + ", bizobjectId=" + bizobjectId + + ", type='" + type + '\'' + + ", code='" + code + '\'' + + ", nameSpace='" + nameSpace + '\'' + + '}'; + } +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java similarity index 78% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java index f309516c1dd81cf79b3a4cfeb4a946fb260904c8..3114fd6f91505b3dfc881df0da5334720aafd391 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Page.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Page.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname Page Description 元数据分页 Date 2019/11/26 13:44 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java similarity index 76% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java index e792b276f19b129fcaaf8ab53b7e155705b06d54..96b4e582f9d64f0d532b5614d78b9018c5d8835d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectMetadataCache.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectMetadataCache.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.Map; @@ -38,7 +38,7 @@ public class ProjectMetadataCache { } public void setDirectReferences( - Map directReferences) { + Map directReferences) { this.directReferences = directReferences; } @@ -47,7 +47,7 @@ public class ProjectMetadataCache { } public void setAllReferences( - Map allReferences) { + Map allReferences) { this.allReferences = allReferences; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java similarity index 61% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java index d194a6cefb2ff949a883a3ca1f69a38735628616..68bd74ec48d38a32fc4f28870477f614fd6c5cf5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceLocation.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceLocation.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,17 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum ResourceLocation { /** * 前端资源 */ - Frontend, + FRONTEND, /** * 后端资源 */ - Backend + BACKEND } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java similarity index 64% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java index 1d06f7a266118e82acaf3516a6206064e1854053..7870b9474444a337fca29210f939efefb506a201 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ResourceType.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ResourceType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public enum ResourceType { /** * 消息资源 */ - Message, + MESSAGE, /** * 异常资源 @@ -30,5 +30,5 @@ public enum ResourceType { /** * 元数据资源 */ - Metadata + METADATA } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java new file mode 100644 index 0000000000000000000000000000000000000000..96293e33510ce85fa267411fb3ed7d0309871602 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/WorkspaceDataLocation.java @@ -0,0 +1,62 @@ +/* + * 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.lcm.metadata.api.entity; + +/** + * @Classname WorkspaceDataLocation + * @Description TODO + * @Date 2019/7/20 15:08 + * @Created by zhongchq + * @Version 1.0 + */ + +public class WorkspaceDataLocation { + public String workspaceDataLocation; + + public String getWorkspaceDataLocation() { + return workspaceDataLocation; + } + + public void setWorkspaceDataLocation(String workspaceDataLocation) { + this.workspaceDataLocation = workspaceDataLocation; + } + + @Override + public String toString() { + return "WorkspaceDataLocation{" + + "workspaceDataLocation='" + workspaceDataLocation + '\'' + + '}'; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof WorkspaceDataLocation)) { + return false; + } + WorkspaceDataLocation item = (WorkspaceDataLocation) obj; + return workspaceDataLocation == null ? item.getWorkspaceDataLocation() == null : workspaceDataLocation.equals(item.getWorkspaceDataLocation()); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (workspaceDataLocation == null ? 0 : workspaceDataLocation.hashCode()); + return result; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java new file mode 100644 index 0000000000000000000000000000000000000000..cf2dc3935c4b5ccfa40ecaf1055f0137eaeec62b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfigData.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata.api.entity.compiler; + +public class MetadataCompilerConfigData { + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private String name; + + public String getAssembly() { + return assembly; + } + + public void setAssembly(String assembly) { + this.assembly = assembly; + } + + private String assembly; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..0a6d16771f2395b18877bf7dea4daef4ca9e60d7 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/compiler/MetadataCompilerConfiguration.java @@ -0,0 +1,47 @@ +/* + * 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.lcm.metadata.api.entity.compiler; + +public class MetadataCompilerConfiguration { + private String typeCode; + private boolean enable; + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } + + public boolean getEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + public MetadataCompilerConfigData getMetadataCompiler() { + return metadataCompiler; + } + + public void setMetadataCompiler(MetadataCompilerConfigData metadataCompiler) { + this.metadataCompiler = metadataCompiler; + } + + private MetadataCompilerConfigData metadataCompiler; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java new file mode 100644 index 0000000000000000000000000000000000000000..2f54a8459c74d08e140f711884dc0a12debdf5d0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeployConfigData.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata.api.entity.deployer; + +public class DeployConfigData { + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAssembly() { + return assembly; + } + + public void setAssembly(String assembly) { + this.assembly = assembly; + } + + private String assembly; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java new file mode 100644 index 0000000000000000000000000000000000000000..127a1f0bb8bb86b8e75ddc18954a6e17f2b7ece0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/deployer/DeploymentType.java @@ -0,0 +1,46 @@ +/* + * 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.lcm.metadata.api.entity.deployer; + +public class DeploymentType { + public DeployConfigData getDeployer() { + return deployer; + } + + public void setDeployer(DeployConfigData deployer) { + this.deployer = deployer; + } + + public boolean getEnable() { + return enable; + } + + public void setEnable(boolean enable) { + this.enable = enable; + } + + private String typeCode; + private DeployConfigData deployer; + private boolean enable; + + public String getTypeCode() { + return typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + } +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java similarity index 63% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java index afa5f365eb09e09bc1f6c0ae386d29c851f9a1d9..ae2134616c22fd7af2e68aaa7f9536af30d1f523 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.extract; +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; import java.io.Serializable; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java similarity index 80% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java index 5a1e516135d24afabd561acab95bd6e492d4728a..30123651857dd7513b0f00736d02e7bdf356b226 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ExtractConfigration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/extract/ExtractConfigration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.extract; import java.io.Serializable; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java similarity index 38% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java index dc818b1a3d69209002b3ced9ed83484cfc630e7d..156a06b86c96ee3b3b5aee638774f54bff1e292e 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/RefCommonServiceImp.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/IndexServerConfiguration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,19 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.api.RefCommonService; +public class IndexServerConfiguration { + private String ip; -/** - * The type RefCommonServiceImp - * - * @author: Jack Lee - */ -public class RefCommonServiceImp implements RefCommonService { - @Override - public GspMetadata getRefMetadata(String metadataID) { - return null; + private String port; + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java index 4065349dcc35bc91367810fb7e866f2d756edf79..c2bd5cf313cfad4943e4440192143608ee7e3a29 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/LocalMetadataIndexItem.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/LocalMetadataIndexItem.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; + +import com.inspur.edp.lcm.metadata.api.entity.LocalRepoPkg; /** * Classname LocalMetadataIndexItem Description 本地元数据索引 Date 2019/11/26 15:33 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java similarity index 68% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java index 7915d3505fb969ad899f4c811c5f10d52a1a1a5f..c11badd29299fb48188cb27eb647afaf40f9a64e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexDto.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,8 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.Page; import java.util.List; /** @@ -33,7 +35,7 @@ public class MetadataIndexDto { } public void setMetadataIndexItems( - List metadataIndexItems) { + List metadataIndexItems) { this.metadataIndexItems = metadataIndexItems; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java similarity index 61% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java index 374bdda21798c0e8cac26b411c6b521c87885600..4e92ff8a23086b28ed989100f2974128c1c7597f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ConfigData.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; -import org.openatom.ubml.model.framework.definition.entity.BaseConfig; +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; /** * @Classname CompilerConfigData diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java similarity index 73% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java index 70dbaf66207449a5362a1e79605a1bca8e8b30a1..d37359dc78cad55f5e396fc9a5010da7925617d3 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/JitRuntimeConfigration.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/JitRuntimeConfigration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class JitRuntimeConfigration { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java index 2cdab541127a8cad99f118b8bdc4143950ff3c6a..563743879f4a93f7c8d39a9d4bfdc6a945bdf38a 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoFilter.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoFilter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; @@ -90,7 +90,7 @@ public class MetadataInfoFilter { } public void setRefPackages( - List refPackages) { + List refPackages) { this.refPackages = refPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java similarity index 93% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java index 199884d22134a4cf78139124eb4e5690f05ecae8..ea4dccc2255e309d169f5be6ff9b07e22b76e958 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoInMaven.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoInMaven.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class MetadataInfoInMaven { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java similarity index 90% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java index d7ec954b205423d9e09b9e61f3699c00673c3dd1..ec35adea16b710114c8737e40ea37719e0e350a9 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataInfoWithVersion.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataInfoWithVersion.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; @@ -134,7 +134,7 @@ public class MetadataInfoWithVersion { } public void setMavenInfos( - List mavenInfos) { + List mavenInfos) { this.mavenInfos = mavenInfos; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java similarity index 83% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java index 873b0d263094b92a4dfacc9ccbf7289379f036f4..64cd5956bada69ed44831876defaea4f87f39154 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataMavenInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataMavenInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; public class MetadataMavenInfo { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java similarity index 76% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java index e2f198ce772dd4c4f65afa2c3a8003576cd023b4..47f50ffa8dab7bf440192c1da661796081f0600d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependencies.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependencies.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname Dependencies Description api module所有依赖 Date 2019/12/11 10:31 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java similarity index 79% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java index b7f0d57a30922a84a5794ea6fa0d29af186149dd..99c92dddbd188ddeb0874209dc8fc47efd1eb767 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/ModuleDependency.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/ModuleDependency.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname Dependency Description 依赖项 Date 2019/12/11 13:43 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java similarity index 83% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java index 8bdee2e63ba6071825e05e452ca1a794f5c6375b..1689e14d4e247ac9e2dbb53900697882ed669477 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageWithMetadataInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageWithMetadataInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; @@ -62,7 +62,7 @@ public class PackageWithMetadataInfo { } public void setMetadatas( - List metadatas) { + List metadatas) { this.metadatas = metadatas; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java similarity index 74% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java index 3029b1da80fcc3ebd919e320e43e6891becc9d78..4c74294c59e3506c30140690d6d1f892c4bf98e5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PageMetadataInfo.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PageMetadataInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; @@ -41,7 +41,7 @@ public class PageMetadataInfo { } public void setMetadataInfos( - List metadataInfos) { + List metadataInfos) { this.metadataInfos = metadataInfos; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java similarity index 87% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java index e45299467ced9b571fc1fa28f9e8cb57bd7fa58c..bb5c99c56034385c5752a52625e5e3c3bb4db705 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoFilterWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; @@ -98,7 +98,7 @@ public class MetadataInfoFilterWithProcessMode { } public void setRefPackages( - List refPackages) { + List refPackages) { this.refPackages = refPackages; } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java similarity index 63% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java index 9a1a9017c1819f26e5bcafbf5d6dd4452adbab11..563ba5e8f781ded3eb3bab0b0c437164c5203395 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoInMavenWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MetadataInfoInMaven; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoInMaven; public class MetadataInfoInMavenWithProcessMode extends MetadataInfoInMaven { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java similarity index 90% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java index dde82f7c128d7d115330b57c09df0bec2f573a15..80f659beb1d9189e21ba15467098d0450ef268a4 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataInfoWithVersionWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; @@ -144,7 +144,7 @@ public class MetadataInfoWithVersionWithProcessMode { } public void setMavenInfos( - List mavenInfos) { + List mavenInfos) { this.mavenInfos = mavenInfos; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java similarity index 63% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java index 490f3ae4d1e1ad9f5fdb71e4ab743a1f181135d1..fecfd69d2ff099febc175098581cdef8a62e79ba 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/MetadataMavenInfoWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MetadataMavenInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataMavenInfo; public class MetadataMavenInfoWithProcessMode extends MetadataMavenInfo { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java similarity index 84% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java index f26c660beb00b0c64cf4196e90111011f7085f33..2920eb64800e7507bece7eae29ca374f533f5e57 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PackageWithMetadataInfoWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; @@ -71,7 +71,7 @@ public class PackageWithMetadataInfoWithProcessMode { } public void setMetadatas( - List metadatas) { + List metadatas) { this.metadatas = metadatas; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java similarity index 73% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java index 613a585b614aff7da298393f403a7a283ffcb9b4..20892215c246ce20fd4cb056c6f64348e25b7287 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/withprocessmode/PageMetadataInfoWithProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity.withprocessmode; +package com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode; import java.util.List; @@ -41,7 +41,7 @@ public class PageMetadataInfoWithProcessMode { } public void setMetadataInfos( - List metadataInfos) { + List metadataInfos) { this.metadataInfos = metadataInfos; } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java new file mode 100644 index 0000000000000000000000000000000000000000..7a179842f83eb57a87f7e66804cd93801596eafd --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileAltMonitor.java @@ -0,0 +1,24 @@ +/* + * 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.lcm.metadata.api.service; + +public interface FileAltMonitor { + void stop(); + + void start(); + + void checkAndNotify(); +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java similarity index 94% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java index 8224205b78ab3fc8d406b6e50e13e809f01cfd77..c8bb6cc0003bbc5355a9621c8029cad6e47f046e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/FileService.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.api; +package com.inspur.edp.lcm.metadata.api.service; import java.io.File; import java.io.IOException; @@ -31,8 +31,6 @@ import java.util.zip.ZipException; */ public interface FileService { - //region 文件操作 - /** * 文件删除 * @@ -93,10 +91,6 @@ public interface FileService { */ void fileCopy(String sourcePath, String destinationPath) throws IOException; - //endregion - - //region 文件夹操作 - /** * 文件夹是否存在 * @@ -136,10 +130,6 @@ public interface FileService { */ void deleteAllFilesUnderDirectory(String dirPath) throws IOException; - //endregion - - //region 路径操作 - /** * 整合路径 * @@ -254,7 +244,6 @@ public interface FileService { * @throws IOException */ Path forceMoveDir(String fromDir, String toDir) throws IOException; - //endregion /** * 获取工程路径 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java new file mode 100644 index 0000000000000000000000000000000000000000..a05714762822481302ad0dbba337a490921e2bd4 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/FileSystemService.java @@ -0,0 +1,35 @@ +/* + * 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.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.FileType; +import java.io.IOException; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +/** + * @author zhaoleitr + */ +public interface FileSystemService { + /** + * 展示到浏览器 + * + * @param path 路径 + * @throws IOException + */ + void showInExplorer(String path) throws IOException; + + FileAltMonitor createFileMonitor(String path, FileType type, FileAlterationListenerAdaptor adaptor); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java new file mode 100644 index 0000000000000000000000000000000000000000..77712516feaa80d4dbc94ff65e32c1c1a8343c75 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MavenUtilsService.java @@ -0,0 +1,42 @@ +/* + * 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.lcm.metadata.api.service; + +/** + * Classname MavenUtilsService Description Maven操作工具类 Date 2020/1/9 14:55 + * + * @author zhongchq + * @version 1.0 + */ +public interface MavenUtilsService { + + /** + * 获取本地仓库地址 + * + * @return 本地仓库地址 + */ + String getLocalRepository(); + + /** + * 执行maven命令 + * + * @param mePath java代码路径 + * @param comd 命令 + * @return 命令是否执行成功 + */ + boolean exeMavenCommand(String mePath, String comd); + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java new file mode 100644 index 0000000000000000000000000000000000000000..ec4fd4019a9324b70dc58c9e748d9c5b9cbc0410 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataRTService.java @@ -0,0 +1,99 @@ +/* + * 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.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import java.util.List; + +/** + * 元数据运行时服务接口 + * + * @author zhaoleitr + */ +public interface MetadataRTService { + /** + * 运行时获取元数据(不带国际化信息) + * + * @param id 元数据id + * @return 元数据内容实体 + */ + GspMetadata getMetadataRTByID(String id); + + /** + * 运行时获取元数据(带国际化信息) + * + * @param id 元数据id + * @return 元数据内容实体 + */ + GspMetadata getMetadata(String id); + + /** + * 根据过滤条件获取元数据 + * + * @param metadataCustomizationFilter 元数据过滤器 + * @return 元数据实体 + */ + GspMetadata getMetadata(MetadataCustomizationFilter metadataCustomizationFilter); + + /** + * 加载服务端所有的元数据 + */ + void loadAllMetadata(); + + /** + * 根据元数据类型获取元数据信息列表 + * + * @param metadataTypes 元数据类型列表,通过","分隔 + * @return 元数据信息列表 + */ + List getMetadataRefList(String metadataTypes); + + /** + * 获取所有的元数据列表 + * + * @return 元数据信息列表 + */ + List getMetadataRefList(); + + /** + * @param filter 过滤条件 + * @return 元数据信息列表 + * @author zhongchq + */ + List getMetadataListByFilter(MetadataRTFilter filter); + + /** + * 根据业务主键获取元数据 + * + * @param metadataNamespace 元数据命名空间 + * @param metadataCode 元数据编号 + * @param metadataTypeCode 元数据类型编号 + * @return 元数据内容实体 + */ + GspMetadata getMetadataBySemanticID(String metadataNamespace, String metadataCode, String metadataTypeCode); + + /** + * 根据元数据ID获取SU信息 + * + * @param metadataId 元数据id + * @return 服务单元信息 + */ + ServiceUnitInfo getServiceUnitInfo(String metadataId); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java new file mode 100644 index 0000000000000000000000000000000000000000..fd364dc75597624ebc7391fb0d3eb84e4122de91 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/PackageGenerateService.java @@ -0,0 +1,37 @@ +/* + * 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.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import java.util.List; + +/** + * 打包服务 + * + * @author zhaoleitr + */ +public interface PackageGenerateService { + + /** + * 打包 + * + * @param projectPath 工程路径 + */ + void generatePackage(String projectPath); + + List getLocalPackages(String path); +} + diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java new file mode 100644 index 0000000000000000000000000000000000000000..7b5ebdae84958d785ad4bcf022402cc65eba5ccd --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/ProjectExtendService.java @@ -0,0 +1,62 @@ +/* + * 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.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import java.io.IOException; +import java.util.List; + +/** + * @author zhaoleitr + */ +public interface ProjectExtendService { + /** + * 提取 + * + * @param path + */ + void extract(String path); + + /** + * 部署 + * + * @param dBConnectionInfo 数据库信息 + * @param serverPath + * @param projPath 工程路径 + * @param restart 是否重启 + * @return + */ + void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart); + + /** + * 文件迁移 + * + * @param path 工程路径 + */ + void migration(String path); + + /** + * 获取部署状态 + * + * @param sign 加密的文件路径 + * @return 部署状态 + * @throws IOException + */ + String getDeployStatus(String sign) throws IOException; + + List batchCompile(String path, String exts, String disabledExts); +} + diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java similarity index 65% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java index 6c4b93f82c114d322a397653786ad42c0562e2c1..3398f3e0be5bb8f381b619ee89a34fef17cc1fbd 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/api/RefCommonService.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/api/service/RefCommonService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.api; +package com.inspur.edp.lcm.metadata.api.service; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; /** * 获取依赖元数据 diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java new file mode 100644 index 0000000000000000000000000000000000000000..8f9384614112dce83e78d455e66b51786b6623f3 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataCacheManager.java @@ -0,0 +1,241 @@ +/* + * 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.lcm.metadata.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 元数据运行时缓存 + */ +public class MetadataCacheManager { + + //元数据包基本信息 + private static final Map MEDATA_PACKAGE_INFO = new HashMap<>(); + //元数据包清单列表信息 + private static final Map> METADATA_MANIFEST_INFO = new HashMap<>(); + //元数据基础信息 + private static final Map METADATA_INFO = new HashMap<>(); + //元数据依赖关系 + private static final Map METADATA_DEPENDENCE = new HashMap<>(); + //元数据与元数据包名的映射关系 + private static final Map METADATA_PATH_MAPPING = new HashMap<>(); + //所有的元数据包信息 + private static final Map> ALL_METADATA_PACKAGE_INFO = new HashMap<>(); + //所有的元数据信息 + private static final Map> ALL_METADATA_INFO = new HashMap<>(); + private static Map> metadataListCache = new HashMap<>(); + private static final ReentrantLock LOCK = new ReentrantLock(); + + MetadataCacheManager() { + } + + public static void removeMetadataInfo(String key) { + LOCK.lock(); + try { + METADATA_INFO.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static Object getMetadataInfo(String metadataKey) { + LOCK.lock(); + try { + return METADATA_INFO.get(metadataKey); + } finally { + LOCK.unlock(); + } + } + + public static void addMetadataInfo(String key, GspMetadata metadata) { + LOCK.lock(); + try { + METADATA_INFO.put(key, metadata); + } finally { + LOCK.unlock(); + } + } + + public static void removeMDDependence(String key) { + LOCK.lock(); + try { + METADATA_DEPENDENCE.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static void addMDDependence(String key, List refs) { + LOCK.lock(); + try { + METADATA_DEPENDENCE.put(key, refs); + } finally { + LOCK.unlock(); + } + } + + public static void removeMetadataPackageInfo(String key) { + LOCK.lock(); + try { + MEDATA_PACKAGE_INFO.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static void addMetadataPackageInfo(String key, MetadataPackage value) { + LOCK.lock(); + try { + MEDATA_PACKAGE_INFO.put(key, value); + } finally { + LOCK.unlock(); + } + } + + public static Object getMetadataPackageInfo(String key) { + LOCK.lock(); + try { + return MEDATA_PACKAGE_INFO.get(key); + } finally { + LOCK.unlock(); + } + } + + public static void removeMDManifestInfo(String key) { + LOCK.lock(); + try { + METADATA_MANIFEST_INFO.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static void addMDManifestInfo(String key, List value) { + LOCK.lock(); + try { + METADATA_MANIFEST_INFO.put(key, value); + } finally { + LOCK.unlock(); + } + } + + public static Object getMDManifestInfo(String key) { + LOCK.lock(); + try { + return METADATA_MANIFEST_INFO.get(key); + } finally { + LOCK.unlock(); + } + } + + public static void removeMPDependence(String key) { + LOCK.lock(); + try { + METADATA_DEPENDENCE.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static void addMPDependence(String key, List value) { + LOCK.lock(); + try { + METADATA_DEPENDENCE.put(key, value); + } finally { + LOCK.unlock(); + } + } + + public static Object getMetadataPathMapping(String key) { + LOCK.lock(); + try { + return METADATA_PATH_MAPPING.get(key); + } finally { + LOCK.unlock(); + } + } + + public static void addMetadataPathMapping(String key, String value) { + LOCK.lock(); + try { + METADATA_PATH_MAPPING.put(key, value); + } finally { + LOCK.unlock(); + } + } + + public static void removeMetadataPathMapping(String key) { + LOCK.lock(); + try { + METADATA_PATH_MAPPING.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static Object getAllMetadataPackageInfo(String key) { + LOCK.lock(); + try { + return ALL_METADATA_PACKAGE_INFO.get(key); + } finally { + LOCK.unlock(); + } + } + + public static void addAllMetadataPackageInfo(String key, List value) { + LOCK.lock(); + try { + ALL_METADATA_PACKAGE_INFO.put(key, value); + } finally { + LOCK.unlock(); + } + } + + public static void removeAllMetadataPackageInfo(String key) { + LOCK.lock(); + try { + ALL_METADATA_PACKAGE_INFO.remove(key); + } finally { + LOCK.unlock(); + } + } + + public static Object getAllMetadataInfo(String key) { + LOCK.lock(); + try { + return ALL_METADATA_INFO.get(key); + } finally { + LOCK.unlock(); + } + } + + public static void addAllMetadataInfo(String key, List value) { + LOCK.lock(); + try { + ALL_METADATA_INFO.put(key, value); + } finally { + LOCK.unlock(); + } + } + +} \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java new file mode 100644 index 0000000000000000000000000000000000000000..45d12413dc88679efdf92932b5159d00f22b7db6 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDevCacheManager.java @@ -0,0 +1,95 @@ +/* + * 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.lcm.metadata.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 元数据设计时缓存 + */ +public class MetadataDevCacheManager { + + MetadataDevCacheManager() { + } + + //某个工程中的元数据列表 + private static Map> metadataListInProject = new HashMap(); + //工程中元数据所在位置缓存 + private static Map projectMetadataCacheMap = new ConcurrentHashMap(); + + // 用来存储元数据设计时服务上下文信息,放到分布式缓存,保证服务重启不丢失。 +// private String metadataContextServerNode = "MetadataContextServer"; + private static ReentrantLock lock = new ReentrantLock(); + + public static List getMetadataListInProject(String key) { + lock.lock(); + try { + return metadataListInProject.get(key); + } finally { + lock.unlock(); + } + } + + public static void removeMetadataListInProject(String key) { + metadataListInProject.remove(key); + } + + public static void setMetadataListInProjectCache(String projectPath, List metadataList) { + lock.lock(); + try { + metadataListInProject.put(projectPath, metadataList); + } finally { + lock.unlock(); + } + } + + public static void clearMetadataListCache() { + metadataListInProject.clear(); + } + + public static void removeProjectMetadataCacheMap(String key) { + lock.lock(); + try { + projectMetadataCacheMap.remove(key); + } finally { + lock.unlock(); + } + } + + public static Object getProjectMetadataCacheMap(String key) { + lock.lock(); + try { + return projectMetadataCacheMap.get(key); + } finally { + lock.unlock(); + } + } + + public static void setProjectMetadataCacheMap(String key, ProjectMetadataCache projectMetadataCache) { + lock.lock(); + try { + projectMetadataCacheMap.put(key, projectMetadataCache); + } finally { + lock.unlock(); + } + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java new file mode 100644 index 0000000000000000000000000000000000000000..634509c84a294ed3d00e6d96e41887022a9c2eb8 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataDistCacheManager.java @@ -0,0 +1,98 @@ +/* + * 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.lcm.metadata.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.layeringcache.cache.LayeringCache; +import io.iec.edp.caf.commons.layeringcache.manager.CacheManager; +import io.iec.edp.caf.commons.layeringcache.setting.LayeringCacheSetting; +import io.iec.edp.caf.commons.layeringcache.support.ExpireMode; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.lang.reflect.Field; +import java.util.concurrent.TimeUnit; + +public class MetadataDistCacheManager { + private static Cache metadataCache; + + private static Cache l2MetadataCache; + + public static String SECOND_CACHE = "secondCache"; + + public static Cache getMetadataCache() { + if (metadataCache == null) { + CacheManager cacheManager = SpringBeanUtils.getBean(CacheManager.class); + //声明当前要使用的缓存配置 + LayeringCacheSetting layeringCacheSetting = new LayeringCacheSetting.Builder() + //开启一级缓存 + .enableFirstCache() + //一级缓存过期策略(可选写入后过期、访问后过期) + .firstCacheExpireMode(ExpireMode.ACCESS) + //一级缓存过期时间 + .firstCacheExpireTime(24) + //一级缓存过期时间单位 + .firstCacheTimeUnit(TimeUnit.HOURS) + //一级缓存初始容量 + .firstCacheInitialCapacity(3000) + //一级缓存最大容量(到达最大容量后 开始驱逐低频缓存) + .firstCacheMaximumSize(6000) + //开启二级缓存 + .enableSecondCache() + //二级缓存过期时间 + .secondCacheExpireTime(12) + //二级缓存时间单位 + .secondCacheTimeUnit(TimeUnit.HOURS) + //二级缓存序列化器 + .dataSerializer(new MetadataSerializer()) + //缓存配置说明 + .depict("元数据缓存配置").build(); + //获取缓存实例 + metadataCache = cacheManager.getCache("metadataCache", layeringCacheSetting); + } + + return metadataCache; + } + + public static Cache getL2MetadataCache() { + if (l2MetadataCache == null) { + Field field; + try { + field = LayeringCache.class.getDeclaredField(SECOND_CACHE); + field.setAccessible(true); + l2MetadataCache = (Cache) field.get(getMetadataCache()); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return l2MetadataCache; + } + + public static void put(String key, GspMetadata metadata, String level) { + Cache cache = getMetadataCache(); + if (SECOND_CACHE.equals(level)) { + cache = getL2MetadataCache(); + if (cache == null) { + cache = getMetadataCache(); + } + } + cache.put(key, metadata); + } + + public static GspMetadata get(String key) { + return getMetadataCache().get(key, GspMetadata.class); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java new file mode 100644 index 0000000000000000000000000000000000000000..299b649df5affcf51c5b143e612d9f2c305f52b2 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/MetadataRtDistCache.java @@ -0,0 +1,98 @@ +/* + * 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.lcm.metadata.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.layeringcache.cache.LayeringCache; +import io.iec.edp.caf.commons.layeringcache.manager.CacheManager; +import io.iec.edp.caf.commons.layeringcache.setting.LayeringCacheSetting; +import io.iec.edp.caf.commons.layeringcache.support.ExpireMode; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.lang.reflect.Field; +import java.util.concurrent.TimeUnit; + +public class MetadataRtDistCache { + private static Cache metadataCache; + + private static Cache l2MetadataCache; + + public static String SECOND_CACHE = "secondCache"; + + public static Cache getMetadataCache() { + if (metadataCache == null) { + CacheManager cacheManager = SpringBeanUtils.getBean(CacheManager.class); + //声明当前要使用的缓存配置 + LayeringCacheSetting layeringCacheSetting = new LayeringCacheSetting.Builder() + //开启一级缓存 + .enableFirstCache() + //一级缓存过期策略(可选写入后过期、访问后过期) + .firstCacheExpireMode(ExpireMode.ACCESS) + //一级缓存过期时间 + .firstCacheExpireTime(24) + //一级缓存过期时间单位 + .firstCacheTimeUnit(TimeUnit.HOURS) + //一级缓存初始容量 + .firstCacheInitialCapacity(3000) + //一级缓存最大容量(到达最大容量后 开始驱逐低频缓存) + .firstCacheMaximumSize(5000) + //开启二级缓存 + .enableSecondCache() + //二级缓存过期时间 + .secondCacheExpireTime(12) + //二级缓存时间单位 + .secondCacheTimeUnit(TimeUnit.HOURS) + //二级缓存序列化器 + .dataSerializer(new MetadataSerializer()) + //缓存配置说明 + .depict("元数据缓存配置").build(); + //获取缓存实例 + metadataCache = cacheManager.getCache("metadataRtCache", layeringCacheSetting); + } + + return metadataCache; + } + + public static Cache getL2MetadataCache() { + if (l2MetadataCache == null) { + Field field; + try { + field = LayeringCache.class.getDeclaredField(SECOND_CACHE); + field.setAccessible(true); + l2MetadataCache = (Cache) field.get(getMetadataCache()); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + return l2MetadataCache; + } + + public static void put(String key, GspMetadata metadata, String level) { + Cache cache = getMetadataCache(); + if (SECOND_CACHE.equals(level)) { + cache = getL2MetadataCache(); + if (cache == null) { + cache = getMetadataCache(); + } + } + cache.put(key, metadata); + } + + public static GspMetadata get(String key) { + return getMetadataCache().get(key, GspMetadata.class); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..8dcdc7a7f37ee080cb0a4cf1f82d720bf096c1ad --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/cache/RtCacheHandler.java @@ -0,0 +1,59 @@ +/* + * 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.lcm.metadata.cache; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; + +public class RtCacheHandler { + + public static final String ALL_METADATA_INFO_CACHE_KEY = "allMetadata"; + public static final String ALL_PACKAGES_CACHE_KEY = "allPackages"; + + public static void updateMetadataPackageCache(String packageKey, MetadataPackage packageRenamed) { + if (packageRenamed.getHeader() != null) { + MetadataCacheManager.removeMetadataPackageInfo(packageKey); + MetadataCacheManager.addMetadataPackageInfo(packageKey, packageRenamed); + } + if (packageRenamed.getMetadataList() != null) { + MetadataCacheManager.removeMDManifestInfo(packageKey); + MetadataCacheManager.addMDManifestInfo(packageKey, packageRenamed.getMetadataList()); + } + if (packageRenamed.getReference() != null) { + MetadataCacheManager.removeMPDependence(packageKey); + MetadataCacheManager.addMPDependence(packageKey, packageRenamed.getReference()); + } + } + + public static void updateMetadataCache(String metadataKey, GspMetadata metadata) { + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.addMetadataInfo(metadataKey, metadata); + if (metadata.getRefs() != null) { + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.addMDDependence(metadataKey, metadata.getRefs()); + } + } + + public static String getMetadataCacheKey(String metadataID, String mpInfoKey) { + return mpInfoKey + metadataID; + } + + private static String getTenantCacheKey(String key) { + String tenantID = RuntimeContext.getTenantID(); + return tenantID + key; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java new file mode 100644 index 0000000000000000000000000000000000000000..bcc0b66f1665daa1afc2e2fd9cfb92a4dead1988 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Edge.java @@ -0,0 +1,88 @@ +/* + * 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.lcm.metadata.common; + +/** + * 连接两个顶点的边 + * + * @author xusy + */ +public class Edge { + + /** + * beginVertex是边的起始顶点
普通情况是不用显示地存储beginVertex,但是生成最小生成树时需要 + */ + private Vertex beginVertex; + + /** + * 由于Edge是存储在Vertex中的,所以包含这个边的vertex是开始点 endVertex是结束点 + */ + private Vertex endVertex; + + /** + * 边的权值 + */ + private double weight; + + /** + * 创建边 + * + * @param beginVertex 边的开始点 + * @param endVertex 边的结束点 + * @param weight 边的权值 + */ + public Edge(Vertex beginVertex, Vertex endVertex, double weight) { + this.beginVertex = beginVertex; + this.endVertex = endVertex; + this.weight = weight; + } + + /** + * 返回边的开始点 + * + * @return + */ + public Vertex getBeginVertex() { + return beginVertex; + } + + /** + * 返回边的结束点 + * + * @return + */ + public Vertex getEndVertex() { + return endVertex; + } + + /** + * 返回边的权值 + * + * @return + */ + public double getWeight() { + return weight; + } + + /** + * 设置边的权值 + * + * @param weight + */ + public void setWeight(double weight) { + this.weight = weight; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..4061739813be5b81646183b10636ab36ddfbd007 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/FileServiceImp.java @@ -0,0 +1,769 @@ +/* + * 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.lcm.metadata.common; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.configuration.WorkspaceHelper; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; + +/** + * @author zhaoleitr + */ +public class FileServiceImp implements FileService { + + /** + * 文件删除操作 + * + * @param fullPath 文件路径 + */ + @Override + public void fileDelete(String fullPath) throws IOException { + File file = new File(fullPath); + if (!file.isFile()) { + final String message = + "This is not a file " + fullPath + "."; + throw new IOException(message); + } + file.delete(); + } + + /** + * 文件更新操作 + * + * @param fullPath 文件路径 + * @param content 文件内容 + */ + @Override + public void fileUpdate(String fullPath, String content) { + try { + byte[] buffer = content.getBytes(StandardCharsets.UTF_8); + FileOutputStream fos = new FileOutputStream(fullPath, true); + fos.write(buffer); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Override + public void fileUpdate(String fullPath, String content, boolean append) { + try { + byte[] buffer = content.getBytes(StandardCharsets.UTF_8); + FileOutputStream fos = new FileOutputStream(fullPath, append); + fos.write(buffer); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * 判断文件是否存在 + * + * @param fullPath 文件路径 + * @return 文件存在返回true,不存在返回false + */ + @Override + public boolean isFileExist(String fullPath) { + File file = new File(fullPath); + return file.isFile(); + } + + /** + * 文件重命名操作 + * + * @param oldFileName 旧文件名 + * @param newFileName 新文件名 + */ + @Override + public void fileRename(String oldFileName, String newFileName) throws IOException { + File oldfile = new File(oldFileName); + if (oldfile.isFile()) { + if (newFileName == null || newFileName.length() <= 0) { + return; + } + if (!(oldfile.renameTo(new File(newFileName)))) { + final String message = + "Can not rename file " + "old name: " + oldFileName + " new name: " + newFileName + "."; + throw new IOException(message); + } + } + } + + /** + * 读取文件内容,返回文件内容的字符串。 + * + * @param path 文件路径 + * @return 文件内容字符串 + */ + @Override + public String fileRead(String path) { + String encoding = "UTF-8"; + File file = new File(path); + long fileLength = file.length(); + String fileContents = null; + try { + byte[] filecontent = new byte[(int) fileLength]; + FileInputStream in = new FileInputStream(file); + in.read(filecontent); + in.close(); + + //判断有没有utf-8 bom头。有则去除。 + fileContents = new String(filecontent, encoding); + if (fileContents.startsWith("\ufeff")) { + + fileContents = fileContents.substring(1); + + } + } catch (UnsupportedEncodingException e) { + System.err.println("The OS does not support " + encoding); + e.printStackTrace(); + return null; + } catch (IOException e) { + e.printStackTrace(); + } + return fileContents; + } + + /** + * @param sourcePath 原路径 + * @param destinationPath 目标路径 + */ + @Override + public void fileCopy(String sourcePath, String destinationPath) throws IOException { + if (sourcePath != null && destinationPath != null) { + Files.copy(Paths.get(sourcePath), Paths.get(destinationPath), REPLACE_EXISTING); + } + } + + /** + * @param path 文件夹路径 + * @return 文件夹存在,返回true,否则返回false + */ + @Override + public boolean isDirectoryExist(String path) { + return (new File(path)).isDirectory(); + } + + /** + * 获取所有目录 + * + * @param path 文件夹路径 + * @return 文件夹下所有文件目录 + */ + @Override + public List getDirectorys(String path) { + //初始化制定路径 + File file = new File(path); + List fileList = new ArrayList<>(); + if (file.isDirectory()) { + File[] files = file.listFiles(); + for (File value : files) { + if (value.isDirectory()) { + fileList.add(value); + } + } + } + return fileList; + } + + /** + * 返回某一文件夹下的所有文件,如果这个路径下没有文件,那么返回空list由调用者进行判断处理 + * + * @param path 文件夹路径 + * @return 文件夹下所有文件 + */ + @Override + public List getAllFiles(String path) { + List filesInFolder = new ArrayList<>(); + File file = new File(path); + // 如果这个路径下没有文件,那么返回空list由调用者进行判断处理 + File[] allfiles = file.listFiles(); + if (allfiles == null) { + return filesInFolder; + } + for (File f : allfiles) { + if (f.isFile()) { + filesInFolder.add(f); + } + } + + return filesInFolder; + } + + /** + * 创建文件夹 + * + * @param dirPath 文件夹路径 + */ + @Override + public void createDirectory(String dirPath) { + File file = new File(dirPath); + file.mkdirs(); + } + + /** + * 删除某文件夹下的所有文件以及文件夹 1.是文件:则删除 2.是目录:则“自动”递归删除指定目录下的所有文件和文件夹 + * + * @param dirPath 文件或文件夹路径 + */ + @Override + public void deleteAllFilesUnderDirectory(String dirPath) throws IOException { + File file = new File(dirPath); + forceDelete(file); + } + + private static void forceDelete(final File file) throws IOException { + if (file.isDirectory()) { + deleteDirectory(file); + } else { + final boolean filePresent = file.exists(); + if (!file.delete()) { + if (!filePresent) { + throw new FileNotFoundException("File does not exist: " + file); + } + final String message = + "Unable to delete file: " + file; + throw new IOException(message); + } + } + } + + private static boolean isSymlink(final File file) throws IOException { + Path path = file.toPath().toRealPath(); + boolean flag = !path.equals(file.toPath().toAbsolutePath()); + return flag; + } + + /** + * Deletes a directory recursively. + * + * @param directory 文件夹路径 + */ + private static void deleteDirectory(final File directory) throws IOException { + if (!directory.exists()) { + return; + } + if (isSymlink(directory)) { + directory.delete(); + return; + } + + cleanDirectory(directory); + + if (!directory.delete()) { + deleteByDos(directory.getAbsolutePath()); + } + + if (directory.exists()) { + final String message = + "Unable to delete directory " + directory + "."; + throw new IOException(message); + } + } + + public static void cleanDirectory(final File directory) throws IOException { + final File[] files = verifiedListFiles(directory); + + IOException exception = null; + for (final File file : files) { + try { + forceDelete(file); + } catch (final IOException ioe) { + exception = ioe; + } + } + + if (null != exception) { + throw exception; + } + } + + private static File[] verifiedListFiles(final File directory) throws IOException { + if (!directory.exists()) { + final String message = directory + " does not exist"; + throw new IllegalArgumentException(message); + } + + if (!directory.isDirectory()) { + final String message = directory + " is not a directory"; + throw new IllegalArgumentException(message); + } + + final File[] files = directory.listFiles(); + // null if security restricted + if (files == null) { + throw new IOException("Failed to list contents of " + directory); + } + return files; + } + + /** + * 整合路径 + * + * @param path1 path1 + * @param path2 path2 + * @return 整合后路径 + */ + @Override + public String getCombinePath(String path1, String path2) { + String path = Paths.get(path1).resolve(path2).toString(); + return handlePath(path); + } + + /** + * 获取后缀信息 + * + * @param path 文件路径 + * @return + */ + @Override + public String getExtension(String path) { + File file = new File(path); + return getExtension(file); + } + + /** + * 获取后缀信息 + * + * @param path 文件 + * @return 文件后缀 + */ + @Override + public String getExtension(File path) { + if (path.isDirectory()) { + final String message = path + " is a directory"; + throw new IllegalArgumentException(message); + } + String fileName = path.getName(); + int point = fileName.lastIndexOf("."); + int length = fileName.length(); + if (point == -1 || point == length - 1) { + return ""; + } else { + return fileName.substring(point, length); + } + } + + /** + * 获取无后缀的路径信息 + * + * @param path 文件路径 + * @return 无后缀的路径信息 + */ + @Override + public String getFileNameWithoutExtension(String path) { + path = handlePath(path); + File file = new File(path); + return getFileNameWithoutExtension(file); + } + + /** + * 获取无后缀的路径信息 + * + * @param path 路径信息 + * @return 无后缀的路径信息 + */ + @Override + public String getFileNameWithoutExtension(File path) { + if (path.isDirectory()) { + final String message = path + " is a directory"; + throw new IllegalArgumentException(message); + } + String fileName = path.getName(); + int point = fileName.lastIndexOf("."); + if (point == -1) { + return fileName; + } else { + return fileName.substring(0, point); + } + } + + @Override + public void createFile(String path, String filename) { + String filePath = path + File.separator + filename; + createFile(filePath); + } + + @Override + public void createFile(String filePath) { + File file = new File(filePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 文件名称 + * + * @param path 文件路径 + * @return 文件名称 + */ + @Override + public String getFileName(String path) { + return (new File(path)).getName(); + } + + /** + * 获取路径名 + * + * @param path 文件夹路径 + * @return 文件夹名 + */ + @Override + public String getDirectoryName(String path) { + return (new File(path)).getParent(); + } + + /** + * 获取目录分隔符 + * + * @return 目录分隔符 + */ + @Override + public char getDirectorySeparatorChar() { + return File.separatorChar; + } + + @Override + public String getDevRootPath() { + return WorkspaceHelper.getInstance().getDevRootPath(); + } + + @Override + public boolean deleteDirectory(String fullPath) throws IOException { + File file = new File(fullPath); + if (!file.isDirectory()) { + final String message = + "This is not a Directory " + fullPath + "."; + throw new IOException(message); + } + return file.delete(); + } + + @Override + public boolean renameDirectory(String fromDir, String toDir) throws IOException { + File from = new File(fromDir); + if (!from.exists() || !from.isDirectory()) { + final String message = + "Directory does not exist: " + fromDir; + throw new IOException(message); + } + File to = new File(toDir); + return from.renameTo(to); + } + + @Override + public Path forceMoveDir(String fromDir, String toDir) throws IOException { + Path fromPath = Paths.get(fromDir); + Path toPath = Paths.get(toDir); + return Files.move(fromPath, toPath.resolve(fromPath.getFileName()), REPLACE_EXISTING); + } + + /** + * @param proPath 路径信息 + * @return 工程路径 + */ + @Override + public String getProjectPath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + //java目录下进行判断。 + File file = new File(proPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (File value : files) { + //对目录进行判断 + if (value.isDirectory()) { + File[] fileInPoject = value.listFiles(); + for (File file1 : fileInPoject) { + if (file1.isFile() && file1.toString().contains("pom.xml")) { + return file1.getParent().substring(file1.toString().indexOf("java")); + } + } + } + } + } + return null; + } + + @Override + public List getJarPath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + Path path = Paths.get(proPath); + List filename = new ArrayList<>(); + try { + Files.walkFileTree(path + , new SimpleFileVisitor() { + // 访问文件时触发 + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith(".jar")) { + String filepaths = file.toString(); + if (filepaths.contains("out") || filepaths.contains("target")) { + filename.add(handlePath(filepaths.substring(filepaths.indexOf("java")))); + } + return FileVisitResult.CONTINUE; + } + return FileVisitResult.CONTINUE; + } +// +// // 访问目录时触发 +// @Override +// public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { +// if (dir.endsWith("target")) { +// String targetpath = dir.getParent().toAbsolutePath().toString().su +// targetpath.substring("java"); +// list.add(targetpath); +// } +// return FileVisitResult.CONTINUE; +// } + }); + } catch (IOException e) { + e.printStackTrace(); + } + Collections.sort(filename); + return filename; + } + + @Override + public String getApiModulePath(String proPath) { + if (!proPath.endsWith("java")) { + proPath = proPath + "/java"; + } + //java目录下进行判断。 + File file = new File(proPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (File value : files) { + //对目录进行判断 + if (value.isDirectory()) { + File[] fileInPoject = value.listFiles(); + for (File file1 : fileInPoject) { + if (file1.isDirectory() && file1.toString().endsWith("api")) { + return handlePath(file1.toString()); + } + } + } + } + } + return null; + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + // 将指定的zip文件解压到指定目录下,其中:zipName:文件名,targetDirName:需解压到的目录 + @Override + public void upzipFile(String zipName, String targetDirName) throws ZipException { + if (!targetDirName.endsWith(File.separator)) { + targetDirName += File.separator; + } + try { + // 根据zip文件创建ZipFile对象,此类的作用是从zip文件读取条目 + ZipFile zipFile = new ZipFile(targetDirName + "/" + zipName); + ZipEntry zn; + String entryName; + String targetFileName; + byte[] buffer = new byte[4096]; + int bytesRead; + Enumeration entrys = zipFile.entries(); // 获取ZIP文件里所有的文件条目的名字 + while (entrys.hasMoreElements()) { // 循环遍历所有的文件条目的名字 + zn = (ZipEntry) entrys.nextElement(); + entryName = zn.getName(); // 获得每一条文件的名字 + targetFileName = targetDirName + entryName; + if (zn.isDirectory()) { + new File(targetFileName).mkdirs(); // 如果zn是一个目录,则创建目录 + continue; + } else { + new File(targetFileName).getParentFile().mkdirs();// 如果zn是文件,则创建父目录 + } + File targetFile = new File(targetFileName); // 否则创建文件 + FileOutputStream os = new FileOutputStream(targetFile);// 打开文件输出流 + InputStream is = zipFile.getInputStream(zn); // 从ZipFile对象中打开entry的输入流 + while ((bytesRead = is.read(buffer)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); // 关闭流 + is.close(); + } + } catch (IOException err) { + throw new ZipException("解压缩" + zipName + "失败: " + err); + } + } + + @Override + public List getAllProjectsDirectories(String path, List projectsList, String proFlag) { + File[] files = (new File(path)).listFiles(); + if (files == null) { + return projectsList; + } + for (File file : files) { + if (file.isFile() && + file.getName().equals(proFlag)) { + projectsList.add(file.getParent()); + } + + if (file.isDirectory() && ( + !"node_modules".equals(file.getName()) || !"packages".equals(file.getName()) || !"maven".equals(file.getName()))) { + getAllProjectsDirectories(file.getAbsolutePath(), projectsList, proFlag); + } + } + + return projectsList; + } + + @Override + public void folderCopy(String sourcePath, String destinationPath) { + try { + (new File(destinationPath)).mkdirs(); + File souceFile = new File(sourcePath); + String[] file = souceFile.list(); + File temp; + for (String s : file) { + if (sourcePath.endsWith(File.separator)) { + temp = new File(sourcePath + s); + } else { + temp = new File(sourcePath + File.separator + s); + } + + if (temp.isFile()) { + FileInputStream input = new FileInputStream(temp); + + FileOutputStream output = new FileOutputStream(destinationPath + File.separator + temp.getName()); + byte[] b = new byte[5120]; + int len; + while ((len = input.read(b)) != -1) { + output.write(b, 0, len); + } + output.flush(); + output.close(); + input.close(); + updateLastModified(destinationPath + File.separator + temp.getName(), temp.lastModified()); + } + if (temp.isDirectory()) { + folderCopy(sourcePath + File.separator + s, destinationPath + File.separator + s); + } + } + + } catch (Exception e) { + throw new RuntimeException("复制目录出错!", e); + } + } + + private void updateLastModified(String filePath, long lastModified) { + new File(filePath).setLastModified(lastModified); + } + + public boolean startWith(String a, String b) { + if (a == null || b == null) { + return false; + } + a = Utils.handlePath(a).replace("//", "/"); + b = Utils.handlePath(b).replace("//", "/"); + if (a.indexOf(':') > -1 && b.indexOf(':') > -1) { + if (a.substring(0, 1).toLowerCase().equals(b.substring(0, 1).toLowerCase())) { + a = a.substring(a.indexOf(':') + 1); + b = b.substring(b.indexOf(':') + 1); + } else { + return false; + } + } else if (a.indexOf(':') > -1) { + a = a.substring(a.indexOf(':') + 1); + } else if (b.indexOf(':') > -1) { + b = b.substring(b.indexOf(':') + 1); + } + + return a.startsWith(b); + } + + public String getRelPath(String a, String b) { + a = Utils.handlePath(a).replace("//", "/"); + b = Utils.handlePath(b).replace("//", "/"); + if (a.indexOf(':') > -1) { + a = a.substring(a.indexOf(':') + 1); + } + if (a.endsWith("/")) { + a = a.substring(0, a.length() - 1); + } + + if (b.indexOf(':') > -1) { + b = b.substring(b.indexOf(':') + 1); + } + if (b.endsWith("/")) { + b = b.substring(0, b.length() - 1); + } + return a.substring(b.length() + 1); + } + + private static void deleteByDos(String path) { + String osName = System.getProperty("os.name"); + if (osName.contains("Windows")) { + try { + String cmd = "cmd /c rd /s/q " + path; + Process p = Runtime.getRuntime().exec(cmd); + p.waitFor(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + public static String combinePath(String startPath, String... paths) { + Path combinedPath = Paths.get(startPath); + for (String path : paths) { + combinedPath = combinedPath.resolve(path); + } + return combinedPath.toString().replace("\\", "/"); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java new file mode 100644 index 0000000000000000000000000000000000000000..c2c85f3fa0bbb20bb890f01c6322a3de19cb9fca --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Graph.java @@ -0,0 +1,278 @@ +/* + * 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.lcm.metadata.common; + +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Stack; + +/** + * 邻接矩阵的图类 + * + * @param + * @author xusy + */ +public class Graph { + + /** + * 用来存储顶点 T做为标识,vertext作为实际的顶点 + */ + private Map> vertexMap; + + /** + * 图中边的数目
顶点的数目可以用vertexMap.size() + */ + private int edgeCount; + + /** + * 图是否为有向图
如果是有向图,则为true + */ + boolean isDirect; + + /** + * 图的构造函数 + * + * @param isDirect 图是否为有向图
如果是有向图,则为true + */ + public Graph(boolean isDirect) { + vertexMap = new LinkedHashMap<>(); + edgeCount = 0; + this.isDirect = isDirect; + } + + //下面与图的顶点相关 + + /** + * 返回图中的顶点个数 + * + * @return + */ + public int getVertexCount() { + return vertexMap.size(); + } + + /** + * 返回图的顶点的迭代器 + * + * @return + */ + public Iterator> getVertexIterator() { + return vertexMap.values().iterator(); + } + + /** + * 在图中插入节点,节点的标识为label,节点的权值为cost + * + * @param label + * @param cost 如果不需要节点的权值,则设0即可 + * @return 如果图中不存在该节点,则插入,返回true
如果图中已经存在该节点,则更新权值,返回false + */ + public boolean addVertex(T label, double cost) { + Vertex vertex = vertexMap.get(label); + if (vertex != null) { + //如果图中已经存在该节点,则更新权值,返回false + vertex.setCost(cost); + return false; + } + //如果图中不存在该节点,则插入,返回true + vertex = new Vertex(label, cost); + vertexMap.put(label, vertex); + return true; + } + + //下面与图的边相关 + + /** + * 返回图中所有的边的个数
如果为有向图,则是所有的有向边的个数
如果为无向图,则视一条边为两条相反的有向边,相当于返回无向边的个数*2 + * + * @return + */ + public int getEdgeCount() { + Iterator> iterator = getVertexIterator(); + int count = 0; + while (iterator.hasNext()) { + Vertex vertex = iterator.next(); + count = count + vertex.getEdgeCount(); + } + return count; + } + + /** + * 返回图中标识为label的顶点作为出发点的边的个数 + * + * @param label + * @return 如果为有向图,则返回标识为label的顶点作为出发点的边的个数 如果为无向图,则返回标识为label的顶点相连接的边的个数 如果图中没有这个顶点,返回-1 + */ + public int getEdgeCount(T label) { + Vertex vertex = vertexMap.get(label); + if (vertex == null) { + //如果图中没有这个顶点,返回-1 + return -1; + } + //返回途中标识为label的顶点作为出发点的边的个数 + return vertex.getEdgeCount(); + } + + /** + * 返回图中标识为label的顶点作为出发点的边的迭代器 + * + * @param label + * @return 如果没有这个顶点,返回null + */ + public Iterator getEdgeIterator(T label) { + Vertex vertex = vertexMap.get(label); + if (vertex == null) { + //如果图中没有这个顶点,返回null + return null; + } + return vertex.getEdgeIterator(); + } + + /** + * 在图中加入一条边,如果isDirect为true,则为有向图,则
建立一条以begin作为标识的节点开始的边,以end作为标识的节点结束,边的权值为weight
+ * 如果isDirect为false,则为无向图,则
建立两条边,一条以begin开始,到end ,一条以end开始,到begin + * + * @param begin + * @param end + * @param weight 如果不需要边的权值,可以设为0 + * @return 如果没有对应的边,则加入对应的边,返回true
如果有对应的边,则更新weight,返回false 如果没有以begin或者end标识的顶点,则直接返回false + */ + public boolean addEdge(T begin, T end, double weight) { + Vertex beginVertex = vertexMap.get(begin); + Vertex endVertex = vertexMap.get(end); + if (beginVertex == null || endVertex == null) { + //如果没有以begin或者end标识的顶点,则直接返回false + return false; + } + //有向图和无向图都要建立begin到end的边 + //如果顶点已经与endVertex连接,那么将会更新权值,result=false + //如果顶点没有与endVertex相连,则互相连接,result=true + boolean result = beginVertex.connect(endVertex, weight); + if (result) { + edgeCount++; + } + if (!isDirect) { + //如果不是有向图,则建立两条边,一条以end开始,到begin + endVertex.connect(beginVertex, weight); + if (result) { + edgeCount++; + } + } + return result; + } + + /** + * 在图中删除一条边,如果isDirect为true,则为有向图,则
删除一条以begin作为标识的节点开始的边,以end作为标识的节点结束
如果isDirect为false,则为无向图,则
+ * 删除两条边,一条以begin开始,到end ,一条以end开始,到begin + * + * @param begin + * @param end + * @return 如果有对应的边,则删除对应的边,返回true
如果没有有对应的边,则直接返回false 如果没有以begin或者end标识的顶点,则直接返回false + */ + public boolean removeEdge(T begin, T end) { + Vertex beginVertex = vertexMap.get(begin); + Vertex endVertex = vertexMap.get(end); + if (beginVertex == null || endVertex == null) { + //如果没有以begin或者end标识的顶点,则直接返回false + return false; + } + //有向图和无向图都要删除begin到end的边 + //如果顶点已经与endVertex连接,那么将会删除这条边,返回true + //如果顶点没有与endVertex连接,则啥都不做,返回false + boolean result = beginVertex.disconnect(endVertex); + if (result) { + edgeCount--; + } + if (!isDirect) { + //如果不是有向图,则删除两条边,一条以end开始,到begin + endVertex.disconnect(beginVertex); + if (result) { + edgeCount--; + } + } + return result; + } + + //下面与打印相关 + + /** + * 打印图的概况,所有顶点,所有边 + */ + public void printGraph() { + Iterator> iteratorVertex = getVertexIterator(); + Iterator iteratorEdge; + Vertex vertex; + Edge edge; + T label; +// "图是否为有向图:" + isDirect + ",图的顶点个数:" + getVertexCount() + ",图的总边个数:" + getEdgeCount() + while (iteratorVertex.hasNext()) { + vertex = iteratorVertex.next(); + label = vertex.getLabel(); + iteratorEdge = vertex.getEdgeIterator(); +// "顶点:" + label + ",以这个顶点为出发点的边的个数:" + getEdgeCount(label) + ",该顶点的权值为:" + vertex.getCost() + while (iteratorEdge.hasNext()) { + edge = iteratorEdge.next(); +// "边:从 " + label + " 到 " + edge.getEndVertex().getLabel() + " ,权值:" + edge.getWeight() + " " + } + } + } + + //下面与拓扑排序相关 + + /** + * 返回一个出度为0(以该点出发的边数为0或者以该点出发的边的结束点都被访问过了),而且没有被访问过的顶点 + * + * @return 如果没有,则返回null + */ + public Vertex getNextTuopoVertex() { + Vertex vertex; + Iterator> iterator = getVertexIterator(); + while (iterator.hasNext()) { + vertex = iterator.next(); + if ((!vertex.isVisited()) && (vertex.getUnvisitedVertex() == null)) { + //返回一个出度为0(以该点出发的边数为0或者以该点出发的边的结束点都被访问过了),而且没有被访问过的顶点 + return vertex; + } + } + //如果没有,则返回null + return null; + } + + /** + * 返回拓扑排序,返回的stack,第一个pop出的是第一个要做的顶点,最后一个是最后一个才能做的顶点 + * + * @return + */ + public Stack> getTopoSort() { +// clearVisitStatus(); + Stack> stack = new Stack<>(); + Vertex vertex; + while (true) { + vertex = getNextTuopoVertex(); + if (vertex == null) { + //如果得不到下一个出度为0的节点,直接返回stack +// "拓扑排序结束" + return stack; + } + //顶点入栈并被访问,遍历完成后,出栈就可以获得图的一个拓扑序列 + stack.push(vertex); + vertex.visit(); +// "拓扑排序:入栈节点:" + vertex.getLabel() + } + } + +} \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..4c24a93f74de762283deebf4ee4eaac224b22f15 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MavenUtils.java @@ -0,0 +1,26 @@ +/* + * 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.lcm.metadata.common; + +public class MavenUtils { + public static final String POM_FILE = "pom.xml"; + + public static final String TEMP_FOLDER = "temp"; + + public static final String RESOURCES_DIR = "src/main/resources"; + + public static final String SNAP_SHOT = "SNAPSHOT"; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..7aed42893c958db9d610d8fa235312602fc9e5b0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataDtoConverter.java @@ -0,0 +1,210 @@ +/* + * 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.lcm.metadata.common; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.AbstractMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.TransferSerializerHelper; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; +import java.io.IOException; +import java.util.ArrayList; +import org.springframework.util.ObjectUtils; + +/** + * Classname MetadataDtoConverter Description 元数据转换器 Date 2019/11/14 20:02 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataDtoConverter { + + public static MetadataDto asDto(GspMetadata metadata) { + if (metadata == null) { + return null; + } + MetadataDto metadataDto = new MetadataDto(); + metadataDto.setBizobjectID(metadata.getHeader().getBizObjectId()); + metadataDto.setType(metadata.getHeader().getType()); + metadataDto.setId(metadata.getHeader().getId()); + metadataDto.setCode(metadata.getHeader().getCode()); + metadataDto.setName(metadata.getHeader().getName()); + metadataDto.setNameSpace(metadata.getHeader().getNameSpace()); + metadataDto.setFileName(metadata.getHeader().getFileName()); + metadataDto.setLanguage(metadata.getHeader().getLanguage()); + metadataDto.setRelativePath(metadata.getRelativePath()); + //GspMetadata没有此属性 + metadataDto.setTranslating(metadata.getHeader().getTranslating()); + metadataDto.setExtendProperty(metadata.getExtendProperty()); + metadataDto.setExtendable(metadata.getHeader().isExtendable()); + metadataDto.setExtented(metadata.isExtended()); + metadataDto.setPreviousVersion(metadata.getPreviousVersion()); + metadataDto.setVersion(metadata.getVersion()); + String ref = ""; + ObjectMapper objectMapper = Utils.getMapper(); + if (metadata.getRefs() != null && metadata.getRefs().size() > 0) { + try { + metadataDto.setRefs(objectMapper.writeValueAsString(metadata.getRefs())); + + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + + } + if (metadata.getContent() != null) { + + String transferStr = null; + JsonNode jsonNode; + MetadataTransferSerializer transferSerializer = TransferSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (!ObjectUtils.isEmpty(transferSerializer)) { + transferStr = transferSerializer.serialize(metadata.getContent()); + } else { + MetadataContentSerializer metadataContentSerializer = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (metadataContentSerializer == null) { + throw new RuntimeException("未能正常获取元数据传输序列化器,请检查配置。元数据为:" + metadata.getHeader().getCode()); + } + jsonNode = metadataContentSerializer.serialize(metadata.getContent()); + + try { + transferStr = objectMapper.writeValueAsString(jsonNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + + metadataDto.setContent(transferStr); + } + if (metadata.getExtendRule() != null) { + MdExtendRuleSerializer serializer = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (serializer != null) { + JsonNode jsonNode = serializer.serialize(metadata.getExtendRule()); + + String transferStr = null; + try { + transferStr = objectMapper.writeValueAsString(jsonNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + metadataDto.setExtendRule(transferStr); + } + } + + asMetadata(null); + return metadataDto; + } + + public static GspMetadata asMetadata(MetadataDto metadataDto) { + if (metadataDto == null) { + return null; + } + GspMetadata metadata = new GspMetadata(); + metadata.setHeader(new MetadataHeader()); + metadata.getHeader().setId(metadataDto.getId()); + metadata.getHeader().setBizObjectId(metadataDto.getBizobjectID()); + metadata.getHeader().setNameSpace(metadataDto.getNameSpace()); + metadata.getHeader().setType(metadataDto.getType()); + metadata.getHeader().setFileName(metadataDto.getFileName()); + metadata.setRelativePath(metadataDto.getRelativePath()); + metadata.getHeader().setLanguage(metadataDto.getLanguage()); + metadata.getHeader().setTranslating(metadataDto.isTranslating); + metadata.setExtendProperty(metadataDto.getExtendProperty()); + metadata.getHeader().setExtendable(metadataDto.isExtendable()); + metadata.setExtended(metadataDto.isExtented()); + metadata.setPreviousVersion(metadataDto.getPreviousVersion()); + metadata.setVersion(metadataDto.getVersion()); + ObjectMapper objectMapper = Utils.getMapper(); + if (metadataDto.getRefs() != null && metadataDto.getRefs() != "") { + try { + metadata.setRefs(objectMapper.readValue(metadataDto.getRefs(), new TypeReference>() { + })); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + metadata.setRefs(new ArrayList<>()); + } + + IMetadataContent content = null; + if (metadataDto.getContent() != null) { + MetadataTransferSerializer transferSerializer = TransferSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (!ObjectUtils.isEmpty(transferSerializer)) { + content = transferSerializer.deserialize(metadataDto.getContent()); + } else { + //反序列化 + MetadataContentSerializer metadataContentSerializer = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (metadataContentSerializer == null) { + throw new RuntimeException("未能正常获取元数据传输序列化器,请检查配置"); + } + + JsonNode contentObj; + try { + contentObj = objectMapper.readTree(metadataDto.getContent()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + content = metadataContentSerializer.deSerialize(contentObj); + } + + metadata.setContent(content); + } + if (metadataDto.getExtendRule() != null) { + MdExtendRuleSerializer serializer = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (serializer != null) { + JsonNode contentObj; + try { + contentObj = objectMapper.readTree(metadataDto.getContent()); + } catch (Exception e) { + throw new RuntimeException(e); + } + + IMdExtRuleContent extRule = serializer.deSerialize(contentObj); + metadata.setExtendRule(extRule); + } + } + + AbstractMetadataContent abstractMetadataContent = null; + + try { + abstractMetadataContent = (AbstractMetadataContent) metadata.getContent(); + } catch (RuntimeException e) { + } + + if (abstractMetadataContent != null) { + metadata.getHeader().setCode(abstractMetadataContent.getCode() == null ? metadataDto.getCode() : abstractMetadataContent.getCode()); + metadata.getHeader().setName(abstractMetadataContent.getName() == null ? metadataDto.getName() : abstractMetadataContent.getName()); + } else { + metadata.getHeader().setCode(metadataDto.getCode()); + metadata.getHeader().setName(metadataDto.getName()); + } + + return metadata; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..e1cf00b3b627cb8882aa5e03e54ea304b7914835 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataPeopertyUtils.java @@ -0,0 +1,29 @@ +/* + * 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.lcm.metadata.common; + +public class MetadataPeopertyUtils { + public static String header = "Header"; + public static String content = "Content"; + public static String extendRule = "ExtendRule"; + public static String refs = "Refs"; + public static String extendProperty = "ExtendProperty"; + public static String properties = "Properties"; + public static String version = "Version"; + public static String previousVersion = "PreviousVersion"; + public static String relativePath = "RelativePath"; + public static String extended = "Extended"; +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..76131b77164261edbd0c37f20dc088a07b7cc865 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/MetadataSerializer.java @@ -0,0 +1,165 @@ +/* + * 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.lcm.metadata.common; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; +import io.iec.edp.caf.commons.layeringcache.serializer.RedisDataSerializer; +import java.io.IOException; + +public class MetadataSerializer implements RedisDataSerializer { + private ObjectMapper mapper = Utils.getMapper(); + + @Override + public T deserialize(String fileString, Class clazz) { + if (fileString == null || fileString.isEmpty()) { + return null; + } + try { + IMetadataContent metadataContent; + JsonNode metadataObj = mapper.readTree(fileString); + GspMetadata metadata = buildMetadataBaseInfo(metadataObj); + + //IMetdataContent需要调用各元数据反序列化 + MetadataContentSerializer manager = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager == null) { + throw new RuntimeException("未能正常获取元数据序列化器,请检查配置,元数据类型为:" + metadata.getHeader().getType()); + } else { + JsonNode content = metadataObj.findValue(MetadataPeopertyUtils.content); + String contentStr = handleJsonString(content.toString()); + JsonNode handledContent = mapper.readTree(contentStr); + metadataContent = manager.deSerialize(handledContent); + } + metadata.setContent(metadataContent); + JsonNode extRule = metadataObj.findValue(MetadataPeopertyUtils.extendRule); + if (extRule != null) { + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode handledContent = mapper.readTree(extRule.toString()); + IMdExtRuleContent extRuleContent = mdExtRulemanager.deSerialize(handledContent); + metadata.setExtendRule(extRuleContent); + } + } + + return (T) metadata; + } catch (RuntimeException | IOException e) { + e.printStackTrace(); + throw new RuntimeException("反序列化元数据失败", e); + } + } + + public GspMetadata buildMetadataBaseInfo(JsonNode metadataObj) { + GspMetadata metadata; + try { + String headerStr = metadataObj.findValue(MetadataPeopertyUtils.header).toString(); + JsonNode refNode = metadataObj.findValue(MetadataPeopertyUtils.refs); + String constraintsStr; + if (refNode == null) { + constraintsStr = "[]"; + } else { + constraintsStr = refNode.toString(); + } + + JsonNode extendPropertyNode = metadataObj.findValue(MetadataPeopertyUtils.extendProperty); + JsonNode extendedNode = metadataObj.findValue(MetadataPeopertyUtils.extended); + JsonNode properties = metadataObj.findValue(MetadataPeopertyUtils.properties); + JsonNode version = metadataObj.findValue(MetadataPeopertyUtils.version); + JsonNode previousVersion = metadataObj.findValue(MetadataPeopertyUtils.previousVersion); + JsonNode relativePath = metadataObj.findValue(MetadataPeopertyUtils.relativePath); + String extendPropertyStr = (extendPropertyNode == null) ? "\"\"" : extendPropertyNode.toString(); + String metadataStr = String.format("{\"%s\":%s,\"%s\":%s,\"%s\":null,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":%s,\"%s\":null}", + MetadataPeopertyUtils.header, headerStr, MetadataPeopertyUtils.refs, constraintsStr, MetadataPeopertyUtils.content, MetadataPeopertyUtils.extendProperty, + extendPropertyStr, MetadataPeopertyUtils.extended, extendedNode, MetadataPeopertyUtils.properties, properties, MetadataPeopertyUtils.version, version, + MetadataPeopertyUtils.previousVersion, previousVersion, MetadataPeopertyUtils.relativePath, relativePath, MetadataPeopertyUtils.extendRule); + metadata = this.mapper.readValue(metadataStr, GspMetadata.class); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + + return metadata; + } + + public static ObjectMapper getMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true); + mapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); + mapper.configure(JsonParser.Feature.ALLOW_MISSING_VALUES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);//大小写脱敏 默认为false 需要改为tru + return mapper; + } + + private static String handleJsonString(String contentJson) { + if (contentJson.startsWith("\"{\\\"")) { + + contentJson = contentJson.replace("\\\"", "\""); + while (contentJson.startsWith("\"")) { + contentJson = contentJson.substring(1, contentJson.length() - 1); + } + } + return contentJson; + } + + @Override + public String serialize(Object o) { + GspMetadata metadata = (GspMetadata) o; + MetadataContentSerializer manager = MetadataSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager == null) { + throw new RuntimeException("未能正常获取" + metadata.getHeader().getType() + "的序列化器,请检查配置"); + } + JsonNode jsonNode = manager.serialize(metadata.getContent()); + JsonNode extRuleNode = null; + if (metadata.getExtendRule() != null) { + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (mdExtRulemanager != null) { + extRuleNode = mdExtRulemanager.serialize(metadata.getExtendRule()); + } + } + + ObjectMapper objectMapper = Utils.getMapper(); + GspMetadata newMetadata = (GspMetadata) metadata.clone(); + String metadataStr = null; + try { + metadataStr = objectMapper.writeValueAsString(newMetadata); + JsonNode metadataObj = objectMapper.readTree(metadataStr); + ObjectNode objNode = (ObjectNode) metadataObj; + objNode.set(MetadataPeopertyUtils.content, jsonNode); + objNode.set(MetadataPeopertyUtils.extendRule, extRuleNode); + metadataStr = objectMapper.writeValueAsString(objNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return metadataStr; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java new file mode 100644 index 0000000000000000000000000000000000000000..56e932f6b4abbaa24f7089c64245aefe12839615 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Utils.java @@ -0,0 +1,411 @@ +/* + * 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.lcm.metadata.common; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.common.configuration.GspProjectExtendHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeConfigLoader; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; +import org.codehaus.plexus.util.StringUtils; + +public class Utils { + private static final Lock LOCK = new ReentrantLock(); + //元数据工程后缀 + private static String metadataProjSuffix; + // pom后缀 + private static String pomSuffix; + // 元数据包version前缀 + private static String versionPrefix; + // 元数据包临时version后缀 + private static String versionSuffix; + //csproj工程后缀 + private static String csprojSuffix; + //GSP工程描述文件名称 + private static String gspProjectName; + //元数据包后缀 + private static String metadataPackageExtension; + //元数据包清单文件 + private static String manifestFileName; + //原始数据修改时间文件 + private static String sourceDataFileName; + // 强制更新依赖jar包标识文件 + private static String mavenUpdateFlagFileName; + + private static String metadataPath; + /** + * 获取maven工程名称。 + */ + private static String mavenProName; + /** + * edpParentVersion + */ + private static String edpParentVersion; + private static List metadataPostfixTypes; + + public Utils() { + } + + public static String getMetadataProjSuffix() { + return ".mdproj"; + } + + public static String getPomSuffix() { + return ".pom"; + } + + public static String getVersionPrefix() { + return "m"; + } + + public static String getVersionSuffix() { + return "-SNAPSHOT"; + } + + public static String getCsprojSuffix() { + return ".csproj"; + } + + public static String getGspProjectName() { + return "gspproject.json"; + } + + public static String getMetadataProjPath() { + return "metadata"; + } + + public static String getMetadataPackageExtension() { + return ".mdpkg"; + } + + public static String getManifestFileName() { + return "manifest.json"; + } + + public static String getSourceDataFileName() { + return "sourcedata.json"; + } + + public static String getMavenUpdateFlagFileName() { + return "mavenupdateflag.txt"; + } + + public static String getMetadataBinPath() { + return "bin"; + } + + public static String getApiSourceDir() { + return "java/code/api/src"; + } + + public static String getApiTargetDir() { + return "java/code/api/target"; + } + + public static String getCompModuleDir() { + return "java/code/comp"; + } + + public static String getRuntimeSourceDir() { + return "java/code/runtime/src"; + } + + public static String getSrcJavaPath() { + return "src/main/java"; + } + + public static String getResourcesPath() { + return "src/main/resources"; + } + + public static String getPomFile() { + return "pom.xml"; + } + + public static String getJavaProjectPath() { + return "java"; + } + + public static String getZipSuffix() { + return ".zip"; + } + + public static String getJarSuffix() { + return ".jar"; + } + + public static String getLanguageMetadataFileExtention() { + return ".lres"; + } + + public static String getPublishPath() { + return "publish"; + } + + public static String getJstackPath() { + return "jstack"; + } + + public static String getCodePath() { + return "code"; + } + + public static String getTargetPath() { + return "target"; + } + + public static String getLibsPath() { + return "libs"; + } + + // 获取启动jar对应的路径 + public static String getStartupPath() { + return EnvironmentUtil.getStartupPath(); + } + + // 获取安装盘的基路径 + public static String getBasePath() { + return EnvironmentUtil.getBasePath(); + } + + // 获取安装盘的基路径 + public static String getBasePath(boolean isDeployTool) { + String basePath; + if (isDeployTool) { + basePath = FileServiceImp.combinePath(EnvironmentUtil.getStartupPath(), "../../../../"); + } else { + basePath = EnvironmentUtil.getBasePath(); + } + return basePath; + } + + // 获取Server运行时路径,对应当前的jstack + public static String getServerRTPath() { + return EnvironmentUtil.getServerRTPath(); + } + + public static String getMavenProName() { + if (mavenProName == null || mavenProName.isEmpty()) { + return GspProjectExtendHelper.getInstance().getMavenProjectName(); + } + return null; + } + + public static String getEdpParentVersion() { + if (mavenProName == null || mavenProName.isEmpty()) { + return GspProjectExtendHelper.getInstance().getEdpParentVersion(); + } + return null; + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + public static String handlePackageName(String packageName) { + String packageFullName; + if (!packageName.contains(getMetadataPackageExtension())) { + packageFullName = packageName + getMetadataPackageExtension(); + } else { + packageFullName = packageName; + } + + return packageFullName; + } + + public static ObjectMapper getMapper() { + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(JsonGenerator.Feature.IGNORE_UNKNOWN, true); + mapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true); + mapper.configure(JsonParser.Feature.ALLOW_MISSING_VALUES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true);//大小写脱敏 默认为false 需要改为tru + mapper.configure(SerializationFeature.INDENT_OUTPUT, true); + return mapper; + } + + public static List getMetadataPostfixTypes() { + if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { + return metadataPostfixTypes; + } + LOCK.lock(); + try { + if (metadataPostfixTypes != null && metadataPostfixTypes.size() > 0) { + return metadataPostfixTypes; + } + metadataPostfixTypes = new ArrayList<>(); + MetadataTypeConfigLoader loader = new MetadataTypeConfigLoader(); + List typeList = loader.loadMetadataConfigurations(); + typeList.forEach(type -> + { + metadataPostfixTypes.add(type.getPostfix()); + }); + return metadataPostfixTypes; + } catch (Exception e) { + e.printStackTrace(); + } finally { + LOCK.unlock(); + } + + return null; + } + + /** + * 将源文件/文件夹生成指定格式的压缩文件,格式zip + * + * @param resourcesPath 源文件/文件夹 + * @param targetPath 目的压缩文件保存路径 + * @param targetName 目的压缩文件名 + */ + public static void compress(String resourcesPath, String targetPath, String targetName) { + //源文件 + File resourcesFile = new File(resourcesPath); + //目的 + File targetFile = new File(targetPath); + //如果目的路径不存在,则新建 + if (!targetFile.exists()) { + targetFile.mkdirs(); + } + //目的压缩文件名 + targetName = targetName + ".mdpkg"; + try { + FileOutputStream outputStream = new FileOutputStream(FileServiceImp.combinePath(targetPath, targetName)); + ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(outputStream)); + + createCompressedFile(out, resourcesFile, ""); + + out.close(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 生成压缩文件。如果是文件夹,则使用递归,进行文件遍历、压缩 如果是文件,直接压缩 + * + * @param out 输出流 + * @param file 目标文件 + * @param dir 文件路径 + */ + public static void createCompressedFile(ZipOutputStream out, File file, String dir) { + //如果当前的是文件夹,则进行进一步处理 + if (file.isDirectory()) { + //得到文件列表信息 + File[] files = file.listFiles(); + try { + //将文件夹添加到下一级打包目录 + out.putNextEntry(new ZipEntry(dir + "/")); + } catch (Exception e) { + throw new RuntimeException(e); + } + + dir = dir.length() == 0 ? "" : dir + "/"; + + //循环将文件夹中的文件打包 + for (int i = 0; i < files.length; i++) { + createCompressedFile(out, files[i], dir + files[i].getName()); //递归处理 + } + } else { //当前的是文件,打包处理 + try { + //文件输入流 + FileInputStream fis = new FileInputStream(file); + + out.putNextEntry(new ZipEntry(dir)); + //进行写操作 + int j = 0; + byte[] buffer = new byte[1024]; + while ((j = fis.read(buffer)) > 0) { + out.write(buffer, 0, j); + } + //关闭输入流 + fis.close(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + public static void writeValue(String mdPath, MetadataProject mdProj) { + try (FileOutputStream fileOutputStream = new FileOutputStream(mdPath)) { + ObjectMapper objectMapper = getMapper(); + objectMapper.enable(SerializationFeature.INDENT_OUTPUT); + objectMapper.writeValue(fileOutputStream, mdProj); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static boolean nameValidating(String name) { + if (StringUtils.isEmpty(name)) { + return false; + } else if (name.trim().length() > 255) { + return false; + } else { + return StringUtils.indexOfAny(name.trim(), getInValidCharacter()) == -1; + } + } + + public static String[] getInValidCharacter() { + return new String[] {"\\", "/", ":", "*", "?", "\"", "<", ">", "|", "&", "@", "\"", "‘", "’", "“", "”", "%", ";", ";"}; + } + + public static boolean isNullOrEmpty(String str) { + return str == null || str.isEmpty(); + } + + public static boolean isNullOrEmpty(List list) { + return list == null || list.size() == 0; + } + + public static void checkNPE(Object obj, String msg) { + if (obj == null) { + throw new RuntimeException(msg); + } + } + + public static void checkEmpty(String str, String msg) { + if (isNullOrEmpty(str)) { + throw new RuntimeException(msg); + } + } + + public static String getMetadataPath() { + return metadataPath; + } + + public static void setMetadataPath(String metadataPath) { + Utils.metadataPath = metadataPath; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java new file mode 100644 index 0000000000000000000000000000000000000000..926a7b4d96a8ed94ce4140d29308a62ff4c42ecc --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Vertex.java @@ -0,0 +1,279 @@ +/* + * 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.lcm.metadata.common; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +/** + * 邻接矩阵的顶点类 + * + * @param + * @author xusy + */ +public class Vertex { + + /** + * 能够标识这个定点的属性,可以用不同类型来标识顶点如String,Integer.... + */ + private T label; + + /** + * 这个定点对应的边
如果为有向图,则代表以这个定点为起点的边 + */ + private List edgeList; + + /** + * 表示这个顶点是否已被访问,在bfs和dfs中会被使用到 + */ + private boolean visited; + + /** + * 该顶点的前驱节点
在求图中某两个顶点之间的最短路径时,在从起始顶点遍历过程中,需要记录下遍历到某个顶点时的前驱顶点 + */ + private Vertex previousVertex; + + /** + * 这个定点的权值(注意不是边的权值) + */ + private double cost; + + /** + * 创建顶点 + * + * @param label 这个顶点的标识 + * @param cost 这个顶点的权值 + */ + public Vertex(T label, double cost) { + this.label = label; + //用链表存储边 + edgeList = new LinkedList<>(); + visited = false; + previousVertex = null; + this.cost = cost; + } + + //下面与顶点的标识相关 + + /** + * 返回顶点的标识 + * + * @return + */ + public T getLabel() { + return label; + } + + /** + * 根据顶点的标识确定是否是同一个顶点 + */ + @Override + public boolean equals(Object otherVertex) { + boolean result; + //如果otherVertex为空或者类不同,直接返回false + if (otherVertex == null || getClass() != otherVertex.getClass()) { + return false; + } + Vertex other = (Vertex) otherVertex; + //根据label确定是否是同一个顶点 + result = label.equals(other.getLabel()); + return result; + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (label == null ? 0 : label.hashCode()); + return result; + } + + //下面与顶点的边相关 + + /** + * 返回边的迭代器 + * + * @return + */ + public Iterator getEdgeIterator() { + return edgeList.iterator(); + } + + /** + * 返回是否有以这个顶点为出发点的边数 + * + * @return + */ + public int getEdgeCount() { + return edgeList.size(); + } + + /** + * 将这个顶点与endVertex连接,边的权值为weight + * + * @param endVertex + * @param weight + * @return 如果顶点已经与endVertex连接,那么将会更新权值,返回false
如果顶点没有与endVertex相连,则互相连接,返回true + */ + public boolean connect(Vertex endVertex, double weight) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将会更新权值,返回false + edge.setWeight(weight); + return false; + } + } + //如果顶点没有与endVertex相连,则互相连接,返回true + edge = new Edge(this, endVertex, weight); + edgeList.add(edge); + return true; + } + + /** + * 将这个顶点与endVertex连接的边删除 + * + * @param endVertex + * @return 如果顶点已经与endVertex连接,那么将会删除这条边,返回true
如果顶点没有与endVertex连接,则啥都不做,返回false + */ + public boolean disconnect(Vertex endVertex) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将会删除这条边,返回true + //edgeList.remove(edge); + iterator.remove(); + return true; + } + } + //如果顶点没有与endVertex连接,则啥都不做,返回false + return false; + } + + /** + * 返回是否有以这个顶点为出发点,以endVertex为结束点的边 + * + * @return 如果有,返回那条边
如果没有,返回null + */ + public Edge hasNeighbourVertex(Vertex endVertex) { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (vertex.equals(endVertex)) { + //如果顶点已经与endVertex连接,那么将返回这个边 + return edge; + } + } + //没有则返回null + return null; + } + + //下面是与顶点是否被访问相关 + + /** + * 返回顶点是否被访问 + * + * @return + */ + public boolean isVisited() { + return visited; + } + + /** + * 访问这个顶点 + */ + public void visit() { + visited = true; + } + + /** + * 不访问这个顶点,或者说是清除访问状态 + */ + public void unVisit() { + visited = false; + } + + /** + * 获得以这个顶点为出发点,相邻的第一个没有被访问的顶点 + * + * @return 如果没有,返回null
如果有,返回对应的顶点 + */ + public Vertex getUnvisitedVertex() { + Iterator iterator = getEdgeIterator(); + Edge edge = null; + Vertex vertex = null; + while (iterator.hasNext()) { + edge = iterator.next(); + vertex = edge.getEndVertex(); + if (!vertex.isVisited()) { + return vertex; + } + } + //没有则返回null + return null; + } + + //下面与前驱节点相关 + + /** + * 返回顶点的前驱节点 + * + * @return + */ + public Vertex getPreviousVertex() { + return previousVertex; + } + + /** + * 设置顶点的前驱节点 + * + * @param previousVertex + */ + public void setPreviousVertex(Vertex previousVertex) { + this.previousVertex = previousVertex; + } + + //下面与顶点的权值相关 + + /** + * 返回顶点的权值 + * + * @return + */ + public double getCost() { + return cost; + } + + /** + * 设置顶点的权值 + * + * @param cost + */ + public void setCost(double cost) { + this.cost = cost; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java new file mode 100644 index 0000000000000000000000000000000000000000..bede8b5bbdaf9bebd9126a12b4af6b616dd0188c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/Which.java @@ -0,0 +1,57 @@ +/* + * 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.lcm.metadata.common; + +import java.io.File; +import java.io.IOException; +import java.net.JarURLConnection; +import java.net.URISyntaxException; +import java.net.URL; +import java.security.AccessController; +import java.security.PrivilegedAction; + +/** + * @author zhaoleitr + */ +public class Which { + public static File jarFile(final Class clazz) throws IOException { + final String resourceName = clazz.getName().replace(".", "/") + ".class"; + URL resource = AccessController.doPrivileged(new PrivilegedAction() { + @Override + public URL run() { + return clazz.getClassLoader().getResource(resourceName); + } + }); + if (resource == null) { + throw new IllegalArgumentException("Cannot get bootstrap path from " + clazz + " class location, aborting"); + } + + if (resource.getProtocol().equals("jar")) { + try { + JarURLConnection c = (JarURLConnection) resource.openConnection(); + URL jarFile = c.getJarFileURL(); + try { + return new File(jarFile.toURI()); + } catch (URISyntaxException e) { + return new File(jarFile.getPath()); + } + } catch (IOException e) { + throw new IllegalArgumentException("Cannot open jar file " + resource, e); + } + } else + throw new IllegalArgumentException("Don't support packaging " + resource + " , please contribute !"); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..40254ac9aa2e3368dfaaa234b543425ad7ab8a25 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerConfigLoader.java @@ -0,0 +1,59 @@ +/* + * 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.lcm.metadata.common.compiler; + +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataServiceHelper; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class MetadataCompilerConfigLoader { + private String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private String sectionName = "MetadataCompilerConfigration"; + private List compileConfigrations; + + protected List loadCompileConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (compileConfigrations == null || compileConfigrations.size() <= 0) { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + compileConfigrations = metadataServiceHelper.getCompileConfigrationList(fileName, sectionName); + return compileConfigrations; + } else { + return compileConfigrations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected MetadataCompilerConfiguration getCompileConfigurationData(String typeName) { + loadCompileConfigration(); + if (compileConfigrations != null && compileConfigrations.size() > 0) { + for (MetadataCompilerConfiguration data : compileConfigrations) { + if (data.getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..4c94f4228fc396e686b9eb755593cf75d11fde1c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/compiler/MetadataCompilerHelper.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.lcm.metadata.common.compiler; + +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import java.util.List; + +public class MetadataCompilerHelper extends MetadataCompilerConfigLoader { + private static MetadataCompilerHelper singleton = null; + + public static MetadataCompilerHelper getInstance() { + if (singleton == null) { + singleton = new MetadataCompilerHelper(); + } + return singleton; + } + + public List getCompileConfigrationList() { + return loadCompileConfigration(); + } + + public MetadataCompileAction getManager(String typeCode) { + MetadataCompileAction manager = null; + MetadataCompilerConfiguration compileConfigurationData = getCompileConfigurationData(typeCode); + if (compileConfigurationData != null) { + Class cls; + try { + if (compileConfigurationData.getMetadataCompiler() != null) { + cls = Class.forName(compileConfigurationData.getMetadataCompiler().getName()); + manager = (MetadataCompileAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..dfddd2b6d49d36098e8cc135c35c76ef115bf75d --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/config/LcmComConfiguration.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata.common.config; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname LcmComConfiguration Description LcmComConfiguration Date 2020/1/9 14:58 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class LcmComConfiguration { + + @Bean + public FileService createFileService() { + return new FileServiceImp(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..605c1f8784e0d8af21da13fa19b2720015bd7c05 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ContentManagerHelper.java @@ -0,0 +1,52 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataContentManager; +import java.util.Objects; + +public class ContentManagerHelper extends MetadataConfigurationLoader { + private static ContentManagerHelper sigleton = null; + + public ContentManagerHelper() { + } + + public static ContentManagerHelper getInstance() { + if (sigleton == null) { + sigleton = new ContentManagerHelper(); + } + return sigleton; + } + + public MetadataContentManager getManager(String typeName) { + MetadataContentManager manager = null; + MetadataConfiguration metadataConfigurationData = getMetadataConfigurationData(typeName); + if (!Objects.isNull(metadataConfigurationData) && !Objects.isNull(metadataConfigurationData.getManager())) { + Class managerClass; + try { + if (metadataConfigurationData.getManager() != null) { + managerClass = Class.forName(metadataConfigurationData.getManager().getName()); + manager = (MetadataContentManager) managerClass.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..4322869d6573c2e008de9924d7d922a6f4bf1c94 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationHelper.java @@ -0,0 +1,43 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import java.util.List; + +public class GspProjectConfigurationHelper extends GspProjectConfigurationLoader { + + private static GspProjectConfigurationHelper sigleton = null; + + public GspProjectConfigurationHelper() { + } + + public static GspProjectConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new GspProjectConfigurationHelper(); + } + return sigleton; + } + + public List getGspProjectConfigurations() { + return super.loadGspProjectConfigurations(); + } + + @Override + public ProjectConfiguration getGspProjectConfigurationData(String typeName) { + return super.getGspProjectConfigurationData(typeName); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..00907197cc5401184c62362a8045fe900c34863f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectConfigurationLoader.java @@ -0,0 +1,80 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +/** + * @Classname MetadataConfigurationLoader + * @Description 配置文件实体 + * @Date 2019/7/23 14:44 + * @Created by zhongchq + * @Version 1.0 + */ +public class GspProjectConfigurationLoader implements Serializable { + + public static List gspProjectConfigurations; + private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private static final String SECTION_NAME = "ProjectConfiguration"; + + public GspProjectConfigurationLoader() { + loadGspProjectConfigurations(); + } + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 类初始化时反序列化Json到实体 + * @date 15:40 2019/7/23 + **/ + protected List loadGspProjectConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + FileServiceImp fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + if (gspProjectConfigurations == null || gspProjectConfigurations.size() <= 0) { + gspProjectConfigurations = metadataServiceHelper.getProjectConfiguration(fileName, SECTION_NAME); + return gspProjectConfigurations; + } else { + return gspProjectConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected ProjectConfiguration getGspProjectConfigurationData(String typeName) { + loadGspProjectConfigurations(); + if (gspProjectConfigurations != null && gspProjectConfigurations.size() > 0) { + for (ProjectConfiguration data : gspProjectConfigurations) { + if (data.getCommonConfigData().getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..d8a35cfb02466ffe0f14f84626869fe99eb6a26b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/GspProjectExtendHelper.java @@ -0,0 +1,67 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; + +/** + * Classname GspProjectExtendHelper Description TODO Date 2019/10/28 11:20 + * + * @author zhongchq + * @version 1.0 + */ +public class GspProjectExtendHelper { + private final String gspProjectExtend = "config/platform/common/lcm_gspprojectextend.json"; + private final String archetypePom = "platform/dev/main/libs/resources/archetypefront/src/main/resources/archetype-resources/pom.xml"; + private static GspProjectExtendHelper singleton = null; + + FileService fileService = new FileServiceImp(); + + public GspProjectExtendHelper() { + + } + + public static GspProjectExtendHelper getInstance() { + if (singleton == null) { + singleton = new GspProjectExtendHelper(); + } + return singleton; + } + + public String getMavenProjectName() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + final String combinePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), gspProjectExtend); + return metadataServiceHelper.getMavenProjectName(combinePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + public String getEdpParentVersion() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + final String combinePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), archetypePom); + return metadataServiceHelper.getEdpParentVersion(combinePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..7310cf2f1a037b97660680ba4948193236f4e134 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/I18nManagerHelper.java @@ -0,0 +1,52 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; + +public class I18nManagerHelper extends MetadataConfigurationLoader { + private static I18nManagerHelper instance; + + private I18nManagerHelper() { + } + + public static I18nManagerHelper getInstance() { + if (instance == null) + instance = new I18nManagerHelper(); + return instance; + } + + public MetadataI18nService getI18nManager(String typeCode) { + MetadataI18nService service = null; + //todo 具体的获取i18nManager的具体逻辑 + MetadataI18nService manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeCode); + if (data != null && data.getI18nConfigData() != null) { + Class cls = null; + try { + if (data.getI18nConfigData() != null) { + cls = Class.forName(data.getI18nConfigData().getName()); + service = (MetadataI18nService) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return service; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..3f558de492ac3d99ff3f62bab24b68462591315f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSettingsLoader.java @@ -0,0 +1,57 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.FileInputStream; +import java.io.IOException; +import org.apache.maven.settings.Settings; +import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Classname MavenSettingsSerializerHelper Description maven settings.xml加载器 Date 2020/1/6 19:12 + * + * @author zhongchq + * @version 1.0 + */ +public class MavenSettingsLoader { + + private static String absoluteSettingsPath; + private static String settingsPath = "/.m2/settings.xml"; + + public static Settings getSettings() throws IOException, XmlPullParserException { + FileServiceImp fileService = new FileServiceImp(); + //可兼容linux + String userHome = System.getProperty("user.home"); + if (fileService.isFileExist(userHome + settingsPath)) { + absoluteSettingsPath = userHome + settingsPath; + } + if (absoluteSettingsPath != null && fileService.isFileExist(absoluteSettingsPath)) { + SettingsXpp3Reader settingsXpp3Reader = new SettingsXpp3Reader(); + return settingsXpp3Reader.read(new FileInputStream(absoluteSettingsPath)); + } + return null; + } + +/* String localRepository; + MavenSettingsLoader(){ + String os = System.getProperty("user.home"); + if (FileUtils.isFileExist(os + settingsPath)) { + absoluteSettingsPath = os + settingsPath; + } + }*/ +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..037ebe8f8d72c5a9dda44b225d640d10948b1ee6 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleConfigLoader.java @@ -0,0 +1,64 @@ +/* + * 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.lcm.metadata.common.configuration; + +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; +import java.util.Map; + +/** + * @Classname MavenSourceRuleConfigLoader + * @Description TODO + * @Date 2019/12/2 19:13 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenSourceRuleConfigLoader { + private static String fileName = "config/platform/common/lcm_mavensourcerule.json"; + private static String sectionName = "rule"; + + public static Map> mavenSourceRuleConfigurations; + + public MavenSourceRuleConfigLoader() { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + } + + public static Map> getMavenSourceRuleConfigurations() { + return mavenSourceRuleConfigurations; + } + + public static void setMavenSourceRuleConfigurations( + Map> mavenSourceRuleConfigurations) { + MavenSourceRuleConfigLoader.mavenSourceRuleConfigurations = mavenSourceRuleConfigurations; + } + + protected Map> loadSourceRuleConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (mavenSourceRuleConfigurations == null || mavenSourceRuleConfigurations.size() <= 0) { + mavenSourceRuleConfigurations = metadataServiceHelper.getMavenSourceRule(fileName, sectionName); + return mavenSourceRuleConfigurations; + } else { + return mavenSourceRuleConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..9ff116c3a4e210b9ec3dd1fa93bf9f546a224857 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MavenSourceRuleHelper.java @@ -0,0 +1,44 @@ +/* + * 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.lcm.metadata.common.configuration; + +import java.util.List; +import java.util.Map; + +/** + * Classname MetadataTypeHelper Description TODO Date 2019/11/25 16:24 + * + * @author zhongchq + * @version 1.0 + */ +public class MavenSourceRuleHelper extends MavenSourceRuleConfigLoader { + + private static MavenSourceRuleHelper singleton = null; + + public MavenSourceRuleHelper() { + } + + public static MavenSourceRuleHelper getInstance() { + if (singleton == null) { + singleton = new MavenSourceRuleHelper(); + } + return singleton; + } + + public Map> getMavenSourceRuleMap() { + return loadSourceRuleConfigration(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..8c543a3662902a21cc5211831ad7311521f63812 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MdExtRuleSerializerHelper.java @@ -0,0 +1,49 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; + +public class MdExtRuleSerializerHelper extends MetadataConfigurationLoader { + private static MdExtRuleSerializerHelper singleton = null; + + private MdExtRuleSerializerHelper() { + } + + public static MdExtRuleSerializerHelper getInstance() { + if (singleton == null) { + singleton = new MdExtRuleSerializerHelper(); + } + return singleton; + } + + public MdExtendRuleSerializer getManager(String typeName) { + MdExtendRuleSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null && data.getMdExtRuleSerializer() != null) { + Class cls = null; + try { + cls = Class.forName(data.getMdExtRuleSerializer().getName()); + manager = (MdExtendRuleSerializer) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..5c6b0bdb44f3ccd4cfd0eddceadf51964bd418ca --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigHelper.java @@ -0,0 +1,41 @@ +/* + * 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.lcm.metadata.common.configuration; + +public class MenuConfigHelper extends MenuConfigLoader { + + private static MetadataConfigurationHelper sigleton = null; + + public MenuConfigHelper() { + } + + public static MetadataConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new MetadataConfigurationHelper(); + } + return sigleton; + } + + @Override + public String getMenuExtendConfiguration(Boolean status) { + return super.getMenuExtendConfiguration(status); + } + + @Override + public void setMenuConfiguration(String configuration) { + super.setMenuConfiguration(configuration); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..2a276c218a11ecdf5e0daef953cbaf667ef68e54 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MenuConfigLoader.java @@ -0,0 +1,57 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.nio.file.Paths; + +public class MenuConfigLoader { + + private static String menuFileName = "web/platform/dev/main/web/webide/ide.module.ngfactory"; + private static String menuExtendFileName = "config/platform/common/lcm_menuextend.conf"; + private static FileServiceImp fileService = new FileServiceImp(); + + public MenuConfigLoader() { + } + + static String menuConfiguration; + static String menuExtendConfiguration; + + public String getMenuExtendConfiguration(Boolean status) { + String fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(menuExtendFileName).toString(); + String contents = null; + + contents = fileService.fileRead(fileName); + + String flag = status ? "on:" : "off:"; + menuExtendConfiguration = contents.substring(contents.indexOf(flag) + flag.length(), contents.indexOf("\n", contents.indexOf(flag)) - 1); + return menuExtendConfiguration; + } + + public void setMenuConfiguration(String configuration) { + String fileName = Paths.get(EnvironmentUtil.getBasePath()).resolve(menuFileName).toString(); + String contents = null; + + contents = fileService.fileRead(fileName); + + String extendOnMenu = getMenuExtendConfiguration(true); + String extendOffMenu = getMenuExtendConfiguration(false); + String oldString = contents.contains(extendOffMenu) ? extendOffMenu : extendOnMenu; + String contentsUpdated = contents.replace(oldString, configuration); + fileService.fileUpdate(fileName, contentsUpdated, false); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..320ec8df6989670e3090d0d61580229573cb149d --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationHelper.java @@ -0,0 +1,37 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; + +public class MetadataConfigurationHelper extends MetadataConfigurationLoader { + + private static MetadataConfigurationHelper sigleton = null; + + public MetadataConfigurationHelper() { + } + + public static MetadataConfigurationHelper getInstance() { + if (sigleton == null) { + sigleton = new MetadataConfigurationHelper(); + } + return sigleton; + } + + public MetadataConfiguration getMetadataConfigurationData(String typeName) { + return super.getMetadataConfigurationData(typeName); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..5be268fd82dd790b9fddc4087210406b800d01fa --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataConfigurationLoader.java @@ -0,0 +1,90 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +/** + * @Classname MetadataConfigurationLoader + * @Description 配置文件实体 + * @Date 2019/7/23 14:44 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataConfigurationLoader implements Serializable { + + public static List metadataConfigurations; + private static String fileName = "config/platform/common/lcm_metadataextend.json"; + private static final String SECTION_NAME = "MetadataConfiguration"; + + public MetadataConfigurationLoader() { + loadMetadataConfigurations(); + } + + public static List getMetadataConfigurations() { + return metadataConfigurations; + } + + public static void setMetadataConfigurations( + List metadataConfigurations) { + MetadataConfigurationLoader.metadataConfigurations = metadataConfigurations; + } + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 类初始化时反序列化Json到实体 + * @date 15:40 2019/7/23 + **/ + protected List loadMetadataConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + FileServiceImp fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + + if (metadataConfigurations == null || metadataConfigurations.size() <= 0) { + metadataConfigurations = metadataServiceHelper.getMetadataConfigurationList(fileName, SECTION_NAME); + return metadataConfigurations; + } else { + return metadataConfigurations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected MetadataConfiguration getMetadataConfigurationData(String typeName) { + loadMetadataConfigurations(); + if (metadataConfigurations != null && metadataConfigurations.size() > 0) { + for (MetadataConfiguration data : metadataConfigurations) { + if (data.getCommon().getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..ced38a0d0d53180da8e153efe8beb7bed77df1b0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataSerializerHelper.java @@ -0,0 +1,67 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer; + +/** + * @Classname MetadataSerializerHelper + * @Description 元数据序列化器帮助 + * @Date 2019/7/24 9:31 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataSerializerHelper extends MetadataConfigurationLoader { + + private static MetadataSerializerHelper singleton = null; + + public MetadataSerializerHelper() { + } + + public static MetadataSerializerHelper getInstance() { + if (singleton == null) { + singleton = new MetadataSerializerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public MetadataContentSerializer getManager(String typeName) { + MetadataContentSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null) { + Class cls = null; + try { + if (data.getSerializer() != null) { + cls = Class.forName(data.getSerializer().getName()); + manager = (MetadataContentSerializer) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..0b321679859f1a48c1d95ca7eb211bf454485681 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataServiceHelper.java @@ -0,0 +1,130 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; + +/** + * @Classname MetadataServiceHelper + * @Description 元数据服务工具 + * @Date 2019/7/20 14:20 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataServiceHelper { + ObjectMapper objectMapper = new ObjectMapper(); + String fileContents; + private static FileServiceImp fileService = new FileServiceImp(); + + //默认构造器 + public MetadataServiceHelper() { + objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + objectMapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + } + + public List getMetadataConfigurationList(String path, + String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getMetadataTypeList(String path, String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getExtractConfigrationList(String fileName, + String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public List getCompileConfigrationList(String fileName, + String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } + + public String getMavenProjectName(String gspProjectExtend) throws IOException { + fileContents = fileService.fileRead(gspProjectExtend); + JsonNode jsonNode = objectMapper.readTree(fileContents); + return jsonNode.findValue("MavenProjectName").asText(); + } + + public Map> getMavenSourceRule(String fileName, String sectionName) throws IOException { + fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>>() { + }); + } + + public String getEdpParentVersion(String pomPath) throws IOException { + FileInputStream fis = null; + try { + fis = new FileInputStream(pomPath); + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + return model.getParent().getVersion(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (!(null == fis)) { + fis.close(); + } + } + return null; + } + + public List getProjectConfiguration(String path, + String sectionName) throws IOException { + fileContents = fileService.fileRead(path); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String metadataConfiguration = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(metadataConfiguration, new TypeReference>() { + }); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..04d8060b0750ad72d88ba27bbbe708458f244497 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeConfigLoader.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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.io.Serializable; +import java.util.List; + +/** + * @Classname MetadataTypeConfigLoader + * @Description 元数据类型 + * @Date 2019/7/23 15:03 + * @Created by zhongchq + * @Version 1.0 + */ +public class MetadataTypeConfigLoader implements Serializable { + + private String fileName = "config/platform/common/lcm_metadataextend.json"; + private String sectionName = "MetadataType"; + + private List metadataTypeList; + + public MetadataTypeConfigLoader() { + loadMetadataConfigurations(); + } + + /** + * @return java.util.List + * @author zhongchq 类初始化时反序列化Json到实体 + **/ + public List loadMetadataConfigurations() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (metadataTypeList != null && metadataTypeList.size() > 0) { + return metadataTypeList; + } + FileService fileService = new FileServiceImp(); + fileName = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), fileName); + metadataTypeList = metadataServiceHelper.getMetadataTypeList(fileName, sectionName); + return metadataTypeList; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..8373036a2a86f27a7d02fc66ebea129549914525 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/MetadataTypeHelper.java @@ -0,0 +1,50 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import java.util.List; + +/** + * Classname MetadataTypeHelper Description TODO Date 2019/11/25 16:24 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataTypeHelper extends MetadataTypeConfigLoader { + + private static MetadataTypeHelper singleton = null; + + public MetadataTypeHelper() { + } + + public static MetadataTypeHelper getInstance() { + if (singleton == null) { + singleton = new MetadataTypeHelper(); + } + return singleton; + } + + public List getMetadataTypes() { + return loadMetadataConfigurations(); + } + + public MetadataType getMetadataType(String typeCode) { + List metadataTypeList = loadMetadataConfigurations(); + MetadataType metadataType = metadataTypeList.stream().filter(type -> type.getTypeCode().equals(typeCode)).findFirst().orElse(null); + return metadataType; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..1736faa958fd323603bf63d4df81a4100050d17f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ProjectCreateManagerHelper.java @@ -0,0 +1,62 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.spi.IProjectCreateManager; +import java.util.List; +import java.util.Objects; +import org.springframework.util.StringUtils; + +public class ProjectCreateManagerHelper extends GspProjectConfigurationLoader { + private static ProjectCreateManagerHelper instance; + + public static ProjectCreateManagerHelper getInstance() { + if (Objects.isNull(instance)) { + instance = new ProjectCreateManagerHelper(); + } + return instance; + } + + private ProjectCreateManagerHelper() { + + } + + /// + /// 返回各元数据序列化器 + /// + /// + /// + public IProjectCreateManager getManager(String typeName) { + IProjectCreateManager manager = null; + ProjectConfiguration data = getGspProjectConfigurationData(typeName); + if (!Objects.isNull(data) && !Objects.isNull(data.getCreateConfigData()) && !StringUtils.isEmpty(data.getCreateConfigData().getName())) { + Class cls = null; + try { + cls = Class.forName(data.getCreateConfigData().getName()); + manager = (IProjectCreateManager) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } + + public List getProjectTypeList() { + return loadGspProjectConfigurations(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..586b7b2815dbe9ae9059db95ac2165bea55eb065 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyConfigLoader.java @@ -0,0 +1,51 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; + +public class RefStrategyConfigLoader { + + private String refStrategy; + private String fileName = "config/platform/dev/main/ref_strategy.json"; + private String sectionName = "strategy"; + ObjectMapper objectMapper = new ObjectMapper(); + + public RefStrategyConfigLoader() { + } + + protected String loadRefStrategy() { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + try { + if (refStrategy != null) { + return refStrategy; + } + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + refStrategy = jsonNode.findValue(sectionName).toString(); + return refStrategy; + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..6d226041af929960f962b28f309458fd77450b5a --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/RefStrategyHelper.java @@ -0,0 +1,34 @@ +/* + * 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.lcm.metadata.common.configuration; + +public class RefStrategyHelper extends RefStrategyConfigLoader { + private static RefStrategyHelper singleton = null; + + public RefStrategyHelper() { + } + + public static RefStrategyHelper getInstance() { + if (singleton == null) { + singleton = new RefStrategyHelper(); + } + return singleton; + } + + public String getRefStrategy() { + return loadRefStrategy(); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..04deaf2fe44b7d28ed56079e41be736bae7d2c2c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/ReferenceManagerHelper.java @@ -0,0 +1,58 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.IMetadataReferenceManager; + +public class ReferenceManagerHelper extends MetadataConfigurationLoader { + private static ReferenceManagerHelper instance; + + public static ReferenceManagerHelper getInstance() { + if (instance == null) { + instance = new ReferenceManagerHelper(); + } + return instance; + } + + /// + /// 构造器 + /// + private ReferenceManagerHelper() { + + } + + /// + /// 返回各元数据序列化器 + /// + /// + /// + public IMetadataReferenceManager getManager(String typeName) { + IMetadataReferenceManager manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null && data.getReference() != null) { + Class cls = null; + try { + cls = Class.forName(data.getReference().getName()); + manager = (IMetadataReferenceManager) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..93b0d7d010803731db2231c68fabaa2edeb46e3d --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/TransferSerializerHelper.java @@ -0,0 +1,69 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.spi.MetadataTransferSerializer; +import org.springframework.util.ObjectUtils; +import org.springframework.util.StringUtils; + +/** + * Classname TransferSerializerHelper Description 传输序列化器帮助类 Date 2019/11/18 8:55 + * + * @author zhongchq + * @version 1.0 + */ +public class TransferSerializerHelper extends MetadataConfigurationLoader { + + private static TransferSerializerHelper singleton = null; + + public TransferSerializerHelper() { + } + + public static TransferSerializerHelper getInstance() { + if (singleton == null) { + singleton = new TransferSerializerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public MetadataTransferSerializer getManager(String typeName) { + MetadataTransferSerializer manager = null; + MetadataConfiguration data = getMetadataConfigurationData(typeName); + if (data != null) { + Class cls = null; + try { + if (!ObjectUtils.isEmpty(data.getTransferSerializer()) && !StringUtils.isEmpty(data.getTransferSerializer().getName())) { + cls = Class.forName(data.getTransferSerializer().getName()); + manager = (MetadataTransferSerializer) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..2a251cb4466bb1c56676fc22f987f868f965b493 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/configuration/WorkspaceHelper.java @@ -0,0 +1,54 @@ +/* + * 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.lcm.metadata.common.configuration; + +import com.inspur.edp.lcm.workspace.api.WorkSpaceService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +/** + * @author zhaoleitr + */ +public class WorkspaceHelper { + private WorkSpaceService wsService; + private static WorkspaceHelper singleton; + + public WorkspaceHelper() { + wsService = SpringBeanUtils.getBean(WorkSpaceService.class); + } + + public static WorkspaceHelper getInstance() { + if (singleton == null) { + singleton = new WorkspaceHelper(); + } + return singleton; + } + + public String getDevRootPath() { +// return "F:\\projects"; + return wsService.getUserBasePath().replace("\\", "/"); + /* + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + + final String combinePath = FileUtils.getCombinePath(caf_boot_home, workspacePath); + return metadataServiceHelper.getDevRootPath(combinePath); + return metadataServiceHelper.getDevRootPath(workspacePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + */ + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java new file mode 100644 index 0000000000000000000000000000000000000000..e12503594c76d4ee16dacca968c6f8198851c92e --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/context/RuntimeContext.java @@ -0,0 +1,55 @@ +/* + * 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.lcm.metadata.common.context; + +import io.iec.edp.caf.boot.context.CAFContext; + +/** + * Classname RuntimeContext Description TODO Date 2019/8/20 14:11 + * + * @author zhongchq + * @version 1.0 + */ +public class RuntimeContext { + + public static String tenantID; + private static String language; + + public static void setTenantID(String tenantID) { + RuntimeContext.tenantID = tenantID; + } + + public static void setLanguage(String language) { + RuntimeContext.language = language; + } + + public static String getTenantID() { + + if (tenantID == null) { + tenantID = "9999"; + } + return tenantID; + } + + public static String getLanguage() { + try { + language = CAFContext.current.getLanguage(); + } catch (Exception e) { + language = "zh-CHS"; + } + return language; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..0b72cf01e7822ece6033c0e34f5668ba17cfcc1d --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentHelper.java @@ -0,0 +1,57 @@ +/* + * 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.lcm.metadata.common.deployer; + +import com.inspur.edp.lcm.metadata.api.entity.deployer.DeploymentType; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import java.util.List; + +public class DeploymentHelper extends DeploymentTypeConfigLoader { + + private static DeploymentHelper singleton = null; + + public DeploymentHelper() { + } + + public static DeploymentHelper getInstance() { + if (singleton == null) { + singleton = new DeploymentHelper(); + } + return singleton; + } + + public List getDeploymentType() { + return loadDeploymentTypeConfiguration(); + } + + public DeployAction getManager(String typeCode) { + DeployAction manager = null; + DeploymentType deploymentType = getDeploymentType(typeCode); + if (deploymentType != null) { + Class cls; + try { + if (deploymentType.getDeployer() != null) { + cls = Class.forName(deploymentType.getDeployer().getName()); + manager = (DeployAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..a8d321c2bb35c4e8e92245bd9dbe07c56494d891 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/deployer/DeploymentTypeConfigLoader.java @@ -0,0 +1,87 @@ +/* + * 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.lcm.metadata.common.deployer; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.deployer.DeploymentType; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class DeploymentTypeConfigLoader { + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + private String serverPath; + protected String fileName = "tools/deploy/project_java/config/platform/common/lcm_deploymenttype.json"; + private String sectionName = "DeploymentType"; + + private List deploymentTypeConfiguration; + + public DeploymentTypeConfigLoader() { + serverPath = Paths.get(Utils.getStartupPath()).resolve("../..").toString().replace("\\", "/"); + } + + protected List loadDeploymentTypeConfiguration() { + if (deploymentTypeConfiguration != null) { + return deploymentTypeConfiguration; + } + try { + fileName = Paths.get(serverPath).resolve(fileName).toString(); + deploymentTypeConfiguration = getDeploymentTypeConfiguration(fileName, sectionName); + return deploymentTypeConfiguration; + } catch (IOException ioException) { + ioException.printStackTrace(); + } finally { + fileName = "tools/deploy/project_java/config/platform/common/lcm_deploymenttype.json"; + } + return null; + } + + protected DeploymentType getDeploymentType(String typeCode) { + List deploymentTypes = loadDeploymentTypeConfiguration(); + DeploymentType deploymentType = deploymentTypes.stream().filter(type -> type.getTypeCode().equals(typeCode)).findFirst().orElse(null); + return deploymentType; + } + + private List getDeploymentTypeConfiguration(String path, String sectionName) throws IOException { + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(path); + ObjectMapper objectMapper = Utils.getMapper(); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String deploymentType = jsonNode.findValue(sectionName).toString(); + return objectMapper.readValue(deploymentType, new TypeReference>() { + }); + } + + public String getServerPath() { + return serverPath; + } + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..74b295c66e30c2b6f77a7387755e1a4c72507a95 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractConfigLoader.java @@ -0,0 +1,67 @@ +/* + * 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.lcm.metadata.common.extractor; + +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataServiceHelper; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; + +public class ExtractConfigLoader { + private String fileName = "config/platform/common/lcm_gspprojectextend.json"; + private String sectionName = "ExtractConfigration"; + private List extractConfigrations; + + /** + * @param + * @return java.util.List + * @throws + * @author zhongchq + * @description 获取配置文件数据 + * @date 15:40 2019/7/23 + **/ + protected List loadExtractConfigration() { + MetadataServiceHelper metadataServiceHelper = new MetadataServiceHelper(); + try { + if (extractConfigrations == null || extractConfigrations.size() <= 0) { + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + extractConfigrations = metadataServiceHelper.getExtractConfigrationList(fileName, sectionName); + return extractConfigrations; + } else { + return extractConfigrations; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + protected ExtractConfigration getExtractConfigurationData(String typeName) { + loadExtractConfigration(); + if (extractConfigrations != null && extractConfigrations.size() > 0) { + for (ExtractConfigration data : extractConfigrations) { + if (data.getTypeCode().equalsIgnoreCase(typeName)) { + return data; + } + } + } else { + return null; + } + return null; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..e9f1c2a818709e4499252d461a5300aa8b2feabc --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/extractor/ExtractHelper.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.lcm.metadata.common.extractor; + +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import java.util.List; + +public class ExtractHelper extends ExtractConfigLoader { + private static ExtractHelper singleton = null; + + public static ExtractHelper getInstance() { + if (singleton == null) { + singleton = new ExtractHelper(); + } + return singleton; + } + + public List getExtractConfigrationList() { + return loadExtractConfigration(); + } + + public ExtractAction getManager(String typeCode) { + ExtractAction manager = null; + ExtractConfigration extractConfigurationData = getExtractConfigurationData(typeCode); + if (extractConfigurationData != null) { + Class cls; + try { + if (extractConfigurationData.getExtract() != null) { + cls = Class.forName(extractConfigurationData.getExtract().getName()); + manager = (ExtractAction) cls.newInstance(); + } + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + return manager; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java new file mode 100644 index 0000000000000000000000000000000000000000..b38e3404e62a6250965f96bac244e5ded2cc6a71 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/logging/MvnStreamConsumer.java @@ -0,0 +1,57 @@ +/* + * 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.lcm.metadata.common.logging; + +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import org.apache.maven.shared.invoker.InvocationOutputHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Classname MvnStreamConsumer Description 获取日志 Date 2020/3/4 11:32 + * + * @author zhongchq + * @version 1.0 + */ +public class MvnStreamConsumer implements InvocationOutputHandler { + private static final Logger log = LoggerFactory.getLogger(MvnStreamConsumer.class); + + private String exceptionString; + + @Override + public void consumeLine(String line) { + if (line.contains("[INFO]")) { + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.info(line); + } else if (line.contains("[WARNING]")) { + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.warn(line); + } else if (line.contains("[ERROR]")) { + this.exceptionString += line + "\r\n"; + LoggerDisruptorQueue.publishEvent(line, CAFContext.current.getUserId()); + log.error(line); + } + } + + public String getExceptionString() { + return exceptionString; + } + + public void setExceptionString(String exceptionString) { + this.exceptionString = exceptionString; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..1363c01b8b07c07ac580079a17c13435b6a4c1fa --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/CommandUtil.java @@ -0,0 +1,643 @@ +/* + * 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.lcm.metadata.common.util; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.net.Socket; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +public class CommandUtil { + public static void newProcess(String directory, String command) { + ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", command); + builder.directory(new File(directory)); + builder.redirectOutput(ProcessBuilder.Redirect.INHERIT); + builder.redirectError(ProcessBuilder.Redirect.INHERIT); + builder.redirectInput(ProcessBuilder.Redirect.INHERIT); + builder.redirectErrorStream(true); + + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + + Process p; + try { + p = builder.start(); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + String line; + while (true) { + line = br.readLine(); + if (line == null) { + break; + } + } + + p.waitFor(); + int exit = p.exitValue(); + if (exit != 0) { + throw new RuntimeException("程序调用异常"); + } + } catch (IOException | InterruptedException e) { + throw new RuntimeException("程序调用异常", e); + } finally { + try { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public static void start(String serverPath) { + Runtime runtime = Runtime.getRuntime(); + try { + runtime.exec("cmd /k start " + serverPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + +// public static int getPid(Process process) { +// int pid = 0; +// try { +// Field field = process.getClass().getDeclaredField("handle"); +// field.setAccessible(true); +// Long pidL = Kernel32.INSTANCE.GetProcessId((Long) field.get(process)); +// pid = pidL.intValue(); +// } catch (Exception ex) { +// ex.printStackTrace(); +// } +// return pid; +// } + + // 通过获取当前运行主机的pidName,截取获得他的pid + public static int getCurrentPid() { + RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); + String pidName = runtime.getName();// 5296@dell-PC + int pid = Integer.parseInt(pidName.substring(0, pidName.indexOf("@"))); + return pid; + } + + // 通过Pid获取PidName + public static String getPidNameByPid(int pid) throws Exception { + String pidName = null; + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); // "javaw.exe","3856","Console","1","72,292 + // K"从这个进程中获取对应的PidName + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (line.indexOf(String.valueOf(pid)) != -1) { + array = line.split(","); + line = array[0].replaceAll("\"", ""); + line = line.replaceAll(".exe", "");// 考虑pidName后缀为exe或者EXE + line = line.replaceAll(".exe".toUpperCase(), ""); + pidName = line; + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程名称出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidName; + } + + // 根据Pid获取当前进程的CPU + public static String getCPUByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (!"".equals(line)) { + array = line.split("\",\""); + line = array[3].replaceAll("\"", ""); + return line; + } + } + } catch (Exception localException) { + throw new Exception("获取进程CPU信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + return null; + } + + // 根据Pid获取当前进程的memory + public static String getMemByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"PID EQ " + pid + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (!"".equals(line)) { + array = line.split("\",\""); + if (array.length < 5) { + continue; + } + line = array[4].replaceAll("\"", ""); + return line; + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程内存信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + return null; + } + + // 根据Pid将进程干掉 + public static void killProcessByPid(int pid) throws Exception { + Runtime.getRuntime().exec("taskkill /F /PID " + pid); + } + + // 根据PidName将进程干掉 + public static void killProcessByPidName(String pidName) throws Exception { + Runtime.getRuntime().exec("taskkill /F /IM " + pidName); + } + + // 根据PidName获取当前的Pid的list集合 + public static List getPidsByPidName(String pidName) throws Exception { + List pidList = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + String imageName = pidName; + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV /FI \"IMAGENAME EQ " + imageName + "\""); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + if (line.indexOf(imageName) != -1) { + array = line.split(","); + line = array[1].replaceAll("\"", ""); + pidList.add(Integer.parseInt(line)); + } + } + } catch (IOException localIOException) { + throw new Exception("获取进程ID出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidList; + } + + // 获取所有的pid + public static List getPidsByFilter(String filter) throws Exception { + List pids = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV | findstr " + filter); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + array = line.split(","); + int pid = Integer.parseInt(array[1].replace("\"", "")); + if (pid != 0) { + pids.add(pid); + } + } + } catch (IOException localIOException) { + throw new Exception("获取系统所有进程名出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pids; + } + + // 获取当前系统的所有的PidName + public static Set getCurrOsAllPidNameSet() throws Exception { + Set pidNameSet = new HashSet<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c TASKLIST /NH /FO CSV"); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + array = line.split(","); + line = array[0].replaceAll("\"", ""); + line = line.replaceAll(".exe", ""); + line = line.replaceAll(".exe".toUpperCase(), ""); + if (line != "") { + pidNameSet.add(line); + } + } + } catch (IOException localIOException) { + throw new Exception("获取系统所有进程名出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return pidNameSet; + } + + // 判断当前pid是否退出,判断根据pid查询的内存是否为空来决定 + public static boolean isPidExist(int pid) throws Exception { + return getMemByPID(pid) != null; + } + + // 对启动路径和运行参数的拼接 + // 这样的思路就可以控制俩种参数的输入 + public static String getCommandFormatStr(String proPath) { + return getCommandFormatStr(proPath, null); + } + + public static String getCommandFormatStr(String proPath, String runArgs) { + StringBuffer command = new StringBuffer(); + command.append("\""); + command.append(proPath); + command.append("\""); + if (runArgs != "") { + command.append(" ").append(runArgs); + } + return command.toString(); + } + + // 执行完相应的命令行就退出cmd + private static String getCommandByCmd(String cmdStr) { + StringBuffer command = new StringBuffer(); + command.append("cmd /C "); + command.append(cmdStr); + return command.toString(); + } + + // 通过cmd打开对应的文件 + // 打开cmd,执行explorer + public static void openDir(String fileDir) throws Exception { + Runtime.getRuntime().exec("cmd /c start explorer " + fileDir);// explorer.exe是Windows的程序管理器或者文件资源管理器 + } + + // 根据当前的Pid获取当前进程的端口 + public static int getPortByPID(int pid) { + if (pid == 0) { + return 0; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line = ""; + String listeningStateType = "LISTENING";// 状态值 + String[] array; + try { + Process p = Runtime.getRuntime().exec("cmd /c netstat /ano | findstr [ | findstr " + pid + " | findstr " + listeningStateType); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + do { + if (line.indexOf(String.valueOf(pid)) != -1) { + line = line.replaceFirst("\\s+", ""); + array = line.split("\\s+"); + int port = Integer.parseInt(array[1].split(":")[3].trim()); + return port; + } + if ((line = br.readLine()) == null) { + break; + } + } + while (pid != 0); + } catch (IOException localIOException) { + throw new RuntimeException("获取进程端口信息出错!"); + } finally { + try { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return 0; + } + + // 根据当前的Pid获取当前进程的端口 + public static Map> getPortsByPID(int pid) throws Exception { + if (pid == 0) { + return null; + } + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line = null; + String tcpType = "TCP"; + String udpType = "UDP"; + String listeningStateType = "LISTENING";// 状态值 + Map> portMap = new HashMap<>(); + List tcpPortList = new ArrayList<>(); + List udpPortList = new ArrayList<>(); + portMap.put(tcpType, tcpPortList); + portMap.put(udpType, udpPortList); + String[] array; + try { + Process p = Runtime.getRuntime().exec("netstat /ano"); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + do { + if (line.indexOf(pid) != -1) { + line = line.replaceFirst("\\s+", ""); + if (line.indexOf(tcpType) != -1) { + if (line.indexOf(listeningStateType) != -1) { + array = line.split("\\s+"); + String port = array[1].split(":")[1]; + tcpPortList.add(port); + } + } else { + array = line.split("\\s+"); + String port = array[1].split(":")[1]; + udpPortList.add(port); + } + } + if ((line = br.readLine()) == null) { + break; + } + } + while (pid != 0); + } catch (IOException localIOException) { + throw new Exception("获取进程端口信息出错!"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return portMap; + } + + public static List getPidsByServerPath(String serverPath) { + List pids = new ArrayList<>(); + ArrayList inputs; + String cmd = "wmic process where caption=\"java.exe\" get caption,executablepath,processid"; + try { + inputs = getInputs(cmd); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("获取进程信息失败:" + cmd, e); + } + List processInfos = inputs.stream().filter(input -> input.contains(serverPath)).collect(Collectors.toList()); + if (processInfos != null) { + processInfos.forEach(processInfo -> { + String[] splits = processInfo.split("\\s+"); + int pid = Integer.parseInt(splits[2].trim()); + pids.add(pid); + }); + } + return pids; + } + + // 根据当前的Pid获取当前进程的端口 + public static ArrayList getInputs(String cmd) throws Exception { + ArrayList inputs = new ArrayList<>(); + InputStream is = null; + InputStreamReader ir = null; + BufferedReader br = null; + String line; + try { + Process p = Runtime.getRuntime().exec(cmd); + is = p.getInputStream(); + ir = new InputStreamReader(is); + br = new BufferedReader(ir); + while ((line = br.readLine()) != null) { + inputs.add(line); + } + + p.waitFor(); + int exit = p.exitValue(); + if (exit != 0) { + throw new RuntimeException("程序调用异常"); + } + } catch (IOException localIOException) { + throw new Exception("执行命令:" + cmd + "出错。"); + } finally { + if (br != null) { + br.close(); + } + if (ir != null) { + ir.close(); + } + if (is != null) { + is.close(); + } + } + return inputs; + } + + public static List getPidsByPort(int port) { + ArrayList pids = new ArrayList<>(); + try { + Runtime rt = Runtime.getRuntime(); + Process proc = rt.exec("cmd /c netstat -ano | findstr " + port); + + BufferedReader stdInput = new BufferedReader(new + InputStreamReader(proc.getInputStream())); + String s = null; + if ((s = stdInput.readLine()) != null) { + int index = s.lastIndexOf(" "); + String sc = s.substring(index); + pids.add(Integer.parseInt(sc.trim())); + //rt.exec("cmd /c Taskkill /PID" +sc+" /T /F"); + } + return pids; + } catch (Exception e) { + throw new RuntimeException("获取pid失败"); + } + } + + public static boolean isPortAvailable(int port) { + try (Socket ignored = new Socket("localhost", port)) { + return false; + } catch (IOException ignored) { + return true; + } + } + + public static boolean isWindows() { + String os = System.getProperty("os.name").toLowerCase(); + boolean isWindows = os.startsWith("windows"); + return isWindows; + } + + // 获取当前环境的Java_Home + public static String getJavaHome(boolean isDeployTool) { + String javaHomeInServer = getJavaHomeInServer(isDeployTool); + if (new File(javaHomeInServer).exists()) { + return javaHomeInServer; + } + + String javaHome = System.getenv("JAVA_HOME"); + javaHome = javaHome == null ? System.getProperty("java.home") : javaHome; + + if (Utils.isNullOrEmpty(javaHome)) { + throw new RuntimeException("请配置系统变量JAVA_HOME"); + } + + return ""; + } + + public static String getJavaHomeInServer(boolean isDeployTool) { + String javaDir = isWindows() ? "amd64-win" : "x86_64-linux"; + String javaHome = FileServiceImp.combinePath(Utils.getBasePath(isDeployTool), EnvironmentUtil.getServerRuntimePathName(), "runtime/java", javaDir, "bin"); + return javaHome; + } + + // 对于这个方法在产品阶段用于判断是否具有JAVA_HOME + public static boolean existJavaHome() throws Exception { + ArrayList inputs = getInputs("cmd /c echo %JAVA_HOME%"); + if (Utils.isNullOrEmpty(inputs)) { + return false; + } + boolean existFlag = inputs.stream().anyMatch(input -> input.contains("%JAVA_HOME%")); + return existFlag; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..8b57a628552daecd6a6769b07b8733f9847b22c8 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/DbUtil.java @@ -0,0 +1,49 @@ +/* + * 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.lcm.metadata.common.util; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import io.iec.edp.caf.commons.dataaccess.DbConfigDataConvertor; +import io.iec.edp.caf.commons.dataaccess.DbType; +import io.iec.edp.caf.commons.dataaccess.GSPDbConfigData; +import io.iec.edp.caf.commons.dataaccess.JDBCConnectionInfo; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class DbUtil { + public static void testDBConnection(DbConnectionInfo dbConnectionInfo) { + JDBCConnectionInfo dbConfigData = getDbConfigData(dbConnectionInfo); + try { + DriverManager.getConnection(dbConfigData.getDatabaseURL(), dbConfigData.getUserName(), dbConfigData.getPassword()); + } catch (SQLException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + private static JDBCConnectionInfo getDbConfigData(DbConnectionInfo dbConnectionInfo) { + String source = dbConnectionInfo.getDbServerIP() + ":" + dbConnectionInfo.getDbPort(); + source = dbConnectionInfo.getDbType().equals(DbType.Oracle) ? source + "/" + dbConnectionInfo.getDbName() : source; + GSPDbConfigData gspDbConfigData = new GSPDbConfigData(); + gspDbConfigData.setDbType(dbConnectionInfo.getDbType()); + gspDbConfigData.setSource(source); + gspDbConfigData.setCatalog(dbConnectionInfo.getDbName()); + gspDbConfigData.setUserId(dbConnectionInfo.getDbUserName()); + gspDbConfigData.setPassword(dbConnectionInfo.getDbPassword()); + JDBCConnectionInfo dbConfigData = DbConfigDataConvertor.Convert(gspDbConfigData); + return dbConfigData; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..c39e1e2474f1313e0ab02534f3803a402d80eb00 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/EncryptUtil.java @@ -0,0 +1,69 @@ +/* + * 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.lcm.metadata.common.util; + +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import sun.misc.BASE64Decoder; +import sun.misc.BASE64Encoder; + +public class EncryptUtil { + final static BASE64Decoder DECODER = new BASE64Decoder(); + final static BASE64Encoder ENCODER = new BASE64Encoder(); + + public static String decryptInBASE64(String decryptString) { + try { + return new String(DECODER.decodeBuffer(decryptString), StandardCharsets.UTF_8); + } catch (Exception e) { + throw new RuntimeException("配置解密失败, 请重新配置或者联系系统管理员。", e); + } + } + + public static String encryptInBASE64(String encodeString) { + if (Utils.isNullOrEmpty(encodeString)) { + return ""; + } + try { + return ENCODER.encode(encodeString.getBytes(StandardCharsets.UTF_8.name())); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return ""; + } + + public static String encryptInAscii(String text, int offset) { + if (Utils.isNullOrEmpty(text)) { + return ""; + } + char[] chars = text.toCharArray(); + for (int i = 0; i < chars.length; i++) { + chars[i] = (char) (chars[i] + offset); + } + return new String(chars); + } + + public static String decryptInAscii(String text, int offset) { + if (Utils.isNullOrEmpty(text)) { + return ""; + } + char[] chars = text.toCharArray(); + for (int i = 0; i < chars.length; i++) { + chars[i] = (char) (chars[i] - offset); + } + return new String(chars); + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java new file mode 100644 index 0000000000000000000000000000000000000000..5311baabb44fd29b7ccdab8f0f0fbe39761aa2a0 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/common/util/Kernel32.java @@ -0,0 +1,25 @@ +/* + * 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.lcm.metadata.common.util; + +import com.sun.jna.Library; +import com.sun.jna.Native; + +public interface Kernel32 extends Library { + public static Kernel32 INSTANCE = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class); + + public long GetProcessId(Long hProcess); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..3821fa5124e1184d1ae454dc2cc975068e1f6e3c --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/devcommon/ManagerUtils.java @@ -0,0 +1,122 @@ +/* + * 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.lcm.metadata.devcommon; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.configuration.WorkspaceHelper; + +public class ManagerUtils { + public static final String SPRING_SHELL_FLAG_NAME = "spring-shell"; + public static final String SPRING_SHELL_FLAG_TRUE = "1"; + public static final boolean SHELL_FLAG = SPRING_SHELL_FLAG_TRUE.equals(System.getProperty(SPRING_SHELL_FLAG_NAME)); + private static final FileServiceImp FILE_SERVICE = new FileServiceImp(); + /** + * 获取开发根路径 + */ + private static String devRootPath; + private static String mavenStoragePath; + private static String metadataPackageLocation; + + public static String getDevRootPath() { + if (SHELL_FLAG) { + return devRootPath; + } + return WorkspaceHelper.getInstance().getDevRootPath(); + } + + public static void setDevRootPath(String path) { + if (SHELL_FLAG) { + devRootPath = path; + } + + } + + public static String getMetadataPackageLocation() { + if (SHELL_FLAG) { + return metadataPackageLocation; + } + return FILE_SERVICE.getCombinePath(getDevRootPath(), "packages"); + } + + public static void setMetadataPackageLocation(String metadataPackageLoc) { + if (SHELL_FLAG) { + metadataPackageLocation = metadataPackageLoc; + } + } + + /** + * @param path 获取绝对路径 + * @return + */ + public static String getAbsolutePath(String path) { + path = handlePath(path); + if (SHELL_FLAG) { + if (isAbsolutePath(path)) { + return path; + } else { + throw new RuntimeException("当前路径不是绝对路径,请确认。当前路径为:" + path); + } + + } + String devRootPath = handlePath(getDevRootPath()); + if (path.startsWith(devRootPath)) { + if (isAbsolutePath(path)) { + return path; + } else { + throw new RuntimeException("当前路径不是绝对路径,请确认。当前路径为:" + path); + } + } else if (path.startsWith("/") || path.startsWith("\\")) { + path = path.substring(1); + } + if (path.startsWith("/")) { + path = path.substring(1); + } + String absolutePath = FILE_SERVICE.getCombinePath(devRootPath, path); + // TODO 判断路径是否存在 + return handlePath(absolutePath); + } + + public static boolean isAbsolutePath(String path) { + return handlePath(path).startsWith("/") || path.contains(":/"); + } + + public static String handlePath(String path) { + return path.replace("\\", "/"); + } + + public static String getMavenStoragePath() { + if (SHELL_FLAG) { + return mavenStoragePath; + } + return FILE_SERVICE.getCombinePath(getDevRootPath(), "maven"); + } + + public static void setMavenStoragePath(String mavenStorageP) { + if (SHELL_FLAG) { + mavenStoragePath = mavenStorageP; + } + } + + public static String getRalativePath(String relativeFullPath) { + String relativePath; + if (!getDevRootPath().isEmpty() && FILE_SERVICE.startWith(relativeFullPath, getDevRootPath())) { + relativePath = FILE_SERVICE.getRelPath(relativeFullPath, getDevRootPath()); + } else { + relativePath = relativeFullPath; + } + return relativePath; + } +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java new file mode 100644 index 0000000000000000000000000000000000000000..65e09fef2673c620ff5dc3f8df273d219876db81 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/ExtractAction.java @@ -0,0 +1,27 @@ +/* + * 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.lcm.metadata.spi; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; + +public interface ExtractAction { + /** + * 提取扩展动作 + * + * @param context 提取上下文 + */ + void extract(ExtractContext context); +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java similarity index 56% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java index 5e4509661b2e46a8f063c31b3acaf3f2a2038eba..5900d72f938328dc63a794c110d90f23239079ad 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/IMetadataReferenceManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IMetadataReferenceManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; public interface IMetadataReferenceManager { List getConstraint(GspMetadata metadata); diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java new file mode 100644 index 0000000000000000000000000000000000000000..4bb1a1a2e82a8b7ba660d1d40063c7152ab3aa3b --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/IProjectCreateManager.java @@ -0,0 +1,22 @@ +/* + * 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.lcm.metadata.spi; + +import java.util.Map; + +public interface IProjectCreateManager { + void onCreatedProject(String projectPathWithFileName, Map items); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java new file mode 100644 index 0000000000000000000000000000000000000000..1a1be7defef4938e5a428fb0b5879546dcc73845 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/JitRuntimeAction.java @@ -0,0 +1,20 @@ +/* + * 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.lcm.metadata.spi; + +public interface JitRuntimeAction { + void generateRuntime(String projPath); +} \ No newline at end of file diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java new file mode 100644 index 0000000000000000000000000000000000000000..636c7f1b6f4a960a0224c1657a36cefa18d171a1 --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MdExtendRuleSerializer.java @@ -0,0 +1,29 @@ +/* + * 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.lcm.metadata.spi; + +import com.fasterxml.jackson.databind.JsonNode; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; + +/** + * @author zhaoleitr 元数据扩展规则序列化 + */ +public interface MdExtendRuleSerializer { + + JsonNode serialize(IMdExtRuleContent extendRule); + + IMdExtRuleContent deSerialize(JsonNode contentJObject); +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java new file mode 100644 index 0000000000000000000000000000000000000000..cada421982271378b1ee52e12f447f417b5a194f --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataCompileAction.java @@ -0,0 +1,27 @@ +/* + * 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.lcm.metadata.spi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; + +public interface MetadataCompileAction { + /** + * 编译扩展动作 + * + * @param context 扩展上下文 + */ + void metadataCompile(MetadataCompilerContext context); +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java similarity index 64% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java index 24a88cf7e33e032a9358648263a4b91e315c2e6b..3462e271d9e3d7e683d32ec9072e83eed895bb22 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentManager.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentManager.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; public interface MetadataContentManager { /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java similarity index 51% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java index 2bb1b1f3cc6b223e6e7082d863676077fa60759e..3fb46a63567512c0ebc5b5d7c2cd13a292400581 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataContentSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataContentSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; import com.fasterxml.jackson.databind.JsonNode; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; public interface MetadataContentSerializer { - JsonNode Serialize(IMetadataContent metadataContent); + JsonNode serialize(IMetadataContent metadataContent); - IMetadataContent DeSerialize(JsonNode contentJObject); + IMetadataContent deSerialize(JsonNode contentJObject); } diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java new file mode 100644 index 0000000000000000000000000000000000000000..0273459682868417e6151b4b0415c471284dd9bb --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataExtRuleService.java @@ -0,0 +1,24 @@ +/* + * 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.lcm.metadata.spi; + +import com.inspur.edp.lcm.metadata.api.IMetadataContent; + +public interface MetadataExtRuleService { + + public IMetadataContent getDefaultExtRule(String type); + +} diff --git a/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java new file mode 100644 index 0000000000000000000000000000000000000000..baae4eecfc1fc251b4794e0da64cd4796e6ca75a --- /dev/null +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataI18nService.java @@ -0,0 +1,33 @@ +/* + * 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.lcm.metadata.spi; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import java.util.List; + +public interface MetadataI18nService { + /// 合并(用于加载翻译后的元数据) + /// 基础元数据 + /// 多语资源 + GspMetadata merge(GspMetadata metadata, List resource); + + /// 此方法在运行时 获取元数据时,用不到。 + /// 此方法用于在设计时抽取资源元数据内容。 + /// 从基础元数据抽取资源元数据内容 + /// 基础元数据 + I18nResource getResourceItem(GspMetadata metadata); +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java similarity index 71% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java rename to model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java index 06f34d6e23d888e37053842a4799e3735144252c..fa4eb57a3680e56e6a128f380fcfab466c771e5e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/spi/MetadataTransferSerializer.java +++ b/model/framework/common/src/main/java/com/inspur/edp/lcm/metadata/spi/MetadataTransferSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,14 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.spi; +package com.inspur.edp.lcm.metadata.spi; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; /** - * Classname MetadataTransferSerializer - * Description 元数据调用的序列化器,转换成各元数据实体 - * Date 2019/11/18 8:50 + * Classname MetadataTransferSerializer Description 元数据调用的序列化器,转换成各元数据实体 Date 2019/11/18 8:50 * * @author zhongchq * @version 1.0 diff --git a/model/framework/devtime-api/pom.xml b/model/framework/devtime-api/pom.xml index 453e1a3400bb407d67cef0d10c08844158200051..0010cd766133094a0c69949d8af913042f48c66b 100644 --- a/model/framework/devtime-api/pom.xml +++ b/model/framework/devtime-api/pom.xml @@ -1,4 +1,20 @@ + + @@ -8,24 +24,15 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-devtime-api ${project.version} - ubml-model-framework-devtime-api + org.openatom.ubml - ubml-model-common-definition - 0.9.0-SNAPSHOT - compile - - - org.openatom.ubml - ubml-model-framework-common - 0.9.0-SNAPSHOT - compile + ubml-model-framework-entity + ${project.version} - \ No newline at end of file diff --git a/model/framework/devtime-api/src/main/java/Test.java b/model/framework/devtime-api/src/main/java/Test.java deleted file mode 100644 index 88fceecc117c5ee739b2461394fd3ec4a14ebd3a..0000000000000000000000000000000000000000 --- a/model/framework/devtime-api/src/main/java/Test.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * The type Test - * - * @author: haozhibei - */ -public class Test { -} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java new file mode 100644 index 0000000000000000000000000000000000000000..05aae80a9588413b7e3a06c0c5065b35e97c38c6 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/context/RefCommonContext.java @@ -0,0 +1,28 @@ +/* + * 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.lcm.metadata.api.context; + +public class RefCommonContext { + private static boolean invokeAtDesignTime = false; + + public static boolean isInvokeAtDesignTime() { + return invokeAtDesignTime; + } + + public static void setInvokeAtDesignTime(boolean invokeAtDesignTime) { + RefCommonContext.invokeAtDesignTime = invokeAtDesignTime; + } +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..aaa7a7d61643891b9da0f670a6f3c052d343de94 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/entity/bo/BOInfo.java @@ -0,0 +1,133 @@ +/* + * 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.lcm.metadata.api.entity.bo; + +import java.util.Date; + +public class BOInfo { + /// + /// BO中项目数量 + /// + /// + private int projectCount; + + /// + /// BO中后端项目数量 + /// + /// + private int backendProjectCount; + + /// + /// BO中前端项目数量 + /// + /// + private int frontendProjectCount; + + /// + /// BO中项目最后修改时间 + /// + /// + private Date boProjectLastModifyTime; + + /// + /// BO ID + /// + /// + private String id; + + /// + /// BO Code + /// + /// + private String code; + + /// + /// BO Name + /// + /// + private String name; + + public int getProjectCount() { + return projectCount; + } + + public void setProjectCount(int projectCount) { + this.projectCount = projectCount; + } + + public int getBackendProjectCount() { + return backendProjectCount; + } + + public void setBackendProjectCount(int backendProjectCount) { + this.backendProjectCount = backendProjectCount; + } + + public int getFrontendProjectCount() { + return frontendProjectCount; + } + + public void setFrontendProjectCount(int frontendProjectCount) { + this.frontendProjectCount = frontendProjectCount; + } + + public Date getBoProjectLastModifyTime() { + return boProjectLastModifyTime; + } + + public void setBoProjectLastModifyTime(Date boProjectLastModifyTime) { + this.boProjectLastModifyTime = boProjectLastModifyTime; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + /// + /// BO 描述 + /// + /// + private String description; + +} diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java new file mode 100644 index 0000000000000000000000000000000000000000..6a0eb190bbd3740d5fac3f055deea6ad28969398 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/exception/MetadataExceptionCode.java @@ -0,0 +1,20 @@ +/* + * 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.lcm.metadata.api.exception; + +public class MetadataExceptionCode { + public final String unknown = "GSP_LCM_Meta_0000"; +} diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java similarity index 65% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java index 804b3abe09a355d76a447e904fb3b6527d258c66..dbe266ee06fe262d61d807159cf77f7f80c44dbd 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/GspProjectService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/GspProjectService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; +package com.inspur.edp.lcm.metadata.api.service; import java.io.IOException; import java.util.List; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; /** * GSP Project工程服务 diff --git a/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java new file mode 100644 index 0000000000000000000000000000000000000000..b9b8930082069b6f5f62ad03a4f44a59f0c385d0 --- /dev/null +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MdpkgService.java @@ -0,0 +1,161 @@ +/* + * 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.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import java.io.IOException; +import java.util.List; + +/** + * 元数据包服务 + * + * @author zhaoleitr + */ +public interface MdpkgService { + + /** + * 安装元数据接口。 + * + * @param groupId groupId + * @param artifactId artifactId + * @param version 版本 + * @param path 工程路径 + * @param forceUpdateFlag 是否强制更新 + * @throws IOException IO异常 + */ + void installMdpkg(String groupId, String artifactId, String version, String path, + Boolean forceUpdateFlag) throws IOException; + + /** + * 卸载元数据接口。 + * + * @param projPath 工程路径 + * @param packName maven包名 + */ + void uninstallMdpkg(String projPath, String packName); + + /** + * 部署jar到nexus私服中。 step1:将元数据包打包中jar中。 step2:推送 + * + * @param proPath 元数据工程路径 + * @param repoId 仓库标识 + * @param dependencyVersion 依赖版本 + */ + void deployMdpkg(String proPath, String repoId, String dependencyVersion); + + /** + * 获取当前环境中配置的maven配置,从settings.xml配置仓库,settings.xml还得配置用户名与密码 + * + * @return MetadataRepo 返回列表 + */ + MetadataRepo getRepoList(); + + /** + * 添加工程依赖 + * + * @param pompath pom文件路径 + * @param groupId groupId + * @param artifactId artifactId + * @param version 版本 + * @throws IOException IO异常 + */ + void addProjectDependency(String pompath, String groupId, String artifactId, String version) throws IOException; + + /** + * 编译 + * + * @param path 工程路径 + * @param modules 编译模块列表 + */ + void compile(String path, String modules); + + /** + * 编译工程下所有模块 + * + * @param path 工程路径 + */ + void compileAll(String path); + + /** + * 重新安装依赖工程 + * + * @param path 工程路径 + * @param force 是否强制更新 工程路径 + */ + void restore(String path, Boolean force); + + /** + * 给工程添加依赖并拉取 + * + * @param path + * @param metadataPackages + */ + void addDepedencyAndRestore(String path, List metadataPackages); + + /** + * 发布正式版本包 + * + * @param path 工程路径 + * @param version 工程版本号 + * @param repoId 仓库id + * @param revert 版本撤回 + * @param dependenciesVersion 依赖的统一版本号 + * @throws IOException IO异常 + */ + void deployReleaseMdVersion(String path, String version, String repoId, boolean revert, + String dependenciesVersion) throws IOException; + + /** + * 发布临时版本包 + * + * @param path 工程路径 + * @param version 工程版本号 + * @param repoId 仓库id + * @param revert 版本撤回 + * @throws IOException IO异常 + **/ + void deploySnapshotMdVersion(String path, String repoId, String version, boolean revert) throws IOException; + + /** + * 获取maven包最新版本 + * + * @param groupId groupId + * @param artifactId artifactId + * @return maven包最新版本 + */ + String getMavenPackageLatestVersion(String groupId, String artifactId); + + /** + * 根据包名获取maven包的GroupId和ArtifactId + * + * @param mdpkgName 元数据包名 + * @return maven依赖关系列表 + */ + MavenPackageRefs getGAByMdpkgName(String mdpkgName); + + /** + * 获取单个Maven包的版本列表 + * + * @param sourceId 包源标识 + * @param packName 包名 + * @return 版本列表 + */ + MavenComponents getVersionsOfSinglePackage(String sourceId, String packName); + + void batchOperate(String path, List operations); +} diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java similarity index 87% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java index 39993bc398b1b39e6c8cd258ba200c146e36ed44..d79fa61d3b0ffc21813afc478af934430659e124 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataProjectService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataProjectService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,20 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; - +package com.inspur.edp.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; import java.io.IOException; import java.util.List; import java.util.Map; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackageHeader; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.definition.entity.ProcessMode; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MavenPackageRefs; /** - * @author zhaoleitr - * 元数据工程服务 + * @author zhaoleitr 元数据工程服务 */ public interface MetadataProjectService { @@ -124,6 +124,8 @@ public interface MetadataProjectService { */ String getProjPath(String path); + String getAbsolutePath(String path); + /** * @param path 文件夹路径路径 * @param projPathList 工程路径列表 @@ -198,7 +200,6 @@ public interface MetadataProjectService { @Deprecated String getMavenUpdateFlag(String projPath); - /** * 获取工程类型(生成型 or 解析型) * @@ -229,4 +230,9 @@ public interface MetadataProjectService { String getBoPath(String path); boolean isInterpretation(String path); + + List getBOInfo(String[] boids); + + void changeProcessMode(String path, ProcessMode processMode); + } diff --git a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java similarity index 87% rename from model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java rename to model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java index 7881b5152b100b55c4408783f9fac529211cdb81..1009e79d7b269ed9b01fad0d5c1888509dce36b3 100644 --- a/model/framework/devtime-api/src/main/java/org/openatom/ubml/metamodel/framework/designtime/api/MetadataService.java +++ b/model/framework/devtime-api/src/main/java/com/inspur/edp/lcm/metadata/api/service/MetadataService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,21 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.metamodel.framework.designtime.api; - +package com.inspur.edp.lcm.metadata.api.service; + +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.common.definition.entity.IMdExtRuleContent; -import org.openatom.ubml.model.common.definition.entity.MetadataHeader; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.Metadata4Ref; -import org.openatom.ubml.model.framework.definition.entity.Metadata4RefDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataFilter; -import org.openatom.ubml.model.framework.definition.entity.MetadataIndexItemDto; -import org.openatom.ubml.model.framework.definition.entity.MetadataPackage; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataType; /** * @author zhaoleitr @@ -67,6 +67,14 @@ public interface MetadataService { */ GspMetadata loadMetadata(String metadataFileName, String path); + /** + * 根据元数据元数据路径,获取元数据 + * + * @param metadataPath 元数据文件路径,包含名称 + * @return 元数据内容实体 + */ + GspMetadata loadMetadata(String metadataPath); + /** * 根据元数据id和路径获取元数据内容,仅支持获取工程下的元数据 * @@ -293,8 +301,8 @@ public interface MetadataService { * @return 元数据索引信息传输列表 */ List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, - List metadataTypeList, boolean page, int pageSize, int pageIndex, - boolean isFilterByRefs, boolean conflictAvoidFlag); + List metadataTypeList, boolean page, int pageSize, int pageIndex, + boolean isFilterByRefs, boolean conflictAvoidFlag); /** * 获取本地元数据索引信息列表 @@ -308,7 +316,7 @@ public interface MetadataService { * @return */ List getLocalMetadataList(String text, String path, List metadataTypeList, - boolean page, int pageSize, int pageIndex); + boolean page, int pageSize, int pageIndex); /** * 根据元数据索引信息获取元数据信息 @@ -320,7 +328,7 @@ public interface MetadataService { * @return 元数据信息传输实体 */ Metadata4RefDto pickMetadataIndex(int scopeType, String currentPath, MetadataIndexItemDto metadataIndexDto, - boolean isNeedMdDto); + boolean isNeedMdDto); /** * 获取工程信息 diff --git a/model/framework/devtime-core/pom.xml b/model/framework/devtime-core/pom.xml index be598424768a2cc2f3f7bea1acf0d252b748a62e..fa21a7739b2ff18faa000ca43e975cf8ca9c4aad 100644 --- a/model/framework/devtime-core/pom.xml +++ b/model/framework/devtime-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -8,10 +24,87 @@ 0.9.0-SNAPSHOT 4.0.0 - ubml-model-framework-devtime-core ${project.version} - ubml-model-framework-devtime-core + + + io.iec.edp + caf-business-object-api + + + lombok + org.projectlombok + + + + + io.iec.edp + caf-boot-starter-context + + + com.inspur.edp + i18n-resource-api + + + lcm-metadata-api + com.inspur.edp + + + + + io.iec.edp + caf-sumgr-core + + + + com.inspur.edp + lcm-logging-service + + + com.inspur.edp + ide-setting-core + + + lcm-metadata-devcommon + com.inspur.edp + + + + + com.inspur.edp + metadata-to-java-context + + + lcm-metadata-api + com.inspur.edp + + + lcm-metadata-manager + com.inspur.edp + + + lcm-metadata-core + com.inspur.edp + + + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + lcm-metadata-api + com.inspur.edp + + + + + org.openatom.ubml + ubml-model-framework-runtime-spi + ${project.version} + + \ No newline at end of file diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..fdd83877a7cdf4a459ac0a8f04bfc93794dbc271 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectCoreService.java @@ -0,0 +1,58 @@ +/* + * 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.lcm.metadata.core; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.GspProjectConfigurationHelper; +import java.io.IOException; +import java.util.List; + +/** + * @author zhaoleitr + */ +public class GspProjectCoreService { + private final FileServiceImp fileService = new FileServiceImp(); + + public GspProject getGspProjectInfo(String absolutePath) { + if (absolutePath.isEmpty()) { + throw new RuntimeException("路径不能为空"); + } + String projPath = MetadataProjectCoreService.getCurrent().getProjPath(absolutePath); + String fullName = fileService.getCombinePath(projPath, Utils.getGspProjectName()); + if (!fileService.isFileExist(fullName)) { + throw new RuntimeException("文件" + fullName + "不存在"); + } + String projStr = fileService.fileRead(Utils.handlePath(fullName)); + + ObjectMapper objectMapper = Utils.getMapper(); + GspProject project; + try { + project = objectMapper.readValue(projStr, GspProject.class); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("序列化" + fullName + "失败", e); + } + return project; + } + + public List getGspProjectTypeInfo() { + return GspProjectConfigurationHelper.getInstance().getGspProjectConfigurations(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..b92b7d725c84347c062d137a65b974609aad4e0e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/GspProjectServiceImp.java @@ -0,0 +1,52 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * GSP工程服务 + * + * @author zhaoleitr + */ +public class GspProjectServiceImp implements GspProjectService { + + private GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + /** + * 获取GSP工程的基本信息 + * + * @param path 工程路径 + * @return Gsp工程 + */ + @Override + public GspProject getGspProjectInfo(String path) { + if (path.isEmpty()) { + throw new RuntimeException("路径不能为空"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + return gspProjectCoreService.getGspProjectInfo(absolutePath); + } + + @Override + public List getGspProjectTypeInfo() { + return gspProjectCoreService.getGspProjectTypeInfo(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..e183c77c064a94c43c6b1c474272165cb5b48412 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/I18nCoreService.java @@ -0,0 +1,215 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.i18n.resource.api.II18nResourceDTManager; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeHelper; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.nio.file.Paths; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +public class I18nCoreService { + private static I18nCoreService sigleton = null; + + private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + + private final String resourceMetadataType = "ResourceMetadata"; + private final String linguisticResourceMetadataType = "LinguisticResource"; + + public static I18nCoreService getInstance() { + if (sigleton == null) { + sigleton = new I18nCoreService(); + } + return sigleton; + } + + public GspMetadata extractResourceMetadata(GspMetadata metadata, String absolutePath) { + GspMetadata baseMetadata; + File metadataFile = new File(absolutePath); + if (metadata.getHeader().getTranslating()) { + baseMetadata = metadataCoreManager.loadMetadata(metadataFile.getName(), metadataFile.getParent()); + } else { + baseMetadata = metadata; + } + // 根据基础元数据抽取元数据 + GspMetadata resourceMetadata = buildResourceMetadata(baseMetadata, absolutePath); + String dirPath = metadataFile.getParent(); + // 建立基础元数据与资源元数据的关联关系 + MetadataReference ref = buildRefs(baseMetadata, resourceMetadata); + if (metadata.getRefs() != null && metadata.getRefs().stream().noneMatch(r -> r.getDependentMetadata().getId().equals(ref.getDependentMetadata().getId()))) { + metadata.getRefs().add(ref); + } + + String resouceMetadataPath = Paths.get(dirPath).resolve(resourceMetadata.getHeader().getFileName()).toString(); + if (metadataCoreManager.isMetadataExist(resouceMetadataPath)) { + metadataCoreManager.saveMetadata(resourceMetadata, resouceMetadataPath); + } else { + metadataCoreManager.createMetadata(dirPath, resourceMetadata); + } + + return resourceMetadata; + } + + public boolean isI18nMetadata(GspMetadata metadata) { + return metadata.getHeader().getTranslating(); + } + + private GspMetadata buildResourceMetadata(GspMetadata metadata, String absolutePath) { + I18nResource resouceItem = getResouceItem(metadata); + // 判断是否存在资源元数据 + String resourceMetadataFileName = getResourceMetadataFileName(metadata); + String resourceMetadataPath = Paths.get(new File(absolutePath).getParent()).resolve(resourceMetadataFileName).toString(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean metadataExist = metadataCoreManager.isMetadataExist(resourceMetadataPath); + GspMetadata resourceMetadata; + File file = new File(resourceMetadataPath); + if (metadataExist) { + resourceMetadata = metadataCoreManager.loadMetadata(resourceMetadataFileName, file.getParent()); + } else { + resourceMetadata = new GspMetadata(); + MetadataHeader header = new MetadataHeader(); + header.setId(UUID.randomUUID().toString()); + FileServiceImp fileService = new FileServiceImp(); + String fileNameWithoutExtension = fileService.getFileNameWithoutExtension(resourceMetadataFileName); + header.setCode(fileNameWithoutExtension); + header.setName(fileNameWithoutExtension); + header.setFileName(resourceMetadataFileName); + header.setNameSpace(metadata.getHeader().getNameSpace()); + header.setBizObjectId(metadata.getHeader().getBizObjectId()); + header.setType(resourceMetadataType); + resourceMetadata.setHeader(header); + } + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + i18nResourceDTManager.getResourceMetadata(resourceMetadata, resouceItem); + return resourceMetadata; + } + + private MetadataReference buildRefs(GspMetadata baseMetadata, GspMetadata resouceMetadata) { + MetadataReference metadataReference = new MetadataReference(); + metadataReference.setMetadata(baseMetadata.getHeader()); + metadataReference.setDependentMetadata(resouceMetadata.getHeader()); + if (baseMetadata.getRefs().stream().noneMatch(item -> item.getDependentMetadata().getId().equals(resouceMetadata.getHeader().getId()))) { + baseMetadata.getRefs().add(metadataReference); + } + return metadataReference; + } + + private I18nResource getResouceItem(GspMetadata metadata) { + MetadataI18nService manager = getI18nManager(metadata.getHeader().getType()); + I18nResource resourceItem = manager.getResourceItem(metadata); + return resourceItem; + } + + private MetadataI18nService getI18nManager(String type) { + MetadataI18nService i18nManager = I18nManagerHelper.getInstance().getI18nManager(type); + if (i18nManager == null) { + throw new RuntimeException("获取当前元数据国际化扩展实现类失败,当前元数据类型为" + type); + } + return i18nManager; + } + + private String getResourceMetadataFileName(GspMetadata metadata) { + String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); + String resourceMetadataSuffix = getMetadataSuffix(resourceMetadataType); + return metadata.getHeader().getCode() + metadataSuffix + resourceMetadataSuffix; + } + + private String getMetadataSuffix(String type) { + MetadataType metadataType = MetadataTypeHelper.getInstance().getMetadataTypes().stream().filter(mt -> type.equals(mt.getTypeCode())).findFirst().orElse(null); + Utils.checkNPE(metadataType, "此类型元数据:" + type + ",在配置文件中不存在。"); + return metadataType.getPostfix(); + } + + public void extractLanguageMetadata(GspMetadata metadata, GspMetadata resourceMetadata, String path) { + GspMetadata i18nResourceMetadata = buildResourceMetadata(metadata, path); + if (i18nResourceMetadata != null) { + i18nResourceMetadata.getHeader().setLanguage(metadata.getHeader().getLanguage()); + saveLanguageMetadata(metadata, resourceMetadata, i18nResourceMetadata, path); + } + } + + public GspMetadata getI18nMetadata(String fileName, String absolutePath, String language) { + GspMetadata metadata = metadataCoreManager.loadMetadata(fileName, absolutePath); + List i18nResourceList = getResourceWithMetadata(metadata, language); + MetadataI18nService i18nManager = I18nManagerHelper.getInstance().getI18nManager(metadata.getHeader().getType()); + if (i18nManager != null) { + return i18nManager.merge(metadata, i18nResourceList); + } + return metadata; + } + + private List getResourceWithMetadata(GspMetadata metadata, String language) { + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + List i18nResourceList = i18nResourceDTManager.getI18nResource(metadata, language); + List collect = i18nResourceList.stream().filter(resource -> resource.getLanguage().equals(language)).collect(Collectors.toList()); + return collect; + } + + private void saveLanguageMetadata(GspMetadata metadata, GspMetadata resourceMetadata, + GspMetadata i18nResourceMetadata, String path) { + // 判断是否存在资源元数据 + String languageMetadataFileName = getLanguageMetadataFileName(metadata); + String languageMetadataPath = Paths.get(new File(path).getParent()).resolve(languageMetadataFileName).toString(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean metadataExist = metadataCoreManager.isMetadataExist(languageMetadataPath); + GspMetadata languageMetadata; + File file = new File(languageMetadataPath); + if (metadataExist) { + languageMetadata = metadataCoreManager.loadMetadata(languageMetadataFileName, file.getParent()); + } else { + languageMetadata = new GspMetadata(); + MetadataHeader header = new MetadataHeader(); + header.setId(UUID.randomUUID().toString()); + FileServiceImp fileService = new FileServiceImp(); + String fileNameWithoutExtension = fileService.getFileNameWithoutExtension(languageMetadataFileName); + header.setCode(fileNameWithoutExtension); + header.setName(fileNameWithoutExtension); + header.setFileName(languageMetadataFileName); + header.setNameSpace(metadata.getHeader().getNameSpace()); + header.setBizObjectId(metadata.getHeader().getBizObjectId()); + header.setType(linguisticResourceMetadataType); + languageMetadata.setHeader(header); + } + II18nResourceDTManager i18nResourceDTManager = SpringBeanUtils.getBean(II18nResourceDTManager.class); + IMetadataContent content = i18nResourceDTManager.extract(resourceMetadata, i18nResourceMetadata); + languageMetadata.setContent(content); + if (metadataExist) { + metadataCoreManager.createMetadata(languageMetadataPath, languageMetadata); + } else { + metadataCoreManager.saveMetadata(languageMetadata, languageMetadataPath); + } + } + + private String getLanguageMetadataFileName(GspMetadata metadata) { + String language = metadata.getHeader().getLanguage(); + String metadataSuffix = getMetadataSuffix(metadata.getHeader().getType()); + String linguisticMetadataSuffix = getMetadataSuffix(linguisticResourceMetadataType); + return metadata.getHeader().getCode() + metadataSuffix + "." + language + linguisticMetadataSuffix; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java new file mode 100644 index 0000000000000000000000000000000000000000..8e43a42b6562ccae00e8b6ea19d3aeb6ce61895f --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MavenUtilsCore.java @@ -0,0 +1,160 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.configuration.MavenSettingsLoader; +import com.inspur.edp.lcm.metadata.common.logging.MvnStreamConsumer; +import com.inspur.edp.lcm.metadata.core.exception.MvnExceptionHandler; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.shared.invoker.DefaultInvocationRequest; +import org.apache.maven.shared.invoker.DefaultInvoker; +import org.apache.maven.shared.invoker.InvocationRequest; +import org.apache.maven.shared.invoker.InvocationResult; +import org.apache.maven.shared.utils.cli.CommandLineException; +import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author zhaoleitr + */ +public class MavenUtilsCore { + private static final Logger log = LoggerFactory.getLogger(MavenUtilsCore.class); + + private String mavenHomePath; + + private final DefaultInvoker invoker; + + private final InvocationRequest request; + + private final MvnStreamConsumer mvnStreamConsumer; + + private String errorMessage; + + public MavenUtilsCore() { + invoker = new DefaultInvoker(); + request = new DefaultInvocationRequest(); + mvnStreamConsumer = new MvnStreamConsumer(); + } + + public boolean exeMavenCommand(String javaCodePath, String mavenPath, String goal) { + initInvoker(); + + invoker.setWorkingDirectory(new File(javaCodePath)); + + List goals = handleGoul(goal, mavenPath); + request.setGoals(goals); + + try { + mvnStreamConsumer.setExceptionString(""); + InvocationResult result = invoker.execute(request); + int resultNum = result.getExitCode(); + if (resultNum == 0) { + return true; + } + + if (resultNum == 1) { + final String exceptionString = mvnStreamConsumer.getExceptionString(); + if (!exceptionString.isEmpty()) { + MvnExceptionHandler mvnExceptionHandler = new MvnExceptionHandler(); + errorMessage = ""; + errorMessage = mvnExceptionHandler.handleMessage(exceptionString); + errorMessage = errorMessage.isEmpty() ? "maven编译失败,具体错误请参考日志服务[ERROR]部分" : errorMessage; + } + + CommandLineException executionException = result.getExecutionException(); + if (executionException != null) { + throw executionException; + } + return false; + } + } catch (Exception e) { + log.error("执行maven命令失败", e); + e.printStackTrace(); + } + return false; + } + + public String getLocalRepository() { + try { + String localRepository = MavenSettingsLoader.getSettings().getLocalRepository(); + if (localRepository != null) { + return localRepository; + } + } catch (IOException | XmlPullParserException e) { + throw new RuntimeException("获取maven本地仓库地址出错,请检查settings.xml配置", e); + } + return null; + } + + public String getErrorMessage() { + return errorMessage; + } + + private void initMavenHomePath() { + if (!StringUtils.isEmpty(mavenHomePath)) { + return; + } + + if (System.getenv("MAVEN_HOME") != null) { + mavenHomePath = System.getenv("MAVEN_HOME"); + } else if (System.getenv("M2_HOME") != null) { + mavenHomePath = System.getenv("M2_HOME"); + + invoker.setMavenHome(new File(System.getenv("M2_HOME"))); + } else { + String systemPath = System.getenv("Path"); + if (systemPath != null) { + String[] paths = systemPath.split("\\;"); + for (String path : paths) { + if (path.contains("maven")) { + mavenHomePath = path.substring(0, path.length() - 4); + } + } + } + } + if (StringUtils.isEmpty(mavenHomePath)) { + throw new IllegalArgumentException("请配置maven环境变量!MAVEN_HOME=...."); + } + } + + private List handleGoul(String goal, String mavenPath) { + List goals = new ArrayList<>(); + + StringBuilder goalSb = new StringBuilder(goal); + String settingsPath = mavenPath + File.separator + "config" + File.separator + "settings.xml"; + FileServiceImp fileService = new FileServiceImp(); + if (fileService.isFileExist(settingsPath)) { + goalSb.append(" -s ").append(settingsPath); + } else { + log.warn("配置文件" + settingsPath + "不存在,使用默认settings.xml配置"); + } + + goals.add(goalSb.toString()); + return goals; + } + + private void initInvoker() { + initMavenHomePath(); + invoker.setMavenHome(new File(mavenHomePath)); + request.setOutputHandler(mvnStreamConsumer).setBatchMode(true); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java new file mode 100644 index 0000000000000000000000000000000000000000..959702ba0b41be50b01d2b3960e0025cc93d9a9b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -0,0 +1,1331 @@ +/* + * 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.lcm.metadata.core; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.ConfigData.CommonConfigData; +import com.inspur.edp.lcm.metadata.api.ConfigData.MetadataConfiguration; +import com.inspur.edp.lcm.metadata.api.context.RefCommonContext; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageVersion; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.LocalMetadataIndexItem; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexRepoItemDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoFilter; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoWithVersion; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataMavenInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageSourceDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PageMetadataInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoFilterWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoWithVersionWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataMavenInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PageMetadataInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.ContentManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MavenSourceRuleHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataConfigurationHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataTypeHelper; +import com.inspur.edp.lcm.metadata.common.configuration.ReferenceManagerHelper; +import com.inspur.edp.lcm.metadata.core.event.DirEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataCreateEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataEventBroker; +import com.inspur.edp.lcm.metadata.core.manager.IndexServerManager; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.core.refi18n.IRefI18nFilter; +import com.inspur.edp.lcm.metadata.core.refi18n.RefI18nMetadataFactory; +import com.inspur.edp.lcm.metadata.spi.IMetadataReferenceManager; +import com.inspur.edp.lcm.metadata.spi.MetadataContentManager; +import com.inspur.edp.lcm.metadata.spi.event.DirEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import org.apache.commons.collections.CollectionUtils; +import org.codehaus.plexus.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author zhaoleitr + */ +public class MetadataCoreManager { + private static final Logger log = LoggerFactory.getLogger(MetadataCoreManager.class); + + private final FileServiceImp fileService = new FileServiceImp(); + private final MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + private final GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + private final PackageCoreService packageCoreService = new PackageCoreService(); + private final Lock lock = new ReentrantLock(); + private static MetadataCoreManager current; + + public static MetadataCoreManager getCurrent() { + if (current == null) { + current = new MetadataCoreManager(); + } + return current; + } + + public void initializeMetadataEntity(GspMetadata metadata) { + metadata.getHeader().setId(UUID.randomUUID().toString()); + MetadataContentManager manager = ContentManagerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (manager != null) { + manager.build(metadata); + } + } + + public void createMetadata(String absolutePath, GspMetadata metadata) { + // 元数据名称 + String suffix = MetadataTypeHelper.getInstance().getMetadataType(metadata.getHeader().getType()).getPostfix(); + String name = metadata.getHeader().getCode() + suffix; + String fullPath = fileService.getCombinePath(absolutePath, name); + if (isMetadataExist(fullPath)) { + throw new RuntimeException("元数据目录" + absolutePath + "已存在元数据" + name); + } + + // 组装依赖 + buildMetadataRef(metadata); + + // 事件准备 + MetadataCreateEventBroker broker = SpringBeanUtils.getBean(MetadataCreateEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadata); + args.setPath(absolutePath); + + // 2. 保存前事件 + broker.fireMetadataCreatingEvent(args); + + RepositoryFactory.getInstance().getMetadataRepository().create(metadata, fullPath); + + // TODO创建后,需要清除元数据缓存 + // 4. 保存后事件 + broker.fireMetadataCreatedEvent(args); + } + + public void saveMetadata(GspMetadata metadata, String path) { + String dirPath = new File(path).getParent(); + + // 设置上下文路径 + Utils.setMetadataPath(dirPath); + + // 1. 组装元数据依赖关系节点 + buildMetadataRef(metadata); + + // 事件准备 + MetadataEventBroker broker = SpringBeanUtils.getBean(MetadataEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadata); + args.setPath(dirPath); + + // 2. 保存前事件 + broker.fireMetadataSavingEvent(args); + + // 获取元数据的配置信息 + MetadataConfiguration metadataConfiguration = MetadataConfigurationHelper.getInstance().getMetadataConfigurationData(metadata.getHeader().getType()); + CommonConfigData commonData = metadataConfiguration.getCommon(); + // 资源元数据 + I18nCoreService i18nCoreService = new I18nCoreService(); + if (i18nCoreService.isI18nMetadata(metadata)) { + GspMetadata resourceMetadata = i18nCoreService.extractResourceMetadata(metadata, path); + i18nCoreService.extractLanguageMetadata(metadata, resourceMetadata, path); + return; + } + + // 普通元数据需要抽取资源元数据 + if (commonData.isCreatingResourceMetadata() && !i18nCoreService.isI18nMetadata(metadata)) { + i18nCoreService.extractResourceMetadata(metadata, path); + } + + // 3. 把元数据保存到文件 + RepositoryFactory.getInstance().getMetadataRepository().save(metadata, path); + + // 4. 保存后事件 + broker.fireMetadataSavedEvent(args); + } + + public GspMetadata loadMetadata(String metadataFileName, String absolutePath) { + String metadataPath = fileService.getCombinePath(absolutePath, metadataFileName); + GspMetadata metadata = loadMetadata(metadataPath); + return metadata; + } + + public GspMetadata loadMetadata(String absolutePath) { + GspMetadata metadata; + if (!isMetadataExist(absolutePath)) { + throw new RuntimeException(String.format("file not exist, filePath is %s", absolutePath)); + } + try { + RefCommonContext.setInvokeAtDesignTime(true); + metadata = RepositoryFactory.getInstance().getMetadataRepository().load(absolutePath); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + RefCommonContext.setInvokeAtDesignTime(false); + } + return metadata; + } + + public GspMetadata loadMetadataByMetadataId(String metadataId, String absolutePath) { + final List metadataList = getMetadataList(absolutePath); + GspMetadata metadata = metadataList.stream().filter(md -> md.getHeader().getId().equals(metadataId)).findFirst().orElse(null); + Utils.checkNPE(metadata, "工程" + absolutePath + "中找不到元数据" + metadataId); + metadata = loadMetadata(metadata.getHeader().getFileName(), metadata.getRelativePath()); + return metadata; + } + + public GspMetadata loadMetadataInBo(String absoluteMetadataPath, String absoluteProjPath) { + absoluteProjPath = metadataProjectCoreService.getProjPath(absoluteProjPath); + GspProject currentGspProjectInfo = gspProjectCoreService.getGspProjectInfo(absoluteProjPath); + GspProject metadataGspProjectInfo = gspProjectCoreService.getGspProjectInfo(absoluteMetadataPath); + if (!currentGspProjectInfo.getMetadataPackageName().equals(metadataGspProjectInfo.getMetadataPackageName())) { + updateBoRef(metadataGspProjectInfo, absoluteMetadataPath, absoluteProjPath); + } + File file = new File(absoluteMetadataPath); + return loadMetadata(file.getName(), file.getParent()); + } + + private void updateBoRef(GspProject gspProjInfo, String metadataFullPath, String currentProjPath) { + String projectPath = Paths.get("..").resolve(gspProjInfo.getMetadataProjectName().toLowerCase()).toString(); + updateProjectReference(currentProjPath, gspProjInfo.getMetadataPackageName() + Utils.getMetadataPackageExtension(), projectPath); + + checkCircle(currentProjPath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataFullPath); + MetadataProject currentMetadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateRefs(currentProjPath, currentMetadataProject, metadataProject.getMetadataPackageInfo()); + + String[] projectNameSpace = gspProjInfo.getProjectNameSpace().split("\\."); + String groupId; + if (projectNameSpace.length == 1) { + groupId = "com." + projectNameSpace[0].toLowerCase(); + } else { + groupId = "com." + (projectNameSpace[0] + "." + projectNameSpace[1]).toLowerCase(); + } + String artifactId = (gspProjInfo.getAppCode() + "-" + gspProjInfo.getServiceUnitCode() + "-" + gspProjInfo.getMetadataProjectName().replace("bo-", "") + "-api").toLowerCase(); + String packageVersion = "m0.1.0-SNAPSHOT"; + updateMavenReference(currentProjPath, groupId, artifactId, packageVersion); + } + + private void updateMavenReference(String currentProjPath, String groupId, String artifactId, + String packageVersion) { + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + mavenPackageRefs.setVersion(packageVersion); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateMavenRefs(currentProjPath, metadataProject, mavenPackageRefs); + } + + private void checkCircle(String currentProjPath) { + List chainOfRef = new ArrayList<>(); + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(currentProjPath); + + chainOfRef.add(gspProjectInfo.getMetadataProjectName().toLowerCase()); + try { + getCircle(currentProjPath, chainOfRef); + } catch (Exception e) { + throw e; + } + } + + private void getCircle(String projectPath, List chainOfRef) { + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(projectPath); + String curProjectName = metadataProject.getName().toLowerCase(); + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + metadataProject.getProjectRefs().forEach(projRef -> { + String projectName = projRef.getProjectPath().replace("..\\", "").toLowerCase(); + String chain = chainOfRef.stream().filter(r -> r.endsWith(curProjectName) && Arrays.asList(r.split("->")).contains(projectName)).findFirst().orElse(null); + if (chain != null) { + chain += "->" + projectName; + throw new RuntimeException("检测到循环引用:" + chain); + } + List refs = chainOfRef.stream().filter(r -> r.endsWith(curProjectName)).collect(Collectors.toList()); + refs.forEach(r -> chainOfRef.add(r + "->" + projectName)); + List refsToRemove = chainOfRef.stream().filter(r -> r.endsWith(curProjectName)).collect(Collectors.toList()); + refsToRemove.forEach(r -> chainOfRef.remove(r)); + + String refProjectPath = Paths.get(metadataProjectCoreService.getProjPath(projectPath)).resolve(projRef.getProjectPath()).toString(); + getCircle(refProjectPath, chainOfRef); + }); + } + } + + private void updateProjectReference(String currentProjPath, String packageName, String packagePath) { + ProjectHeader projectHeader = new ProjectHeader(); + projectHeader.setName(fileService.getFileNameWithoutExtension(packageName)); + projectHeader.setProjectPath(packagePath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(currentProjPath); + metadataProjectCoreService.updateProjectRefs(currentProjPath, metadataProject, projectHeader); + } + + public GspMetadata getRefMetadata(String metadataID, String absolutePath) { + if (absolutePath != null && !absolutePath.isEmpty()) { + Utils.setMetadataPath(absolutePath); + } + RefCommonServiceImp refCommonService = new RefCommonServiceImp(); + return refCommonService.getRefMetadata(metadataID); + } + + public GspMetadata getMetadataWithoutContent(String absolutePath) { + return RepositoryFactory.getInstance().getMetadataRepository().getMetadataWithoutContent(absolutePath); + } + + public void deleteMetadata(String absolutePath, String metadataFileName) { + String fullPath = fileService.getCombinePath(absolutePath, metadataFileName); + if (!isMetadataExist(fullPath)) { + return; + } + // 如果不是元数据,则直接删除文件,如ts文件 + if (!isMetadata(fullPath)) { + try { + fileService.fileDelete(fullPath); + } catch (IOException e) { + e.printStackTrace(); + } + return; + } + + GspMetadata metadataWithoutContent = getMetadataWithoutContent(fullPath); + + // 事件准备 + MetadataEventBroker broker = SpringBeanUtils.getBean(MetadataEventBroker.class); + MetadataEventArgs args = new MetadataEventArgs(); + args.setMetadata(metadataWithoutContent); + args.setPath(fullPath); + + // 删除前事件 + broker.fireMetadataDeletingEvent(args); + + RepositoryFactory.getInstance().getMetadataRepository().delete(fullPath); + + broker.fireMetadataDeletedEvent(args); + } + + public void deleteFolder(String absolutePath) { + DirEventBroker broker = SpringBeanUtils.getBean(DirEventBroker.class); + DirEventArgs args = new DirEventArgs(); + args.setPath(absolutePath); + + broker.fireDirDeletingEvent(args); + + try { + fileService.deleteAllFilesUnderDirectory(absolutePath); + } catch (IOException e) { + e.printStackTrace(); + } + + broker.fireDirDeletedEvent(args); + } + + public void renameMetadata(String oldFileName, String newFileName, String absolutePath) { + if (oldFileName.equals(newFileName)) { + return; + } + String oldFilePath = fileService.getCombinePath(absolutePath, oldFileName); + if (!isMetadataExist(oldFilePath)) { + throw new RuntimeException("元数据不存在:" + oldFilePath); + } + String newFilePath = fileService.getCombinePath(absolutePath, newFileName); + if (!isMetadataExist(newFilePath)) { + throw new RuntimeException("新元数据已存在:" + newFilePath); + } + + validateMetadataCode(newFileName.substring(0, newFileName.lastIndexOf("\\.")), false); + RepositoryFactory.getInstance().getMetadataRepository().rename(oldFilePath, newFilePath); + + // 修改文件内容,将 元数据头结点元数据名称一起修改 + GspMetadata metadata = loadMetadata(newFileName, absolutePath); + metadata.getHeader().setName(newFileName.substring(0, newFileName.lastIndexOf("\\."))); + RepositoryFactory.getInstance().getMetadataRepository().save(metadata, newFilePath); + } + + private void validateMetadataCode(String code, boolean isLanguageMetadata) { + if (code.length() > 255) { + throw new RuntimeException("编号不可长于255个字符:" + code); + } + String rexStr = isLanguageMetadata ? "^[a-zA-Z_-\\x7f-\\xff][a-zA-Z0-9-._\\x7f-\\xff]*$" : "^[a-zA-Z_\\x7f-\\xff][a-zA-Z0-9._\\x7f-\\xff]*$"; + if (!Pattern.matches(rexStr, code)) { + throw new RuntimeException("编号含有违法字符:" + code); + } + } + + public List getMetadataListInBo(String projPath, List metadataTypes) { + List projectsInBo = metadataProjectCoreService.getProjectsInBo(projPath); + + // 生成型只能引用生成型,解析型可以引用生成型和解析型 + final MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + boolean isGenerationFlag = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + + if (isGenerationFlag) { + projectsInBo = projectsInBo.stream().filter(project -> { + MetadataProject metadataProjInfoInBo = metadataProjectCoreService.getMetadataProjInfo(project); + return metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + }).collect(Collectors.toList()); + } + + // 获取列表,生成型只能引用生成型,解析型可以引用生成型和解析型 + List metadataList = new ArrayList<>(); + projectsInBo.forEach(project -> { + MetadataProject metadataProjInfoInBo = metadataProjectCoreService.getMetadataProjInfo(project); + if (isGenerationFlag) { + boolean isEachProjectGenerationFlag = metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + if (!isEachProjectGenerationFlag) { + return; + } + } + String metadataProjPath = project + File.separator + Utils.getMetadataProjPath(); + List result = getMetadataList(metadataProjPath, metadataTypes); + for (GspMetadata metadata : result) { + MetadataDto metadataDto = MetadataDtoConverter.asDto(metadata); + metadataDto.setProjectName(new File(project).getName()); + metadataDto.setProcessMode(metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION.toString() : metadataProjInfoInBo.getMetadataPackageInfo().getProcessMode().toString()); + metadataList.add(metadataDto); + } + }); + return metadataList; + } + + public List getMetadataList(String absolutePath, List metadataTypes) { + // 编译时缓存可用 + List metadataList = MetadataDevCacheManager.getMetadataListInProject(absolutePath); + if (metadataList != null) { + return metadataList; + } + metadataList = new ArrayList<>(); + List paths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(paths, absolutePath); + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + List metadataTypeList = (metadataTypes == null || metadataTypes.size() == 0) ? metadataAllTypes : metadataTypes; + for (String path : paths) { + String extension = fileService.getExtension(path).toLowerCase(); + String result = metadataTypeList.stream().filter(item -> item.toLowerCase().equals(extension)).findAny().orElse(null); + if (result != null) { + GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + if (metadataWithoutContent != null) { + metadataList.add(metadataWithoutContent); + } + } + } + return metadataList; + } + + public List getMetadataTypeList() { + return MetadataTypeHelper.getInstance().getMetadataTypes(); + } + + public boolean isMetadataExist(String absolutePath) { + return fileService.isFileExist(absolutePath); + } + + public boolean isMetadataExistInProject(String projPath, String metadataID) { + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + if (Objects.isNull(metadataProjInfo)) { + return false; + } + List metadataList = getMetadataList(metadataProjInfo.getProjectPath()); + return metadataList.stream().anyMatch(metadata -> metadata.getHeader().getId().equals(metadataID)); + } + + public String getRefPath(String absolutePath) { + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + return fileService.getCombinePath(metadataProjInfo.getProjectPath(), Utils.getMetadataBinPath()); + } + + public MetadataHeader getRefMetadataHeader(String metadataID, String absolutePath) { + GspMetadata metadata = getRefMetadata(metadataID, absolutePath); + Utils.checkNPE(metadata, "在工程" + absolutePath + "及其依赖中,无法找到元数据" + metadataID); + return metadata.getHeader(); + } + + public List getResourceMetadata(String metadataId, String proPath) { + final List metadataList = getMetadataList(proPath); + GspMetadata metadata = new GspMetadata(); + if (metadataList != null) { + for (GspMetadata item : metadataList) { + if (item.getHeader().getId().equals(metadataId)) { + metadata = item; + break; + } + } + } + List metadataHeader = new ArrayList<>(); + if (metadata.getRefs() != null) { + metadata.getRefs().forEach(item -> { + if ("ResourceMetadata".equals(item.getDependentMetadata().getType())) { + metadataHeader.add(item.getDependentMetadata()); + } + }); + } + return metadataHeader; + } + + public void setMetadataUri(String absolutePath) { + Utils.setMetadataPath(absolutePath); + } + + public GspMetadata getI18nMetadata(String fileName, String absolutePath, String language) { + I18nCoreService i18nCoreService = new I18nCoreService(); + return i18nCoreService.getI18nMetadata(fileName, absolutePath, language); + } + + public List getRefI18nMetadata(String resourceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + RefI18nMetadataFactory refI18nMetadataFactory = new RefI18nMetadataFactory(); + IRefI18nFilter filter = refI18nMetadataFactory.createFilter(resourceMdID, path); + return filter.getRefI18nMetadata(resourceMdID, resourceFileName, path, mavenPath, packagePath); + } + + public List getMetadataList(String absolutePath) { + //先从缓存获取 + String projPath = metadataProjectCoreService.getProjPath(absolutePath); + if (StringUtils.isEmpty(projPath)) { + return null; + } + String projectName = new File(projPath).getName(); + List metadataListCache = MetadataDevCacheManager.getMetadataListInProject(projectName); + if (!CollectionUtils.isEmpty(metadataListCache)) { + return metadataListCache; + } + List metadataList = new ArrayList<>(); + List paths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(paths, absolutePath); + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + for (String path : paths) { + //获取文件后缀名 + String extension = fileService.getExtension(path).toLowerCase(); + boolean flag = false; + for (String item : metadataAllTypes) { + if (item.toLowerCase().equals(extension)) { + flag = true; + break; + } + } + if (flag) { + GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + if (metadataWithoutContent != null) { + metadataList.add(metadataWithoutContent); + } + } + } +// if (!CollectionUtils.isEmpty(metadataList)) { +// MetadataDevCacheManager.setMetadataListInProjectCache(projectName, metadataList); +// } + return metadataList; + } + + public MetadataPackage getMetadataPackageInfo(String packageFileName, String packagePath) { + String packageFullName = Utils.handlePackageName(packageFileName); + + String absolutePath = fileService.getCombinePath(packagePath, packageFullName); + if (fileService.isFileExist(absolutePath)) { + MetadataPackage metadataPackage = getMetadataPackage(packagePath, absolutePath); + metadataPackage.getHeader().setLocation(Utils.handlePath(packagePath)); + return metadataPackage; + } else { + List dirs = fileService.getDirectorys(packagePath); + for (File dir : dirs) { + String targetFile = fileService.getCombinePath(dir.getPath(), packageFullName); + if (fileService.isFileExist(targetFile)) { + MetadataPackage metadataPackage = getMetadataPackage(packagePath, targetFile); + metadataPackage.getHeader().setLocation(Utils.handlePath(dir.getPath())); + return metadataPackage; + } + } + } + + return null; + } + + public List getMetadataListByRefedMetadataId(String path, String metadataId) { + List metadataList = new ArrayList<>(); + List projPaths = metadataProjectCoreService.getProjPathsInBoByRefedProjPath(path); + projPaths.add(path); + projPaths.forEach(projPath -> { + List metadataListInProject = getMetadataList(projPath); + metadataList.addAll(metadataListInProject.stream().filter(metadata -> { + if (metadata.getRefs() == null) { + return false; + } + return metadata.getRefs().stream().anyMatch(ref -> ref.getDependentMetadata().getId().equals(metadataId)); + }).collect(Collectors.toList())); + }); + return metadataList; + } + + public boolean isMetadataRefed(String path) { + if (!isMetadata(path)) { + return false; + } + final GspMetadata metadataWithoutContent = getMetadataWithoutContent(path); + final String projPath = metadataProjectCoreService.getProjPath(path); + final Map> metadataHashMapByRefedMetadataId = getMetadataHashMapByRefedMetadataId(projPath, metadataWithoutContent.getHeader().getId()); + boolean isMetadataRefedFlag = metadataHashMapByRefedMetadataId != null && metadataHashMapByRefedMetadataId.size() > 0; + if (isMetadataRefedFlag) { + metadataHashMapByRefedMetadataId.forEach((projName, metadataList) -> { + metadataList.forEach(metadata -> { + String log = "[LCM Warning]工程【" + projName + "】中的元数据【" + metadata.getHeader().getFileName() + "】依赖了此元数据"; + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + }); + }); + } + return isMetadataRefedFlag; + } + + private boolean isMetadata(String path) { + List metadataTypeList = getMetadataTypeList(); + return metadataTypeList.stream().anyMatch(metadataType -> path.endsWith(metadataType.getPostfix())); + } + + private Map> getMetadataHashMapByRefedMetadataId(String path, String metadataId) { + Map> metadataHashMap = new HashMap<>(); + List projPaths = metadataProjectCoreService.getProjPathsInBoByRefedProjPath(path); + projPaths.add(path); + projPaths.forEach(projPath -> { + List metadataListInProject = getMetadataList(projPath); + List metadataList = metadataListInProject.stream().filter(metadata -> { + if (metadata.getRefs() == null) { + return false; + } + return metadata.getRefs().stream().anyMatch(ref -> ref.getDependentMetadata().getId().equals(metadataId)); + }).collect(Collectors.toList()); + if (metadataList != null && metadataList.size() > 0) { + metadataHashMap.put(new File(projPath).getName(), metadataList); + } + }); + return metadataHashMap; + } + + public Metadata4Ref getMetadataFromPackage(String packageName, String packagePath, String metadataId) { + String packageFullName = Utils.handlePackageName(packageName); + + MetadataPackage packageInfo = getMetadataPackageInfo(packageFullName, packagePath); + if (packageInfo == null) { + return null; + } + GspMetadata metadata = null; + String absolutePath = fileService.getCombinePath(packageInfo.getHeader().getLocation(), packageFullName); + for (GspMetadata item : packageInfo.getMetadataList()) { + if (item.getHeader().getId().equals(metadataId)) { + + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(absolutePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(absolutePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zin = new ZipInputStream(in, utf8); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(ze), utf8)); + try { + if (fileService.getFileName(ze.toString()).equals(fileService.getFileName(item.getRelativePath()))) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + } + } catch (IOException e) { +// e.printStackTrace(); + throw new IOException("读取元数据失败", e); + } finally { + br.close(); + } + } + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + metadata = new MetadataSerializer().deserialize(sb.toString(), GspMetadata.class); + + } catch (IOException | RuntimeException e) { + log.error("反序列化元数据失败,路径为:" + packagePath + "包名为:" + packageName, e); +// e.printStackTrace(); + throw new RuntimeException("反序列化元数据失败,路径为:" + packagePath + "包名为:" + packageName, e); + } finally { + lock.unlock(); +// } + } + } + } + Metadata4Ref metadataDt = new Metadata4Ref(); + metadataDt.setPackageHeader(packageInfo.getHeader()); + metadataDt.setMetadata(metadata); + + return metadataDt; + } + + public MetadataProject getMetadataProjInfo(String absolutePath) { + String assemblyName = ""; + MetadataProject project; + String projPath = MetadataProjectCoreService.getCurrent().getProjPath(absolutePath); + String metadataPath = fileService.getCombinePath(projPath, Utils.getMetadataProjPath()); + if (fileService.isDirectoryExist(metadataPath)) { + GspProject gspProject = new GspProjectCoreService().getGspProjectInfo(absolutePath); + assemblyName = gspProject.getMetadataPackageName(); + } + project = metadataProjectCoreService.getMetadataProjInfo(projPath); + project.setCsprojAssemblyName(assemblyName); + return project; + } + + public List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, + List typeList, boolean page, int pageSize, int pageIndex, boolean isFilterByRefs, + boolean conflictAvoidFlag) { + Utils.checkEmpty(path, "获取的路径为空:" + path); + MetadataProject metadataProjInfo = getMetadataProjInfo(path); + + if (metadataProjInfo != null) { + if (isFilterByRefs && (metadataProjInfo.getMavenPackageRefs() == null || metadataProjInfo.getMavenPackageRefs().size() == 0)) { + return new ArrayList<>(); + } + } + + try { + String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServerWithProcessMode(); +// pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); + ProcessMode processMode = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION : metadataProjInfo.getMetadataPackageInfo().getProcessMode(); + MetadataInfoFilterWithProcessMode filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs, processMode); + PageMetadataInfoWithProcessMode pageMetadataInfoWithProcessMode = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); + List metadataInfos = pageMetadataInfoWithProcessMode.getMetadataInfos(); + return buildIndexDtoFromMetadataInfoWithVersionWithProcessMode(metadataInfos); + + } catch (Exception e) { + String pageWebapiOfIndexServer = IndexServerManager.getInstance().getPageWebapiOfIndexServer(); +// pageWebapiOfIndexServer = pageWebapiOfIndexServer.replace("10.24.15.33", "localhost"); + MetadataInfoFilter filter = getMetadataInfoFilter(text, typeList, page, pageSize, pageIndex, selectedPackageSource, path, isFilterByRefs); + PageMetadataInfo pageMetadataInfo = RestTemplateService.instance.getObjectByPost(pageWebapiOfIndexServer, filter); + List metadataInfos = pageMetadataInfo.getMetadataInfos(); + return buildIndexDtoFromMetadataInfoWithVersion(metadataInfos); + } + } + + public void throwMetadataNotFoundException(String metadataId) { + final MetadataInfoWithVersion metadataInfoWithVersion = getIndexByMetadataId(metadataId); + StringBuilder sb = new StringBuilder(); + sb.append("未找到元数据:"); + sb.append(metadataId); + if (metadataInfoWithVersion != null) { + sb.append(",元数据Code为:"); + sb.append(metadataInfoWithVersion.getMetadataCode()); + sb.append(",元数据包名为:"); + sb.append(metadataInfoWithVersion.getPackageCode()).append(Utils.getMetadataPackageExtension()); + } + String msg = sb.toString(); + log.error(msg); + throw new RuntimeException(msg); + } + + private MetadataInfoWithVersion getIndexByMetadataId(String metadataId) { + String metadataWebapiOfIndexServer = IndexServerManager.getInstance().getMetadataWebapiOfIndexServer() + "?metadataId=" + metadataId; + List metadataInfoWithVersionList = RestTemplateService.instance.getObjectByGet(metadataWebapiOfIndexServer); + if (metadataInfoWithVersionList != null && metadataInfoWithVersionList.size() > 0) { + return metadataInfoWithVersionList.get(0); + } + return null; + } + + public List getLocalMetadataList(String text, String absolutePath, List typeList, + boolean page, int pageSize, int pageIndex, String packagePath) { + List mds = new ArrayList<>(); + // 根据索引,返回元数据dto列表 + List localMdIndexList = MetadataIndexCacheService.getInstance().getLocalPackagesMdIndexDic(packagePath); + + if (localMdIndexList == null || localMdIndexList.size() < 1) { + return mds; + } + + // 解析型 + final MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + boolean isGenerationFlag = metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null || metadataProjInfo.getMetadataPackageInfo().getProcessMode().equals(ProcessMode.GENERATION); + + if (isGenerationFlag) { + localMdIndexList = localMdIndexList.stream().filter(localMetadataIndexItem -> localMetadataIndexItem.getProcessMode() == null || localMetadataIndexItem.getProcessMode().equals(ProcessMode.GENERATION.toString())).collect(Collectors.toList()); + } + + String packageNameExcluded = ""; + if (!(absolutePath == null || absolutePath.isEmpty())) { + MetadataProject projInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + if (projInfo != null) { + packageNameExcluded = projInfo.getMetadataPackageInfo().getName(); + } + if (!page) { + for (LocalMetadataIndexItem localMdIndex : localMdIndexList) { + if (isPackMd(localMdIndex, typeList, text, packageNameExcluded)) { + MetadataIndexItemDto dto = assemblyMetadataIndexItemDto(localMdIndex); + mds.add(dto); + } + } + } else { + int count = 0; + int skip = pageIndex * pageSize; + int max = pageSize + skip; + for (LocalMetadataIndexItem localMdIndex : localMdIndexList) { + if (count >= max) { + break; + } + if (isPackMd(localMdIndex, typeList, text, packageNameExcluded)) { + count++; + if (count <= skip) { + continue; + } + MetadataIndexItemDto dto = assemblyMetadataIndexItemDto(localMdIndex); + mds.add(dto); + } + } + + } + } + return mds; + } + + public Metadata4RefDto pickMetadataIndex(int scopeType, String absolutePath, + MetadataIndexItemDto metadataIndexItemDto, boolean isNeedMdDto, String packagePath, String mavenPath) { + Metadata4Ref result; + switch (scopeType) { + case 1: + result = pickLocalMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath); + break; + // 远程maven中的元数据包 + case 2: + result = pickRemoteMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath, mavenPath); + break; + // 已引用的元数据包 + case 3: + result = pickRefedMdIndex(absolutePath, metadataIndexItemDto, isNeedMdDto, packagePath, mavenPath); + break; + default: + throw new IllegalArgumentException("Scope is invalid."); + } + if (result == null) { + return null; + } + MetadataDto metadataDto = MetadataDtoConverter.asDto(result.getMetadata()); + Metadata4RefDto dto = new Metadata4RefDto(); + dto.setPackageHeader(result.getPackageHeader()); + dto.setMetadata(metadataDto); + return dto; + } + + public String getIndexServerStatus(String ip, String port) { + final String testStatusWebapiIndexServer = IndexServerManager.getInstance().getTestStatusWebapiOfIndexServer(ip, port); + return RestTemplateService.instance.getStatusByGet(testStatusWebapiIndexServer); + } + + public void buildMetadataRef(GspMetadata metadata) { + //TODO:考虑添加依赖关系是否变更标志,现在每次都需要获取依赖关系保存 + //构造元数据依赖关系 + IMetadataReferenceManager refManager = ReferenceManagerHelper.getInstance().getManager(metadata.getHeader().getType()); + if (refManager != null) { + List refsCollection = refManager.getConstraint(metadata); + metadata.setRefs(refsCollection); + } + } + + private Metadata4Ref pickRefedMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath, String mavenPath) { + validateRemoteMdIndex(metadataIndexItemDto); + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + + String groupId = metadataIndexItemDto.getRepoPkg().get(0).getGroupId(); + String artifactId = metadataIndexItemDto.getRepoPkg().get(0).getArtifactId(); + String version = metadataIndexItemDto.getRepoPkg().get(0).getVersion(); + + MavenPackageRefs ref = new MavenPackageRefs(); + ref.setGroupId(groupId); + ref.setArtifactId(artifactId); + ref.setVersion(version); + boolean installFlag = packageCoreService.getInstallFlag(ref, false, mavenPath, packagePath); + if (installFlag) { + try { + packageCoreService.installMdpkg(groupId, artifactId, version, currentPath, true, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(mavenPath, groupId + '-' + artifactId + '-' + version); + metadata = getMetadataFromPackage(metadataIndexItemDto.getMdPkgName(), metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的原数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + return metadata; + } + + private Metadata4Ref pickRemoteMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath, String mavenPath) { + validateRemoteMdIndex(metadataIndexItemDto); + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + + String groupId = metadataIndexItemDto.getRepoPkg().get(0).getGroupId(); + String artifactId = metadataIndexItemDto.getRepoPkg().get(0).getArtifactId(); + String version = metadataIndexItemDto.getRepoPkg().get(0).getVersion(); + + MavenPackageRefs ref = new MavenPackageRefs(); + ref.setGroupId(groupId); + ref.setArtifactId(artifactId); + ref.setVersion(version); + + // 安装的包是生成型的才需要安装jar + boolean isGenerationFlag = metadataIndexItemDto.getProcessMode() == null || metadataIndexItemDto.getProcessMode().isEmpty() || metadataIndexItemDto.getProcessMode().equals(ProcessMode.GENERATION.toString()); + boolean installFlag = packageCoreService.getInstallFlag(ref, true, mavenPath, packagePath); + if (installFlag) { + try { + packageCoreService.installMdpkg(groupId, artifactId, version, currentPath, isGenerationFlag, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(mavenPath, groupId + '-' + artifactId + '-' + version); + metadata = getMetadataFromPackage(metadataIndexItemDto.getMdPkgName(), metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的原数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(fileService.getFileNameWithoutExtension(metadataIndexItemDto.getMdPkgName())); + metadataPackageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + ProcessMode processMode = isGenerationFlag ? ProcessMode.GENERATION : ProcessMode.INTERPRETATION; + metadataPackageHeader.setProcessMode(processMode); + metadataProjectCoreService.updateRefs(currentPath, metadataProject, metadataPackageHeader); + metadataProjectCoreService.updateMavenRefs(currentPath, metadataProject, ref); + + return metadata; + } + + private void validateRemoteMdIndex(MetadataIndexItemDto metadataIndexItemDto) { + if (metadataIndexItemDto.getRepoPkg() == null || metadataIndexItemDto.getRepoPkg().size() < 1) { + throw new IllegalArgumentException("未指定仓库包。"); + } + } + + private Metadata4Ref pickLocalMdIndex(String currentPath, MetadataIndexItemDto metadataIndexItemDto, + boolean isNeedMdDto, String packagePath) { + String mdPkgName = metadataIndexItemDto.getMdPkgName(); + String mdPkgFullName = mdPkgName + Utils.getMetadataPackageExtension(); + // 获取工程信息 + MetadataProject metadataProject = getMetadataProjInfo(currentPath); + Utils.checkNPE(metadataProject, "Path is invalid project folder:" + currentPath); + // 本地是否存在 + if (!MetadataIndexCacheService.getInstance().isExistInLocalPackages(mdPkgName)) { + throw new IllegalArgumentException("Local package: " + mdPkgName + " not exists"); + } + + Metadata4Ref metadata = null; + if (isNeedMdDto) { + String metadataPackagePath = fileService.getCombinePath(packagePath, mdPkgFullName); + metadata = getMetadataFromPackage(mdPkgFullName, metadataPackagePath, metadataIndexItemDto.getId()); + Utils.checkNPE(metadata, metadataPackagePath + "中的元数据包" + metadataIndexItemDto.getMdPkgName() + "不包含此元数据:" + metadataIndexItemDto.getId()); + } + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(mdPkgName); + metadataPackageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + metadataProjectCoreService.updateRefs(currentPath, metadataProject, metadataPackageHeader); + + return metadata; + } + + private List buildIndexDtoFromMetadataInfoWithVersion( + List versions) { + if (versions.size() < 1) { + return new ArrayList<>(); + } + List dtos = new ArrayList<>(); + versions.forEach(version -> { + MetadataIndexItemDto indexDto = new MetadataIndexItemDto(); + indexDto.setId(version.getMetadataId()); + indexDto.setCode(version.getMetadataCode()); + indexDto.setName(version.getMetadataName()); + indexDto.setNameSpace(version.getMetadataNamespace()); + indexDto.setType(version.getMetadataType()); + indexDto.setBizobjectID(version.getMdBizobjectId()); + indexDto.setLanguage(version.getMetadataLanguage()); + indexDto.setTranslating(version.getMetadataIsTranslating() != null && "true".equals(version.getMetadataIsTranslating())); + indexDto.setMdPkgName(version.getPackageCode() + ".mdpkg"); + List metadataIndexRepoItemDtoList = new ArrayList<>(); + version.getMavenInfos().forEach(maveninfo -> { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(maveninfo.getMavenPackageGroupId()); + metadataIndexRepoItemDto.setArtifactId(maveninfo.getMavenPackageArtifactId()); + metadataIndexRepoItemDto.setVersion("m" + maveninfo.getMavenPackageVersion()); + metadataIndexRepoItemDto.setUrl(maveninfo.getMavenPackageUrl()); + metadataIndexRepoItemDto.setProcessMode(ProcessMode.GENERATION.toString()); + metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); + }); + if (version.getMavenInfos() == null || version.getMavenInfos().size() < 1) { + indexDto.setRepoPkg(new ArrayList<>()); + } else { + indexDto.setRepoPkg(metadataIndexRepoItemDtoList); + } + dtos.add(indexDto); + }); + return dtos; + } + + private List buildIndexDtoFromMetadataInfoWithVersionWithProcessMode( + List versions) { + if (versions.size() < 1) { + return new ArrayList<>(); + } + List dtos = new ArrayList<>(); + versions.forEach(version -> { + MetadataIndexItemDto indexDto = new MetadataIndexItemDto(); + indexDto.setId(version.getMetadataId()); + indexDto.setCode(version.getMetadataCode()); + indexDto.setName(version.getMetadataName()); + indexDto.setNameSpace(version.getMetadataNamespace()); + indexDto.setType(version.getMetadataType()); + indexDto.setBizobjectID(version.getMdBizobjectId()); + indexDto.setLanguage(version.getMetadataLanguage()); + indexDto.setTranslating(version.getMetadataIsTranslating() != null && "true".equals(version.getMetadataIsTranslating())); + indexDto.setMdPkgName(version.getPackageCode() + ".mdpkg"); + indexDto.setProcessMode(version.getProcessMode()); + List metadataIndexRepoItemDtoList = new ArrayList<>(); + version.getMavenInfos().forEach(maveninfo -> { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(maveninfo.getMavenPackageGroupId()); + metadataIndexRepoItemDto.setArtifactId(maveninfo.getMavenPackageArtifactId()); + metadataIndexRepoItemDto.setVersion("m" + maveninfo.getMavenPackageVersion()); + metadataIndexRepoItemDto.setUrl(maveninfo.getMavenPackageUrl()); + metadataIndexRepoItemDto.setProcessMode(maveninfo.getProcessMode()); + metadataIndexRepoItemDtoList.add(metadataIndexRepoItemDto); + }); + if (version.getMavenInfos() == null || version.getMavenInfos().size() < 1) { + indexDto.setRepoPkg(new ArrayList<>()); + } else { + indexDto.setRepoPkg(metadataIndexRepoItemDtoList); + } + dtos.add(indexDto); + }); + return dtos; + } + + private MetadataInfoFilter getMetadataInfoFilter(String text, List typePostfixList, boolean page, + int pageSize, int pageIndex, String selectedPackageSource, String projPath, boolean isFilterByRefs) { + + MetadataInfoFilter metadataInfoFilter = new MetadataInfoFilter(); + metadataInfoFilter.setCodeOrName(text); + metadataInfoFilter.setPageable(page); + metadataInfoFilter.setPageSize(pageSize); + metadataInfoFilter.setPageIndex(pageIndex); + // 检查类型是否正确 + List metadataTypes = new ArrayList<>(); + if (typePostfixList != null && typePostfixList.size() > 0) { + List typeList = getMetadataTypeList(); + typeList.forEach(type -> { + if (typePostfixList.contains(type.getPostfix().toLowerCase())) { + metadataTypes.add(type.getTypeCode().toLowerCase()); + } + }); + metadataInfoFilter.setMetadataTypes(metadataTypes); + } + // packageSources + List packageSrouceList = new ArrayList<>(); + if (selectedPackageSource != null && !selectedPackageSource.isEmpty()) { + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + List packageSourceDtoList = mdpkgService.getRepoList().getRepoList(); + if ("All".equals(selectedPackageSource)) { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } else { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + if (packageSourceDto.getId() != null) { + if (packageSourceDto.getId().equals(selectedPackageSource)) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } + } + } + metadataInfoFilter.setPackageSources(getEntitySources(packageSrouceList)); + } + + // 获取自己的metadataCode + MetadataProject projInfo = null; + if (!(projPath == null || projPath.isEmpty())) { + projInfo = getMetadataProjInfo(projPath); + metadataInfoFilter.setPackageCodeExcluded(projInfo.getMetadataPackageInfo().getName()); + } + + // 获取MavenRefPackages + List refsList = new ArrayList<>(); + if (projInfo != null && isFilterByRefs) { + if (projInfo.getMavenPackageRefs() != null && projInfo.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs ref : projInfo.getMavenPackageRefs()) { + MetadataMavenInfo packageRef = new MetadataMavenInfo(); + packageRef.setMavenPackageGroupId(ref.getGroupId()); + packageRef.setMavenPackageArtifactId(ref.getArtifactId()); + packageRef.setMavenPackageVersion(ref.getVersion().substring(1)); + refsList.add(packageRef); + } + } + } + metadataInfoFilter.setRefPackages(refsList); + + return metadataInfoFilter; + } + + private MetadataInfoFilterWithProcessMode getMetadataInfoFilter(String text, List typePostfixList, + boolean page, int pageSize, int pageIndex, String selectedPackageSource, String projPath, + boolean isFilterByRefs, ProcessMode processMode) { + MetadataInfoFilterWithProcessMode metadataInfoFilterWithProcessMode = new MetadataInfoFilterWithProcessMode(); + metadataInfoFilterWithProcessMode.setCodeOrName(text); + metadataInfoFilterWithProcessMode.setPageable(page); + metadataInfoFilterWithProcessMode.setPageSize(pageSize); + metadataInfoFilterWithProcessMode.setPageIndex(pageIndex); + // 检查类型是否正确 + List metadataTypes = new ArrayList<>(); + if (typePostfixList != null && typePostfixList.size() > 0) { + List typeList = getMetadataTypeList(); + typeList.forEach(type -> { + if (typePostfixList.contains(type.getPostfix().toLowerCase())) { + metadataTypes.add(type.getTypeCode().toLowerCase()); + } + }); + metadataInfoFilterWithProcessMode.setMetadataTypes(metadataTypes); + } + // packageSources + List packageSrouceList = new ArrayList<>(); + if (selectedPackageSource != null && !selectedPackageSource.isEmpty()) { + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + List packageSourceDtoList = mdpkgService.getRepoList().getRepoList(); + if ("All".equals(selectedPackageSource)) { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } else { + for (PackageSourceDto packageSourceDto : packageSourceDtoList) { + if (packageSourceDto.getId() != null) { + if (packageSourceDto.getId().equals(selectedPackageSource)) { + packageSrouceList.add(packageSourceDto.getSourceUrl()); + } + } + } + } + metadataInfoFilterWithProcessMode.setPackageSources(getEntitySources(packageSrouceList)); + } + + // 获取自己的metadataCode + MetadataProject projInfo = null; + if (!(projPath == null || projPath.isEmpty())) { + projInfo = getMetadataProjInfo(projPath); + metadataInfoFilterWithProcessMode.setPackageCodeExcluded(projInfo.getMetadataPackageInfo().getName()); + } + + // 获取MavenRefPackages + List refsList = new ArrayList<>(); + if (projInfo != null && isFilterByRefs) { + if (projInfo.getMavenPackageRefs() != null && projInfo.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs ref : projInfo.getMavenPackageRefs()) { + MetadataMavenInfoWithProcessMode packageRef = new MetadataMavenInfoWithProcessMode(); + packageRef.setMavenPackageGroupId(ref.getGroupId()); + packageRef.setMavenPackageArtifactId(ref.getArtifactId()); + packageRef.setMavenPackageVersion(ref.getVersion().substring(1)); + refsList.add(packageRef); + } + } + } + metadataInfoFilterWithProcessMode.setRefPackages(refsList); + + metadataInfoFilterWithProcessMode.setProcessMode(processMode.equals(ProcessMode.GENERATION) ? ProcessMode.GENERATION.toString() : "All"); + + return metadataInfoFilterWithProcessMode; + } + + private List getEntitySources(List packageSrouceList) { + List entitySources = new ArrayList<>(); + Map> mavenSourceRule = MavenSourceRuleHelper.getInstance().getMavenSourceRuleMap(); + if (mavenSourceRule != null && mavenSourceRule.size() > 0) { + for (String source : packageSrouceList) { + String key = source.split("/")[source.split("/").length - 1]; + if (mavenSourceRule.containsKey(key)) { + entitySources.addAll(mavenSourceRule.get(key)); + } else { + entitySources.add(source); + } + } + } + return entitySources.stream().distinct().collect(Collectors.toList()); + } + + private boolean isPackMd(LocalMetadataIndexItem item, List typeList, String text, + String packageNameExcluded) { + + boolean isPack = false; + if (typeList == null || typeList.contains(fileService.getExtension(item.getFileName().toLowerCase()))) { + if (item.getMdPkgName().equals(packageNameExcluded)) { + return false; + } + if (text == null || text.isEmpty()) { + isPack = true; + } else { + if (isMath(item.getCode(), text)) { + isPack = true; + } else if (isMath(item.getName(), text)) { + isPack = true; + } else if (isMath(item.getMdPkgName(), text)) { + isPack = true; + } else if (isMath(item.getNameSpace(), text)) { + isPack = true; + } + } + } + return isPack; + } + + private boolean isMath(String a, String b) { + if (a == null || a.isEmpty()) { + return false; + } + return a.toLowerCase().contains(b.toLowerCase()); + } + + private MetadataIndexItemDto assemblyMetadataIndexItemDto(LocalMetadataIndexItem mdIndexDto) { + MetadataIndexItemDto dto = new MetadataIndexItemDto(); + dto.setId(mdIndexDto.getId()); + dto.setName(mdIndexDto.getName()); + dto.setCode(mdIndexDto.getCode()); + dto.setFileName(mdIndexDto.getFileName()); + dto.setNameSpace(mdIndexDto.getNameSpace()); + dto.setMdPkgName(mdIndexDto.getMdPkgName()); + dto.setType(mdIndexDto.getType()); + dto.setRelativePath(mdIndexDto.getRelativePath()); + String processMode = mdIndexDto.getProcessMode() == null || mdIndexDto.getProcessMode().isEmpty() || mdIndexDto.getProcessMode().equals(ProcessMode.GENERATION.toString()) ? ProcessMode.GENERATION.toString() : ProcessMode.INTERPRETATION.toString(); + dto.setProcessMode(processMode); + if (mdIndexDto.getRepoPkg() != null) { + MetadataIndexRepoItemDto metadataIndexRepoItemDto = new MetadataIndexRepoItemDto(); + metadataIndexRepoItemDto.setGroupId(mdIndexDto.getRepoPkg().getGroupId()); + metadataIndexRepoItemDto.setArtifactId(mdIndexDto.getRepoPkg().getArtifactId()); + metadataIndexRepoItemDto.setVersion(mdIndexDto.getRepoPkg().getVersion()); + List list = new ArrayList<>(); + list.add(metadataIndexRepoItemDto); + dto.setRepoPkg(list); + } + return dto; + } + + private MetadataPackage getMetadataPackage(String defaultPackagePath, String absolutePath) { + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(absolutePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(absolutePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zin = new ZipInputStream(in, utf8); + ZipEntry ze; + while ((ze = zin.getNextEntry()) != null) { + try (BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(ze), utf8))) { + if (ze.toString().equals(Utils.getManifestFileName())) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + } + } catch (IOException e) { + throw new IOException("读取元数据失败", e); + } + } + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + ObjectMapper objectMapper = Utils.getMapper(); + return objectMapper.readValue(sb.toString(), MetadataPackage.class); + } catch (IOException e) { + throw new RuntimeException("反序列化元数据失败", e); + } finally { + lock.unlock(); + } + } + + public boolean validateRepeatName(String absolutePath, String fileName) { + String combinePath = fileService.getCombinePath(absolutePath, fileName); + return !isMetadataExist(combinePath); + } + + public List getMetadataByFilter(String absolutePath, MetadataFilter metadataFilter) { + List typeList = new ArrayList<>(); + if (metadataFilter.getMetadataPostfix() != null && !metadataFilter.getMetadataPostfix().isEmpty()) { + String[] types = metadataFilter.getMetadataPostfix().split(","); + typeList = Arrays.asList(types); + } + List metadataList = getMetadataList(absolutePath, typeList); + // TODO 加上各元数据自己的过滤器 + return metadataList; + } + + public void removeMetadataListCache(String absoluteProjPath) { + MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + String projPath = projectCoreService.getProjPath(absoluteProjPath); + if (!StringUtils.isEmpty(projPath)) { + String projName = (new File(projPath)).getName(); + MetadataDevCacheManager.removeMetadataListInProject(projName); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java new file mode 100644 index 0000000000000000000000000000000000000000..17152a619c197864a3e4bd2b9960ecc807358c32 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataIndexCacheService.java @@ -0,0 +1,348 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.LocalRepoPkg; +import com.inspur.edp.lcm.metadata.api.entity.MdPkg; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.LocalMetadataIndexItem; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 元数据索引服务 + * + * @author zhaoleitr + */ +public class MetadataIndexCacheService { + private static final Logger log = LoggerFactory.getLogger(MetadataIndexCacheService.class); + + private static MetadataIndexCacheService singleton = null; + + private final FileServiceImp fileServiceImp = new FileServiceImp(); + + private MetadataIndexCacheService() { + resetLocalPackagesMdIndex(); + resetLocalRepoCacheMdIndex(); + } + + public static MetadataIndexCacheService getInstance() { + if (singleton == null) { + singleton = new MetadataIndexCacheService(); + } + return singleton; + } + + /** + * 本地元数据包中元数据<元数据标识,元数据信息缓存项> + */ + private Map localPackagesMdIndexDic; + /** + * <元数据包编码.mdpkg, 元数据标识列表>,规则元数据包code + */ + private Map localPackagesMdPkgIndexDic; + + /** + * 本地NugetPkg缓存中元数据索引 <元数据标识_nuget version,元数据信息缓存项> + */ + private Map localRepoCacheMdIndexDic; + + /** + * + */ + private Map localRepoCacheMdPkgIndexDic; + + /** + * + */ + public List getLocalPackagesMdIndexDic(String packagePath) { + refreshLocalPackageMdIndex(packagePath); + return new ArrayList<>(localPackagesMdIndexDic.values()); + } + + private static Lock lock = new ReentrantLock(); + private Map localRepoCachePkgIndexDic; + + public Map getLocalRepoCachePkgIndexDic() { +// refreshLocalRepoCache(); + return new ConcurrentHashMap<>(localRepoCachePkgIndexDic); + } + + private void refreshLocalRepoCache(String mavenPath) { + lock.lock(); + try { + // 1. 对比本地元数据包是否为最新,是否有增删 + String mavenPackageLocation = mavenPath; + if (fileServiceImp.isDirectoryExist(mavenPackageLocation)) { + resetLocalRepoCacheMdIndex(); + return; + } + Map mavenPkgDirs = new HashMap(); + fileServiceImp.getDirectorys(mavenPackageLocation).forEach(dir -> { + mavenPkgDirs.put(dir.getName(), dir); + }); + // nuget包缓存索引信息 + List localMavenPkgCacheIndexList = new ArrayList<>(); + for (Map.Entry key : localRepoCachePkgIndexDic.entrySet()) { + localMavenPkgCacheIndexList.add(key.getKey()); + } + // 2. 如果1中有更新,更新索引 + // 删掉的 + if (mavenPkgDirs.size() < 1) { + if (localMavenPkgCacheIndexList.size() > 0) { + resetLocalRepoCacheMdIndex(); + } + } else if (localMavenPkgCacheIndexList.size() > 0) { + for (String mavenPkgIndex : localMavenPkgCacheIndexList) { + if (!mavenPkgDirs.containsKey(mavenPkgIndex)) { + deleteLocalRepoCachePkgIndex(mavenPkgIndex); + } + } + } + // 新增的 +// if (mavenPkgDirs.size() > 0) { +// for(Map.Entry entry : mavenPkgDirs.entrySet()){ +// String mavenPkgDir = entry.getKey(); +// String mavenPkgPath = entry.getValue(); +// } +// } + } finally { + lock.unlock(); + } + } + + private void deleteLocalRepoCachePkgIndex(String mavenPkgName) { + lock.lock(); + try { + toDeleteLocalRepoCachePkgIndex(mavenPkgName); + } finally { + lock.unlock(); + } + + } + + private void toDeleteLocalRepoCachePkgIndex(String mavenPkgName) { + LocalRepoPkg localRepoPkg = localRepoCachePkgIndexDic.get(mavenPkgName); + if (localRepoPkg != null && localRepoPkg.getMdPkgs() != null && localRepoPkg.getMdPkgs().size() > 0) { + localPackagesMdPkgIndexDic.remove(mavenPkgName); + for (MdPkg mdPkg : localRepoPkg.getMdPkgs()) { + MdPkg mdpkg = localRepoCacheMdPkgIndexDic.get(makeKey(mdPkg.getMdPkgName(), localRepoPkg.getVersion())); + if (mdpkg != null && mdpkg.getMetadataIds() != null && mdpkg.getMetadataIds().size() > 0) { + localRepoCacheMdPkgIndexDic.remove(makeKey(mdPkg.getMdPkgName(), localRepoPkg.getVersion())); + mdpkg.getMetadataIds().forEach(id -> { + if (localPackagesMdIndexDic.get(id) != null) { + localRepoCacheMdIndexDic.remove(makeKey(id, localRepoPkg.getVersion())); + } + }); + } + } +// mdPkg.getMetadataIds().forEach(id->{ +// if (localPackagesMdIndexDic.get(id) != null) { +// localPackagesMdIndexDic.remove(id); +// } +// }); + } + } + + private String makeKey(String a, String b) { + return a + "_" + b; + } + + private void resetLocalRepoCacheMdIndex() { + localRepoCacheMdIndexDic = new ConcurrentHashMap<>(); + localRepoCacheMdPkgIndexDic = new ConcurrentHashMap<>(); + localRepoCachePkgIndexDic = new ConcurrentHashMap<>(); + } + + /*** + * 更新pakcages目录索引 + * @author zhongchq + **/ + private void refreshLocalPackageMdIndex(String packagePath) { + lock.lock(); + // 1. 对比本地元数据包是否为最新,是否有增删 + try { + String metadataPackageLocation = packagePath; + if (!fileServiceImp.isDirectoryExist(metadataPackageLocation)) { + resetLocalPackagesMdIndex(); + return; + } + List mdPkgDirInfoNames = fileServiceImp.getDirectorys(metadataPackageLocation); + //缓存目录下元数据文件名 + List mdPkgFileInfoNames = new ArrayList<>(); + mdPkgDirInfoNames.forEach(dirname -> { + fileServiceImp.getAllFiles(dirname.toString()).forEach(file -> { + mdPkgFileInfoNames.add(file.getName()); + }); + }); + // 元数据包文件索引信息 + List localMdPkgCodeList = new ArrayList<>(); + for (Map.Entry key : localPackagesMdPkgIndexDic.entrySet()) { + localMdPkgCodeList.add(key.getKey()); + } + // 2. 如果1中有更新,更新索引 + // 删掉的 + if (mdPkgFileInfoNames.size() < 1) { + if (localMdPkgCodeList.size() > 0) { + resetLocalPackagesMdIndex(); + } + } else if (localMdPkgCodeList.size() > 0) { + localMdPkgCodeList.forEach(mdPkgCode -> { + if (!mdPkgFileInfoNames.contains(mdPkgCode)) { + deleteLocalPackagesMdPkgIndex(mdPkgCode); + } + }); + } + // 新增的 + if (mdPkgFileInfoNames.size() > 0) { + mdPkgFileInfoNames.forEach(mdPkgFileInfoName -> { + if (!localMdPkgCodeList.contains(mdPkgFileInfoName)) { + MetadataPackage mdPkg; + mdPkg = new MetadataCoreManager().getMetadataPackageInfo(mdPkgFileInfoName, packagePath); + try { + if (!(mdPkg.getMetadataList() == null || + mdPkg.getMetadataList().size() < 1)) { + List items = new ArrayList<>(); + for (GspMetadata gspMetadata : mdPkg.getMetadataList()) { + items.add(assemblyLocalMdIndexItem(gspMetadata, mdPkg, null)); + } + MdPkg mdPkgCache = assemblyLocalMdPkg(mdPkg, items); + addLocalPackagesMdIndex(mdPkgCache, items); + } + } catch (Exception e) { + log.error("Parse Error: " + mdPkgFileInfoName); + e.printStackTrace(); + } + } + }); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + lock.unlock(); + } + } + + private void addLocalPackagesMdIndex(MdPkg mdPkg, List items) { + lock.lock(); + try { + localPackagesMdPkgIndexDic.put(mdPkg.getMdPkgName() + Utils.getMetadataPackageExtension(), mdPkg); + if (items != null && items.size() > 0) { + items.forEach(item -> { + localPackagesMdIndexDic.put(item.getId(), item); + }); + } + } finally { + lock.unlock(); + } + } + + private MdPkg assemblyLocalMdPkg(MetadataPackage mdPkg, List items) { + + List depMdPkgs = new ArrayList<>(); + if (mdPkg.getReference() != null && mdPkg.getReference().size() > 0) { + mdPkg.getReference().forEach(mdRef -> { + MdPkg md = new MdPkg(); + md.setMdPkgName(mdRef.getDepententPackage().getName()); + depMdPkgs.add(md); + }); + } + MdPkg result = new MdPkg(); + result.setMdPkgName(mdPkg.getHeader().getName()); + result.setDepMdPkgs(depMdPkgs); + HashSet hashSet = new HashSet<>(); + items.forEach(item -> { + hashSet.add(item.getId()); + }); + result.setMetadataIds(items.size() < 1 ? new HashSet<>() : hashSet); + return result; + } + + private LocalMetadataIndexItem assemblyLocalMdIndexItem(GspMetadata md, MetadataPackage mdPkg, + LocalRepoPkg repoPkg) { + if (md == null) { + return null; + } + if (md.getHeader() == null) { + return null; + } + LocalMetadataIndexItem item = new LocalMetadataIndexItem(); + item.setId(md.getHeader().getId()); + item.setCode(md.getHeader().getCode()); + item.setName(md.getHeader().getName()); + item.setNameSpace(md.getHeader().getNameSpace()); + item.setFileName(md.getHeader().getFileName()); + item.setType(md.getHeader().getType()); + item.setMdPkgName(mdPkg.getHeader().getName()); + item.setProcessMode(mdPkg.getHeader().getProcessMode() == null ? ProcessMode.GENERATION.toString() : mdPkg.getHeader().getProcessMode().toString()); + item.setRelativePath(md.getRelativePath()); + if (repoPkg != null) { + item.setRepoPkg(repoPkg); + } + return item; + } + + private void deleteLocalPackagesMdPkgIndex(String mdPkgName) { + lock.lock(); + try { + MdPkg mdPkg = localPackagesMdPkgIndexDic.get(mdPkgName); + if (mdPkg != null) { + localPackagesMdPkgIndexDic.remove(mdPkgName); + mdPkg.getMetadataIds().forEach(id -> { + if (localPackagesMdIndexDic.get(id) != null) { + localPackagesMdIndexDic.remove(id); + } + }); + } + } finally { + lock.unlock(); + } + } + + private void resetLocalPackagesMdIndex() { + lock.lock(); + try { + localPackagesMdIndexDic = new ConcurrentHashMap<>(); + localPackagesMdPkgIndexDic = new ConcurrentHashMap<>(); + } finally { + lock.unlock(); + } + } + + public boolean isExistInLocalPackages(String pkgName) { + + if (pkgName == null || pkgName.isEmpty()) { + return false; + } + if (!pkgName.endsWith(Utils.getMetadataPackageExtension())) { + pkgName = pkgName + Utils.getMetadataPackageExtension(); + } + return localPackagesMdPkgIndexDic.containsKey(pkgName); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..be307f973bc4acb0ef9be823bc3f40482002a181 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectCoreService.java @@ -0,0 +1,775 @@ +/* + * 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.lcm.metadata.core; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Graph; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.Vertex; +import com.inspur.edp.lcm.metadata.core.entity.MdprojInfoDto; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.businessobject.api.entity.DevBasicBoInfo; +import io.iec.edp.caf.businessobject.api.service.DevBasicInfoService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Stack; +import java.util.concurrent.ConcurrentHashMap; +import org.codehaus.plexus.util.StringUtils; + +public class MetadataProjectCoreService { + private static MetadataProjectCoreService current; + + public static MetadataProjectCoreService getCurrent() { + if (current == null) { + current = new MetadataProjectCoreService(); + } + return current; + } + + private final FileServiceImp fileService = new FileServiceImp(); + + public void create(String projectPath, String projectName, String projectNameSpace, String packageName, + String processMode) { + try { + MetadataProject metadataProject = RepositoryFactory.getInstance().getMetadataProjectRepository().assmbllyMetadataProj(projectName, projectNameSpace, packageName); + + // 解析型 + metadataProject.getMetadataPackageInfo().setProcessMode(ProcessMode.valueOf(processMode)); + + String metadataProjStr = buildMetadataProjectStr(metadataProject); + + RepositoryFactory.getInstance().getMetadataProjectRepository().add(projectPath, metadataProjStr); + } catch (Exception e) { + throw new RuntimeException("元数据工程创建报错", e); + } + } + + public void createGspProject(String absolutePath, GspProject projectData) { + // 将GSPProject实体转为文件流 + String projectStr = buildGspProjectStr(projectData); + //全路径 + String projectPath = Paths.get(absolutePath).resolve(Utils.getGspProjectName()).toString(); + RepositoryFactory.getInstance().getMetadataProjectRepository().add(projectPath, projectStr); + } + + private String buildMetadataProjectStr(MetadataProject metadataProject) { + try { + ObjectMapper mapper = Utils.getMapper(); + return mapper.writeValueAsString(metadataProject); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + private String buildGspProjectStr(GspProject gspProject) { + try { + ObjectMapper mapper = Utils.getMapper(); + return mapper.writeValueAsString(gspProject); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + } + + public void rename(String absolutePath, String oldName, String newName) { + try { + Utils.checkEmpty(oldName, "oldName"); + Utils.checkEmpty(newName, "newName"); + Utils.checkEmpty(absolutePath, "absolutePath"); + String oldFilePath = Paths.get(absolutePath).resolve(oldName).toString(); + //要重命名的文件不存在 + if (!fileService.isFileExist(oldFilePath)) { + throw new RuntimeException("文件不存在" + oldFilePath); + } else if (!Utils.nameValidating(newName)) { + throw new RuntimeException("文件命名不规范" + newName); + } else if (oldName.equals(newName)) { + return; + } + + String newFilePath = Paths.get(absolutePath).resolve(newName).toString(); + //已经存在新名称的文件 + if (fileService.isFileExist(newFilePath)) { + throw new RuntimeException("文件已经存在" + newFilePath); + } + //重命名 + fileService.fileRename(oldFilePath, newFilePath); + //修改文件内容 + //RepositoryFactory.getInstance().getMetadataProjectRepository().updateBaseInfo(newFilePath, newName); + } catch (Exception e) { + throw new RuntimeException("工程重命名失败", e); + } + } + + public MetadataProject getMetadataProjInfo(String absolutePath) { + String projPath = getProjPath(absolutePath); + if (StringUtils.isEmpty(projPath)) { + return null; + } + absolutePath = fileService.getCombinePath(projPath, Utils.getMetadataProjPath()); + if (isExistProjFile(absolutePath)) { + return getMetadataProjDirectly(absolutePath); + } else { + List projPathList = new LinkedList<>(); + return getMetadataProjRecursively(absolutePath, projPathList); + } + } + + public ProcessMode getProcessMode(String absolutePath) { + final MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + Utils.checkNPE(metadataProjInfo, "无法获取元数据工程信息:" + absolutePath); + return metadataProjInfo.getMetadataPackageInfo().getProcessMode() == null ? ProcessMode.GENERATION : metadataProjInfo.getMetadataPackageInfo().getProcessMode(); + } + + public boolean metadataChangesDetected(String absolutePath) { + Map metadataModifiedTime = getMetadataModifiedTime(absolutePath); + Map> sourceDataModifiedTime = getSourceDataModifiedTime(absolutePath); + if (sourceDataModifiedTime.get("metadata").size() == metadataModifiedTime.size()) { + for (String key : metadataModifiedTime.keySet()) { + if (!metadataModifiedTime.get(key).equals(sourceDataModifiedTime.get("metadata").get(key))) { + return true; + } + } + } else { + return true; + } + return false; + } + + public boolean isExistProjFile(String absolutePath) { + List files = fileService.getAllFiles(absolutePath); + if (files == null || files.size() == 0) { + return false; + } + for (File file : files) { + if (file.getName().equals(Utils.getGspProjectName())) { + return true; + } + } + + return false; + } + + public MetadataProject getMetadataProjRecursively(String absolutePath, List projectPath) { + if (absolutePath.isEmpty()) { + return null; + } + + List files = fileService.getAllFiles(absolutePath); + // 目录下没文件,继续往上级目录下找 + if (files == null || files.size() == 0) { + String parentPath = absolutePath.substring(0, absolutePath.lastIndexOf('/')); + return getMetadataProjRecursively(parentPath, projectPath); + } else { + // 遍历目录下的文件 + for (File item : files) { + if (fileService.getExtension(Utils.handlePath(item.getPath())).equals(Utils.getMetadataProjSuffix())) { + if (!projectPath.contains(Utils.handlePath(item.getPath()))) { + projectPath.add(Utils.handlePath(item.getPath())); + } + } + } + if (projectPath.size() == 1) { // 如果找到工程文件且仅有一个则返回不再查找 + String projStr = fileService.fileRead(projectPath.get(0)); + + String projPath = projectPath.get(0).substring(0, projectPath.get(0).lastIndexOf('/')); + String projFileName = projectPath.get(0).substring(projectPath.get(0).lastIndexOf('/') + 1); + ObjectMapper objectMapper = Utils.getMapper(); + MetadataProject project; + try { + project = objectMapper.readValue(projStr, MetadataProject.class); + project.setProjectPath(projPath); + project.setProjectFileName(projFileName); + project.setCsprojAssemblyName(project.getMetadataPackageInfo().getName()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + return project; + } else if (projectPath.size() > 1) { // 如果同一目录下有两个工程文件,则不知道更新哪个,抛异常 + try { + throw new IOException("同一目录下有两个工程文件"); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } else { // 没找到,则继续往上层查找 + String parentPath = absolutePath.substring(0, absolutePath.lastIndexOf('/')); + if (parentPath.isEmpty()) { + return null; + } + return getMetadataProjRecursively(parentPath, projectPath); + } + } + } + + public Map getMetadataModifiedTime(String absolutePath) { + Map metadataModifiedTime = new HashMap<>(); + List metadataPaths = new ArrayList<>(); + //获取目录下的所有文件路径 + RepositoryFactory.getInstance().getMetadataRepository().getMetadatasUnderDir(metadataPaths, absolutePath); + for (String metadataPath : metadataPaths) { + String extension = fileService.getExtension(metadataPath).toLowerCase(); + String result = Utils.getMetadataPostfixTypes().stream().filter(item -> item.toLowerCase().equals(extension)).findAny().orElse(null); + if (result != null) { + String metadataAbsoulutePath = Utils.handlePath(metadataPath); + metadataModifiedTime.put(metadataAbsoulutePath.replace(absolutePath, "."), new File(metadataAbsoulutePath).lastModified()); + } + } + return metadataModifiedTime; + } + + public boolean codeChangesDetected(String absolutePath, String type) { + Map codeModifiedTime = new HashMap<>(); + if ("api_src".equals(type)) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + return apiSrcModifiedTime == null || apiSrcModifiedTime.size() == 0 || apiSrcModifiedTime.containsKey("nofile"); + } + + if ("api".equals(type)) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + Map apiTargetModifiedTime = getCodeModifiedTime(absolutePath, "api_target"); + codeModifiedTime.putAll(apiSrcModifiedTime); + codeModifiedTime.putAll(apiTargetModifiedTime); + } else { + codeModifiedTime = getCodeModifiedTime(absolutePath, type); + } + Map> sourceDataModifiedTime = getSourceDataModifiedTime(absolutePath); + if (sourceDataModifiedTime.get(type) != null && sourceDataModifiedTime.get(type).size() == codeModifiedTime.size()) { + for (String key : codeModifiedTime.keySet()) { + if (!codeModifiedTime.get(key).equals(sourceDataModifiedTime.get(type).get(key))) { + return true; + } + } + } else { + return true; + } + return false; + } + + public Map> getSourceDataModifiedTime(String absolutePath) { + return RepositoryFactory.getInstance().getMetadataProjectRepository().getSourceData(absolutePath).get("modifiedtime"); + } + + public void setSourceDataModifiedTime(String projPath, List types) { + try { + Map>> sourceDataModifiedTime = getSourceDataModifiedTime(projPath, types); + RepositoryFactory.getInstance().getMetadataProjectRepository().setSourceData(projPath, sourceDataModifiedTime); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void getRefProjPaths(String absolutePath, List refProjPaths) { + absolutePath = getProjPath(absolutePath); + MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + if (metadataProjInfo != null && metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0) { + for (ProjectHeader projectHeader : metadataProjInfo.getProjectRefs()) { + String refProjPath = fileService.getCombinePath(absolutePath, projectHeader.getProjectPath()); + if (fileService.isDirectoryExist(refProjPath) && !refProjPaths.contains(refProjPath)) { + refProjPaths.add(refProjPath); + getRefProjPaths(refProjPath, refProjPaths); + } + } + } + } + + public List getBuildOrder(Map mdprojInfoDtos) { + List projectsBuildOrder = new ArrayList<>(); + + Graph graph = new Graph<>(true); + for (String mdpkgName : mdprojInfoDtos.keySet()) { + graph.addVertex(mdpkgName, 0); + getDirectedGraph(mdpkgName, graph, mdprojInfoDtos); + } + + Stack> buildOrder = graph.getTopoSort(); + for (Vertex vertex : buildOrder) { + projectsBuildOrder.add(mdprojInfoDtos.get(vertex.getLabel()).getProjPath()); + } + return projectsBuildOrder; + } + + private void getDirectedGraph(String mdpkgName, Graph graph, Map mdprojInfoDtos) { + MetadataProject metadataProjInfo = mdprojInfoDtos.get(mdpkgName).getMetadataProject(); + if (metadataProjInfo.getMetadataPackageRefs() != null && metadataProjInfo.getMetadataPackageRefs().size() > 0) { + for (MetadataPackageHeader metadataPackageHeader : metadataProjInfo.getMetadataPackageRefs()) { + if (mdprojInfoDtos.containsKey(metadataPackageHeader.getName()) && graph.addVertex(metadataPackageHeader.getName(), 0)) { + graph.addEdge(mdpkgName, metadataPackageHeader.getName(), 0); + getDirectedGraph(metadataPackageHeader.getName(), graph, mdprojInfoDtos); + } + } + } + } + + public List getBuildOrder(String absolutePath) { + List projectsBuildOrder = new ArrayList<>(); + + MetadataProject metadataProjInfo = getMetadataProjInfo(absolutePath); + if (metadataProjInfo == null || metadataProjInfo.getProjectRefs() == null || metadataProjInfo.getProjectRefs().size() == 0 || metadataProjInfo.getMavenPackageRefs() == null || metadataProjInfo.getMavenPackageRefs().size() == 0) { + projectsBuildOrder.add(absolutePath); + return projectsBuildOrder; + } + + Graph graph = new Graph<>(true); + graph.addVertex(absolutePath, 0); + getDirectedGraph(absolutePath, graph); + Stack> buildOrder = graph.getTopoSort(); + for (Vertex vertex : buildOrder) { + projectsBuildOrder.add(vertex.getLabel()); + } + return projectsBuildOrder; + } + + private void getDirectedGraph(String projPath, Graph graph) { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null && metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0 && metadataProjInfo.getMavenPackageRefs() != null && metadataProjInfo.getMavenPackageRefs().size() > 0) { + for (ProjectHeader projectHeader : metadataProjInfo.getProjectRefs()) { + String depProjPath = Utils.handlePath(fileService.getCombinePath(projPath, projectHeader.getProjectPath())); + if (fileService.isDirectoryExist(depProjPath)) { + graph.addVertex(depProjPath, 0); + graph.addEdge(projPath, depProjPath, 0); + getDirectedGraph(depProjPath, graph); + } + } + } + } + + public void updateMavenRefVersion(String projPath, MetadataProject metadataProj, + MavenPackageRefs mavenPackageRefs) { + if (metadataProj.getMavenPackageRefs() == null) { + metadataProj.setMavenPackageRefs(new ArrayList<>()); + } + boolean findIt = false; + if (metadataProj.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRef : metadataProj.getMavenPackageRefs()) { + if (mavenPackageRef.getArtifactId().equals(mavenPackageRefs.getArtifactId())) { + if (mavenPackageRef.getVersion().equals(mavenPackageRefs.getVersion())) { + return; + } + findIt = true; + mavenPackageRef.setVersion(mavenPackageRefs.getVersion()); + break; + } + } + } + if (!findIt) { + metadataProj.getMavenPackageRefs().add(mavenPackageRefs); + } + Utils.writeValue(projPath, metadataProj); + } + + public void updateRefs(String projPath, MetadataProject metadataProj, MetadataPackageHeader packageHeader) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateRefs(projPath, metadataProj, packageHeader); + } + + public void updateProjectRefs(String projPath, MetadataProject metadataProj, ProjectHeader projectHeader) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateProjectRefs(projPath, metadataProj, projectHeader); + } + + public void updateMavenRefs(String projPath, MetadataProject metadataProj, MavenPackageRefs packageRefs) { + RepositoryFactory.getInstance().getMetadataProjectRepository().updateMavenRefs(projPath, metadataProj, packageRefs); + } + + public Map>> getSourceDataModifiedTime(String absolutePath, + List types) { + + Map>> sourceDataModifiedTime = RepositoryFactory.getInstance().getMetadataProjectRepository().getSourceData(absolutePath); + if (types.contains("metadata")) { + Map metadataModifiedTime = getMetadataModifiedTime(absolutePath); + sourceDataModifiedTime.get("modifiedtime").put("metadata", metadataModifiedTime); + } + if (types.contains("api_src")) { + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + sourceDataModifiedTime.get("modifiedtime").put("api_src", apiSrcModifiedTime); + } + if (types.contains("api")) { + Map apiModifiedTime = new HashMap<>(); + Map apiSrcModifiedTime = getCodeModifiedTime(absolutePath, "api_src"); + Map apiTargetModifiedTime = getCodeModifiedTime(absolutePath, "api_target"); + apiModifiedTime.putAll(apiSrcModifiedTime); + apiModifiedTime.putAll(apiTargetModifiedTime); + sourceDataModifiedTime.get("modifiedtime").put("api", apiModifiedTime); + } + if (types.contains("comp")) { + Map compModifiedTime = getCodeModifiedTime(absolutePath, "comp"); + sourceDataModifiedTime.get("modifiedtime").put("comp", compModifiedTime); + } + if (types.contains("runtime")) { + Map runtimeModifiedTime = getCodeModifiedTime(absolutePath, "runtime"); + sourceDataModifiedTime.get("modifiedtime").put("runtime", runtimeModifiedTime); + } + return sourceDataModifiedTime; + } + + public Map getCodeModifiedTime(String absolutePath, String type) { + Map codeModifiedTime = new HashMap<>(); + String relativePath = ""; + switch (type) { + case "api_src": + relativePath = Utils.getApiSourceDir(); + break; + case "api_target": + relativePath = Utils.getApiTargetDir(); + break; + case "comp": + relativePath = Utils.getCompModuleDir(); + break; + case "runtime": + relativePath = Utils.getRuntimeSourceDir(); + break; + default: + break; + } + String codePath = fileService.getCombinePath(absolutePath, relativePath); + if (!fileService.isDirectoryExist(codePath)) { + codeModifiedTime.put("nofile", (long) 0); + return codeModifiedTime; + } + //获取目录下的所有文件路径 + List filePaths = new ArrayList<>(); + getAllFilesUnderDir(filePaths, codePath); + for (String filePath : filePaths) { + codeModifiedTime.put(filePath.replace(absolutePath, "."), new File(filePath).lastModified()); + } + return codeModifiedTime; + } + + public boolean containsCode(String absolutePath, String type) { + String relativePath = ""; + if ("comp".equals(type)) { + relativePath = Utils.getCompModuleDir(); + } + String codePath = fileService.getCombinePath(absolutePath, relativePath + File.separator + "src"); + List filePaths = new ArrayList<>(); + getAllFilesUnderDir(filePaths, codePath); + for (String filePath : filePaths) { + if (filePath.endsWith(".java")) { + return true; + } + } + return false; + } + + /*** + * 根据传过来的文件或者文件夹相对路径,获取当前文件或者文件夹所在的工程目录。查找当前目录或者上级目录。不检查下级目录。 + * @author zhongchq + * @param absolutePath + * 绝对路径 + * @return java.lang.String + **/ + public String getProjPath(String absolutePath) { + if (absolutePath == null || absolutePath.isEmpty()) { + return null; + } + String projPath; + // 如果是文件 + File file = new File(absolutePath); + absolutePath = file.isFile() ? file.getParent() : absolutePath; + + // 当前目录是否是工程目录 + projPath = isExistGspProjFileInCurPath(absolutePath) ? absolutePath : getProjPath(file.getParent()); + + return projPath; + } + + public boolean isExistGspProjFileInCurPath(String absolutePath) { + List files = fileService.getAllFiles(absolutePath); + if (files.size() == 0) { + return false; + } + for (File file : files) { + if (fileService.getFileName(Utils.handlePath(file.toString())).equals(Utils.getGspProjectName())) { + return true; + } + } + return false; + } + + public List getProjectsInBo(String projPath) { + List projects = new ArrayList<>(); + String boPath = new File(projPath).getParent(); + final File[] files = new File(boPath).listFiles(); + if (files == null) { + return projects; + } + for (File file : files) { + if (isExistGspProjFileInCurPath(file.getPath())) { + projects.add(file.getAbsolutePath()); + } + } + return projects; + } + + public String getMdprojPath(String projPath) { + List files = fileService.getAllFiles(projPath + File.separator + Utils.getMetadataProjPath()); + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataProjSuffix())) { + return file.getPath(); + } + } + return null; + } + + public String getMdpkgPath(String projPath) { + List files = fileService.getAllFiles(projPath + File.separator + Utils.getMetadataProjPath() + File.separator + Utils.getMetadataBinPath()); + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataPackageExtension())) { + return file.getPath(); + } + } + return null; + } + + public String getMavenUpdateFlag(String projPath) { + return RepositoryFactory.getInstance().getMetadataProjectRepository().getMavenUpdateFlag(projPath); + } + + public void setMavenUpdateFlag(String projPath, Boolean flag) { + RepositoryFactory.getInstance().getMetadataProjectRepository().setMavenUpdateFlag(projPath, flag); + } + + public String getMdpkgNameExistInBo(String projPath, String mdpkgName) { + List projectsInBo = getProjectsInBo(projPath); + projectsInBo.remove(projPath); + for (String project : projectsInBo) { + MetadataProject metadataProjInfo = getMetadataProjInfo(project); + if (metadataProjInfo != null && mdpkgName.equals(metadataProjInfo.getMetadataPackageInfo().getName())) { + return project; + } + } + return null; + } + + private MetadataProject getMetadataProjDirectly(String path) { + MetadataProject project = new MetadataProject(); + List files = fileService.getAllFiles(path); + if (files.size() == 0) { + return null; + } + for (File file : files) { + if (fileService.getExtension(file.getPath()).equals(Utils.getMetadataProjSuffix())) { + String projStr; + try { + projStr = fileService.fileRead(Utils.handlePath(file.getPath())); + ObjectMapper objectMapper = Utils.getMapper(); + project = objectMapper.readValue(projStr, MetadataProject.class); + String projPath = Utils.handlePath(file.getPath()).substring(0, Utils.handlePath(file.getPath()).lastIndexOf('/')); + String projFileName = Utils.handlePath(file.getPath()).substring(Utils.handlePath(file.getPath()).lastIndexOf('/') + 1); + project.setProjectPath(projPath); + project.setProjectFileName(projFileName); + project.setCsprojAssemblyName(project.getMetadataPackageInfo().getName()); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + } + + return project; + } + + private void getAllFilesUnderDir(List filePathList, String dirPath) { + List dirs = fileService.getDirectorys(dirPath); + if (dirs.size() > 0) { + for (File dir : dirs) { + String dirName = fileService.getFileName(Utils.handlePath(dir.getPath())); + String temPath = dirPath + "/" + dirName; + getAllFilesUnderDir(filePathList, temPath); + } + } + List paths = fileService.getAllFiles(dirPath); + if (paths.size() > 0) { + for (File path : paths) { + filePathList.add(Utils.handlePath(path.getPath())); + } + } + } + + public List getProjPathsInBoByRefedProjPath(String projPath) { + List projPaths = new ArrayList<>(); + File project = new File(getProjPath(projPath)); + File bo = project.getParentFile(); + File[] projectsInBo = bo.listFiles(); + for (File file : projectsInBo) { + try { + final MetadataProject metadataProjInfo = getMetadataProjInfo(file.getPath()); + if (metadataProjInfo.getProjectRefs() != null && metadataProjInfo.getProjectRefs().size() > 0) { + if (metadataProjInfo.getProjectRefs().stream().anyMatch(ref -> ref.getProjectPath().endsWith(project.getName()))) { + projPaths.add(file.getPath()); + } + } + } catch (Exception e) { + } + } + return projPaths; + } + + public void getProjPathsInPath(String path, List projPaths) { + List files = fileService.getAllFiles(path); + List dirs = fileService.getDirectorys(path); + if (files != null && files.size() > 0) { + for (File file : files) { + String extension = fileService.getFileName(file.getPath()); + if (extension.toLowerCase().equals(Utils.getGspProjectName())) { + projPaths.add(file.getParent()); + return; + } + } + } + if (dirs != null && dirs.size() > 0) { + dirs.forEach(item -> getProjPathsInPath(item.getPath(), projPaths)); + } + } + + public Map transformToMdprojInfoDto(List projPaths) { + Map mdprojInfos = new ConcurrentHashMap<>(); + projPaths.stream().parallel().forEach(projPath -> { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null) { + MdprojInfoDto mdprojInfoDto = new MdprojInfoDto(); + mdprojInfoDto.setMetadataProject(metadataProjInfo); + mdprojInfoDto.setProjPath(projPath); + mdprojInfos.put(metadataProjInfo.getMetadataPackageInfo().getName(), mdprojInfoDto); + } + }); + return mdprojInfos; + } + + public boolean isExistProjFileRecursively(String absolutePath) { + // 如果是文件 + File file = new File(absolutePath); + if (file.isFile()) { + absolutePath = file.getParent(); + } + boolean exist = isExistGspProjFileInCurPath(absolutePath); + if (exist) { + return true; + } + + // 获取下级目录 + File[] files = new File(absolutePath).listFiles(); + for (File subDir : files) { + exist = isExistProjFileRecursively(subDir.getPath()); + if (exist) { + return true; + } + } + return false; + } + + public String getBoPath(String absolutePath) { + String projPath = getProjPath(absolutePath); + return new File(projPath).getParent(); + } + + public boolean isInterpretation(String absolutePath) { + ProcessMode processMode = getProcessMode(absolutePath); + return ProcessMode.INTERPRETATION.equals(processMode); + } + + public List getBOInfo(String[] boids) { + List boInfoList = new ArrayList<>(); + for (String boId : boids) { + DevBasicBoInfo devBasicBOInfo = SpringBeanUtils.getBean(DevBasicInfoService.class).getDevBasicBoInfo(boId); + String boPath = devBasicBOInfo.getAppCode() + "/" + devBasicBOInfo.getSuCode() + "/" + devBasicBOInfo.getBoInfo().getCode(); + Map projPaths = getPathOfBOProjects(ManagerUtils.getAbsolutePath(boPath)); + if (projPaths != null && projPaths.size() > 0) { + BOInfo boInfo = new BOInfo(); + boInfo.setId(boId); + for (String projPath : projPaths.values()) { + try { + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(projPath); + switch (gspProjectInfo.getProjectType()) { + case "backend": + boInfo.setBackendProjectCount(boInfo.getBackendProjectCount() + 1); + break; + case "frontend": + boInfo.setFrontendProjectCount(boInfo.getFrontendProjectCount() + 1); + break; + } + } catch (Exception e) { +// "无法读取工程" + projPath + "的信息。" + } + } + boInfo.setProjectCount(projPaths.size()); + boInfoList.add(boInfo); + } + } + return boInfoList; + } + + public String getJavaCompProjectPath(String absolutePath) { + String projPath = getProjPath(absolutePath); + return Paths.get(projPath).resolve(Utils.getCompModuleDir()).resolve(Utils.getSrcJavaPath()).toString(); + } + + private Map getPathOfBOProjects(String boPath) { + Map paths = new HashMap<>(); + File boFile = new File(boPath); + if (boFile.isDirectory() && boFile.exists()) { + File[] files = boFile.listFiles(pathname -> pathname.isDirectory()); + for (File file : files) { + boolean isProjectFlag = new File(Paths.get(file.getPath()).resolve(Utils.getGspProjectName()).toString()).exists(); + if (isProjectFlag) { + paths.put(file.getName(), file.getPath()); + } + } + } + return paths; + } + + public ConcurrentHashMap transformToMdprojInfoDto(ArrayList projPaths) { + ConcurrentHashMap mdprojInfos = new ConcurrentHashMap<>(); + projPaths.stream().parallel().forEach(projPath -> { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + if (metadataProjInfo != null) { + MdprojInfoDto mdprojInfoDto = new MdprojInfoDto(); + mdprojInfoDto.setMetadataProject(metadataProjInfo); + mdprojInfoDto.setProjPath(projPath); + mdprojInfos.put(metadataProjInfo.getMetadataPackageInfo().getName(), mdprojInfoDto); + } + }); + return mdprojInfos; + } + + public void changeProcessMode(String absolutePath, ProcessMode processMode) { + String projPath = getProjPath(absolutePath); + GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + if (!"frontend".equals(gspProjectInfo.getProjectType())) { + throw new RuntimeException("暂时仅支持前端工程转变处理模式"); + } + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + metadataProjInfo.getMetadataPackageInfo().setProcessMode(processMode); + RepositoryFactory.getInstance().getMetadataProjectRepository().updateMetadataProject(projPath, metadataProjInfo); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..9811911573fa3751f34015ab1ed2b8dcc695671a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataProjectServiceImp.java @@ -0,0 +1,252 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.springframework.util.StringUtils; + +/** + * 元数据工程服务 + * + * @author zhaoleitr + */ +public class MetadataProjectServiceImp implements MetadataProjectService { + + private final MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + + @Override + public boolean isExistProjFile(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isExistProjFile(absolutePath); + + } + + @Override + public void rename(String path, String oldName, String newName) { + try { + Utils.checkEmpty(oldName, "oldName"); + Utils.checkEmpty(newName, "newName"); + Utils.checkEmpty(path, "path"); + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.rename(absolutePath, oldName, newName); + } catch (Exception e) { + throw new RuntimeException("元数据工程重命名失败", e); + } + } + + @Override + public MetadataProject getMetadataProjInfo(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + MetadataProject metadataProjInfo = projectCoreService.getMetadataProjInfo(absolutePath); + return metadataProjInfo; + } + + @Override + public String getJavaCompProjectPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.getJavaCompProjectPath(absolutePath); + } + + @Override + public MetadataProject getMetadataProjRecursively(String path, List projectPath) { + return projectCoreService.getMetadataProjRecursively(path, projectPath); + } + + @Override + public void create(String path, String projectName, String projectNameSpace, String packageName, + String processMode) { + try { + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projectNameLower = projectName.toLowerCase(); + handleDefaultPath(absolutePath, projectNameLower); + String projectPath = Paths.get(absolutePath).resolve(projectNameLower).resolve(Utils.getMetadataProjPath()).resolve(projectName + Utils.getMetadataProjSuffix()).toString(); + projectCoreService.create(projectPath, projectName, projectNameSpace, packageName, processMode); + } catch (Exception e) { + throw new RuntimeException("元数据工程创建失败", e); + } + } + + private void handleDefaultPath(String projPath, String projName) { + String projFullPath = Paths.get(projPath).resolve(projName).toString(); + FileServiceImp fileServiceImp = new FileServiceImp(); + if (!fileServiceImp.isDirectoryExist(projFullPath)) { + fileServiceImp.createDirectory(projFullPath); + } + + String metadataProjPath = Paths.get(projFullPath).resolve(Utils.getMetadataProjPath()).toString(); + if (!fileServiceImp.isDirectoryExist(metadataProjPath)) { + fileServiceImp.createDirectory(metadataProjPath); + } + } + + @Override + public void createGspProject(String path, GspProject projectData) { + if (StringUtils.isEmpty(path)) { + throw new RuntimeException("路径不能为空"); + } + //全路径 + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.createGspProject(absolutePath, projectData); + } + + @Override + public void updateMavenRefs(String projPath, MetadataProject metadataProj, MavenPackageRefs packageRefs) { + projectCoreService.updateMavenRefs(projPath, metadataProj, packageRefs); + } + + @Override + public void updateMavenRefVersion(String projPath, MetadataProject metadataProj, + MavenPackageRefs mavenPackageRefs) { + projectCoreService.updateMavenRefVersion(projPath, metadataProj, mavenPackageRefs); + } + + @Override + public void updateRefs(String projPath, MetadataProject metadataProj, MetadataPackageHeader packageHeader) { + projectCoreService.updateRefs(projPath, metadataProj, packageHeader); + } + + @Override + public void updateRefs(String projPath, MetadataPackageHeader packageHeader) { + MetadataProject metadataProjInfo = getMetadataProjInfo(projPath); + updateRefs(projPath, metadataProjInfo, packageHeader); + } + + @Override + public String getProjPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = projectCoreService.getProjPath(absolutePath); + return projPath; + } + + @Override + public String getAbsolutePath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return absolutePath; + } + + @Override + public void getRefProjPaths(String projPath, List refProjPaths) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.getRefProjPaths(absolutePath, refProjPaths); + } + + @Override + public List getBuildOrder(String path) { + String projPath = getProjPath(path); + return projectCoreService.getBuildOrder(projPath); + } + + @Override + public Map> getSourceDataModifiedTime(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.getSourceDataModifiedTime(absolutePath); + } + + @Override + public void setSourceDataModifiedTime(String projPath, List types) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.setSourceDataModifiedTime(absolutePath, types); + } + + @Override + public boolean metadataChangesDetected(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.metadataChangesDetected(absolutePath); + } + + @Override + public boolean codeChangesDetected(String projPath, String type) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.codeChangesDetected(absolutePath, type); + } + + @Override + public String getMavenUpdateFlag(String projPath) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + return projectCoreService.getMavenUpdateFlag(absolutePath); + } + + @Override + public ProcessMode getProcessMode(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.getProcessMode(absolutePath); + } + + @Override + public List getProjPathsInPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List projPaths = new ArrayList<>(); + projectCoreService.getProjPathsInPath(absolutePath, projPaths); + return projPaths; + } + + @Override + public void setMavenUpdateFlag(String projPath, Boolean flag) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectCoreService.setMavenUpdateFlag(absolutePath, flag); + } + + @Override + public String getMdpkgNameExistInBo(String path, String mdpkgName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPathExist = projectCoreService.getMdpkgNameExistInBo(absolutePath, mdpkgName); + return projPathExist != null ? new File(projPathExist).getName() : projPathExist; + } + + @Override + public boolean isExistProjFileRecursively(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isExistProjFileRecursively(absolutePath); + } + + @Override + public String getBoPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return ManagerUtils.getRalativePath(projectCoreService.getBoPath(absolutePath)); + } + + @Override + public boolean isInterpretation(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return projectCoreService.isInterpretation(absolutePath); + } + + @Override + public List getBOInfo(String[] boids) { + return projectCoreService.getBOInfo(boids); + } + + public void changeProcessMode(String path, ProcessMode processMode) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectCoreService.changeProcessMode(absolutePath, processMode); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..37988f4828c1ba8117572f722131913c0b5e7382 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataServiceImp.java @@ -0,0 +1,342 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.List; +import java.util.Objects; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author zhaoleitr + */ +public class MetadataServiceImp implements MetadataService { + private static final Logger log = LoggerFactory.getLogger(MetadataServiceImp.class); + + private final GspProjectService gspProjectService = new GspProjectServiceImp(); + private final MetadataProjectCoreService metadataProjectService = new MetadataProjectCoreService(); + private final MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + + @Override + public GspMetadata initializeMetadataEntity(GspMetadata metadata) { + metadataCoreManager.initializeMetadataEntity(metadata); + return metadata; + } + + @Override + public void createMetadata(String path, GspMetadata metadata) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.createMetadata(absolutePath, metadata); + } + + @Override + public GspMetadata loadMetadata(String metadataFileName, String path) { + Utils.checkEmpty(metadataFileName, "parameter value is empty,paramter is metadataFileName"); + Utils.checkEmpty(path, "parameter value is empty,paramter is path"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + GspMetadata metadata; + try { + metadata = metadataCoreManager.loadMetadata(metadataFileName, absolutePath); + } catch (Exception e) { + String ralativePath = ManagerUtils.getRalativePath(absolutePath) + "/" + metadataFileName; + throw new RuntimeException(String.format("找不到元数据,元数据路径为:%s", ralativePath)); + } + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata loadMetadata(String metadataPath) { + Utils.checkEmpty(metadataPath, "parameter value is empty,paramter is metadataPath"); + String absolutePath = ManagerUtils.getAbsolutePath(metadataPath); + GspMetadata metadata; + try { + metadata = metadataCoreManager.loadMetadata(absolutePath); + } catch (Exception e) { + String ralativePath = ManagerUtils.getRalativePath(absolutePath); + throw new RuntimeException(String.format("找不到元数据,元数据路径为:%s", ralativePath)); + } + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata loadMetadataByMetadataId(String metadataId, String path) { + Utils.checkEmpty(metadataId, "parameter value is empty,paramter is metadataFileName"); + Utils.checkEmpty(path, "parameter value is empty,paramter is path"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.loadMetadataByMetadataId(metadataId, absolutePath); + } + + @Override + public GspMetadata loadMetadataInBo(String metadataFullPath, String currentProjPath) { + String absoluteMetadataPath = ManagerUtils.getAbsolutePath(metadataFullPath); + String absoluteProjPath = ManagerUtils.getAbsolutePath(currentProjPath); + GspMetadata metadata = metadataCoreManager.loadMetadataInBo(absoluteMetadataPath, absoluteProjPath); + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public GspMetadata getRefMetadata(String spacePath, String metadataID) { + if (!spacePath.isEmpty()) { + spacePath = ManagerUtils.getAbsolutePath(spacePath); + } + return metadataCoreManager.getRefMetadata(metadataID, spacePath); + } + + @Override + public GspMetadata getMetadataWithoutContent(String fullPath) { + String absolutePath = ManagerUtils.getAbsolutePath(fullPath); + GspMetadata metadata = metadataCoreManager.getMetadataWithoutContent(absolutePath); + metadata.setRelativePath(ManagerUtils.getRalativePath(metadata.getRelativePath())); + return metadata; + } + + @Override + public void deleteMetadata(String path, String metadataFileName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.deleteMetadata(absolutePath, metadataFileName); + } + + @Override + public void deleteFolder(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.deleteFolder(absolutePath); + } + + @Override + public void renameMetadata(String oldFileName, String newFileName, String metadataFilePath) { + String absolutePath = ManagerUtils.getAbsolutePath(metadataFilePath); + metadataCoreManager.renameMetadata(oldFileName, newFileName, absolutePath); + } + + @Override + public List getMetadataList(String spacePath, List metadataTypes) { + String absolutePath = ManagerUtils.getAbsolutePath(spacePath); + List result = metadataCoreManager.getMetadataList(absolutePath, metadataTypes); + return result; + } + + @Override + public List getMetadataListInBo(String path, List metadataTypes) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List metadataListInBo = metadataCoreManager.getMetadataListInBo(metadataProjectService.getProjPath(absolutePath), metadataTypes); + return metadataListInBo; + } + + @Override + public List getMetadataByFilter(String path, MetadataFilter metadataFilter) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + List metadataByFilter = metadataCoreManager.getMetadataByFilter(absolutePath, metadataFilter); + return metadataByFilter; + } + + @Override + public boolean validateRepeatName(String path, String fileName) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.validateRepeatName(absolutePath, fileName); + } + + @Override + public List getMetadataTypeList() { + return metadataCoreManager.getMetadataTypeList(); + } + + @Override + public boolean isMetadataExist(String path, String metadataFileName) { + String absolutePath = Paths.get(ManagerUtils.getAbsolutePath(path)).resolve(metadataFileName).toString(); + return metadataCoreManager.isMetadataExist(absolutePath); + } + + @Override + public boolean isMetadataExistInProject(String path, String metadataID) { + String projPath = metadataProjectService.getProjPath(ManagerUtils.getAbsolutePath(path)); + return metadataCoreManager.isMetadataExistInProject(projPath, metadataID); + } + + @Override + public String getRefPath(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRefPath(absolutePath); + } + + @Override + public MetadataHeader getRefMetadataHeader(String metadataID, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRefMetadataHeader(metadataID, absolutePath); + } + + @Override + public List getMetadataList(String spacePath) { + String absolutePath = ManagerUtils.getAbsolutePath(spacePath); + List result = metadataCoreManager.getMetadataList(absolutePath); + return result; + } + + @Override + public MetadataPackage getMetadataPackageInfo(String packageFileName, String packagePath) { + if (packagePath.isEmpty()) { + packagePath = ManagerUtils.getMetadataPackageLocation(); + } + + return metadataCoreManager.getMetadataPackageInfo(packageFileName, packagePath); + } + + @Override + public List getMetadataListByRefedMetadataId(String path, String metadataId) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String metadataPath = new FileServiceImp().getCombinePath(metadataProjectService.getProjPath(absolutePath), Utils.getMetadataProjPath()); + return metadataCoreManager.getMetadataListByRefedMetadataId(metadataPath, metadataId); + } + + @Override + public Metadata4Ref getMetadataFromPackage(String packageName, String packagePath, String metadataID) { + + if (packagePath.isEmpty()) { + packagePath = ManagerUtils.getMetadataPackageLocation(); + } + return metadataCoreManager.getMetadataFromPackage(packageName, packagePath, metadataID); + } + + @Override + public MetadataProject getMetadataProjInfo(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getMetadataProjInfo(absolutePath); + } + + @Override + public List getRemoteMetadataIndexList(String text, String path, String selectedPackageSource, + List typeList, boolean page, int pageSize, int pageIndex, boolean isFilterByRefs, + boolean conflictAvoidFlag) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getRemoteMetadataIndexList(text, absolutePath, selectedPackageSource, typeList, page, pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + @Override + public List getLocalMetadataList(String text, String path, List typeList, + boolean page, int pageSize, int pageIndex) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getLocalMetadataList(text, absolutePath, typeList, page, pageSize, pageIndex, ManagerUtils.getMetadataPackageLocation()); + } + + @Override + public Metadata4RefDto pickMetadataIndex(int scopeType, String currentPath, + MetadataIndexItemDto metadataIndexItemDto, boolean isNeedMdDto) { + String absolutePath = ManagerUtils.getAbsolutePath(currentPath); + if (scopeType == 1 || scopeType == 2) { + absolutePath = metadataProjectService.getProjPath(absolutePath); + } + return metadataCoreManager.pickMetadataIndex(scopeType, absolutePath, metadataIndexItemDto, isNeedMdDto, ManagerUtils.getMetadataPackageLocation(), ManagerUtils.getMavenStoragePath()); + } + + @Override + public GspProject getGspProjectInfo(String path) { + try { + return gspProjectService.getGspProjectInfo(path); + } catch (IOException e) { + log.error("获取工程信息失败,请检查工程路径"); + e.printStackTrace(); + } + return null; + } + + @Override + public List getResourceMetadata(String metadataId, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + MetadataProject projInfo = metadataProjectService.getMetadataProjInfo(absolutePath); + return metadataCoreManager.getResourceMetadata(metadataId, projInfo.getProjectPath()); + } + + @Override + public void setMetadataUri(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + metadataCoreManager.setMetadataUri(absolutePath); + } + + @Override + public GspMetadata getI18nMetadata(String fileName, String path, String language) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.getI18nMetadata(fileName, absolutePath, language); + } + + @Override + public List GetRefI18nMetadata(String resourceMdID, String resourceFileName, String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + String mavenPath = ManagerUtils.getMavenStoragePath(); + return metadataCoreManager.getRefI18nMetadata(resourceMdID, resourceFileName, absolutePath, mavenPath, packagePath); + } + + @Override + public void saveMetadata(GspMetadata metadata, String fullPath) { + String absolutePath = ManagerUtils.getAbsolutePath(fullPath); + metadataCoreManager.saveMetadata(metadata, absolutePath); + } + + @Override + public String getIndexServerStatus(String ip, String port) { + return metadataCoreManager.getIndexServerStatus(ip, port); + } + + @Override + public IMdExtRuleContent getMdExtRule(String metadataId, String path) { + GspMetadata metadata = loadMetadataByMetadataId(metadataId, path); + if (!Objects.isNull(metadata)) { + return metadata.getExtendRule(); + } + return null; + } + + @Override + public void saveMdExtRule(String metadataId, String path, IMdExtRuleContent extendRule) { + try { + GspMetadata metadata = loadMetadataByMetadataId(metadataId, path); + if (Objects.isNull(metadata)) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + metadata.setExtendRule(extendRule); + saveMetadata(metadata, path); + } catch (Exception e) { + throw new RuntimeException("保存元数据扩展规则报错", e); + } + } + + @Override + public boolean isMetadataRefed(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return metadataCoreManager.isMetadataRefed(absolutePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..8159b0aced8bba6df9236c74827c08c5313ad0c1 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageCoreService.java @@ -0,0 +1,1362 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.ide.setting.api.entity.MavenSettings; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsMirror; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsServer; +import com.inspur.edp.ide.setting.api.service.MavenService; +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.lcm.metadata.api.entity.ApiModuleInfo; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageVersion; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponent; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoInMaven; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageSourceDto; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PackageWithMetadataInfo; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.entity.MdprojInfoDto; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import com.inspur.edp.lcm.metadata.core.exception.MvnException; +import com.inspur.edp.lcm.metadata.core.exception.MvnExceptionEnum; +import com.inspur.edp.lcm.metadata.core.manager.IndexServerManager; +import com.inspur.edp.lcm.metadata.core.manager.MavenCommandGenerator; +import com.inspur.edp.lcm.metadata.core.manager.MavenDeploymentForMdpkgManager; +import com.inspur.edp.lcm.metadata.core.manager.PackageNameManager; +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import com.inspur.edp.lcm.metadata.core.manager.VersionManager; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import com.inspur.edp.lcm.metadata.core.sync.CopyToPackagesRunnable; +import com.inspur.edp.lcm.metadata.core.sync.InstallJarRunnable; +import com.inspur.edp.lcm.metadata.core.sync.InstallSingleJarRunnable; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.util.StringUtils; +import org.springframework.web.client.RestTemplate; + +/** + * @author zhaoleitr + */ +public class PackageCoreService { + private static final Logger log = LoggerFactory.getLogger(PackageCoreService.class); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + private String downloadPath; + private final DecimalFormat df; + private MetadataProject metadataProject; + private final Lock lock = new ReentrantLock(); + private final RestTemplate restTemplate = new RestTemplate(); + private ApiModuleInfo apiModuleInfo = null; + private List downloadMdpkgPaths; + private List publicMirrors = new ArrayList<>(); + private String alimavenFlag = "maven.aliyun.com"; + private Map depModules; + + public PackageCoreService() { + String path = System.getenv("Path"); + if (path != null) { + String[] allPath = path.split(";"); + for (String s : allPath) { + if (s.contains("maven")) { + s = s.substring(0, s.length() - 4); + System.setProperty("MAVEN_HOME", s); + } + } + } + df = new DecimalFormat("0.000"); + + depModules = new HashMap<>(); + depModules.put("comp", "api"); + depModules.put("core", "comp"); + depModules.put("runtime", "core"); + MavenSettingsMirror gspMirror = new MavenSettingsMirror("gsp-releases-repo", "gsp-releases", "https://repos.iec.io/repository/maven-gsp-releases/", "gsp-rep"); + MavenSettingsMirror bfMirror = new MavenSettingsMirror("bf-releases-repo", "bf-releases", "https://repos.iec.io/repository/maven-bf-releases/", "bf-rep"); + publicMirrors.add(gspMirror); + publicMirrors.add(bfMirror); + + } + + // 解析型工程编译comp构件 + public void compile(String absolutePath, String modules, String mavenPath) { + if ("all".equals(modules) || "comp".equals(modules)) { + // 编译前检查代码是否含有代码,以及代码是否变更 + boolean containsCodeFlag = metadataProjectCoreService.containsCode(absolutePath, "comp"); + if (!containsCodeFlag) { + return; + } + boolean codeChangedFlag = metadataProjectCoreService.codeChangesDetected(absolutePath, "comp"); + if (!codeChangedFlag) { + return; + } + } + + String javaProjPath = fileServiceImp.getCombinePath(absolutePath, "java" + File.separator + "code"); + final MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + if (!mavenUtilsCore.exeMavenCommand(javaProjPath, mavenPath, handleCompileGoal(modules))) { + final String errorMessage = mavenUtilsCore.getErrorMessage(); + throw new MvnException(MvnExceptionEnum.GSP_LCM_MVN_0001.toString(), errorMessage, new RuntimeException(errorMessage)); + } + + if ("all".equals(modules) || "comp".equals(modules)) { + // 编译后更新代码变更记录 + afterCompile(absolutePath); + } + } + + public void batchOperation(String absolutePath, String mavenPath, List operations) { + List projPaths = new ArrayList<>(); + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + Map mdprojInfoDtos = metadataProjectCoreService.transformToMdprojInfoDto(projPaths); + List buildOrder = metadataProjectCoreService.getBuildOrder(mdprojInfoDtos); + GenerateService generateService = SpringBeanUtils.getBean(GenerateService.class); + List errorMsgs = new ArrayList<>(); + for (String projPath : buildOrder) { + try { + String start = "开始操作:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Info]" + start, CAFContext.current.getUserId()); + if (operations.contains("generate")) { + generateService.generate(projPath); + } + if (operations.contains("compile")) { + compile(projPath, "api,core,comp", mavenPath); + } + String end = "完成操作:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Info]" + end, CAFContext.current.getUserId()); + } catch (Exception e) { + String excep = "异常结束:" + projPath + "-----------------"; + LoggerDisruptorQueue.publishEvent("[LCM Error]" + excep, CAFContext.current.getUserId()); + StringBuilder sb = new StringBuilder(); + sb.append(projPath); + sb.append(":"); + sb.append(e.getMessage()); + errorMsgs.add(sb.toString()); + e.printStackTrace(); + } + } + try { + // 防止其他的日志输出比这个晚。 + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (!errorMsgs.isEmpty()) { + String log = "[LCM Error]以下工程批量操作失败,请排除问题后重新编译:"; + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + for (String msg : errorMsgs) { + LoggerDisruptorQueue.publishEvent("[LCM Error]" + msg, CAFContext.current.getUserId()); + } + } else { + LoggerDisruptorQueue.publishEvent("[LCM Success]批量操作完成。", CAFContext.current.getUserId()); + } + } + + public void restore(String absolutePath, Boolean force, String mavenPath, String packagePath) { + if (Utils.isNullOrEmpty(absolutePath)) { + throw new IllegalArgumentException("工程路径不能为空"); + } + MetadataProjectCoreService projectCoreService = new MetadataProjectCoreService(); + absolutePath = projectCoreService.getProjPath(absolutePath); + MetadataProject metadataProjInfo = projectCoreService.getMetadataProjInfo(absolutePath); + Utils.checkNPE(metadataProjInfo, "获取元数据工程信息失败,工程路径为:" + absolutePath); + + List mavenPackageRefsList = metadataProjInfo.getMavenPackageRefs(); + if (Utils.isNullOrEmpty(mavenPackageRefsList)) { + return; + } + + // bo间工程引用 + List projectHeaderList = metadataProjInfo.getProjectRefs(); + removeProjectRefs(absolutePath, mavenPackageRefsList, projectHeaderList); + + boolean installFlag; + List needInstallPackages = new ArrayList<>(); + for (MavenPackageRefs ref : mavenPackageRefsList) { + installFlag = getInstallFlag(ref, force, mavenPath, packagePath); + if (installFlag) { + needInstallPackages.add(ref); + } + } + try { + log.info("元数据开始下载"); + doRestore(needInstallPackages, absolutePath, force, mavenPath, packagePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void addDependencyAndRestore(String absolutePath, List metadataPackages, String mavenPath, + String packagePath) { + String projPath = metadataProjectCoreService.getProjPath(absolutePath); + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(projPath); + metadataPackages.forEach(item -> { + MavenPackageRefs mavenPackageRefs = handleMavenPackageName(item); + MetadataPackageHeader packageHeader = handleMetadataPackageName(item); + //1、更新maven依赖 + metadataProjectCoreService.updateMavenRefs(projPath, metadataProject, mavenPackageRefs); + //2、更新metadata依赖 + metadataProjectCoreService.updateRefs(projPath, metadataProject, packageHeader); + //3、安装特定包 + restoreSpecificPackage(metadataProject.getProjectPath().substring(0, metadataProject.getProjectPath().indexOf(Utils.getMetadataProjPath()) - 1), mavenPackageRefs, mavenPath, packagePath); + }); + } + + public void installMdpkg(String groupId, String artifactId, String version, String absolutePath, String mavenPath, + String packagePath) throws IOException { + try { + installMdpkg(groupId, artifactId, version, absolutePath, false, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + + public void doRestore(List refs, String absolutePath, boolean forceUpdateFlag, String mavenPath, + String packagePath) throws IOException { + // 防止工作空间未初始化maven文件夹 + if (!fileServiceImp.isDirectoryExist(mavenPath)) { + fileServiceImp.createDirectory(mavenPath); + } + + String metadataPath = fileServiceImp.getCombinePath(absolutePath, Utils.getMetadataProjPath()); + String pomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.POM_FILE); + ProcessMode processMode = metadataProjectCoreService.getProcessMode(absolutePath); + try { + // 创建pom + final PomManager pomManager = new PomManager(); + pomManager.createPomForDependencyCopy(refs, pomPath); + + // copy dependency + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.TEMP_FOLDER); + copyDependencies(metadataPath, mavenPath, downloadPath, forceUpdateFlag); + + // 解压并复制下载的元数据包到maven目录下 + extractMd(downloadPath, mavenPath); + ExecutorService executorService = Executors.newFixedThreadPool(2); + if (downloadMdpkgPaths != null && downloadMdpkgPaths.size() > 0) { + CopyToPackagesRunnable copyToPackagesRunnable = new CopyToPackagesRunnable(); + copyToPackagesRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + copyToPackagesRunnable.setPackagePath(packagePath); + executorService.submit(copyToPackagesRunnable::run); + } + + // 下载jar + if (forceUpdateFlag && ProcessMode.GENERATION.equals(processMode)) { + InstallJarRunnable installJarRunnable = new InstallJarRunnable(); + installJarRunnable.setPomPath(pomPath); + installJarRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + installJarRunnable.setPomDirPath(metadataPath); + installJarRunnable.setForceUpdateFlag(true); + installJarRunnable.setMavenPath(mavenPath); + installJarRunnable.setDownloadPath(downloadPath); + executorService.submit(installJarRunnable::run); + } + } finally { + if (!forceUpdateFlag || !ProcessMode.GENERATION.equals(processMode)) { + //删除pom.xml + if (fileServiceImp.isFileExist(pomPath)) { + fileServiceImp.fileDelete(pomPath); + } + //删除\projects\maven/temp + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } + } + } + + public void installMdpkg(String groupId, String artifactId, String version, String absolutePath, + Boolean forceUpdateFlag, String mavenPath, String packagePath) throws IOException { + //创建pom文件,对应的mdproj添加依赖信息 + absolutePath = metadataProjectCoreService.getProjPath(absolutePath); + String metadataPath = absolutePath + File.separator + "metadata"; + String desPath = new File(mavenPath).getAbsolutePath(); + if (!fileServiceImp.isDirectoryExist(desPath)) { + fileServiceImp.createDirectory(desPath); + } + try { + boolean isDone = createPomAndDownloadMdproj(groupId, artifactId, version, metadataPath, forceUpdateFlag, mavenPath); + if (!isDone) { + throw new RuntimeException("获取元数据依赖失败"); + } + if (!addDependencyToMdproj(groupId, artifactId, version, metadataPath)) { + throw new RuntimeException("添加依赖包到mdproj失败"); + } + + //解压并复制下载的元数据包到/projects/maven目录下,结构和nuget对齐。 + extractMd(downloadPath, mavenPath); + ExecutorService executorService = Executors.newSingleThreadExecutor(); + if (downloadMdpkgPaths != null && downloadMdpkgPaths.size() > 0) { + CopyToPackagesRunnable copyToPackagesRunnable = new CopyToPackagesRunnable(); + copyToPackagesRunnable.setDownloadMdpkgPaths(downloadMdpkgPaths); + copyToPackagesRunnable.setPackagePath(packagePath); + executorService.submit(copyToPackagesRunnable::run); + } + + //下载jar包 + ProcessMode processMode = metadataProjectCoreService.getProcessMode(absolutePath); + if (version.contains("SNAPSHOT") && forceUpdateFlag && ProcessMode.GENERATION.equals(processMode)) { + InstallSingleJarRunnable installSingleJarRunnable = new InstallSingleJarRunnable(); + installSingleJarRunnable.setPomDirPath(metadataPath); + installSingleJarRunnable.setDownloadPath(downloadPath); + installSingleJarRunnable.setMavenPath(mavenPath); + executorService.submit(installSingleJarRunnable::run); + } + + //添加api依赖 + String apiPath = fileServiceImp.getApiModulePath(absolutePath); + if (apiPath != null && !apiPath.isEmpty()) { + String pomApi = fileServiceImp.getCombinePath(fileServiceImp.getApiModulePath(absolutePath), MavenUtils.POM_FILE); + if (fileServiceImp.isFileExist(pomApi)) { + addProjectDependency(pomApi, groupId, artifactId, version); + } + } + + } finally { + String metadataPomPath = fileServiceImp.getCombinePath(metadataPath, MavenUtils.POM_FILE); + //删除pom.xml + if (fileServiceImp.isFileExist(metadataPomPath)) { + fileServiceImp.fileDelete(metadataPomPath); + } + //删除\projects\maven/temp + if (!version.contains("SNAPSHOT") || !forceUpdateFlag) { + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } + } + } + + public void uninstallMdpkg(String absolutePath, String packName, String mavenPath) { + int divideIndex = packName.indexOf("-"); + String groupId = packName.substring(0, divideIndex); + String artifactId = packName.substring(divideIndex + 1); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeMavenRefs(absolutePath, metadataProject, mavenPackageRefs); + + PackageNameManager packageNameManager = new PackageNameManager(); + String mdpkgName = packageNameManager.getMdpkgNameByGA(groupId, artifactId, mavenPath, absolutePath); + if (mdpkgName.isEmpty()) { + throw new RuntimeException("无法根据" + packName + "获取准确的元数据包名,请手动删除工程引用文件中MetadataPackageRefs节点和ProjectRefs节点中的相关内容。"); + } + + List mdpkgNames = new ArrayList<>(); + mdpkgNames.add(mdpkgName); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeProjectRefs(absolutePath, metadataProject, mdpkgNames); + + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(mdpkgName); + RepositoryFactory.getInstance().getMetadataProjectRepository().removeRefs(absolutePath, metadataProject, metadataPackageHeader); + } + + public void addProjectDependency(String pomPath, String groupId, String artifactId, String version) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + List list = model.getDependencies(); + Dependency dependency = new Dependency(); + dependency.setGroupId(groupId); + dependency.setArtifactId(artifactId); + if (version.startsWith("m")) { + dependency.setVersion(version.substring(1)); + } else { + dependency.setVersion(version); + } + //需要判断依赖信息。依赖信息中不允许有重复。 + boolean isDependencyExits = false; + for (Dependency dep : list) { + if (dep.getGroupId().equals(groupId) && dep.getArtifactId().equals(artifactId)) { + //如果groupId,artifactId相同,则更新版本号。 + isDependencyExits = true; + if (version.startsWith("m")) { + dep.setVersion(version.substring(1)); + } else { + dep.setVersion(version); + } + } + } + if (!isDependencyExits) { + list.add(dependency); + } + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + mavenXpp3Writer.write(fileOutputStream, model); + } + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + } + + public void deployReleaseMdVersion(String projPath, String version, String repoId, boolean revert, + String dependenciesVersion, String mavenPath) throws IOException { + if (projPath == null || projPath.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (version == null || version.isEmpty()) { + throw new IllegalArgumentException("version不能为空"); + } + String codepath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + + String apiPomPath = fileServiceImp.getApiModulePath(projPath) + File.separator + MavenUtils.POM_FILE; + String revertCommand = "versions:revert"; + String commitCommand = "versions:commit"; + String command = String.format("versions:set -DnewVersion=%s", version); + //更新release版本号 + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, command); + //根据前端dependencies进行版本号变更 + if (!StringUtils.isEmpty(dependenciesVersion)) { + List list = null; + Model model = null; + try (FileInputStream fis = new FileInputStream(apiPomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + model = reader.read(fis); + list = model.getDependencies(); + for (Dependency dependency : list) { + if (dependency.getVersion() != null) { + if (dependency.getVersion().endsWith(MavenUtils.SNAP_SHOT)) { + dependency.setVersion(dependenciesVersion); + } + } + } + + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + if (model != null) { + model.setDependencies(list); + } else { + throw new RuntimeException("api模块pom.xml内容为空"); + } + FileOutputStream fos = new FileOutputStream(apiPomPath); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fos, model); + fos.close(); + //然后进行推送操作 + try { + deployMdpkg(projPath, repoId, dependenciesVersion, mavenPath); + } finally { + if (revert) { + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, revertCommand); + } else { + mavenUtilsCore.exeMavenCommand(codepath, mavenPath, commitCommand); + } + } + } + } + + public void deploySnapshotMdVersion(String projPath, String repoId, String version, boolean revert, + String mavenPath) { + if (projPath == null || projPath.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (version == null || version.isEmpty()) { + throw new IllegalArgumentException("version不能为空"); + } + + String codePath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + String revertCommand = "versions:revert"; + String commitCommand = "versions:commit"; + String command = String.format("versions:set -DnewVersion=%s", version); + //更新版本号 + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, command); + //然后进行推送操作 + try { + deployMdpkg(projPath, repoId, null, mavenPath); + } finally { + if (revert) { + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, revertCommand); + } else { + mavenUtilsCore.exeMavenCommand(codePath, mavenPath, commitCommand); + } + } + } + + public void deployMdpkgForInterpretation(String projPath, String repoId, String version, String dependencyVersion, + String mavenPath) { + final MavenDeploymentForMdpkgManager mavenDeploymentForMdpkgManager = new MavenDeploymentForMdpkgManager(); + mavenDeploymentForMdpkgManager.deploy(projPath, repoId, version, dependencyVersion, mavenPath); + } + + public void deployMdpkg(String proPath, String repoId, String dependencyVersion, String mavenPath) { + String repoUrl = getRepoUrl(repoId, mavenPath); + if (repoUrl == null || repoUrl.isEmpty()) { + throw new IllegalArgumentException("获取repoUrl失败,请检查" + mavenPath + "/config/settings.xml配置"); + } + boolean isModelExist = isJavaProjExist(proPath); + //接下来拷贝元数据 + String moduleApiPath; + String codePath = proPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + String codePom = fileServiceImp.getCombinePath(codePath, MavenUtils.POM_FILE); + String apiPomPath; + String metadataBin = File.separator + "metadata" + File.separator + "bin"; + String metadataBinPath = proPath + metadataBin; + String metadataPath = File.separator + "metadata"; + String metadataDir = proPath + metadataPath; + String metadataTempDir = fileServiceImp.getCombinePath(metadataDir, MavenUtils.TEMP_FOLDER); + if (isModelExist) { + moduleApiPath = fileServiceImp.getApiModulePath(proPath); + apiPomPath = fileServiceImp.getCombinePath(moduleApiPath, MavenUtils.POM_FILE); + //读mdproj获取依赖信息 + metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataDir); + List refsList = metadataProject.getMavenPackageRefs(); + try { + //获取api module的groupId,artifactId,version + apiModuleInfo = getApiModuleInfo(apiPomPath); + if (apiModuleInfo != null) { + boolean isSnapshot = apiModuleInfo.getVersion().endsWith(MavenUtils.SNAP_SHOT); + setRepoUrl(codePom, repoUrl, repoId, isSnapshot); + } + createPomForDeploy(apiModuleInfo, refsList, metadataTempDir, repoUrl, repoId, dependencyVersion); + boolean isCreated = createSrcDir(metadataTempDir); + if (!isCreated) { + log.error("创建资源目录失败"); + } + } catch (IOException e) { + e.printStackTrace(); + } + //获取工程下元数据包名 + String metadaPackageName = ""; + List list = fileServiceImp.getAllFiles(metadataBinPath); + for (File file : list) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + metadaPackageName = file.getName(); + } + } + if (metadaPackageName.isEmpty()) { + throw new RuntimeException("找不到元数据包,请先编译!"); + } + String metadataFullPath = metadataBinPath + File.separator + metadaPackageName; + String destPath = metadataTempDir + File.separator + MavenUtils.RESOURCES_DIR + File.separator + metadaPackageName; + try { + fileServiceImp.fileCopy(metadataFullPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + try { + if (!mavenUtilsCore.exeMavenCommand(metadataTempDir, mavenPath, "deploy")) { + throw new RuntimeException("部署元数据包失败"); + } + } catch (Exception e) { + throw new RuntimeException("部署元数据失败", e); + } finally { + try { + fileServiceImp.deleteAllFilesUnderDirectory(metadataTempDir); + } catch (IOException e) { + e.printStackTrace(); + } + } + boolean isApiPushed = mavenUtilsCore.exeMavenCommand(codePath, mavenPath, "deploy -pl api -am"); + if (!isApiPushed) { + throw new RuntimeException("部署api失败"); + } + + try { + String processMode = metadataProject.getMetadataPackageInfo().getProcessMode() == null ? "generation" : metadataProject.getMetadataPackageInfo().getProcessMode().toString(); + updateMetadataIndexWithProcessMode(metadaPackageName, metadataBinPath, repoUrl, apiModuleInfo, processMode); + } catch (Exception e) { + updateMetadataIndex(metadaPackageName, metadataBinPath, repoUrl, apiModuleInfo); + } + } else { + throw new RuntimeException("未找到Java模板工程目录,请先生成Java代码"); + } + } + + public MavenComponents getVersionsOfSinglePackage(String sourceUrl, String packName) { + String[] urlSections = sourceUrl.split("/"); + String repository = urlSections[urlSections.length - 1]; + String groupId = packName.substring(0, packName.indexOf("-")); + String artifactId = packName.substring(packName.indexOf("-") + 1); + String url = "https://repos.iec.io/service/rest/v1/search?repository=" + + repository + + "&group=" + + groupId + + "&name=" + + artifactId + + "&sort=version"; + try { + HttpHeaders headers = new HttpHeaders(); + headers.setBasicAuth("igix-web-ide", "imUIz2J#mEgmkvRS"); + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, MavenComponents.class); + return response.getBody(); + } catch (Exception e) { + return null; + } + } + + public String getMavenPackageLatestVersion(String groupId, String artifactId) { + // 首先从gsp-releases获取,如果可以连接外网,则可以获取。 + String version = getMavenPackageVersionsFromGsp(groupId, artifactId); + if ("0.1.0".equals(version)) { + // 读取settings.xml中的仓库,循环查找版本 + try { + version = getMavenPackageVersionsFromRepository(groupId, artifactId); + } catch (MalformedURLException e) { + } + } + return version; + } + + private String getMavenPackageVersionsFromGsp(String groupId, String artifactId) { + String version = "0.1.0"; + try { + String url = "https://repos.iec.io/service/rest/v1/search?repository=maven-gsp-releases&group=" + groupId + "&name=" + artifactId + "&sort=version"; + HttpHeaders headers = new HttpHeaders(); + headers.setBasicAuth("igix-web-ide", "imUIz2J#mEgmkvRS"); + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(url, HttpMethod.GET, entity, MavenComponents.class); + // 如果查找到版本,排序获取最新版本 + VersionManager versionManager = new VersionManager(); + for (MavenComponent item : response.getBody().getItems()) { + version = versionManager.versionCompare(version, item.getVersion().replace("m", "")); + } + } catch (Exception e) { + } + return version; + } + + private String getMavenPackageVersionsFromRepository(String groupId, + String artifactId) throws MalformedURLException { + String version = "0.1.0"; + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + if (mavenSettings == null) { + return version; + } + + for (MavenSettingsMirror mirror : mavenSettings.getMirrors()) { + if (mirror.getUrl() == null || mirror.getId() == null) { + break; + } + + HttpHeaders headers = null; + for (MavenSettingsServer server : mavenSettings.getServers()) { + if (server.getId().equals(mirror.getId())) { + headers = new HttpHeaders(); + headers.setBasicAuth(server.getUsername(), server.getPassword()); + break; + } + } + if (headers == null) { + break; + } + + final URL url = new URL(mirror.getUrl()); + final String[] splitUrl = mirror.getUrl().split("/"); + String repository = splitUrl[splitUrl.length - 1]; + String searchUrl = url.getProtocol() + "://" + url.getHost(); + searchUrl += url.getPort() == -1 ? "" : ":" + url.getPort(); + searchUrl += "/service/rest/v1/search?repository=" + repository + "&group=" + groupId + "&name=" + artifactId + "&sort=version"; + + try { + HttpEntity entity = new HttpEntity<>(null, headers); + ResponseEntity response = restTemplate.exchange(searchUrl, HttpMethod.GET, entity, MavenComponents.class); + // 如果查找到版本,排序获取最新版本 + if (response.getBody() != null && response.getBody().getItems() != null && response.getBody().getItems().size() > 0) { + for (MavenComponent item : response.getBody().getItems()) { + version = versionCompareRelease(version, item.getVersion().replace("m", "")); + } + } + } catch (Exception e) { + } + } + return version; + } + + private String versionCompareRelease(String existVersion, String newVersion) { + if (newVersion.contains("-")) { + return existVersion; + } else { + VersionManager versionManager = new VersionManager(); + return versionManager.versionCompare(existVersion, newVersion); + } + } + + public MavenPackageRefs getGAByMdpkgName(String mdpkgName) { + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String groupId; + String artifactId; + + String[] info = mdpkgName.split("\\."); + switch (info.length) { + case 2: + groupId = "com." + info[0].toLowerCase(); + artifactId = String.format("%s-api", info[0]).toLowerCase(); + break; + case 3: + groupId = "com." + info[0].toLowerCase(); + artifactId = String.format("%s-api", info[1]).toLowerCase(); + break; + default: + groupId = String.format("com.%s.%s", info[0], info[1]).toLowerCase(); + if ("Inspur.Gsp.Common.CommonCmp.mdpkg".equals(mdpkgName)) { + artifactId = "gsp-common-commoncomponent-api"; + } else if ("Inspur.Gsp.Common.CommonUdt.mdpkg".equals(mdpkgName)) { + artifactId = "gsp-pfcommon-commonudt-api"; + } else { + if (info.length > 4) { + artifactId = String.format("%s-%s-%s-api", info[2], info[3], info[4]).toLowerCase(); + } else { + artifactId = String.format("%s-%s-%s-api", info[1], info[2], info[3]).toLowerCase(); + } + } + } + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + return mavenPackageRefs; + } + + public MetadataRepo getRepoList() { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + final MetadataRepo metadataRepo = transferMirrorsToMetadataRepo(mirrors); + return metadataRepo; + } + + public MetadataRepo getHostedRepoList() { + final List mirrors = getHostedMirrors(); + final MetadataRepo metadataRepo = transferMirrorsToMetadataRepo(mirrors); + return metadataRepo; + } + + private List getHostedMirrors() { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrorsInSettings = mavenSettings.getMirrors(); + // 去掉aliyun + List mirrors = mirrorsInSettings.stream().filter(mirror -> !mirror.getUrl().contains(alimavenFlag)).collect(Collectors.toList()); + // 加上gsp和bf + publicMirrors.forEach(publicMirror -> { + if (mirrors.stream().noneMatch(mirror -> mirror.getUrl().equals(publicMirror.getUrl()))) { + mirrors.add(publicMirror); + } + }); + return mirrors; + } + + private MetadataRepo transferMirrorsToMetadataRepo(List mirrors) { + MetadataRepo metadataRepo = new MetadataRepo(); + List sourceDtos = new ArrayList<>(); + mirrors.forEach(mirror -> { + final PackageSourceDto packageSourceDto = new PackageSourceDto(); + packageSourceDto.setId(mirror.getId()); + packageSourceDto.setName(mirror.getName()); + packageSourceDto.setSourceUrl(mirror.getUrl()); + sourceDtos.add(packageSourceDto); + }); + metadataRepo.setRepoList(sourceDtos); + return metadataRepo; + } + + private String handleCompileGoal(String modules) { + StringBuilder sb; + if ("all".equals(modules)) { + sb = new StringBuilder("clean install").append(" -T 100C -Dmaven.test.skip=true"); + } else { + sb = new StringBuilder("clean install -pl ").append(modules).append(" -T 100C -Dmaven.test.skip=true"); + } + + if (modules.contains("api")) { + sb.append(" -am "); + } + return sb.toString(); + } + + public boolean getInstallFlag(MavenPackageRefs ref, Boolean force, String mavenPath, String packagePath) { + boolean flagValidMavenRef = ref.getGroupId() != null && ref.getArtifactId() != null && ref.getVersion() != null; + if (!flagValidMavenRef) { + String log = "[LCM Warning]" + "存在不合法的maven引用,GAV:" + ref.getGroupId() + "," + ref.getArtifactId() + "," + ref.getVersion(); + LoggerDisruptorQueue.publishEvent(log, CAFContext.current.getUserId()); + return false; + } + + // 是临时包则下载;maven文件夹下需要元数据包和pom文件,缺一则下载;packages文件夹下需要元数据包,缺少则下载 + boolean installFlag = ref.getVersion().contains(MavenUtils.SNAP_SHOT) && force; + if (!installFlag) { + List fileInMaven = fileServiceImp.getAllFiles(mavenPath + File.separator + ref.getGroupId() + "-" + ref.getArtifactId() + "-" + ref.getVersion()); + installFlag = fileInMaven.size() < 2; + if (!installFlag) { + File mdpkg = fileInMaven.stream().filter(file -> file.getName().endsWith(".mdpkg")).findAny().orElse(null); + installFlag = mdpkg == null || !fileServiceImp.isFileExist(packagePath + File.separator + mdpkg.getName() + File.separator + mdpkg.getName()); + } + } + return installFlag; + } + + private void removeProjectRefs(String absolutePath, List mavenPackageRefsList, + List projectHeaderList) { + if (Utils.isNullOrEmpty(projectHeaderList) || Utils.isNullOrEmpty(mavenPackageRefsList)) { + return; + } + + List mavenPackageInfoInBo = new ArrayList<>(); + for (ProjectHeader projectHeader : projectHeaderList) { + String projPath = fileServiceImp.getCombinePath(absolutePath, projectHeader.getProjectPath()); + if (fileServiceImp.isDirectoryExist(projPath)) { + GspProject gspProjectInfo = new GspProjectCoreService().getGspProjectInfo(projPath); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String[] strings = gspProjectInfo.getProjectNameSpace().split("\\."); + if (strings.length == 1) { + mavenPackageRefs.setGroupId("com." + strings[0].toLowerCase()); + } else { + mavenPackageRefs.setGroupId("com." + (strings[0] + "." + strings[1]).toLowerCase()); + } + mavenPackageRefs.setArtifactId((gspProjectInfo.getAppCode() + "-" + gspProjectInfo.getServiceUnitCode() + "-" + gspProjectInfo.getMetadataProjectName().replace("bo-", "") + "-api").toLowerCase()); + mavenPackageInfoInBo.add(mavenPackageRefs); + } + } + + List refForExclude = new ArrayList<>(); + if (mavenPackageInfoInBo.size() > 0) { + for (MavenPackageRefs mavenPackageRefs : mavenPackageRefsList) { + for (MavenPackageRefs mavenPackageRefsInBo : mavenPackageInfoInBo) { + if (mavenPackageRefs.getGroupId().equals(mavenPackageRefsInBo.getGroupId()) + && mavenPackageRefs.getArtifactId().equals(mavenPackageRefsInBo.getArtifactId())) { + refForExclude.add(mavenPackageRefs); + } + } + } + for (MavenPackageRefs mavenPackageRefs : refForExclude) { + mavenPackageRefsList.remove(mavenPackageRefs); + } + } + } + + private void updateMetadataIndex(String mdpkgName, String mdpkgPath, String repoUrl, ApiModuleInfo apiModuleInfo) { + MetadataPackage metadataPackage = new MetadataCoreManager().getMetadataPackageInfo(mdpkgName, mdpkgPath); + if (metadataPackage.getMetadataList() != null && metadataPackage.getMetadataList().size() > 0) { + PackageWithMetadataInfo packageWithMetadataInfo = new PackageWithMetadataInfo(); + packageWithMetadataInfo.setMavenPackageGroupId(apiModuleInfo.getGroupId()); + packageWithMetadataInfo.setMavenPackageArtifactId(apiModuleInfo.getArtifactId()); + packageWithMetadataInfo.setMavenPackageVersion(apiModuleInfo.getVersion()); + packageWithMetadataInfo.setMavenPackageUrl(repoUrl); + + List metadatas = new ArrayList<>(); + for (GspMetadata metadata : metadataPackage.getMetadataList()) { + MetadataInfoInMaven tempMetadata = new MetadataInfoInMaven(); + tempMetadata.setMetadataId(metadata.getHeader().getId()); + tempMetadata.setMetadataCode(metadata.getHeader().getCode()); + tempMetadata.setMetadataName(metadata.getHeader().getName()); + tempMetadata.setMetadataNamespace(metadata.getHeader().getNameSpace()); + tempMetadata.setMetadataType(metadata.getHeader().getType()); + tempMetadata.setMetadataIsTranslating(metadata.getHeader().getTranslating() ? "t" : "f"); + tempMetadata.setMdBizobjectId(metadata.getHeader().getBizObjectId()); + tempMetadata.setMetadataPackageCode(metadataPackage.getHeader().getName()); + tempMetadata.setMetadataPackageVersion(metadataPackage.getHeader().getVersion().getVersionString()); + tempMetadata.setMetadataLanguage(metadata.getHeader().getLanguage()); + tempMetadata.setMavenPackageGroupId(apiModuleInfo.getGroupId()); + tempMetadata.setMavenPackageArtifactId(apiModuleInfo.getArtifactId()); + tempMetadata.setMavenPackageVersion(apiModuleInfo.getVersion()); + tempMetadata.setMavenPackageUrl(repoUrl); + metadatas.add(tempMetadata); + } + + packageWithMetadataInfo.setMetadatas(metadatas); + + String indexServerUrl = IndexServerManager.getInstance().getIndexServerUrl(); +// IndexServerConfiguration indexServer = IndexServerHelper.getInstance().getIndexServerConfigUration(); +// indexServer.setIP("localhost"); +// String url = "http://" + indexServer.getIP() + ":" + indexServer.getPort() + "/api/v1/metadataindex/mvn"; + restTemplate.postForObject(indexServerUrl, new HttpEntity<>(packageWithMetadataInfo, new HttpHeaders()), boolean.class); + } + } + + private ApiModuleInfo getApiModuleInfo(String apiPomPath) { + try (FileInputStream fis = new FileInputStream(apiPomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + ApiModuleInfo apiModuleInfo = new ApiModuleInfo(); + //api模块继承父的groupid,artifactid,version,自己没有定义 + if (model.getGroupId() != null) { + apiModuleInfo.setGroupId(model.getGroupId()); + } else { + apiModuleInfo.setGroupId(model.getParent().getGroupId()); + } + if (model.getArtifactId() != null) { + apiModuleInfo.setArtifactId(model.getArtifactId()); + } else { + apiModuleInfo.setArtifactId(model.getParent().getArtifactId()); + } + if (model.getVersion() != null) { + apiModuleInfo.setVersion(model.getVersion()); + } else { + apiModuleInfo.setVersion(model.getParent().getVersion()); + } + return apiModuleInfo; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } + + private void setRepoUrl(String codePom, String repoUrl, String repoId, boolean isSnapshot) { + try (FileInputStream fis = new FileInputStream(codePom)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + DistributionManagement distributionManagement = getDistributionManagement(repoUrl, repoId, isSnapshot); + model.setDistributionManagement(distributionManagement); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + FileOutputStream fos = new FileOutputStream(codePom); + mavenXpp3Writer.write(fos, model); + fos.close(); + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + } + + private boolean isJavaProjExist(String proPath) { + //判断模板工程是否已创建。 + if (fileServiceImp.getProjectPath(proPath) != null) { + String subpropath = fileServiceImp.getProjectPath(proPath); + String fullPath = fileServiceImp.getCombinePath(proPath, subpropath); + List list = fileServiceImp.getAllFiles(fullPath); + for (File file : list) { + if (file.toString().endsWith("pom.xml")) { + return true; + } + } + } + return false; + } + + private String getRepoUrl(String repoId, String mavenPath) { + String repoUrl = ""; + MetadataRepo metadataRepo = getRepoList(); + if (metadataRepo == null || metadataRepo.getRepoList() == null || metadataRepo.getRepoList().size() <= 0) { + return null; + } + for (PackageSourceDto item : metadataRepo.getRepoList()) { + if (item.getId().equals(repoId)) { + repoUrl = item.getSourceUrl(); + } + } + + return repoUrl; + } + + private boolean addDependencyToMdproj(String groupid, String artifactid, String version, String mepath) { + //给对应的mdproj添加依赖信息 + metadataProject = metadataProjectCoreService.getMetadataProjInfo(mepath); + MavenPackageRefs singlemavenPackageRefs = new MavenPackageRefs(); + singlemavenPackageRefs.setGroupId(groupid); + singlemavenPackageRefs.setArtifactId(artifactid); + singlemavenPackageRefs.setVersion(version); + if (metadataProject.getMavenPackageRefs() == null) { + List list = new ArrayList<>(); + list.add(singlemavenPackageRefs); + metadataProject.setMavenPackageRefs(list); + } else { + //不允许引用多个版本的相同包。 + List mavenPackageRefs = metadataProject.getMavenPackageRefs(); + boolean isDependencyExits = false; + for (MavenPackageRefs dep : mavenPackageRefs) { + if (dep.getGroupId().equals(groupid) && dep.getArtifactId().equals(artifactid)) { + //如果groupId,artifactId相同,则更新版本号。 + isDependencyExits = true; + dep.setVersion(version); + } + } + if (!isDependencyExits) { + mavenPackageRefs.add(singlemavenPackageRefs); + } + metadataProject.setMavenPackageRefs(mavenPackageRefs); + } + //实体已更新,序列化到磁盘 + List files = fileServiceImp.getAllFiles(mepath); + File mdprojFile = null; + for (File file : files) { + if (".mdproj".equals(fileServiceImp.getExtension(file))) { + mdprojFile = file; + } + } + if (mdprojFile == null) { + throw new RuntimeException(".mdproj文件不存在"); + } + Utils.writeValue(mdprojFile.getPath(), metadataProject); + + return true; + } + + private boolean createPomAndDownloadMdproj(String groupid, String artifactid, String version, String path, + Boolean forceUpdateFlag, String mavenPath) throws IOException { + File pomFile = new File(fileServiceImp.getCombinePath(path, MavenUtils.POM_FILE)); + if (!pomFile.exists()) { + if (pomFile.createNewFile()) { + log.debug("创建下载pom.xml完成"); + } + } + FileOutputStream fileOutputStream = new FileOutputStream(pomFile); + Model model = new Model(); + model.setArtifactId("com.inspur.edp"); + model.setGroupId("download-tools"); + model.setVersion("0.1.0-SNAPSHOT"); + model.setModelVersion("4.0.0"); + model.setPackaging("pom"); + List list = model.getDependencies(); + Dependency dependency = new Dependency(); + dependency.setArtifactId(artifactid); + dependency.setGroupId(groupid); + dependency.setVersion(version); + dependency.setType("zip"); + list.add(dependency); + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + fileOutputStream.close(); + downloadPath = fileServiceImp.getCombinePath(mavenPath, MavenUtils.TEMP_FOLDER); + + //获取排除的artifact + MetadataProject metadataProject = metadataProjectCoreService.getMetadataProjInfo(metadataProjectCoreService.getProjPath(path)); + StringBuilder excludeArtifactIds = new StringBuilder(); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRef : metadataProject.getMavenPackageRefs()) { + if (!mavenPackageRef.getArtifactId().equals(artifactid)) { + excludeArtifactIds.append(mavenPackageRef.getArtifactId()).append(","); + } + } + } + if (excludeArtifactIds.length() > 0) { + excludeArtifactIds = new StringBuilder(excludeArtifactIds.substring(0, excludeArtifactIds.length() - 1)); + } + + String mvnCommand = String.format(" dependency:copy-dependencies -DoutputDirectory=%s -DincludeTypes=zip -DexcludeArtifactIds=%s -Dmdep.copyPom", downloadPath, excludeArtifactIds.toString()); + mvnCommand = forceUpdateFlag ? mvnCommand + " -U" : mvnCommand; + //拷贝依赖 + return mavenUtilsCore.exeMavenCommand(path, mavenPath, mvnCommand); + } + + private void checkModules(String projPath, String modules) { + String codePath = projPath + File.separator + "java" + File.separator + "code"; + String[] moduleArray = modules.split(","); + for (String module : moduleArray) { + checkModule(codePath, module); + } +// if (moduleArray.length == 1) { +// checkModuleTarget(codePath, moduleArray[0]); +// } + } + + private void checkModule(String codePath, String module) { + String srcPath = codePath + File.separator + module + File.separator + "pom.xml"; + if (!fileServiceImp.isFileExist(srcPath)) { + throw new RuntimeException("未找到" + module + "模块代码pom文件,请检查" + module + "模块代码是否已经成功生成。"); + } + } + + private MavenPackageRefs handleMavenPackageName(String mdpkgName) { + MavenPackageRefs mavenPackageRefs = getGAByMdpkgName(mdpkgName); + String version = getMavenPackageLatestVersion(mavenPackageRefs.getGroupId(), mavenPackageRefs.getArtifactId()); + version = version.startsWith("m") ? version : "m" + version; + mavenPackageRefs.setVersion(version); + return mavenPackageRefs; + + } + + private MetadataPackageHeader handleMetadataPackageName(String packName) { + MetadataPackageHeader packageHeader = new MetadataPackageHeader(); + packageHeader.setName(packName.replace(".mdpkg", "")); + packageHeader.setVersion(new MetadataPackageVersion("1.0.0")); + + return packageHeader; + } + + private void restoreSpecificPackage(String path, MavenPackageRefs ref, String mavenPath, String packagePath) { + if (path == null || path.isEmpty()) { + throw new IllegalArgumentException("工程路径不能为空"); + } + if (ref.getGroupId() != null && ref.getArtifactId() != null && ref.getVersion() != null) { + if (ref.getVersion().contains(MavenUtils.SNAP_SHOT)) { + try { + installMdpkg(ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), path, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + if (fileServiceImp.getAllFiles(mavenPath + "/" + ref.getGroupId() + "-" + ref.getArtifactId() + "-" + ref.getVersion() + ).size() == 0) { + log.info("路径" + mavenPath + "/" + ref.getGroupId() + "-" + ref.getArtifactId() + + "-" + ref.getVersion() + "元数据不存在,开始下载"); + try { + installMdpkg(ref.getGroupId(), ref.getArtifactId(), ref.getVersion(), path, mavenPath, packagePath); + } catch (IOException e) { + log.error("获取最新元数据包失败,请查看mdproj文件中引用的元数据包是否正确"); + throw new RuntimeException(e); + } + } + } + } + + private void createPomForDeploy(ApiModuleInfo info, List refs, String pomPath, String repoUrl, + String repoId, String dependencyVersion) throws IOException { + File pomDir = new File(pomPath); + if (!pomDir.exists()) { + if (pomDir.mkdir()) { + log.debug("创建打包目录完成"); + } + } + File pomFile = new File(fileServiceImp.getCombinePath(pomDir.toString(), MavenUtils.POM_FILE)); + if (!pomFile.exists()) { + if (pomFile.createNewFile()) { + log.debug("创建打包pom.xml完成"); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pomFile)) { + Model model = new Model(); + //构造父pom信息 + Parent parent = new Parent(); + parent.setArtifactId("metadata-parent"); + parent.setGroupId("com.inspur.edp"); + boolean isSnotshot = apiModuleInfo.getVersion().endsWith(MavenUtils.SNAP_SHOT); + parent.setVersion("0.1.0"); + model.setParent(parent); + model.setArtifactId(info.getArtifactId()); + model.setGroupId(info.getGroupId()); + model.setVersion("m" + info.getVersion()); + model.setModelVersion("4.0.0"); + model.setPackaging("metadata-pack"); + DistributionManagement distributionManagement = getDistributionManagement(repoUrl, repoId, isSnotshot); + model.setDistributionManagement(distributionManagement); + List list = model.getDependencies(); + if (refs != null && refs.size() > 0) { + refs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + if (dependencyVersion != null && ref.getVersion().endsWith(MavenUtils.SNAP_SHOT)) { + + dependency.setVersion("m" + dependencyVersion); + } else { + dependency.setVersion(ref.getVersion()); + } + dependency.setType("zip"); + list.add(dependency); + }); + } + //配置插件,必须配置lcm-metadata-build-maven-plugin + + model.setDependencies(list); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private DistributionManagement getDistributionManagement(String repoUrl, String repoId, boolean isSnotshot) { + DistributionManagement distributionManagement = new DistributionManagement(); + DeploymentRepository deploymentRepository = new DeploymentRepository(); + deploymentRepository.setId(repoId); + deploymentRepository.setUrl(repoUrl); + if (isSnotshot) { + distributionManagement.setSnapshotRepository(deploymentRepository); + } else { + distributionManagement.setRepository(deploymentRepository); + } + return distributionManagement; + } + + private boolean createSrcDir(String mdpkgPath) { + String resDir = mdpkgPath + File.separator + MavenUtils.RESOURCES_DIR; + File resourceFile = new File(resDir); + return resourceFile.mkdirs(); + } + + private void afterCompile(String absolutePath) { + List types = new ArrayList<>(); + types.add("comp"); + metadataProjectCoreService.setSourceDataModifiedTime(absolutePath, types); + } + + private void extractMd(String libPath, String mavenPath) { + lock.lock(); + try { + // 获取lib下所有的元数据包,解压到/projects/maven下 + List allFiles = fileServiceImp.getAllFiles(libPath); + downloadMdpkgPaths = new ArrayList<>(); + allFiles.stream().parallel().forEach(file -> { + String desMetadataDir; + String exactGroupId = getGroupId(file); + // 解压元数据包 + if (Utils.getZipSuffix().equals(fileServiceImp.getExtension(file))) { + ZipFile zf = null; + InputStream in = null; + ZipInputStream zin = null; + try { + zf = new ZipFile(file); + in = new BufferedInputStream(new FileInputStream(file)); + Charset utf8 = StandardCharsets.UTF_8; + zin = new ZipInputStream(in, utf8); + ZipEntry ze; + InputStream is = null; + OutputStream outputStream = null; + OutputStream packageOutputStream = null; + while ((ze = zin.getNextEntry()) != null) { + try { + if (Utils.getMetadataPackageExtension().equals(fileServiceImp.getExtension(ze.toString()))) { + String fileName = ze.getName(); + is = zf.getInputStream(ze); + + String fileNameWithoutExt = fileServiceImp.getFileNameWithoutExtension(file); + desMetadataDir = mavenPath + File.separator + exactGroupId + "-" + fileNameWithoutExt; + String outputFilePath = desMetadataDir + File.separator + fileName; + downloadMdpkgPaths.add(outputFilePath); + // 如果是已存在的正式版,则不需要再解压到maven文件夹 + if (isReleaseMdpkgExists(desMetadataDir)) { + return; + } + + if (!fileServiceImp.isDirectoryExist(desMetadataDir)) { + fileServiceImp.createDirectory(desMetadataDir); + } + String pomFileName = fileNameWithoutExt + Utils.getPomSuffix(); + fileServiceImp.fileCopy(libPath + File.separator + pomFileName, desMetadataDir + File.separator + pomFileName); + File outputFile = new File(outputFilePath); + outputStream = new FileOutputStream(outputFile); + int len; + while ((len = is.read()) != -1) { + outputStream.write(len); + } + } + } catch (IOException e) { + log.error(e.toString()); + } finally { + if (is != null) { + is.close(); + } + if (packageOutputStream != null) { + packageOutputStream.close(); + } + if (outputStream != null) { + outputStream.close(); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + assert zin != null; + try { + zin.closeEntry(); + zin.close(); + in.close(); + zf.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("提取元数据包错误,路径为:" + libPath, e); + } finally { + lock.unlock(); + } + } + + private boolean isReleaseMdpkgExists(String desMetadataDir) { + return !desMetadataDir.endsWith(Utils.getVersionSuffix()) && fileServiceImp.getAllFiles(desMetadataDir).size() == 2; + } + + private String getGroupId(File file) { + PomManager pomManager = new PomManager(); + String groupId = null; + String pomPath = file.getPath().replace(".zip", ".pom"); + if (fileServiceImp.isFileExist(pomPath)) { + Model model = pomManager.getModel(pomPath); + if (model != null) { + groupId = model.getGroupId(); + } + } + return groupId; + } + + private boolean copyDependencies(String pomDirPath, String mavenPath, String tempPath, boolean forceUpdateFlag) { + final MavenCommandGenerator mavenCommandGenerator = new MavenCommandGenerator(); + mavenCommandGenerator.setOutputDirectory(tempPath); + mavenCommandGenerator.setIncludeTypes(PackageType.zip.toString()); + mavenCommandGenerator.setCopyPom(true); + mavenCommandGenerator.setForceUpdate(forceUpdateFlag); + final String mavenCommand = mavenCommandGenerator.generateCopydependencies(); + return mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mavenCommand); + } + + private void updateMetadataIndexWithProcessMode(String mdpkgName, String mdpkgDir, String repoUrl, + ApiModuleInfo apiModuleInfo, String processMode) { + final MavenDeploymentForMdpkgManager mavenDeploymentForMdpkgManager = new MavenDeploymentForMdpkgManager(); + Model sourceModel = new Model(); + sourceModel.setGroupId(apiModuleInfo.getGroupId()); + sourceModel.setArtifactId(apiModuleInfo.getArtifactId()); + sourceModel.setVersion(apiModuleInfo.getVersion()); + mavenDeploymentForMdpkgManager.updateMetadataIndex(mdpkgName, mdpkgDir, repoUrl, sourceModel, processMode); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..ba2f1e009af4021db6bebcf4d23d0ac0721de5b7 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateCoreService.java @@ -0,0 +1,304 @@ +/* + * 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.lcm.metadata.core; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageVersion; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static com.inspur.edp.lcm.metadata.common.Utils.handlePath; + +/** + * @author zhaoleitr + */ +public class PackageGenerateCoreService { + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + + private String packageName = ""; + private String projectPath = ""; + private String packagePath = ""; + private String projectFileName = ""; + private MetadataPackageHeader metadataPackageHeader; + private List metadataList; + private Map metadataAndDirPathList; + private MetadataPackageVersion packageVersion = new MetadataPackageVersion(); + private final FileServiceImp fileService = new FileServiceImp(); + + public void generatePackage(String path) { + projectPath = handlePath(path); + //1、初始化参数 + initialize(projectPath); + //2、组织manifest文件 + getManifest(); + //3、打包 + publishPackage(); + } + + private void initialize(String path) { + MetadataProject project = projectService.getMetadataProjInfo(path); + projectFileName = project.getName() + Utils.getMetadataProjSuffix(); + packageName = project.getMetadataPackageInfo().getName(); + packageVersion = project.getMetadataPackageInfo().getVersion(); + metadataPackageHeader = project.getMetadataPackageInfo(); + + String tempPath = fileService.getCombinePath(projectPath, "bin"); + packagePath = fileService.getCombinePath(tempPath, UUID.randomUUID().toString()); + metadataAndDirPathList = new LinkedHashMap<>(); + metadataList = new ArrayList<>(); + } + + private void getManifest() { + //1、获取头结点 + MetadataPackageHeader mpHeader = metadataPackageHeader; + //2、获取SU信息 + ServiceUnitInfo suInfo = getServiceUnitInfo(); + //3、获取依赖关系 + List mpRefs = getMpReference(); + //4、查找元数据前处理 + handleMetadataBeforePackage(metadataAndDirPathList, projectPath, packagePath); + //5、查找元数据后处理 + handleMetadataAfterFinding(mpHeader, suInfo, mpRefs); + } + + private void publishPackage() { + Utils.compress(packagePath, fileService.getDirectoryName(packagePath), this.packageName); + //将新建的文件夹删除,只保留生成的元数据包文件 + handleMetadataAfterPackage(packagePath); + } + + private MetadataPackageHeader getMpHeader() { + MetadataPackageHeader mpHeader = new MetadataPackageHeader(); + mpHeader.setName(packageName); + mpHeader.setVersion(packageVersion); + + return mpHeader; + } + + private ServiceUnitInfo getServiceUnitInfo() { + // 获取工程信息 + GspProject gspProject = new GspProjectCoreService().getGspProjectInfo(projectPath); + // 从工程信息中获取服务单元信息 + ServiceUnitInfo suInfo = new ServiceUnitInfo(); + suInfo.setAppCode(gspProject.getAppCode()); + suInfo.setServiceUnitCode(gspProject.getServiceUnitCode()); + + return suInfo; + } + + private List getMpReference() { + String projectFilePath = fileService.getCombinePath(projectPath, projectFileName); + if (!fileService.isFileExist(projectFilePath)) { + return null; + } + List mpReferences = new ArrayList<>(); + FileService service = new FileServiceImp(); + String projStr = null; + try { + projStr = service.fileRead(projectFilePath); + } catch (IOException e) { + e.printStackTrace(); + } + ObjectMapper objectMapper = Utils.getMapper(); + MetadataProject project; + try { + project = objectMapper.readValue(projStr, MetadataProject.class); + } catch (Exception e) { + throw new RuntimeException(e); + } + if (project.getMetadataPackageRefs() == null) { + return null; + } + for (MetadataPackageHeader item : project.getMetadataPackageRefs()) { + MetadataPackageReference mpRefs = new MetadataPackageReference(); + mpRefs.setDepententPackage(new MetadataPackageHeader()); + mpRefs.getDepententPackage().setName(item.getName()); + if (item.getVersion().getVersionString().contains("-")) { + mpRefs.getDepententPackage().setVersion(new MetadataPackageVersion(item.getVersion().getVersionString().substring(0, item.getVersion().getVersionString().indexOf("-")))); + } else { + mpRefs.getDepententPackage().setVersion(new MetadataPackageVersion(item.getVersion())); + } + mpReferences.add(mpRefs); + } + + return mpReferences; + } + + private void handleMetadataBeforePackage(Map hashMap, String projectPath, String packagePath) { + //找到工程下所有的元数据及文件夹列表 + findMdAndDirPathWithinProject(hashMap, projectPath); + //创建临时文件夹 + if (!fileService.isDirectoryExist(packagePath)) { + fileService.createDirectory(packagePath); + } + //拷贝元数据文件到临时路径下 + copyMdFiles(hashMap, projectPath, packagePath); + if (hashMap != null && hashMap.size() > 0) { + for (String item : hashMap.keySet()) { + String relativePath; + if ("File".equals(hashMap.get(item))) { + GspMetadata metadata = new MetadataCoreManager().getMetadataWithoutContent(item); + relativePath = item.replace(projectPath, ""); + metadata.setRelativePath(Utils.handlePath(relativePath)); + if (!metadataList.contains(metadata)) { + metadataList.add(metadata); + } + } + } + } + } + + private void handleMetadataAfterFinding(MetadataPackageHeader mpHeader, ServiceUnitInfo suInfo, + List mpReference) { + MetadataPackage metadataPackage = new MetadataPackage(); + metadataPackage.setHeader(mpHeader); + metadataPackage.setServiceUnitInfo(suInfo); + metadataPackage.setReference(mpReference); + metadataPackage.setMetadataList(new ArrayList<>()); + if (metadataList != null && metadataList.size() > 0) { + metadataList.forEach(item -> metadataPackage.getMetadataList().add(item)); + } + ObjectMapper objectMapper = new ObjectMapper(); + String metadataPackageStr; + try { + metadataPackageStr = objectMapper.writeValueAsString(metadataPackage); + } catch (Exception e) { + throw new RuntimeException(e); + } + String manifestPath = fileService.getCombinePath(packagePath, Utils.getManifestFileName()); + if (!fileService.isFileExist(manifestPath)) { + try { + fileService.createFile(packagePath, Utils.getManifestFileName()); + fileService.fileUpdate(manifestPath, metadataPackageStr); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + fileService.fileUpdate(manifestPath, metadataPackageStr); + } + } + + private void findMdAndDirPathWithinProject(Map hashMap, String projectPath) { + + List dirs = fileService.getDirectorys(projectPath); + if (dirs.size() > 0) { + for (File dir : dirs) { + String dirName = fileService.getFileName(handlePath(dir.getPath())); + String temPath = projectPath + File.separator + dirName; + if (!hashMap.containsKey(temPath) && !".git".equals(dirName) && !".vs".equals(dirName) && !"bin".equals(dirName) && !"publish".equals(dirName) && !"obj".equals(dirName) && !"src".equals(dirName)) { + hashMap.put(handlePath(temPath), "Directory"); + findMdAndDirPathWithinProject(hashMap, temPath); + } + } + } + + List paths = fileService.getAllFiles(projectPath); + if (paths.size() > 0) { + boolean isMetadataExisting = false; + for (File path : paths) { + String extension = fileService.getExtension(handlePath(path.getPath())).toLowerCase(); + //TODO 这里需要从配置文件读取元数据后缀类型 + List metadataAllTypes = Utils.getMetadataPostfixTypes(); + boolean flag = false; + for (String item : metadataAllTypes) { + if (item.toLowerCase().equals(extension)) { + flag = true; + break; + } + } + if (flag) { + hashMap.put(handlePath(path.getPath()), "File"); + isMetadataExisting = true; + } + } + if (!isMetadataExisting) { + hashMap.remove(handlePath(projectPath)); + } + } else { + hashMap.remove(handlePath(projectPath)); + } + } + + private void copyMdFiles(Map hashMap, String projectPath, String packagePath) { + //将工程下的元数据文件都拷贝到新建的以程序集名称的文件夹下 + String absolutePath; + String relativePath; + if (hashMap == null || metadataAndDirPathList.size() == 0) { + return; + } + for (String path : metadataAndDirPathList.keySet()) { + relativePath = path.replace(projectPath, "").substring(1); + absolutePath = fileService.getCombinePath(packagePath, relativePath); + if ("Directory".equals(hashMap.get(path))) { + if (!fileService.isDirectoryExist(absolutePath)) { + fileService.createDirectory(absolutePath); + } + } else { + if (fileService.isFileExist(absolutePath)) { + try { + fileService.fileDelete(absolutePath); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + copyMdFiles(path, absolutePath); + } + } + } + + private void copyMdFiles(String sourcePath, String destinationPath) { + try { + fileService.fileCopy(sourcePath, destinationPath); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private void handleMetadataAfterPackage(String path) { + try { + fileService.deleteAllFilesUnderDirectory(path); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getLocalPackages(String absolutePath) { + List metadataPackages = new ArrayList<>(); + File[] files = new File(absolutePath).listFiles(pathname -> pathname.getName().endsWith(Utils.getMetadataProjSuffix())); + if (files != null && files.length > 0) { + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + for (File file : files) { + metadataPackages.add(metadataCoreManager.getMetadataPackageInfo(file.getName(), file.getParent())); + } + } + return metadataPackages; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..23698e2be1d4eb7496789afd8f03a79b891da64e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/PackageGenerateServiceImp.java @@ -0,0 +1,40 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * @author zhaoleitr + */ +public class PackageGenerateServiceImp implements PackageGenerateService { + private PackageGenerateCoreService packageGenerateCoreService = new PackageGenerateCoreService(); + + @Override + public void generatePackage(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + packageGenerateCoreService.generatePackage(absolutePath); + } + + @Override + public List getLocalPackages(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + return packageGenerateCoreService.getLocalPackages(absolutePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..b5f13a473797c5370e1faa8271d5564fddc97e14 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendCoreService.java @@ -0,0 +1,276 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.entity.DebugEnvironment; +import com.inspur.edp.lcm.metadata.api.entity.DeploymentContext; +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; +import com.inspur.edp.lcm.metadata.api.entity.compiler.MetadataCompilerConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.extract.ExtractConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.compiler.MetadataCompilerHelper; +import com.inspur.edp.lcm.metadata.common.deployer.DeploymentHelper; +import com.inspur.edp.lcm.metadata.common.extractor.ExtractHelper; +import com.inspur.edp.lcm.metadata.common.util.CommandUtil; +import com.inspur.edp.lcm.metadata.core.thread.ProcessRunnable; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.sumgr.core.ServiceUnitFactory; +import java.io.File; +import java.io.IOException; +import java.net.URLDecoder; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; +import sun.misc.BASE64Decoder; + +/** + * @author zhaoleitr + */ +public class ProjectExtendCoreService { + private final FileServiceImp fileService = new FileServiceImp(); + private final MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + private final GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + public String getDeployStatus(String sign) throws IOException { + BASE64Decoder decoder = new BASE64Decoder(); + byte[] bytes = decoder.decodeBuffer(sign); + String urlEncodeSign = new String(bytes); + String fileName = URLDecoder.decode(urlEncodeSign, "utf8"); + String status = ""; + if (fileService.isFileExist(fileName)) { + status = fileService.fileRead(fileName); + switch (status) { + case "success": + case "fail": + fileService.fileDelete(fileName); + break; + default: + break; + } + } + return status; + } + + public void extract(String absolutePath) { + List projPaths = new ArrayList<>(); + if (absolutePath.endsWith(Utils.getMetadataProjPath())) { + absolutePath = new File(absolutePath).getParent(); + } + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + for (String projPath : projPaths) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + ExtractContext extractContext = new ExtractContext(); + extractContext.setProjectPath(projPath); + extractContext.setDeployPath(gspProjectInfo.getSuDeploymentPath()); + doExtract(extractContext); + } + } + + private void doExtract(ExtractContext extractContext) { + // 文件清理 + clearPublishDir(extractContext); + // 组织上下文 + buildExtractContext(extractContext); + // 各类型提取扩展 + List extractConfigrationList = ExtractHelper.getInstance().getExtractConfigrationList(); + extractConfigrationList.forEach(item -> { + if (item.isEnable()) { + if (extractContext.getDeployType() != null && "WEB".equals(item.getTypeCode()) && !"all".equals(extractContext.getDeployType()) && !extractContext.getDeployType().contains("web")) { + return; + } + ExtractAction extractAction = ExtractHelper.getInstance().getManager(item.getTypeCode()); + if (extractAction == null) { + throw new RuntimeException("未能获取到" + item.getTypeCode() + "的提取器,请确认配置是否正确"); + } + extractAction.extract(extractContext); + } + }); + } + + private void buildExtractContext(ExtractContext context) { + String publishPath = Paths.get(context.getProjectPath()).resolve(Utils.getPublishPath()).toString(); + String deployPath = Paths.get(publishPath).resolve(Utils.getJstackPath()).resolve(context.getDeployPath().toLowerCase()).toString(); + context.setDeployPath(deployPath); + } + + private void clearPublishDir(ExtractContext extractContext) { + String publishPath = Paths.get(extractContext.getProjectPath()).resolve(Utils.getPublishPath()).toString(); + File file = new File(publishPath); + if (!file.exists()) { + file.mkdir(); + } + try { + fileService.cleanDirectory(file); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart) { + serverPath = serverPath == null || serverPath.isEmpty() ? Utils.getBasePath() : serverPath; + + beforeDeploy(serverPath, projPath); + + String args = handleArgs(dBConnectionInfo, serverPath, projPath, restart); + String currentServerPath = Paths.get(Utils.getBasePath()).resolve("tools/deploy/project_java/runtime").toString(); + String javaHome = CommandUtil.getJavaHome(false); + String javaCmd = javaHome == "" ? "java" : javaHome + "/java"; + String serverRuntimePathName = EnvironmentUtil.getServerRuntimePathName(); + String command = javaCmd + " -server \"-Dloader.path=libs,3rd\" \"-Dserver.runtime.path.name=" + serverRuntimePathName + "\" \"-Dspring.config.location=../config/application.yaml\" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -jar lcm-project-deploy-tool.jar" + args; + if ("0".equals(restart)) { + newProcessRunnable(currentServerPath, command); + } else { + CommandUtil.newProcess(currentServerPath, command); + } + } + + private void beforeDeploy(String serverPath, String projPath) { + if (!suFileExists(serverPath, projPath)) { + generateSuFile(serverPath, projPath); + } + } + + private boolean suFileExists(String serverPath, String projPath) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + String serverLink = new File(FileServiceImp.combinePath(serverPath, "jstack")).exists() ? "jstack" : "server"; + String destDir = FileServiceImp.combinePath(serverPath, serverLink, "apps", gspProjectInfo.getAppCode().toLowerCase(), gspProjectInfo.getServiceUnitCode().toLowerCase()); + File file = new File(destDir); + file.mkdirs(); + Boolean existsFlag = ServiceUnitFactory.createGenerator().exists(file); + return existsFlag; + } + + private void generateSuFile(String serverPath, String projPath) { + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + io.iec.edp.caf.sumgr.api.entity.ServiceUnitInfo serviceUnitInfo = new io.iec.edp.caf.sumgr.api.entity.ServiceUnitInfo(); + serviceUnitInfo.setApplicationName(gspProjectInfo.getAppCode()); + serviceUnitInfo.setName(gspProjectInfo.getServiceUnitCode()); + String serverLink = new File(FileServiceImp.combinePath(serverPath, "jstack")).exists() ? "jstack" : "server"; + String destDir = FileServiceImp.combinePath(serverPath, serverLink, "apps", gspProjectInfo.getAppCode().toLowerCase(), gspProjectInfo.getServiceUnitCode().toLowerCase()); + File file = new File(destDir); + ServiceUnitFactory.createGenerator().generate(serviceUnitInfo, file); + } + + private void newProcessRunnable(String serverPath, String command) { + ProcessRunnable processRunnable = new ProcessRunnable(); + processRunnable.setServerPath(serverPath); + processRunnable.setCommand(command); + ExecutorService executor = Executors.newCachedThreadPool(); + executor.submit(processRunnable::run); + } + + private String handleArgs(DbConnectionInfo dbConnectionInfo, String serverPath, String projPath, String restart) { + StringBuilder stringBuilder = new StringBuilder(); + String publishPath = Paths.get(metadataProjectCoreService.getProjPath(projPath)).resolve(Utils.getPublishPath()).toString(); + appendArg(stringBuilder, publishPath); + appendArg(stringBuilder, serverPath); + appendArg(stringBuilder, dbConnectionInfo.getDbServerIP()); + appendArg(stringBuilder, dbConnectionInfo.getDbPort()); + appendArg(stringBuilder, dbConnectionInfo.getDbName()); + appendArg(stringBuilder, dbConnectionInfo.getDbUserName()); + appendArg(stringBuilder, dbConnectionInfo.getDbPassword()); + appendArg(stringBuilder, String.valueOf(dbConnectionInfo.getDbType().ordinal())); + appendArg(stringBuilder, restart); + + if (restart.equals("0")) { + int currentPid = CommandUtil.getCurrentPid(); + appendArg(stringBuilder, String.valueOf(currentPid)); + } + + return stringBuilder.toString(); + } + + private void appendArg(StringBuilder stringBuilder, String arg) { + stringBuilder.append(" \""); + stringBuilder.append(arg); + stringBuilder.append("\""); + } + + public void migration(String absolutePath) { + DeploymentContext context = new DeploymentContext(); + String publishPath = Paths.get(metadataProjectCoreService.getProjPath(absolutePath)).resolve(Utils.getPublishPath()).toString(); + context.setPublishPath(publishPath); + DebugEnvironment debugEnvironment = new DebugEnvironment(); + debugEnvironment.setServerPath(Utils.getBasePath()); + context.setDebugEnvironment(debugEnvironment); + DeployAction baseMigration = DeploymentHelper.getInstance().getManager("BaseMigration"); + if (baseMigration == null) { + throw new RuntimeException("未能获取到BaseMigration的部署器,请确认配置是否正确"); + } + baseMigration.deploy(context); + } + + public List batchCompile(String absolutePath, String exts, String disabledExts, String packagePath) { + List projPaths = new ArrayList<>(); + if (absolutePath.contains(",")) { + projPaths = Arrays.asList(absolutePath.split(",")); + } else { + if (absolutePath.endsWith(Utils.getMetadataProjPath())) { + absolutePath = new File(absolutePath).getParent(); + } + metadataProjectCoreService.getProjPathsInPath(absolutePath, projPaths); + } + + List extsList = exts.isEmpty() ? new ArrayList<>() : Arrays.asList(exts.split(",")); + List disabledExtsList = disabledExts.isEmpty() ? new ArrayList<>() : Arrays.asList(disabledExts.split(",")); + + for (String projPath : projPaths) { + //todo +// "正在编译:" + projPath + String projectMetadataPath = Paths.get(projPath).resolve(Utils.getMetadataProjPath()).toString(); + MetadataCompilerContext metadataCompilerContext = new MetadataCompilerContext(); + metadataCompilerContext.setProjectPath(projectMetadataPath); + compile(metadataCompilerContext, extsList, disabledExtsList); + //todo +// "编译完成:" + projPath + } + + return null; + } + + private void compile(MetadataCompilerContext metadataCompilerContext, List extsList, + List disabledExtsList) { + List compileConfigrationList = MetadataCompilerHelper.getInstance().getCompileConfigrationList(); + if (extsList != null && extsList.size() > 0) { + compileConfigrationList = compileConfigrationList.stream().filter(config -> extsList.contains(config.getTypeCode())).collect(Collectors.toList()); + } + if (disabledExtsList != null && disabledExtsList.size() > 0) { + compileConfigrationList = compileConfigrationList.stream().filter(config -> !disabledExtsList.contains(config.getTypeCode())).collect(Collectors.toList()); + } + for (MetadataCompilerConfiguration item : compileConfigrationList) { + if (item.getEnable()) { + MetadataCompileAction manager = MetadataCompilerHelper.getInstance().getManager(item.getTypeCode()); + if (manager != null) { + manager.metadataCompile(metadataCompilerContext); + } else { + //todo +// item.getTypeCode() + "无法获取类" + } + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..a8138ae0b6261002dbe9311dbd0e19ed1a6c6bdb --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/ProjectExtendServiceImp.java @@ -0,0 +1,55 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +public class ProjectExtendServiceImp implements ProjectExtendService { + private final ProjectExtendCoreService projectExtendCoreService = new ProjectExtendCoreService(); + + @Override + public void deploy(DbConnectionInfo dBConnectionInfo, String serverPath, String projPath, String restart) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + projectExtendCoreService.deploy(dBConnectionInfo, serverPath, absolutePath, restart); + } + + @Override + public void extract(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectExtendCoreService.extract(absolutePath); + } + + @Override + public void migration(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + projectExtendCoreService.migration(absolutePath); + } + + @Override + public String getDeployStatus(String sign) { + return null; + } + + @Override + public List batchCompile(String path, String exts, String disabledExts) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + return projectExtendCoreService.batchCompile(absolutePath, exts, disabledExts, packagePath); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java new file mode 100644 index 0000000000000000000000000000000000000000..1d79d28c2a58795be62efb6d7e313dfb1e16f779 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonCoreService.java @@ -0,0 +1,95 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.configuration.RefStrategyHelper; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForMaven; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForPackages; +import com.inspur.edp.lcm.metadata.core.index.ProjectMetadataCacheService; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * @author zhaoleitr + */ +public class RefCommonCoreService { + private final MetadataCoreManager metadataManager = new MetadataCoreManager(); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + private ProjectMetadataCacheService projectMetadataCacheService; + + public GspMetadata getRefMetadata(String metadataId, String path, String packagePath, String mavenPath) { + + // 工程信息 + String projectPath = projectService.getProjPath(path); + MetadataProject metadataProject = projectService.getMetadataProjInfo(path); + + // 当前工程及bo下的引用的工程下搜索 + GspMetadata gspMetadata = getMetadataFromProjects(metadataId, metadataProject); + if (gspMetadata != null) { + return gspMetadata; + } + + // 从缓存中获取 + projectMetadataCacheService = ProjectMetadataCacheService.getNewInstance(metadataProject, projectPath, packagePath, mavenPath); + projectMetadataCacheService.setRefStrategy(RefStrategyHelper.getInstance().getRefStrategy()); + String metadataPackageLocation = getMetadataPackageLocationFromCache(metadataId, metadataProject, false, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataPackageLocation = getMetadataPackageLocationFromCache(metadataId, metadataProject, true, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataManager.throwMetadataNotFoundException(metadataId); + } + } + File metadataPackage = new File(metadataPackageLocation); + gspMetadata = metadataManager.getMetadataFromPackage(metadataPackage.getName(), metadataPackage.getParent(), metadataId).getMetadata(); + return gspMetadata; + } + + private GspMetadata getMetadataFromProjects(String metadataID, MetadataProject metadataProject) { + List refProjPaths = new ArrayList<>(); + if (metadataProject != null) { + refProjPaths.add(metadataProject.getProjectPath()); + projectService.getRefProjPaths(metadataProject.getProjectPath(), refProjPaths); + + for (String projPath : refProjPaths) { + List metadataList = metadataManager.getMetadataList(projPath); + for (GspMetadata gspMetadata : metadataList) { + if (gspMetadata.getHeader() != null && gspMetadata.getHeader().getId() != null && metadataID.equals(gspMetadata.getHeader().getId())) { + gspMetadata = metadataManager.loadMetadata(gspMetadata.getHeader().getFileName(), gspMetadata.getRelativePath()); + return gspMetadata; + } + } + } + } + return null; + } + + private String getMetadataPackageLocationFromCache(String metadataID, MetadataProject metadataProject, + Boolean refreshIndexFlag, String packagePath, String mavenPath) { + if (refreshIndexFlag) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + projectMetadataCacheService.clearCache(); + } + projectMetadataCacheService.syncProjectMetadataCache(); + ProjectMetadataCache projectMetadataCacheMap = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + return projectMetadataCacheMap.getMetadataPackageLocations().get(metadataID); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..312dc725041f87d25b6ffeb82cfcaff351257df0 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RefCommonServiceImp.java @@ -0,0 +1,47 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; + +/** + * @author zhaoleitr + */ +public class RefCommonServiceImp implements RefCommonService { + private final RefCommonCoreService refService = new RefCommonCoreService(); + + @Override + public GspMetadata getRefMetadata(String metadataID) { + String packagePath = ManagerUtils.getMetadataPackageLocation(); + String mavenPath = ManagerUtils.getMavenStoragePath(); + // 工程信息 + String path = Utils.getMetadataPath(); + if (path == null || path.isEmpty()) { + throw new RuntimeException("元数据归属工程路径为空,无法找到元数据:" + metadataID); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + GspMetadata gspMetadata = refService.getRefMetadata(metadataID, absolutePath, packagePath, mavenPath); + + String devRootPath = Utils.handlePath(ManagerUtils.getDevRootPath()); + if (gspMetadata.getRelativePath() != null && gspMetadata.getRelativePath().startsWith(devRootPath)) { + gspMetadata.setRelativePath(gspMetadata.getRelativePath().substring(devRootPath.length()).substring(1)); + } + return gspMetadata; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java new file mode 100644 index 0000000000000000000000000000000000000000..9de02d5b42dab7a07718b0ff596c9688aeb6d582 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/RestTemplateService.java @@ -0,0 +1,86 @@ +/* + * 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.lcm.metadata.core; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoFilter; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataInfoWithVersion; +import com.inspur.edp.lcm.metadata.api.mvnEntity.PageMetadataInfo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoFilterWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PageMetadataInfoWithProcessMode; +import java.net.URI; +import java.util.List; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +/** + * Classname RestTemplateService Description RestTemplate工具类 Date 2019/11/29 17:43 + * + * @author zhongchq + * @version 1.0 + */ +public class RestTemplateService { + + public static RestTemplateService instance = new RestTemplateService(); + private final RestTemplate restTemplate = new RestTemplate(); + + /** + * post请求 + */ + public PageMetadataInfo getObjectByPost(String remoteIndexUrl, MetadataInfoFilter filter) { + HttpHeaders headers = new HttpHeaders(); + HttpEntity entity = new HttpEntity<>(filter, headers); + return restTemplate.postForObject(remoteIndexUrl, entity, PageMetadataInfo.class); + } + + /** + * post请求 + */ + public PageMetadataInfoWithProcessMode getObjectByPost(String remoteIndexUrl, + MetadataInfoFilterWithProcessMode filter) { + HttpHeaders headers = new HttpHeaders(); + HttpEntity entity = new HttpEntity<>(filter, headers); + return restTemplate.postForObject(remoteIndexUrl, entity, PageMetadataInfoWithProcessMode.class); + } + + /** + * get请求 + */ + public List getObjectByGet(String url) { + ParameterizedTypeReference> typeRef = new ParameterizedTypeReference>() { + }; + ResponseEntity> responseEntity = restTemplate.exchange(new RequestEntity(HttpMethod.GET, URI.create(url)), typeRef); + if (responseEntity.getStatusCode().equals(HttpStatus.OK)) { + return responseEntity.getBody(); + } + return null; + } + + public String getStatusByGet(String url) { + try { + final ResponseEntity responseEntity = restTemplate.getForEntity(url, Object.class); + return responseEntity.getStatusCode().getReasonPhrase(); + } catch (Exception e) { + return e.getCause().getMessage(); + } + } +} + diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..895d0f0903703d49fe9055c97ef4714f1ec6e64f --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/CoreServiceConfiguration.java @@ -0,0 +1,55 @@ +/* + * 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.lcm.metadata.core.config; + +import com.inspur.edp.lcm.metadata.core.event.DirEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataCreateEventBroker; +import com.inspur.edp.lcm.metadata.core.event.MetadataEventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname ServiceConfiguration Description TODO Date 2019/11/9 15:40 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class CoreServiceConfiguration { + private EventListenerSettings settings; + + public CoreServiceConfiguration(EventListenerSettings settings) { + this.settings = settings; + } + + @Bean + public MetadataEventBroker metadataEventBroker() { + return new MetadataEventBroker(settings); + } + + @Bean + public MetadataCreateEventBroker metadataCreateEventBroker() { + return new MetadataCreateEventBroker(settings); + } + + @Bean + public DirEventBroker dirEventBroker() { + return new DirEventBroker(settings); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..977b132d9db0b97d598269c62a70d27435a9242d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeConfigLoader.java @@ -0,0 +1,67 @@ +/* + * 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.lcm.metadata.core.config; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.mvnEntity.JitRuntimeConfigration; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import java.io.IOException; +import java.nio.file.Paths; + +public class JitRuntimeConfigLoader { + + private static final String SECTION_NAME = "JitRuntimeConfigration"; + static JitRuntimeConfigration jitRuntimeConfigration; + private static String fileName = "config/platform/common/lcm_gspprojectextend.json"; + + public JitRuntimeConfigLoader() { + } + + public static void setJitRuntimeConfigration( + JitRuntimeConfigration jitRuntimeConfigration) { + JitRuntimeConfigLoader.jitRuntimeConfigration = jitRuntimeConfigration; + } + + protected JitRuntimeConfigration getJitRuntimeConfigration() { + + fileName = Paths.get(EnvironmentUtil.getServerRTPath()).resolve(fileName).toString(); + + try { + if (jitRuntimeConfigration == null) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + FileServiceImp fileService = new FileServiceImp(); + String fileContents = fileService.fileRead(fileName); + JsonNode jsonNode = objectMapper.readTree(fileContents); + String jitRuntimeConfigrationJson = jsonNode.findValue(SECTION_NAME).toString(); + jitRuntimeConfigration = objectMapper.readValue(jitRuntimeConfigrationJson, new TypeReference() { + }); + return jitRuntimeConfigration; + } else { + return jitRuntimeConfigration; + } + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..09a1323d8901b32698ded513b22ba5d7f47d6578 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/JitRuntimeHelper.java @@ -0,0 +1,58 @@ +/* + * 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.lcm.metadata.core.config; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.JitRuntimeConfigration; +import com.inspur.edp.lcm.metadata.spi.JitRuntimeAction; + +/** + * @Classname JitCompilerHelper + * @Description TODO + * @Date 2019/7/29 16:06 + * @Created by zhongchq + * @Version 1.0 + */ +public class JitRuntimeHelper extends JitRuntimeConfigLoader { + + private static JitRuntimeHelper singleton = null; + + public JitRuntimeHelper() { + } + + public static JitRuntimeHelper getInstance() { + if (singleton == null) { + singleton = new JitRuntimeHelper(); + } + return singleton; + } + + public JitRuntimeAction getManager() { + JitRuntimeAction manager = null; + JitRuntimeConfigration data = getJitRuntimeConfigration(); + if (data != null && data.getEnable()) { + Class cls = null; + if (data.getAction() != null) { + try { + cls = Class.forName(data.getAction().getName()); + manager = (JitRuntimeAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..ae6fd110cf52c009e663cacf2693e0a5ab133943 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/config/ServiceConfiguration.java @@ -0,0 +1,73 @@ +/* + * 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.lcm.metadata.core.config; + +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.core.GspProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataServiceImp; +import com.inspur.edp.lcm.metadata.core.PackageGenerateServiceImp; +import com.inspur.edp.lcm.metadata.core.ProjectExtendServiceImp; +import com.inspur.edp.lcm.metadata.core.RefCommonServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Classname ServiceConfiguration + * @Description 配置类 + * @Date 2019/7/26 14:55 + * @Created by liu_bintr + * @Version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class ServiceConfiguration { + @Bean + public MetadataService createMetadataService() { + return new MetadataServiceImp(); + } + + @Bean + public GspProjectService createGspProjectService() { + return new GspProjectServiceImp(); + } + + @Bean + public MetadataProjectService createMetadataProjectService() { + return new MetadataProjectServiceImp(); + } + + @Bean + public RefCommonService createRefService() { + return new RefCommonServiceImp(); + } + + @Bean + public PackageGenerateService createPackageGenerateService() { + return new PackageGenerateServiceImp(); + } + + @Bean + public ProjectExtendService createProjectExtendService() { + return new ProjectExtendServiceImp(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java new file mode 100644 index 0000000000000000000000000000000000000000..23758fdf976a011f4840ba40f115f3fe2860f0e4 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/MdprojInfoDto.java @@ -0,0 +1,39 @@ +/* + * 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.lcm.metadata.core.entity; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; + +public class MdprojInfoDto { + private String projPath; + private MetadataProject metadataProject; + + public String getProjPath() { + return projPath; + } + + public void setProjPath(String projPath) { + this.projPath = projPath; + } + + public MetadataProject getMetadataProject() { + return metadataProject; + } + + public void setMetadataProject(MetadataProject metadataProject) { + this.metadataProject = metadataProject; + } +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java similarity index 54% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java rename to model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java index b9929a17eed4230c5521b55adfabe0cc784d10b2..779bf812abbe1d02f9344d9add3c27f99ef65457 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCreateConfigData.java +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/entity/PackageType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.core.entity; -public class ProjectCreateConfigData extends BaseConfig { +public enum PackageType { + jar, + zip } diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java new file mode 100644 index 0000000000000000000000000000000000000000..0809fac6a5b8e1c677f67f2b3fe067914f184b2f --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventBroker.java @@ -0,0 +1,43 @@ +/* + * 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.lcm.metadata.core.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class DirEventBroker extends EventBroker { + private DirEventManager dirEventManager; + + public DirEventBroker(EventListenerSettings settings) { + super(settings); + this.dirEventManager = new DirEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(dirEventManager); + } + + public void fireDirDeletingEvent(CAFEventArgs args) { + this.dirEventManager.fireDirDeletingEvent(args); + } + + public void fireDirDeletedEvent(CAFEventArgs args) { + this.dirEventManager.fireDirDeletedEvent(args); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..289190d6d3427543de532b34680c253a81459c3b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventListenerImpl.java @@ -0,0 +1,72 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.spi.event.DirEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.DirEventListener; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.springframework.util.CollectionUtils; + +public class DirEventListenerImpl implements DirEventListener { + @Override + public void fireDirDeletingEvent(DirEventArgs args) { + // 获取目录下的元数据,将id和filename存入字典 + List metadataListInDir = MetadataCoreManager.getCurrent().getMetadataList(args.getPath()); + // 目录下无元数据,直接删除。 + if (CollectionUtils.isEmpty(metadataListInDir)) { + return; + } + + Map filesInDir = new HashMap<>(); + metadataListInDir.forEach(metadata -> + { + filesInDir.put(metadata.getHeader().getId(), metadata.getHeader().getFileName()); + }); + // 获取工程下的元数据 + MetadataProject project = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(args.getPath()); + // 非工程文件夹,直接删除 + if (project == null) { + return; + } + List metadataListInProject = MetadataCoreManager.getCurrent().getMetadataList(project.getProjectPath()); + + // 排除目录下的元数据 + List metadataListExclude = metadataListInProject.stream().filter(item -> !filesInDir.containsKey(item.getHeader().getId())).collect(Collectors.toList()); + + metadataListExclude.forEach(metadata -> + { + metadata.getRefs().forEach(item -> + { + if (filesInDir.containsKey(item.getDependentMetadata().getId())) { + String message = "元数据" + filesInDir.get(item.getDependentMetadata().getId()) + "被文件夹外的元数据" + metadata.getHeader().getFileName() + "依赖,请清除其中依赖后重试。"; + throw new RuntimeException(message); + } + }); + }); + } + + @Override + public void fireDirDeletedEvent(DirEventArgs args) { + MetadataCoreManager.getCurrent().removeMetadataListCache(args.getPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java new file mode 100644 index 0000000000000000000000000000000000000000..d043f78adbfc04dc3869d36e4dddd17d2330edd5 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/DirEventManager.java @@ -0,0 +1,70 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.spi.event.DirEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class DirEventManager extends EventManager { + + enum DirEventType { + fireDirDeletingEvent, + fireDirDeletedEvent + } + + @Override + public String getEventManagerName() { + return "DirEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof DirEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + DirEventListener dirEventListener = (DirEventListener) iEventListener; + this.addEventHandler(DirEventType.fireDirDeletingEvent, dirEventListener, "fireDirDeletingEvent"); + this.addEventHandler(DirEventType.fireDirDeletedEvent, dirEventListener, "fireDirDeletedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + DirEventListener dirEventListener = (DirEventListener) iEventListener; + this.removeEventHandler(DirEventType.fireDirDeletingEvent, dirEventListener, "fireDirDeletingEvent"); + this.removeEventHandler(DirEventType.fireDirDeletedEvent, dirEventListener, "fireDirDeletedEvent"); + } + + public void fireDirDeletingEvent(CAFEventArgs args) { + this.fire(DirEventType.fireDirDeletingEvent, args); + } + + public void fireDirDeletedEvent(CAFEventArgs args) { + this.fire(DirEventType.fireDirDeletedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + DirEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java new file mode 100644 index 0000000000000000000000000000000000000000..5da8769bb297f26ce2c242ad27cd6337c99447aa --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventBroker.java @@ -0,0 +1,43 @@ +/* + * 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.lcm.metadata.core.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class MetadataCreateEventBroker extends EventBroker { + private MetadataCreateEventManager metadataCreateEventManager; + + public MetadataCreateEventBroker(EventListenerSettings settings) { + super(settings); + this.metadataCreateEventManager = new MetadataCreateEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(metadataCreateEventManager); + } + + public void fireMetadataCreatingEvent(CAFEventArgs args) { + this.metadataCreateEventManager.fireMetadataCreatingEvent(args); + } + + public void fireMetadataCreatedEvent(CAFEventArgs args) { + this.metadataCreateEventManager.fireMetadataCreatedEvent(args); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..082498035f33c953381de3a190f5569488c551d8 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventListenerImpl.java @@ -0,0 +1,32 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataCreateEventListener; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; + +public class MetadataCreateEventListenerImpl implements MetadataCreateEventListener { + + @Override + public void fireMetadataCreatingEvent(MetadataEventArgs args) { +// "fireMetadataCreatingEvent" + } + + @Override + public void fireMetadataCreatedEvent(MetadataEventArgs args) { +// "fireMetadataCreatedEvent" + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java new file mode 100644 index 0000000000000000000000000000000000000000..72640b62f6d3baf164ad7376d4913cc174e90c44 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataCreateEventManager.java @@ -0,0 +1,70 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataCreateEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class MetadataCreateEventManager extends EventManager { + + enum MetadataCreateEventType { + metadataCreatingEvent, + metadataCreatedEvent + } + + @Override + public String getEventManagerName() { + return "MetadataCreateEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MetadataCreateEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataCreateEventListener metadataCreateEventListener = (MetadataCreateEventListener) iEventListener; + this.addEventHandler(MetadataCreateEventType.metadataCreatingEvent, metadataCreateEventListener, "fireMetadataCreatingEvent"); + this.addEventHandler(MetadataCreateEventType.metadataCreatedEvent, metadataCreateEventListener, "fireMetadataCreatedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataCreateEventListener metadataCreateEventListener = (MetadataCreateEventListener) iEventListener; + this.removeEventHandler(MetadataCreateEventType.metadataCreatingEvent, metadataCreateEventListener, "fireMetadataCreatingEvent"); + this.removeEventHandler(MetadataCreateEventType.metadataCreatedEvent, metadataCreateEventListener, "fireMetadataCreatedEvent"); + } + + public void fireMetadataCreatingEvent(CAFEventArgs args) { + this.fire(MetadataCreateEventType.metadataCreatingEvent, args); + } + + public void fireMetadataCreatedEvent(CAFEventArgs args) { + this.fire(MetadataCreateEventType.metadataCreatedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + MetadataCreateEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java new file mode 100644 index 0000000000000000000000000000000000000000..840c195376f77670df4f1697823866bead58a150 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventBroker.java @@ -0,0 +1,69 @@ +/* + * 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.lcm.metadata.core.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.IEventListener; +import io.iec.edp.caf.commons.event.config.EventListenerData; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +public class MetadataEventBroker extends EventBroker { + private MetadataEventManager metadataEventManager; + + public MetadataEventBroker(EventListenerSettings settings) { + super(settings); + this.metadataEventManager = new MetadataEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(metadataEventManager); + } + + public void fireMetadataSavingEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataSavingEvent(args); + } + + public void fireMetadataSavedEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataSavedEvent(args); + } + + public void fireMetadataDeletingEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataDeletingEvent(args); + } + + public void fireMetadataDeletedEvent(CAFEventArgs args) { + this.metadataEventManager.fireMetadataDeletedEvent(args); + } + + /** + * 测试异常是否被抛出 + */ + public IEventListener createEventListenerTest(EventListenerData eventListenerData) { + return this.createEventListener(eventListenerData); + } + + /** + * 测试注销事件 + * + * @param eventListener + */ + public void removeListenerTest(IEventListener eventListener) { + this.removeListener(eventListener); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..208c2c1fea523c6d7daecc29103bbcf98c08193b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventListenerImpl.java @@ -0,0 +1,60 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventArgs; +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventListener; +import java.util.List; + +public class MetadataEventListenerImpl implements MetadataEventListener { + MetadataCoreManager manager = new MetadataCoreManager(); + + @Override + public void fireMetadataSavingEvent(MetadataEventArgs args) { + + } + + @Override + public void fireMetadataSavedEvent(MetadataEventArgs args) { + MetadataCoreManager.getCurrent().removeMetadataListCache(args.getPath()); + } + + @Override + public void fireMetadataDeletingEvent(MetadataEventArgs args) { + // 找到工程下的所有元数据 + MetadataProject project = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(args.getPath()); + List metadataList = MetadataCoreManager.getCurrent().getMetadataList(project.getProjectPath()); + + metadataList.forEach(metadata -> { + if (metadata.getRefs() != null) { + metadata.getRefs().forEach(item -> { + if (item.getDependentMetadata().getId().equals(args.getMetadata().getHeader().getId())) { + throw new RuntimeException("此元数据被" + metadata.getHeader().getFileName() + "依赖,请清除其中依赖后重试。"); + } + }); + } + }); + } + + @Override + public void fireMetadataDeletedEvent(MetadataEventArgs args) { + manager.removeMetadataListCache(args.getPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java new file mode 100644 index 0000000000000000000000000000000000000000..47195636604a42e677c53ada10de91656148f04a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/event/MetadataEventManager.java @@ -0,0 +1,84 @@ +/* + * 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.lcm.metadata.core.event; + +import com.inspur.edp.lcm.metadata.spi.event.MetadataEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +public class MetadataEventManager extends EventManager { + + enum MetadataEventType { + metadataSavingEvent, + metadataSavedEvent, + metadataDeletingEvent, + metadataDeletedEvent + } + + @Override + public String getEventManagerName() { + return "MetadataEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MetadataEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataEventListener metadataEventListener = (MetadataEventListener) iEventListener; + this.addEventHandler(MetadataEventType.metadataSavingEvent, metadataEventListener, "fireMetadataSavingEvent"); + this.addEventHandler(MetadataEventType.metadataSavedEvent, metadataEventListener, "fireMetadataSavedEvent"); + this.addEventHandler(MetadataEventType.metadataDeletingEvent, metadataEventListener, "fireMetadataDeletingEvent"); + this.addEventHandler(MetadataEventType.metadataDeletedEvent, metadataEventListener, "fireMetadataDeletedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + checkHandlerListener(iEventListener); + MetadataEventListener metadataEventListener = (MetadataEventListener) iEventListener; + this.removeEventHandler(MetadataEventType.metadataSavingEvent, metadataEventListener, "fireMetadataSavingEvent"); + this.removeEventHandler(MetadataEventType.metadataSavedEvent, metadataEventListener, "fireMetadataSavedEvent"); + this.removeEventHandler(MetadataEventType.metadataDeletingEvent, metadataEventListener, "fireMetadataDeletingEvent"); + this.removeEventHandler(MetadataEventType.metadataDeletedEvent, metadataEventListener, "fireMetadataDeletedEvent"); + } + + public void fireMetadataSavingEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataSavingEvent, args); + } + + public void fireMetadataSavedEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataSavedEvent, args); + } + + public void fireMetadataDeletingEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataDeletingEvent, args); + } + + public void fireMetadataDeletedEvent(CAFEventArgs args) { + this.fire(MetadataEventType.metadataDeletedEvent, args); + } + + private void checkHandlerListener(IEventListener iEventListener) { + if (!isHandlerListener(iEventListener)) { + throw new RuntimeException("指定的监听者" + iEventListener.getClass().getName() + + "没有实现" + MetadataEventListener.class.getName() + "接口"); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java new file mode 100644 index 0000000000000000000000000000000000000000..72840793835dcca02cb0eea8a15219cea67e65a9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnException.java @@ -0,0 +1,25 @@ +/* + * 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.lcm.metadata.core.exception; + +import io.iec.edp.caf.commons.exception.CAFRuntimeException; +import io.iec.edp.caf.commons.exception.ExceptionLevel; + +public class MvnException extends CAFRuntimeException { + public MvnException(String exceptionCode, String message, Exception innerException) { + super("lcm", exceptionCode, message, innerException, ExceptionLevel.Error); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java new file mode 100644 index 0000000000000000000000000000000000000000..044a83d2c8e46a804d3f0ae26173502a6a2664a4 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionEnum.java @@ -0,0 +1,20 @@ +/* + * 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.lcm.metadata.core.exception; + +public enum MvnExceptionEnum { + GSP_LCM_MVN_0001 +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..e1b2680d2f541dd04a4b84db028159687746ec64 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionHandler.java @@ -0,0 +1,118 @@ +/* + * 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.lcm.metadata.core.exception; + +import io.iec.edp.caf.commons.exception.handle.DefaultExceptionHandler; + +public class MvnExceptionHandler extends DefaultExceptionHandler { + private static final String ERROR_KEYWORD = "[ERROR]"; + private String messageHandled = ""; + + public String handleMessage(String message) { + handleNotFindSymbolError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_EXIST, MvnExceptionSolution.NOT_EXIST_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_ABSTRACT, MvnExceptionSolution.NOT_ABSTRACT_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.DEFINED_NAME, MvnExceptionSolution.DEFINED_NAME_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.NOT_BE_RESOLVED, MvnExceptionSolution.NOT_BE_RESOLVED_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleClassNotAvailableError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleNotAccessableError(message); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + handleError(message, MvnExceptionKeyword.ERROR_IN_OPENING_ZIP_FILE, MvnExceptionSolution.ERROR_IN_OPENING_ZIP_FILE_SOLUTION); + if (!messageHandled.isEmpty()) { + return messageHandled; + } + + return messageHandled; + } + + private void handleNotFindSymbolError(String message) { + if (message.contains(MvnExceptionKeyword.NOT_FIND_SYMBOL)) { + final String notFindSymbolString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_FIND_SYMBOL); + final String symbolString = findErrorStringByKeyword(message, MvnExceptionKeyword.SYMBOL); + final String symbolLocationString = findErrorStringByKeyword(message, MvnExceptionKeyword.SYMBOL_LOCATION); + messageHandled += MvnExceptionSolution.NOT_FIND_SYMBOL_SOLUTION + notFindSymbolString + symbolString + symbolLocationString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleClassNotAvailableError(String message) { + if (message.contains(MvnExceptionKeyword.CLASS_NOT_AVAILABLE)) { + final String classNotAvailableString = findErrorStringByKeyword(message, MvnExceptionKeyword.CLASS_NOT_AVAILABLE); + final String needString = findErrorStringByKeyword(message, MvnExceptionKeyword.NEED); + final String findString = findErrorStringByKeyword(message, MvnExceptionKeyword.FIND); + final String reasonString = findErrorStringByKeyword(message, MvnExceptionKeyword.REASON); + messageHandled += MvnExceptionSolution.CLASS_NOT_AVAILABLE_SOLUTION + classNotAvailableString + needString + findString + reasonString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleNotAccessableError(String message) { + if (message.contains(MvnExceptionKeyword.NOT_ACCESSIBLE)) { + final String classNotAccessableString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_ACCESSIBLE); + final String classNotFindString = findErrorStringByKeyword(message, MvnExceptionKeyword.NOT_FIND); + messageHandled += MvnExceptionSolution.NOT_ACCESSIBLE_SOLUTION + classNotAccessableString + classNotFindString + MvnExceptionSolution.LOG_REMINDER; + } + } + + private void handleError(String message, String keyword, String solution) { + if (message.contains(keyword)) { + final String errorStringByKeyword = findErrorStringByKeyword(message, keyword); + messageHandled += solution + errorStringByKeyword + MvnExceptionSolution.LOG_REMINDER; + } + } + + private String findErrorStringByKeyword(String message, String keyword) { + String errorString = ""; + final int keywordIndex = message.indexOf(keyword); + if (keywordIndex > -1) { + int lastErrorIndex = message.substring(0, keywordIndex).lastIndexOf(ERROR_KEYWORD); + lastErrorIndex = lastErrorIndex == -1 ? ERROR_KEYWORD.length() : lastErrorIndex + ERROR_KEYWORD.length(); + + int nextErrorIndex = message.substring(keywordIndex).indexOf(ERROR_KEYWORD) + keywordIndex; + if (nextErrorIndex == -1) { + errorString = message.substring(lastErrorIndex).trim(); + } else { + errorString = message.substring(lastErrorIndex, nextErrorIndex).trim(); + } + } + return errorString + "。"; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java new file mode 100644 index 0000000000000000000000000000000000000000..7cbdf3114524f2770121b893967088affe0e064a --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionKeyword.java @@ -0,0 +1,40 @@ +/* + * 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.lcm.metadata.core.exception; + +public class MvnExceptionKeyword { + public static final String NOT_FIND_SYMBOL = "找不到符号"; + public static final String SYMBOL = "符号:"; + public static final String SYMBOL_LOCATION = "位置"; + + public static final String NOT_EXIST = "不存在"; + + public static final String NOT_ABSTRACT = "不是抽象的"; + + public static final String DEFINED_NAME = "已定义"; + + public static final String NOT_BE_RESOLVED = "The following artifacts could not be resolved"; + + public static final String CLASS_NOT_AVAILABLE = "无法将类"; + public static final String NEED = "需要"; + public static final String FIND = "找到"; + public static final String REASON = "无法将类"; + + public static final String NOT_ACCESSIBLE = "无法访问"; + public static final String NOT_FIND = "找不到"; + + public static final String ERROR_IN_OPENING_ZIP_FILE = "error in opening zip file"; +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java new file mode 100644 index 0000000000000000000000000000000000000000..809eeed194bece1f15233f3930052c3ddccb3ef6 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/exception/MvnExceptionSolution.java @@ -0,0 +1,36 @@ +/* + * 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.lcm.metadata.core.exception; + +public class MvnExceptionSolution { + public static final String NOT_FIND_SYMBOL_SOLUTION = "请确认是否已点击保存并同步。"; + + public static final String NOT_EXIST_SOLUTION = "请确认是否已点击保存并同步。"; + + public static final String NOT_ABSTRACT_SOLUTION = "请确认edp-parent的版本是否为最新。"; + + public static final String DEFINED_NAME_SOLUTION = "请确认是否存在字段名相同的关联。"; + + public static final String NOT_BE_RESOLVED_SOLUTION = "请确认仓库中是否存在以下包。"; + + public static final String CLASS_NOT_AVAILABLE_SOLUTION = "请将以下符号保持一致。"; + + public static final String NOT_ACCESSIBLE_SOLUTION = "请确认包中是否存在以下文件。"; + + public static final String ERROR_IN_OPENING_ZIP_FILE_SOLUTION = "请删除本地仓库中的以下包。"; + + public static final String LOG_REMINDER = "可在输出框查看详细错误日志。"; +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java new file mode 100644 index 0000000000000000000000000000000000000000..ecfc1d03c71941b70957c0be351b719448458cad --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexService.java @@ -0,0 +1,258 @@ +/* + * 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.lcm.metadata.core.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class MetadataPackageIndexService { + + FileServiceImp fileServiceImp = new FileServiceImp(); + + protected String keyConnector = "_"; + + protected String line = "-"; + + protected String featureInName = "-api-"; + + public String location; + + protected String depFileSuffix; + + protected Map metadataPackageIndexHashMap; + + public MetadataPackageIndexService() { + metadataPackageIndexHashMap = new HashMap<>(); + } + + public void refreshMetadataPackageIndex() { + // 初始化 + if (metadataPackageIndexHashMap.size() == 0) { + initMetadataPackageIndex(); + } else { + // 增删改处理 + refreshIndex(); + } + } + + private void refreshIndex() { + // 获取所有keys + List currentKeys = getAllKeysFromLocation(); + List indexKeys = new ArrayList<>(metadataPackageIndexHashMap.keySet()); + + // 交集 + List retainKeys = new ArrayList<>(currentKeys); + retainKeys.retainAll(indexKeys); + + // 新增 + currentKeys.removeAll(retainKeys); + + // 减少 + indexKeys.removeAll(retainKeys); + + delete(indexKeys); + + insert(currentKeys); + + update(retainKeys); + } + + private void delete(List deleteKeys) { + for (String key : deleteKeys) { + if (metadataPackageIndexHashMap.containsKey(key)) { + metadataPackageIndexHashMap.remove(key); + } + } + } + + private void update(List retainKeys) { + for (String key : retainKeys) { + String[] fileNameArray = key.split(keyConnector); + if (!fileNameArray[1].contains(line) || fileNameArray[1].endsWith(Utils.getVersionSuffix())) { + Long lastModified = new File(location + File.separator + fileNameArray[1] + File.separator + fileNameArray[0]).lastModified(); + boolean changeFlag = lastModified - metadataPackageIndexHashMap.get(key).getLastModified() != 0; + if (changeFlag) { + metadataPackageIndexHashMap.get(key).setLastModified(lastModified); + getMetadataIdsAndReferencesInSinglePackage(key); + } + } + } + } + + private void insert(List insertKeys) { + for (String key : insertKeys) { + String[] fileNameArray = key.split(keyConnector); + File dir = new File(location + File.separator + fileNameArray[1]); + getSingleMetadataPackageForIndex(dir); + } + for (String key : insertKeys) { + getMetadataIdsAndReferencesInSinglePackage(key); + } + } + + private List getAllKeysFromLocation() { + List metadataPackageIndexKeys = new ArrayList<>(); + List dirs = fileServiceImp.getDirectorys(location); + for (File dir : dirs) { + File[] files = dir.listFiles(); + String key; + for (File file : files) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + key = handleKey(file.getName(), dir.getName()); + metadataPackageIndexKeys.add(key); + } + } + } + return metadataPackageIndexKeys; + } + + private void initMetadataPackageIndex() { + // 初始metadatapackage + getAllMetadataPackages(); + + // 获取metadataIds和depMetadataPackages + getMetadataIdsAndReferences(); + } + + private void getAllMetadataPackages() { + // 获取location下所有文件夹 + List dirs = fileServiceImp.getDirectorys(location); + for (File dir : dirs) { + getSingleMetadataPackageForIndex(dir); + } + } + + protected void getSingleMetadataPackageForIndex(File dir) { + File[] files = dir.listFiles(); + MetadataPackageForIndex metadataPackageForIndex = new MetadataPackageForIndex(); + String metadataPackageForIndexKey = ""; + for (File file : files) { + if (file.getName().endsWith(Utils.getMetadataPackageExtension())) { + metadataPackageForIndexKey = handleKey(file.getName(), dir.getName()); + metadataPackageForIndex.setMetadataPackageName(file.getName()); + metadataPackageForIndex.setLocation(file.getAbsolutePath()); + metadataPackageForIndex.setLastModified(file.lastModified()); + metadataPackageForIndex.setSourceName(dir.getName()); + if (dir.getName().contains(featureInName)) { + String sourceVersion = dir.getName().substring(dir.getName().lastIndexOf(featureInName) + featureInName.length()); + metadataPackageForIndex.setSourceVersion(sourceVersion); + } + } + if (depFileSuffix != null && file.getName().endsWith(depFileSuffix)) { + metadataPackageForIndex.setDepFileLocation(file.getAbsolutePath()); + } + } + if (metadataPackageForIndexKey != "") { + metadataPackageIndexHashMap.put(metadataPackageForIndexKey, metadataPackageForIndex); + } + } + + protected String handleKey(String metadataPackageName, String name) { + String key = metadataPackageName + keyConnector + name; + return key; + } + + private void getMetadataIdsAndReferences() { + metadataPackageIndexHashMap.keySet().forEach(key -> { + getMetadataIdsAndReferencesInSinglePackage(key); + }); + } + + private void getMetadataIdsAndReferencesInSinglePackage(String metadataPackageIndexKey) { + // 获取元数据包信息 + MetadataCoreManager metadataManager = new MetadataCoreManager(); + if (!metadataPackageIndexHashMap.containsKey(metadataPackageIndexKey)) { + return; + } + String packageLocation = fileServiceImp.getDirectoryName(metadataPackageIndexHashMap.get(metadataPackageIndexKey).getLocation()); + MetadataPackage metadataPackageInfo = metadataManager.getMetadataPackageInfo(metadataPackageIndexHashMap.get(metadataPackageIndexKey).getMetadataPackageName(), packageLocation); + + // 获取元数据包中的metadataIds + getMetadataIdsInSinglePackage(metadataPackageInfo, metadataPackageIndexKey); + + // 获取元数据包中的依赖 + getReferencesInSinglePackage(metadataPackageInfo, metadataPackageIndexKey); + } + + private void getMetadataIdsInSinglePackage(MetadataPackage metadataPackageInfo, String metadataPackageForIndexKey) { + List metadataIds = new ArrayList<>(); + metadataPackageInfo.getMetadataList().forEach(metadata -> { + metadataIds.add(metadata.getHeader().getId()); + }); + metadataPackageIndexHashMap.get(metadataPackageForIndexKey).setMetadataIds(metadataIds); + } + + private void getReferencesInSinglePackage(MetadataPackage metadataPackageInfo, String metadataPackageForIndexKey) { + Map depMetadataPackages = new HashMap<>(); + // 添加maven依赖 + String depFileLocation = metadataPackageIndexHashMap.get(metadataPackageForIndexKey).getDepFileLocation(); + if (depFileLocation != null) { + Model model = getModel(depFileLocation); + model.getDependencies().forEach(dependency -> { + String gav = dependency.getGroupId() + line + dependency.getArtifactId() + line + dependency.getVersion(); + metadataPackageIndexHashMap.keySet().forEach(key -> { + if (key.endsWith(gav)) { + depMetadataPackages.put(key, metadataPackageIndexHashMap.get(key)); + return; + } + }); + }); + } + // 添加元数据包依赖 + if (metadataPackageInfo != null && metadataPackageInfo.getReference() != null) { + metadataPackageInfo.getReference().forEach(depMetadataPackage -> { + boolean existFlag = false; + String depMetadataPackageName = depMetadataPackage.getDepententPackage().getName() + Utils.getMetadataPackageExtension(); + for (String key : depMetadataPackages.keySet()) { + if (key.startsWith(depMetadataPackageName)) { + existFlag = true; + break; + } + } + if (!existFlag) { + String key = depMetadataPackageName + keyConnector + depMetadataPackageName; + depMetadataPackages.put(key, MetadataPackageIndexServiceForPackages.getInstance(null).getMetadataPackageIndexForPackagesHashMap().get(key)); + } + }); + } + + metadataPackageIndexHashMap.get(metadataPackageForIndexKey).setDepMetadataPackages(depMetadataPackages); + } + + private Model getModel(String depFileLocation) { + try (FileInputStream fis = new FileInputStream(depFileLocation)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java new file mode 100644 index 0000000000000000000000000000000000000000..9eec1a64596d24c892c8fc24dad03e143c82b659 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForMaven.java @@ -0,0 +1,47 @@ +/* + * 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.lcm.metadata.core.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.util.HashMap; +import java.util.Map; + +public class MetadataPackageIndexServiceForMaven extends MetadataPackageIndexService { + + private static MetadataPackageIndexServiceForMaven instance; + private final Map metadataPackageIndexForMavenHashMap; + + public MetadataPackageIndexServiceForMaven(String location) { + this.location = location; + depFileSuffix = Utils.getPomSuffix(); + metadataPackageIndexHashMap = metadataPackageIndexForMavenHashMap = new HashMap<>(); + } + + public static MetadataPackageIndexServiceForMaven getInstance(String location) { + if (instance == null || (location != null && !location.equals(instance.location))) { + instance = new MetadataPackageIndexServiceForMaven(location); + } + return instance; + } + + public Map getMetadataPackageIndexForMavenHashMap() { + if (metadataPackageIndexForMavenHashMap == null || metadataPackageIndexForMavenHashMap.size() == 0) { + refreshMetadataPackageIndex(); + } + return metadataPackageIndexForMavenHashMap; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java new file mode 100644 index 0000000000000000000000000000000000000000..2503bc2777ff5c50620bdd112edf133a5ba950d7 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/MetadataPackageIndexServiceForPackages.java @@ -0,0 +1,46 @@ +/* + * 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.lcm.metadata.core.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import java.util.HashMap; +import java.util.Map; + +public class MetadataPackageIndexServiceForPackages extends MetadataPackageIndexService { + + private static MetadataPackageIndexServiceForPackages instance; + + public static MetadataPackageIndexServiceForPackages getInstance(String location) { + if (instance == null || (location != null && !location.equals(instance.location))) { + instance = new MetadataPackageIndexServiceForPackages(location); + } + return instance; + } + + private Map metadataPackageIndexForPackagesHashMap; + + public Map getMetadataPackageIndexForPackagesHashMap() { + if (metadataPackageIndexForPackagesHashMap == null || metadataPackageIndexForPackagesHashMap.size() == 0) { + refreshMetadataPackageIndex(); + } + return metadataPackageIndexForPackagesHashMap; + } + + public MetadataPackageIndexServiceForPackages(String location) { + this.location = location; + metadataPackageIndexHashMap = metadataPackageIndexForPackagesHashMap = new HashMap<>(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java new file mode 100644 index 0000000000000000000000000000000000000000..7ef80f78a28c73103646700650937b7127cbf3d5 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/index/ProjectMetadataCacheService.java @@ -0,0 +1,353 @@ +/* + * 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.lcm.metadata.core.index; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageForIndex; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.manager.VersionManager; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ProjectMetadataCacheService { + + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + + public static ProjectMetadataCacheService getNewInstance(MetadataProject metadataProject, String projectPath, + String packagePath, String mavenPath) { + return new ProjectMetadataCacheService(metadataProject, projectPath, packagePath, mavenPath); + } + + private MetadataProject metadataProject; + private String projectPath; + private String packagePath; + private String mavenPath; + private String refStrategy; + + private ProjectMetadataCache projectMetadataCache; + + final Map metadataPackageIndexForPackagesHashMap; + + final Map metadataPackageIndexForMavenHashMap; + + private List scannedKeys; + + public ProjectMetadataCacheService(MetadataProject metadataProject, String projectPath, String packagePath, + String mavenPath) { + this.metadataProject = metadataProject; + this.projectPath = projectPath; + this.packagePath = packagePath; + this.mavenPath = mavenPath; + metadataPackageIndexForPackagesHashMap = MetadataPackageIndexServiceForPackages.getInstance(packagePath).getMetadataPackageIndexForPackagesHashMap(); + metadataPackageIndexForMavenHashMap = MetadataPackageIndexServiceForMaven.getInstance(mavenPath).getMetadataPackageIndexForMavenHashMap(); + projectMetadataCache = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + } + + public void syncProjectMetadataCache() { + if (projectMetadataCache == null) { + initProjectMetadataCache(); + } else { + syncCache(); + } + } + + public void clearCache() { + projectMetadataCache = null; + } + + private void initProjectMetadataCache() { + projectMetadataCache = new ProjectMetadataCache(); + // 获取直接引用的索引元数据包 + getDirectReferences(); + + // 获取所有引用的索引原数据包,取版本最新 + getAllReferences(); + + // 获取所有元数据路径信息 + getMetadataPackageLocations(); + + MetadataDevCacheManager.setProjectMetadataCacheMap(metadataProject.getProjectPath(), projectMetadataCache); + } + + private void syncCache() { + Map oldDirectReferences = new HashMap<>(projectMetadataCache.getDirectReferences()); + List oldKeys = new ArrayList<>(oldDirectReferences.keySet()); + getDirectReferences(); + Map currentDirectReferences = projectMetadataCache.getDirectReferences(); + List currentKeys = new ArrayList<>(currentDirectReferences.keySet()); + // 交集 + List retainKeys = new ArrayList<>(oldKeys); + retainKeys.retainAll(currentKeys); + + // 删除 + oldKeys.removeAll(retainKeys); + if (oldKeys.size() > 0) { + initProjectMetadataCache(); + return; + } + + // 修改 + for (String key : retainKeys) { + if (!currentDirectReferences.get(key).getLastModified().equals(oldDirectReferences.get(key).getLastModified())) { + initProjectMetadataCache(); + return; + } + } + + // 新增 + currentKeys.removeAll(retainKeys); + if (currentKeys.size() > 0) { + scannedKeys = new ArrayList<>(); + currentKeys.forEach(key -> { + getReferencesRecursive(projectMetadataCache.getAllReferences(), key, currentDirectReferences.get(key)); + }); + getMetadataPackageLocations(); + MetadataDevCacheManager.setProjectMetadataCacheMap(metadataProject.getProjectPath(), projectMetadataCache); + } + } + + private void getDirectReferences() { + Map directReferences = getReferencesFromMetadataProject(metadataProject); + projectMetadataCache.setDirectReferences(directReferences); + } + + private Map getReferencesFromMetadataProject(MetadataProject metadataProject) { + Map references = new HashMap<>(); + List existMavenPackageRefs = new ArrayList<>(); + + metadataProject.getMetadataPackageRefs().forEach(metadataPackageHeader -> { + String metadataPackageName = metadataPackageHeader.getName() + Utils.getMetadataPackageExtension(); + final MavenPackageRefs mavenPackageRef = mdpkgService.getGAByMdpkgName(metadataPackageName); + String mavenIndexKey = null; + + // bo间引用 + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + ProjectHeader projectHeader = metadataProject.getProjectRefs().stream().filter( + header -> header.getName().equals(metadataPackageHeader.getName())).findFirst().orElse(null); + if (projectHeader != null) { + String refProjectPath = projectPath + File.separator + projectHeader.getProjectPath(); + if (new File(refProjectPath).exists()) { + existMavenPackageRefs.add(mavenPackageRef); + mavenIndexKey = metadataPackageName + "_" + projectHeader.getProjectPath(); + MetadataPackageForIndex metadataPackageForIndex = new MetadataPackageForIndex(); + metadataPackageForIndex.setLocation(refProjectPath); + metadataPackageForIndex.setSourceName("bo"); + String refMdprojPath = projectService.getMdprojPath(refProjectPath); + metadataPackageForIndex.setDepFileLocation(refMdprojPath); + metadataPackageForIndex.setLastModified(new File(refMdprojPath).lastModified()); + references.put(mavenIndexKey, metadataPackageForIndex); + return; + } + } + } + + // maven引用 + if (metadataProject.getMavenPackageRefs() != null) { + for (MavenPackageRefs mavenRef : metadataProject.getMavenPackageRefs()) { + if (mavenRef.getGroupId().equals(mavenPackageRef.getGroupId()) && mavenRef.getArtifactId().equals(mavenPackageRef.getArtifactId())) { + mavenIndexKey = metadataPackageName + "_" + mavenRef.getGroupId() + "-" + mavenRef.getArtifactId() + "-" + mavenRef.getVersion(); + existMavenPackageRefs.add(mavenPackageRef); + if (!metadataPackageIndexForMavenHashMap.containsKey(mavenIndexKey)) { + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + } + if (metadataPackageIndexForMavenHashMap.containsKey(mavenIndexKey)) { + references.put(mavenIndexKey, metadataPackageIndexForMavenHashMap.get(mavenIndexKey)); + return; + } + break; + } + } + } + + // packages引用 + String key = metadataPackageName + "_" + metadataPackageName; + if (!metadataPackageIndexForPackagesHashMap.containsKey(key)) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + } + if (metadataPackageIndexForPackagesHashMap.containsKey(key)) { + references.put(key, metadataPackageIndexForPackagesHashMap.get(key)); + return; + } +// "找不到对元数据包" + metadataPackageName + "的引用。" + }); + + // 存在多余的maven引用 + if (metadataProject.getMavenPackageRefs() != null) { + metadataProject.getMavenPackageRefs().forEach(mavenPackageRef -> { + Boolean existFlag = existMavenPackageRefs.stream().anyMatch(ref -> ref.getGroupId().equals(mavenPackageRef.getGroupId()) && ref.getArtifactId().equals(mavenPackageRef.getArtifactId())); + if (existFlag) { + return; + } + String gav = mavenPackageRef.getGroupId() + "-" + mavenPackageRef.getArtifactId() + "-" + mavenPackageRef.getVersion(); + final String metadataPackageIndexKey = metadataPackageIndexForMavenHashMap.keySet().stream().filter(key -> key.endsWith(gav)).findFirst().orElse(null); + if (metadataPackageIndexKey != null && metadataPackageIndexForMavenHashMap.containsKey(metadataPackageIndexKey)) { + references.put(metadataPackageIndexKey, metadataPackageIndexForMavenHashMap.get(metadataPackageIndexKey)); + } + }); + } + + return references; + } + + private void getAllReferences() { + Map allReferences = new HashMap<>(); + Map directReferences = projectMetadataCache.getDirectReferences(); + scannedKeys = new ArrayList<>(); + directReferences.forEach((key, metadataPackageForIndex) -> { + getReferencesRecursive(allReferences, key, metadataPackageForIndex); + }); + projectMetadataCache.setAllReferences(allReferences); + } + + private void getReferencesRecursive(Map allReferences, + String metadataPackageForIndexKey, MetadataPackageForIndex ref) { + if (scannedKeys.contains(metadataPackageForIndexKey)) { + return; + } else { + scannedKeys.add(metadataPackageForIndexKey); + } + if (ref == null) { + return; + } + + // bo内引用 + if (ref.getSourceName().equals("bo")) { + String refProjectPath = ref.getLocation(); + final MetadataProject refMetadataProject = projectService.getMetadataProjInfo(refProjectPath); + final Map depMetadataPackages = getReferencesFromMetadataProject(refMetadataProject); + ref.setMetadataPackageName(refMetadataProject.getMetadataPackageInfo().getName() + Utils.getMetadataPackageExtension()); + ref.setDepMetadataPackages(depMetadataPackages); + } else { + if ("nearest".equals(refStrategy)) { + // 直接引用版本优先,直接引用版本,并且直接引用版本带具体版本 + String mdpkgName = metadataPackageForIndexKey.split("_")[0]; + // 直接引用中存在对此元数据包的直接引用 + boolean directExistFlag = projectMetadataCache.getDirectReferences().keySet().stream().anyMatch(key -> key.startsWith(mdpkgName)); + // !直接引用中不包含此包,或者此包不带版本 + boolean directRefFlag = projectMetadataCache.getDirectReferences().containsKey(metadataPackageForIndexKey) && metadataPackageForIndexKey.contains("-"); + if (directExistFlag && !directRefFlag) { + return; + } + if (!directRefFlag) { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } +// handleMultiVersion(allReferences, ref); + } + } else { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + // 如果已经存在的版本和要比较的版本一致,则不再继续处理 + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + // 如果比较出来的版本和已经存在的版本一致,则不再继续处理 + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } +// handleMultiVersion(allReferences, ref); + } + } + + allReferences.put(metadataPackageForIndexKey, ref); + + if (ref.getDepMetadataPackages() == null) { + return; + } + + ref.getDepMetadataPackages().forEach((key, metadataPackageForIndex) -> { + getReferencesRecursive(allReferences, key, metadataPackageForIndex); + }); + } + + private void handleMultiVersion(Map allReferences, MetadataPackageForIndex ref) { + // maven和packages下的版本比较 + String existKey = allReferences.keySet().stream().filter(key -> key.startsWith(ref.getMetadataPackageName())).findFirst().orElse(null); + if (existKey != null) { + // 比较版本 + String existVersion = allReferences.get(existKey).getSourceVersion(); + String newVersion = ref.getSourceVersion(); + if (existVersion != null && existVersion.equals(newVersion)) { + return; + } + + VersionManager versionManager = new VersionManager(); + String decidedVersion = versionManager.versionCompare(existVersion, newVersion); + if (decidedVersion == null || decidedVersion.equals(existVersion)) { + return; + } + + allReferences.remove(existKey); + } + } + + private void getMetadataPackageLocations() { + Map metadataPackageLocations = new HashMap<>(); + final Map allReferences = projectMetadataCache.getAllReferences(); + allReferences.values().forEach(ref -> { + if (ref != null && ref.getMetadataIds() != null) { + ref.getMetadataIds().forEach(metadataId -> metadataPackageLocations.put(metadataId, ref.getLocation())); + } else { +// "ref:" + ref.getLocation() + } + }); + projectMetadataCache.setMetadataPackageLocations(metadataPackageLocations); + } + + public String getRefStrategy() { + return refStrategy; + } + + public void setRefStrategy(String refStrategy) { + this.refStrategy = refStrategy; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java new file mode 100644 index 0000000000000000000000000000000000000000..809f48806104c0aad3035a2a5d8cef676a90acc6 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/IndexServerManager.java @@ -0,0 +1,65 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.ide.setting.api.entity.MetadataIndexServer; +import com.inspur.edp.ide.setting.api.service.SettingService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class IndexServerManager { + private SettingService settingService; + + private SettingService getSettingService() { + if (settingService == null) { + settingService = SpringBeanUtils.getBean(SettingService.class); + } + return settingService; + } + + private static IndexServerManager instance; + + public static IndexServerManager getInstance() { + if (instance == null) { + instance = new IndexServerManager(); + } + return instance; + } + + public String getPageWebapiOfIndexServer() { + return getIndexServerUrl() + "/page"; + } + + public String getPageWebapiOfIndexServerWithProcessMode() { + return getIndexServerWithProcessModeUrl() + "/page"; + } + + public String getMetadataWebapiOfIndexServer() { + return getIndexServerUrl() + "/metadataId"; + } + + public String getIndexServerUrl() { + MetadataIndexServer metadataIndexServer = getSettingService().getMetadataIndexServer(); + return "http://" + metadataIndexServer.getIp() + ":" + metadataIndexServer.getPort() + "/api/v1/metadataindex/mvn"; + } + + public String getIndexServerWithProcessModeUrl() { + return getIndexServerUrl() + "/withprocessmode"; + } + + public String getTestStatusWebapiOfIndexServer(String ip, String port) { + return "http://" + ip + ":" + port + "/api/v1/metadataindex/mvn/metadataId?metadataId=test"; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..1b32a2878529bd5e0d442a64563ff261a9c5d7f2 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenCommandGenerator.java @@ -0,0 +1,83 @@ +/* + * 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.lcm.metadata.core.manager; + +public class MavenCommandGenerator { + private String outputDirectory = ""; + private String includeTypes = ""; + private String excludeArtifactIds = ""; + private boolean copyPom; + private boolean excludeTransitive; + private boolean forceUpdate; + + public String generateCopydependencies() { + StringBuilder stringBuilder = new StringBuilder("dependency:copy-dependencies"); + if (!outputDirectory.isEmpty()) { + stringBuilder.append(" -DoutputDirectory="); + stringBuilder.append(outputDirectory); + } + if (!includeTypes.isEmpty()) { + stringBuilder.append(" -DincludeTypes="); + stringBuilder.append(includeTypes); + } + if (!excludeArtifactIds.isEmpty()) { + stringBuilder.append(" -DexcludeArtifactIds="); + stringBuilder.append(excludeArtifactIds); + } + if (copyPom) { + stringBuilder.append(" -Dmdep.copyPom"); + } + if (excludeTransitive) { + stringBuilder.append(" -DexcludeTransitive"); + } + if (forceUpdate) { + stringBuilder.append(" -U"); + } + return stringBuilder.toString(); + } + + public String generateInstall() { + StringBuilder stringBuilder = new StringBuilder("install"); + if (forceUpdate) { + stringBuilder.append(" -U"); + } + return stringBuilder.toString(); + } + + public void setOutputDirectory(String outputDirectory) { + this.outputDirectory = outputDirectory; + } + + public void setIncludeTypes(String includeTypes) { + this.includeTypes = includeTypes; + } + + public void setExcludeArtifactIds(String excludeArtifactIds) { + this.excludeArtifactIds = excludeArtifactIds; + } + + public void setCopyPom(boolean copyPom) { + this.copyPom = copyPom; + } + + public void setExcludeTransitive(boolean excludeTransitive) { + this.excludeTransitive = excludeTransitive; + } + + public void setForceUpdate(boolean forceUpdate) { + this.forceUpdate = forceUpdate; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java new file mode 100644 index 0000000000000000000000000000000000000000..6c65d7eb62f9877140a11716f6b463aa45efa337 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForJarManager.java @@ -0,0 +1,95 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import java.io.File; +import java.util.List; + +public class MavenDeploymentForJarManager extends MavenDeploymentManager { + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + private PomManager pomManager = new PomManager(); + + private String projPath; + private String repoId; + private String dependencyVersion; + private String mavenPath; + + public MavenDeploymentForJarManager() { + + } + + public void deploy(String projPath, String repoId, String dependencyVersion, String mavenPath) { + this.projPath = projPath; + this.repoId = repoId; + this.dependencyVersion = dependencyVersion; + this.mavenPath = mavenPath; + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + protected void beforeDeploy() { + boolean isModelExist = isJavaProjExist(projPath); + if (!isModelExist) { + throw new RuntimeException("未找到Java模板工程目录,请先生成Java代码"); + } + + setCodeRepoUrl(projPath, repoId); + } + + protected void doDeploy() { + // 推送api + String codePath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName(); + boolean isApiPushed = mavenUtilsCore.exeMavenCommand(codePath, mavenPath, "deploy -pl api -am"); + if (!isApiPushed) { + throw new RuntimeException("部署api失败"); + } + } + + protected void afterDeploy() { + + } + + private boolean isJavaProjExist(String projPath) { + //判断模板工程是否已创建。 + if (fileServiceImp.getProjectPath(projPath) != null) { + String subpropath = fileServiceImp.getProjectPath(projPath); + String fullPath = fileServiceImp.getCombinePath(projPath, subpropath); + List list = fileServiceImp.getAllFiles(fullPath); + for (File file : list) { + if (file.toString().endsWith("pom.xml")) { + return true; + } + } + } + return false; + } + + private void setCodeRepoUrl(String projPath, String repoId) { + String codePomPath = projPath + File.separator + "java" + File.separator + Utils.getMavenProName() + File.separator + MavenUtils.POM_FILE; + pomManager.setRepoUrl(codePomPath, repoId); + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java new file mode 100644 index 0000000000000000000000000000000000000000..cc94dd04456e493b6dfa362761f8fc59ac396e9d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentForMdpkgManager.java @@ -0,0 +1,230 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.MetadataInfoInMavenWithProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.withprocessmode.PackageWithMetadataInfoWithProcessMode; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.GspProjectCoreService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.web.client.RestTemplate; + +public class MavenDeploymentForMdpkgManager extends MavenDeploymentManager { + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + private GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + + private RestTemplate restTemplate = new RestTemplate(); + + private PomManager pomManager = new PomManager(); + + private String projPath; + private String repoId; + private String version; + private String dependencyVersion; + private String mavenPath; + private String metadataBinPath; + private String metadataTempDir; + private String metadataPomPath; + private String mdpkgPath; + private Model sourceModel; + + public MavenDeploymentForMdpkgManager() { + + } + + public void deploy(String projPath, String repoId, String version, String dependencyVersion, String mavenPath) { + this.projPath = projPath; + this.repoId = repoId; + this.version = version; + this.dependencyVersion = dependencyVersion; + this.mavenPath = mavenPath; + metadataBinPath = projPath + File.separator + "metadata" + File.separator + "bin"; + metadataTempDir = fileServiceImp.getCombinePath(projPath + File.separator + "metadata", MavenUtils.TEMP_FOLDER); + metadataPomPath = fileServiceImp.getCombinePath(metadataTempDir, MavenUtils.POM_FILE); + + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + @Override + protected void beforeDeploy() { + handlePomForMetadata(); + } + + @Override + protected void doDeploy() { + try { + if (!mavenUtilsCore.exeMavenCommand(metadataTempDir, mavenPath, "deploy")) { + throw new RuntimeException("部署元数据包失败"); + } + } catch (Exception e) { + throw new RuntimeException("部署元数据失败", e); + } finally { + try { + fileServiceImp.deleteAllFilesUnderDirectory(metadataTempDir); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + protected void afterDeploy() { + String metadaPackageName = new File(mdpkgPath).getName(); + String repoUrl = RepositoryFactory.getInstance().getMavenSettingsRepository().getRepoUrl(repoId); + String processMode = metadataProjectCoreService.getProcessMode(projPath).toString(); + updateMetadataIndex(metadaPackageName, metadataBinPath, repoUrl, sourceModel, processMode); + } + + private void handlePomForMetadata() { + // 准备pom + pomManager.createPomWithSourceModel(createSourceModel(), metadataPomPath, repoId, dependencyVersion); + + // 准备元数据包 + mdpkgPath = metadataProjectCoreService.getMdpkgPath(projPath); + Utils.checkEmpty(mdpkgPath, "未找到元数据包,请先编译:" + projPath); + createSrcDir(metadataTempDir); + String destPath = metadataTempDir + File.separator + MavenUtils.RESOURCES_DIR + File.separator + new File(mdpkgPath).getName(); + try { + fileServiceImp.fileCopy(mdpkgPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private Model createSourceModel() { + sourceModel = new Model(); + final GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(projPath); + sourceModel.setGroupId(getGroupId(gspProjectInfo)); + sourceModel.setArtifactId(getArtifactID(gspProjectInfo) + "-api"); + sourceModel.setVersion(version); + List dependencies = new ArrayList<>(); + final MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(projPath); + if (metadataProjInfo.getMavenPackageRefs() != null && metadataProjInfo.getMavenPackageRefs().size() > 0) { + metadataProjInfo.getMavenPackageRefs().forEach(mavenPackageRef -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(mavenPackageRef.getGroupId()); + dependency.setArtifactId(mavenPackageRef.getArtifactId()); + dependency.setVersion(mavenPackageRef.getVersion()); + dependencies.add(dependency); + }); + } + sourceModel.setDependencies(dependencies); + return sourceModel; + } + + private String getGroupId(GspProject gspProject) { + String groupId; + String prepareGroupId = gspProject.getProjectNameSpace().toLowerCase(); + String firstGroupId = "com."; + if (!prepareGroupId.contains(".")) { + return firstGroupId + prepareGroupId; + } + String[] subGroupId = prepareGroupId.split("\\."); + groupId = firstGroupId + (subGroupId[0] + "." + subGroupId[1]).toLowerCase(); + return groupId; + } + + private String getArtifactID(GspProject gspProject) { + String appCode = gspProject.getAppCode().toLowerCase(); + String suCode = gspProject.getServiceUnitCode().toLowerCase(); + String boCode = gspProject.getMetadataProjectName().toLowerCase(); + if (boCode.startsWith("bo-")) { + boCode = boCode.substring(boCode.indexOf("-") + 1); + } + String artifactId = String.format("%s-%s-%s", appCode, suCode, boCode); + + return artifactId; + } + + private boolean createSrcDir(String mdpkgPath) { + String resDir = mdpkgPath + File.separator + MavenUtils.RESOURCES_DIR; + File resourceFile = new File(resDir); + return resourceFile.mkdirs(); + } + + public void updateMetadataIndex(String mdpkgName, String mdpkgDir, String repoUrl, Model sourceModel, + String processMode) { + MetadataPackage metadataPackage = new MetadataCoreManager().getMetadataPackageInfo(mdpkgName, mdpkgDir); + if (metadataPackage.getMetadataList() != null && metadataPackage.getMetadataList().size() > 0) { + PackageWithMetadataInfoWithProcessMode packageWithMetadataInfoWithProcessMode = new PackageWithMetadataInfoWithProcessMode(); + packageWithMetadataInfoWithProcessMode.setMavenPackageGroupId(sourceModel.getGroupId()); + packageWithMetadataInfoWithProcessMode.setMavenPackageArtifactId(sourceModel.getArtifactId()); + packageWithMetadataInfoWithProcessMode.setMavenPackageVersion(sourceModel.getVersion()); + packageWithMetadataInfoWithProcessMode.setMavenPackageUrl(repoUrl); + packageWithMetadataInfoWithProcessMode.setProcessMode(processMode); + + List metadatas = new ArrayList<>(); + for (GspMetadata metadata : metadataPackage.getMetadataList()) { + MetadataInfoInMavenWithProcessMode tempMetadata = new MetadataInfoInMavenWithProcessMode(); + tempMetadata.setMetadataId(metadata.getHeader().getId()); + tempMetadata.setMetadataCode(metadata.getHeader().getCode()); + tempMetadata.setMetadataName(metadata.getHeader().getName()); + tempMetadata.setMetadataNamespace(metadata.getHeader().getNameSpace()); + tempMetadata.setMetadataType(metadata.getHeader().getType()); + tempMetadata.setMetadataIsTranslating(metadata.getHeader().getTranslating() ? "t" : "f"); + tempMetadata.setMdBizobjectId(metadata.getHeader().getBizObjectId()); + tempMetadata.setMetadataPackageCode(metadataPackage.getHeader().getName()); + tempMetadata.setMetadataPackageVersion(metadataPackage.getHeader().getVersion().getVersionString()); + tempMetadata.setMetadataLanguage(metadata.getHeader().getLanguage()); + tempMetadata.setMavenPackageGroupId(sourceModel.getGroupId()); + tempMetadata.setMavenPackageArtifactId(sourceModel.getArtifactId()); + tempMetadata.setMavenPackageVersion(sourceModel.getVersion()); + tempMetadata.setMavenPackageUrl(repoUrl); + tempMetadata.setProcessMode(processMode); + metadatas.add(tempMetadata); + } + + packageWithMetadataInfoWithProcessMode.setMetadatas(metadatas); + + String indexServerUrl = IndexServerManager.getInstance().getIndexServerWithProcessModeUrl(); + try { + restTemplate.postForObject(indexServerUrl, new HttpEntity<>(packageWithMetadataInfoWithProcessMode, new HttpHeaders()), boolean.class); + } catch (Exception e) { + if (e.getMessage().contains("404")) { + throw new RuntimeException("未更新索引服务器版本,无法推送解析型元数据。请联系管理员解决。"); + } else { + throw e; + } + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java new file mode 100644 index 0000000000000000000000000000000000000000..b78fe6d6d87c984292feaaad7b1a0489a24ea5e8 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/MavenDeploymentManager.java @@ -0,0 +1,50 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; + +public class MavenDeploymentManager { + + private MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + + private FileServiceImp fileServiceImp = new FileServiceImp(); + + public MavenDeploymentManager() { + + } + + public void deploy() { + beforeDeploy(); + + doDeploy(); + + afterDeploy(); + } + + protected void beforeDeploy() { + + } + + protected void doDeploy() { + + } + + protected void afterDeploy() { + + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java new file mode 100644 index 0000000000000000000000000000000000000000..b6a39ba5a9a2d1f27364d80de877caa12b29a047 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PackageNameManager.java @@ -0,0 +1,79 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import java.io.File; +import java.util.List; + +public class PackageNameManager { + private MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + + public String getMdpkgNameByGA(String groupId, String artifactId, String mavenPath, String absolutePath) { + String mdpkgName = ""; + + mdpkgName = getMdpkgNameByGAFromMaven(groupId, artifactId, mavenPath); + if (!mdpkgName.isEmpty()) { + return mdpkgName; + } + + mdpkgName = getMdpkgNameByGASplice(groupId, artifactId, absolutePath); + return mdpkgName; + } + + private String getMdpkgNameByGASplice(String groupId, String artifactId, String absolutePath) { + String mdpkgName = ""; + if (artifactId.equals("gsp-common-commoncomponent-api")) { + mdpkgName = "Inspur.Gsp.Common.CommonCmp".toLowerCase(); + } else if (artifactId.equals("gsp-pfcommon-commonudt-api")) { + mdpkgName = "Inspur.Gsp.Common.CommonUdt".toLowerCase(); + } else { + String front = groupId.substring(groupId.indexOf(".") + 1); + String back = artifactId.substring(0, artifactId.indexOf("-api")).replace('-', '.'); + back = back.endsWith("front") ? back.substring(0, back.length() - 5) + ".front" : back; + String mdpkgNameLikely = front + '.' + back; + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + List metadataPackageRefs = metadataProjInfo.getMetadataPackageRefs(); + if (metadataPackageRefs != null && metadataPackageRefs.size() > 0) { + MetadataPackageHeader metadataPackageHeader = metadataPackageRefs.stream().filter(ref -> ref.getName().toLowerCase().equals(mdpkgNameLikely)).findFirst().orElse(null); + if (metadataPackageHeader != null) { + mdpkgName = metadataPackageHeader.getName(); + } + } + } + return mdpkgName; + } + + private String getMdpkgNameByGAFromMaven(String groupId, String artifactId, String mavenPath) { + String mdpkgName = ""; + FileServiceImp fileServiceImp = new FileServiceImp(); + + // 首先从maven目录获取,以packName开头的目录将被选出来,其余被过滤掉 + File[] dirs = new File(mavenPath).listFiles((dir, name) -> name.startsWith(groupId + "-" + artifactId)); + if (dirs != null && dirs.length > 0) { + File[] files = dirs[0].listFiles((dir, name) -> name.endsWith(Utils.getMetadataPackageExtension())); + if (files != null && files.length > 0) { + mdpkgName = fileServiceImp.getFileNameWithoutExtension(files[0].getPath()); + } + } + return mdpkgName; + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java new file mode 100644 index 0000000000000000000000000000000000000000..523d240cead4c4c099c498f060d201e3c04b7ad3 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/PomManager.java @@ -0,0 +1,64 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.core.persistence.RepositoryFactory; +import java.util.List; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; + +public class PomManager { + + public void createPomWithSourceModel(Model sourceModel, String pomPath, String repoId, String dependencyVersion) { + final Model model = createModelWithSourceModel(sourceModel, repoId, dependencyVersion); + writeModel(pomPath, model); + } + + public void createPomForDependencyCopy(List refs, String pomPath) { + RepositoryFactory.getInstance().getPomRepository().createPomForDependencyCopy(refs, pomPath); + } + + public void updatePom(String pomPath, List refs, String packaging) { + RepositoryFactory.getInstance().getPomRepository().updatePom(pomPath, refs, packaging); + } + + public void setRepoUrl(String pomPath, String repoId) { + final Model model = getModel(pomPath); + final DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, model.getVersion().endsWith(MavenUtils.SNAP_SHOT)); + model.setDistributionManagement(distributionManagement); + writeModel(pomPath, model); + } + + public void writeModel(String pomPath, Model model) { + RepositoryFactory.getInstance().getPomRepository().writeModel(pomPath, model); + } + + public Model getModel(String pomPath) { + Model model = RepositoryFactory.getInstance().getPomRepository().getModel(pomPath); + model.setGroupId(model.getGroupId() == null ? model.getParent().getGroupId() : model.getGroupId()); + model.setArtifactId(model.getArtifactId() == null ? model.getParent().getArtifactId() : model.getArtifactId()); + model.setVersion(model.getVersion() == null ? model.getParent().getVersion() : model.getVersion()); + return model; + } + + private Model createModelWithSourceModel(Model sourceModel, String repoId, String dependencyVersion) { + final Model modelWithSourceModel = RepositoryFactory.getInstance().getPomRepository().createModelWithSourceModel(sourceModel, repoId, dependencyVersion); + return modelWithSourceModel; + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java new file mode 100644 index 0000000000000000000000000000000000000000..88121810cd568829094cf8957a9a60d5557014cf --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/manager/VersionManager.java @@ -0,0 +1,77 @@ +/* + * 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.lcm.metadata.core.manager; + +import com.inspur.edp.lcm.metadata.common.Utils; + +public class VersionManager { + public String versionCompare(String existVersion, String newVersion) { + if (newVersion == null) { + return existVersion; + } + + if (existVersion == null) { + return newVersion; + } + + String[] existVersions = existVersion.split("\\."); + String[] newVersions = newVersion.split("\\."); + int first = Integer.parseInt(existVersions[0].replace(Utils.getVersionPrefix(), "")) - Integer.parseInt(newVersions[0].replace(Utils.getVersionPrefix(), "")); + if (first > 0) { + return existVersion; + } + if (first < 0) { + return newVersion; + } + int second = Integer.parseInt(existVersions[1]) - Integer.parseInt(newVersions[1]); + if (second > 0) { + return existVersion; + } + if (second < 0) { + return newVersion; + } + + // 解决其他后缀对比问题 + String third1 = existVersions[2].replace(Utils.getVersionSuffix(), ""); + int thirdInt1; + if (third1.contains("-")) { + thirdInt1 = Integer.parseInt(third1.split("-")[0]); + } else { + thirdInt1 = Integer.parseInt(third1); + } + String third2 = newVersions[2].replace(Utils.getVersionSuffix(), ""); + int thirdInt2; + if (third2.contains("-")) { + thirdInt2 = Integer.parseInt(third2.split("-")[0]); + } else { + thirdInt2 = Integer.parseInt(third2); + } + int third = thirdInt1 - thirdInt2; + + if (third > 0) { + return existVersion; + } + if (third < 0) { + return newVersion; + } + + if (!existVersion.endsWith(Utils.getVersionSuffix())) { + return existVersion; + } else { + return newVersion; + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..d4f895c1adab43cd14c59f595b1477568078b291 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MavenSettingsRepository.java @@ -0,0 +1,66 @@ +/* + * 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.lcm.metadata.core.persistence; + +import com.inspur.edp.ide.setting.api.entity.MavenSettings; +import com.inspur.edp.ide.setting.api.entity.MavenSettingsMirror; +import com.inspur.edp.ide.setting.api.service.MavenService; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.common.Utils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import org.apache.maven.model.DeploymentRepository; +import org.apache.maven.model.DistributionManagement; + +public class MavenSettingsRepository { + public List getRepoUrls() { + MetadataRepo metadataRepo = new MetadataRepo(); + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + return mirrors; + } + + public String getRepoUrl(String repoId) { + final MavenSettings mavenSettings = SpringBeanUtils.getBean(MavenService.class).getMavenSettings(); + final List mirrors = mavenSettings.getMirrors(); + if (mirrors == null || mirrors.size() <= 0) { + return null; + } + for (MavenSettingsMirror mirror : mirrors) { + if (mirror.getId().equals(repoId)) { + return mirror.getUrl(); + } + } + return null; + } + + public DistributionManagement getDistributionManagement(String repoId, boolean isSnotshot) { + DeploymentRepository deploymentRepository = new DeploymentRepository(); + String repoUrl = getRepoUrl(repoId); + Utils.checkEmpty(repoUrl, "获取仓库地址为空:" + repoId + ",请检查工作空间下的settings.xml文件。"); + deploymentRepository.setId(repoId); + deploymentRepository.setUrl(repoUrl); + + DistributionManagement distributionManagement = new DistributionManagement(); + if (isSnotshot) { + distributionManagement.setSnapshotRepository(deploymentRepository); + } else { + distributionManagement.setRepository(deploymentRepository); + } + + return distributionManagement; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..80b34388de6c4ae4559d38fb7101c81efc05d722 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataProjectRepository.java @@ -0,0 +1,264 @@ +/* + * 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.lcm.metadata.core.persistence; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageVersion; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.stream.Collectors; + +public class MetadataProjectRepository { + private FileServiceImp fileService = new FileServiceImp(); + + public void add(String fullPath, String projectStr) { + fileService.createFile(fullPath); + fileService.fileUpdate(fullPath, projectStr, false); + } + + public MetadataProject assmbllyMetadataProj(String projName, String projNameSpace, String packageName) { + MetadataProject metadataProject = new MetadataProject(); + metadataProject.setId(UUID.randomUUID().toString()); + metadataProject.setNameSpace(projNameSpace); + metadataProject.setName(projName); + metadataProject.setMetadataPackageInfo(new MetadataPackageHeader()); + metadataProject.getMetadataPackageInfo().setName(packageName); + metadataProject.getMetadataPackageInfo().setVersion(new MetadataPackageVersion("1.0.0")); + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + metadataProject.setMavenPackageRefs(new ArrayList<>()); + return metadataProject; + } + + public void setSourceData(String absolutePath, + Map>> sourceData) throws IOException { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + "/" + Utils.getMetadataBinPath() + "/" + Utils.getSourceDataFileName(); + File sourceDataFile = new File(filePath); + if (!sourceDataFile.exists()) { + createBinDir(absolutePath); + sourceDataFile.createNewFile(); + } + fileService.fileUpdate(filePath, JSON.toJSONString(sourceData, true), false); + } + + public Map>> getSourceData(String absolutePath) { + Map>> sourceData = new HashMap<>(); + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getSourceDataFileName(); + if (!fileService.isFileExist(filePath)) { + Map> modifiedTime = new HashMap<>(); + modifiedTime.put("metadata", new HashMap<>()); + modifiedTime.put("api_src", new HashMap<>()); + modifiedTime.put("api", new HashMap<>()); + modifiedTime.put("comp", new HashMap<>()); + modifiedTime.put("runtime", new HashMap<>()); + sourceData.put("modifiedtime", modifiedTime); + return sourceData; + } + try { + // 如果sourcedata.json文件格式错误,则初始化,并返回空。 + sourceData = JSONObject.parseObject(fileService.fileRead(filePath), new TypeReference>>>() { + }); + return sourceData; + } catch (Exception e) { + try { + fileService.fileDelete(filePath); + return getSourceData(absolutePath); + } catch (IOException ioException) { + ioException.printStackTrace(); + } + } + return sourceData; + } + + public void setMavenUpdateFlag(String absolutePath, Boolean flag) { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getMavenUpdateFlagFileName(); + File mavenUpdateFlagFile = new File(filePath); + if (!mavenUpdateFlagFile.exists()) { + createBinDir(absolutePath); + try { + mavenUpdateFlagFile.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + String feature = flag ? " -U" : ""; + fileService.fileUpdate(filePath, feature, false); + } + + public String getMavenUpdateFlag(String absolutePath) { + String filePath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath() + "/" + Utils.getMavenUpdateFlagFileName(); + if (!fileService.isFileExist(filePath)) { + setMavenUpdateFlag(absolutePath, false); + } + String updateFlag = fileService.fileRead(filePath); + return updateFlag; + } + + private void createBinDir(String absolutePath) { + String dirPath = absolutePath + "/" + Utils.getMetadataProjPath() + + "/" + Utils.getMetadataBinPath(); + File binDir = new File(dirPath); + if (!binDir.exists()) { + binDir.mkdirs(); + } + } + + public void updateMetadataProject(String projPath, MetadataProject metadataProject) { + String filePath = getMdprojPath(projPath, metadataProject); + Utils.writeValue(filePath, metadataProject); + } + + public void updateRefs(String projPath, MetadataProject metadataProject, MetadataPackageHeader packageHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (packageHeader.getName() == null || packageHeader.getName().isEmpty()) { + return; + } + + if (packageHeader.getName().endsWith(Utils.getMetadataPackageExtension())) { + packageHeader.setName(fileService.getFileNameWithoutExtension(packageHeader.getName())); + } + + if (metadataProject.getMetadataPackageRefs() == null) { + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + } + + boolean existFlag = metadataProject.getMetadataPackageRefs().stream().anyMatch(ref -> ref.getName().equals(packageHeader.getName())); + if (!existFlag) { + metadataProject.getMetadataPackageRefs().add(packageHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + public void removeRefs(String projPath, MetadataProject metadataProject, MetadataPackageHeader packageHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (packageHeader.getName() == null || packageHeader.getName().isEmpty()) { + return; + } + + if (packageHeader.getName().endsWith(Utils.getMetadataPackageExtension())) { + packageHeader.setName(fileService.getFileNameWithoutExtension(packageHeader.getName())); + } + + if (metadataProject.getMetadataPackageRefs() == null) { + metadataProject.setMetadataPackageRefs(new ArrayList<>()); + } + + MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs() + .stream() + .filter(ref -> ref.getName().equals(packageHeader.getName())) + .findFirst().orElse(null); + if (metadataPackageHeader != null) { + metadataProject.getMetadataPackageRefs().remove(metadataPackageHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + public void updateMavenRefs(String projPath, MetadataProject metadataProject, MavenPackageRefs packageRefs) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (metadataProject.getMavenPackageRefs() == null) { + metadataProject.setMavenPackageRefs(new ArrayList<>()); + } + + int index = -1; + for (int i = 0; i < metadataProject.getMavenPackageRefs().size(); i++) { + if (metadataProject.getMavenPackageRefs().get(i).getGroupId().equals(packageRefs.getGroupId()) && metadataProject.getMavenPackageRefs().get(i).getArtifactId().equals(packageRefs.getArtifactId())) { + index = i; + break; + } + } + if (index != -1) { + metadataProject.getMavenPackageRefs().get(index).setVersion(packageRefs.getVersion()); + } else { + metadataProject.getMavenPackageRefs().add(packageRefs); + } + + Utils.writeValue(filePath, metadataProject); + } + + public void removeMavenRefs(String projPath, MetadataProject metadataProject, MavenPackageRefs packageRefs) { + String filePath = getMdprojPath(projPath, metadataProject); + + if (metadataProject.getMavenPackageRefs() == null) { + metadataProject.setMavenPackageRefs(new ArrayList<>()); + } + + MavenPackageRefs mavenPackageRefs = metadataProject.getMavenPackageRefs() + .stream() + .filter(ref -> ref.getGroupId().equals(packageRefs.getGroupId()) && ref.getArtifactId().equals(packageRefs.getArtifactId())) + .findFirst() + .orElse(null); + if (mavenPackageRefs != null) { + metadataProject.getMavenPackageRefs().remove(mavenPackageRefs); + Utils.writeValue(filePath, metadataProject); + } + } + + public void removeProjectRefs(String projPath, MetadataProject metadataProject, List mdpkgNames) { + String filePath = getMdprojPath(projPath, metadataProject); + if (metadataProject.getProjectRefs() == null) { + metadataProject.setProjectRefs(new ArrayList<>()); + } + + List projectHeaders = metadataProject.getProjectRefs() + .stream() + .filter(ref -> mdpkgNames.contains(ref.getName())) + .collect(Collectors.toList()); + if (projectHeaders != null && projectHeaders.size() > 0) { + for (ProjectHeader header : projectHeaders) { + metadataProject.getProjectRefs().remove(header); + } + Utils.writeValue(filePath, metadataProject); + } + } + + public void updateProjectRefs(String projPath, MetadataProject metadataProject, ProjectHeader projectHeader) { + String filePath = getMdprojPath(projPath, metadataProject); + if (metadataProject.getProjectRefs() == null) { + metadataProject.setProjectRefs(new ArrayList<>()); + } + boolean notExistFlag = metadataProject.getProjectRefs() + .stream() + .noneMatch(ref -> projectHeader.getName().equals(ref.getName())); + if (notExistFlag) { + metadataProject.getProjectRefs().add(projectHeader); + Utils.writeValue(filePath, metadataProject); + } + } + + private String getMdprojPath(String projPath, MetadataProject metadataProject) { + String mdprojPath = Paths.get(projPath).resolve(Utils.getMetadataProjPath() + File.separator + metadataProject.getProjectFileName()).toString(); + return mdprojPath; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..99807ea6c9e915ce20c3dc5256971ad27f16f63d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/MetadataRepository.java @@ -0,0 +1,110 @@ +/* + * 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.lcm.metadata.core.persistence; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.util.List; + +public class MetadataRepository { + private FileServiceImp fileService = new FileServiceImp(); + MetadataSerializer metadataSerializer = new MetadataSerializer(); + + public GspMetadata load(String absolutePath) { + String fileString = fileService.fileRead(absolutePath); + GspMetadata metadata = metadataSerializer.deserialize(fileString, GspMetadata.class); + metadata.setRelativePath(absolutePath.substring(0, Utils.handlePath(absolutePath).lastIndexOf('/'))); + return metadata; + } + + public GspMetadata getMetadataWithoutContent(String path) { + String fileStr = fileService.fileRead(path); + if (fileStr == null || fileStr.isEmpty()) { + return null; + } + ObjectMapper mapper = Utils.getMapper(); + JsonNode metadataObj = null; + try { + metadataObj = mapper.readTree(fileStr); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + e.printStackTrace(); + } + GspMetadata metadata = metadataSerializer.buildMetadataBaseInfo(metadataObj); + metadata.setRelativePath(path.substring(0, Utils.handlePath(path).lastIndexOf('/'))); + return metadata; + } + + public void getMetadatasUnderDir(List mdPathList, String dirPath) { + List dirs = fileService.getDirectorys(dirPath); + if (dirs.size() > 0) { + for (int i = 0; i < dirs.size(); i++) { + String dirName = fileService.getFileName(Utils.handlePath(dirs.get(i).getPath())); + String temPath = dirPath + "/" + dirName; + if (!dirName.equalsIgnoreCase(".git") && !dirName.equalsIgnoreCase(".vs") && !dirName.equalsIgnoreCase("bin") && !dirName.toLowerCase().equals("publish") && !dirName.toLowerCase().equals("obj") && !dirName.toLowerCase().equals("src") && !dirName.toLowerCase().equals("java")) { + getMetadatasUnderDir(mdPathList, temPath); + } + } + } + List paths = fileService.getAllFiles(dirPath); + if (paths.size() > 0) { + for (File path : paths) { + mdPathList.add(Utils.handlePath(path.getPath())); + } + } + } + + public void create(GspMetadata metadata, String path) { + // 序列化元数据 + String metadataStr = metadataSerializer.serialize(metadata); + String folderPath = new File(path).getParent(); + if (!fileService.isDirectoryExist(folderPath)) { + fileService.createDirectory(folderPath); + } + fileService.createFile(path); + fileService.fileUpdate(path, metadataStr, false); + } + + public void save(GspMetadata metadata, String path) { + // 序列化元数据 + String metadataStr = metadataSerializer.serialize(metadata); + fileService.fileUpdate(path, metadataStr, false); + } + + public void delete(String path) { + try { + fileService.fileDelete(path); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public void rename(String oldName, String newName) { + try { + fileService.fileRename(oldName, newName); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..5fbdcdcf62fb91dac06e0e09d2b100ad50733752 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/PomRepository.java @@ -0,0 +1,156 @@ +/* + * 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.lcm.metadata.core.persistence; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MavenUtils; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.DistributionManagement; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class PomRepository { + private final String groupId = "com.inspur.edp"; + private final String artifactId = "download-tools"; + private final String version = "0.1.0-SNAPSHOT"; + private final String modelVersion = "4.0.0"; + private final String packaging = "pom"; + + FileServiceImp fileServiceImp = new FileServiceImp(); + + public Model getModel(String pomPath) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return null; + } + + public void writeModel(String pomPath, Model model) { + File pom = new File(pomPath); + if (!pom.exists()) { + pom.getParentFile().mkdirs(); + try { + pom.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void createPomForDependencyCopy(List refs, String pomPath) { + // 创建pom文件 + fileServiceImp.createFile(pomPath); + // 创建model并写入 + final List dependencies = createDependencies(refs, PackageType.zip.toString()); + final Model model = createModel(groupId, artifactId, version, modelVersion, packaging, dependencies); + writeModel(pomPath, model); + } + + public void updatePom(String pomPath, List refs, String packaging) { + Model model = getModel(pomPath); + model.setPackaging(packaging); + final List dependencies = createDependencies(refs, PackageType.jar.toString()); + model.setDependencies(dependencies); + writeModel(pomPath, model); + } + + public Model createModelWithSourceModel(Model sourceModel, String repoId, String dependencyVersion) { + Model model = new Model(); + + Parent parent = createParent(); + model.setParent(parent); + + model.setGroupId(sourceModel.getGroupId()); + model.setArtifactId(sourceModel.getArtifactId()); + model.setVersion(sourceModel.getVersion().startsWith("m") ? sourceModel.getVersion() : "m" + sourceModel.getVersion()); + + model.setModelVersion("4.0.0"); + model.setPackaging("metadata-pack"); + + final boolean isSnotshot = sourceModel.getVersion().endsWith(MavenUtils.SNAP_SHOT); + DistributionManagement distributionManagement = RepositoryFactory.getInstance().getMavenSettingsRepository().getDistributionManagement(repoId, isSnotshot); + model.setDistributionManagement(distributionManagement); + + List list = model.getDependencies(); + if (sourceModel.getDependencies() != null && sourceModel.getDependencies().size() > 0) { + sourceModel.getDependencies().forEach(sourceDependency -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(sourceDependency.getGroupId()); + dependency.setArtifactId(sourceDependency.getArtifactId()); + boolean dependencyVersionFlag = dependencyVersion != null && sourceDependency.getVersion().endsWith(MavenUtils.SNAP_SHOT); + String actingVersion = "m" + (dependencyVersionFlag ? dependencyVersion : sourceDependency.getVersion()); + dependency.setVersion(actingVersion); + dependency.setType("zip"); + }); + } + model.setDependencies(list); + return model; + } + + private Model createModel(String groupId, String artifactId, String version, String modelVersion, String packaging, + List dependencies) { + Model model = new Model(); + model.setArtifactId(groupId); + model.setGroupId(artifactId); + model.setVersion(version); + model.setModelVersion(modelVersion); + model.setPackaging(packaging); + model.setDependencies(dependencies); + return model; + } + + private List createDependencies(List refs, String dependencyType) { + List dependencies = new ArrayList<>(); + refs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setGroupId(ref.getGroupId()); + dependency.setVersion(ref.getVersion()); + dependency.setType(dependencyType); + dependencies.add(dependency); + }); + return dependencies; + } + + private Parent createParent() { + final Parent parent = new Parent(); + parent.setArtifactId("metadata-parent"); + parent.setGroupId("com.inspur.edp"); + parent.setVersion("0.1.0"); + return parent; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..2fed75c54ed41015251eca424c99824d67b7c830 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/persistence/RepositoryFactory.java @@ -0,0 +1,68 @@ +/* + * 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.lcm.metadata.core.persistence; + +public class RepositoryFactory { + private RepositoryFactory() { + } + + ; + private static RepositoryFactory instance; + + public static RepositoryFactory getInstance() { + if (instance == null) { + instance = new RepositoryFactory(); + } + return instance; + } + + private MetadataRepository metadataRepository; + + public MetadataRepository getMetadataRepository() { + if (metadataRepository == null) { + metadataRepository = new MetadataRepository(); + } + return metadataRepository; + } + + private MetadataProjectRepository metadataProjectRepository; + + public MetadataProjectRepository getMetadataProjectRepository() { + if (metadataProjectRepository == null) { + metadataProjectRepository = new MetadataProjectRepository(); + } + return metadataProjectRepository; + } + + private PomRepository pomRepository; + + public PomRepository getPomRepository() { + if (pomRepository == null) { + pomRepository = new PomRepository(); + } + return pomRepository; + } + + private MavenSettingsRepository mavenSettingsRepository; + + public MavenSettingsRepository getMavenSettingsRepository() { + if (mavenSettingsRepository == null) { + mavenSettingsRepository = new MavenSettingsRepository(); + } + return mavenSettingsRepository; + } + +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..cd00fbf23fc101dbe66725d248fc117cd10be9c9 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/IRefI18nFilter.java @@ -0,0 +1,24 @@ +/* + * 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.lcm.metadata.core.refi18n; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import java.util.List; + +public interface IRefI18nFilter { + List getRefI18nMetadata(String resouceMdID, String resourceFileName, String path, String mavenPath, + String packagePath); +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..964928ef73eea0477bc679f3193e493bad4c183d --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefI18nMetadataFactory.java @@ -0,0 +1,26 @@ +/* + * 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.lcm.metadata.core.refi18n; + +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; + +public class RefI18nMetadataFactory { + public IRefI18nFilter createFilter(String resourceMetadataID, String path) { + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + boolean existInProject = metadataCoreManager.isMetadataExistInProject(path, resourceMetadataID); + return existInProject ? new SelfProjectFilter() : new RefLocationFilter(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..b77c06a6153a168a0ce5cbacab81046f7bac9389 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/RefLocationFilter.java @@ -0,0 +1,134 @@ +/* + * 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.lcm.metadata.core.refi18n; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProjectMetadataCache; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.cache.MetadataDevCacheManager; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForMaven; +import com.inspur.edp.lcm.metadata.core.index.MetadataPackageIndexServiceForPackages; +import com.inspur.edp.lcm.metadata.core.index.ProjectMetadataCacheService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class RefLocationFilter implements IRefI18nFilter { + private final MetadataCoreManager metadataManager = new MetadataCoreManager(); + private final MetadataProjectCoreService projectService = new MetadataProjectCoreService(); + private ProjectMetadataCacheService projectMetadataCacheService; + + @Override + public List getRefI18nMetadata(String resourceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + //从工程引用范围内,查找包依赖的元数据内容 + MetadataProject metadataProject = MetadataProjectCoreService.getCurrent().getMetadataProjInfo(path); + Utils.checkNPE(metadataProject, "获取的元数据工程信息为null,参数为projPath:" + path); + + // 从当前工程及bo下的引用的工程下搜索 + List metadataFromProjects = getMetadataFromProjects(resourceMdID, metadataProject); + if (metadataFromProjects.size() > 0) { + return metadataFromProjects; + } + + // 从缓存中获取 + projectMetadataCacheService = ProjectMetadataCacheService.getNewInstance(metadataProject, path, packagePath, mavenPath); + String metadataPackageLocation = getMetadataPackageLocationFromCache(resourceMdID, metadataProject, false, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataPackageLocation = getMetadataPackageLocationFromCache(resourceMdID, metadataProject, true, packagePath, mavenPath); + if (metadataPackageLocation == null || metadataPackageLocation.isEmpty()) { + metadataManager.throwMetadataNotFoundException(resourceMdID); + } + } + + //按照maven的查找规范查找,查找maven目录与packages目录 + //获取资源元数据所在包的信息,包括包所在的位置,元数据所处包中的位置,需要过滤具体的包中,资源元数据对应的语言包元数据,元数据文件名称.languagecode.lres(SalesOrder0426.be.en.lres) + return GetlresMetadataFromPackage(resourceMdID, resourceFileName, metadataPackageLocation); + } + + private String getMetadataPackageLocationFromCache(String metadataID, MetadataProject metadataProject, + Boolean refreshIndexFlag, String packagePath, String mavenPath) { + if (refreshIndexFlag) { + MetadataPackageIndexServiceForPackages.getInstance(packagePath).refreshMetadataPackageIndex(); + MetadataPackageIndexServiceForMaven.getInstance(mavenPath).refreshMetadataPackageIndex(); + projectMetadataCacheService.clearCache(); + } + projectMetadataCacheService.syncProjectMetadataCache(); + ProjectMetadataCache projectMetadataCacheMap = (ProjectMetadataCache) MetadataDevCacheManager.getProjectMetadataCacheMap(metadataProject.getProjectPath()); + return projectMetadataCacheMap.getMetadataPackageLocations().get(metadataID); + } + + private List getMetadataFromProjects(String resourceMdID, MetadataProject metadataProject) { + List lresMetadataList = new ArrayList<>(); + List refProjPaths = new ArrayList<>(); + if (metadataProject != null) { + refProjPaths.add(metadataProject.getProjectPath()); + projectService.getRefProjPaths(metadataProject.getProjectPath(), refProjPaths); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + for (String projPath : refProjPaths) { + List metadataList = metadataManager.getMetadataList(projPath); + for (GspMetadata gspMetadata : metadataList) { + if (gspMetadata.getHeader().getId().equals(resourceMdID)) { + String resourceMdFileNameWithoutExt = fileService.getFileNameWithoutExtension(gspMetadata.getHeader().getFileName()); + for (GspMetadata metadata : metadataList) { + if (metadata.getHeader().getFileName().endsWith(Utils.getLanguageMetadataFileExtention()) && metadata.getHeader().getFileName().startsWith(resourceMdFileNameWithoutExt)) { + GspMetadata lresMetadata = metadataManager.loadMetadata(gspMetadata.getHeader().getFileName(), gspMetadata.getRelativePath()); + lresMetadataList.add(lresMetadata); + } + } + break; + } + } + } + } + return lresMetadataList; + } + + private List GetlresMetadataFromPackage(String resourceMdID, String resourceMdFileName, + String metadataPackageLocation) { + File packageFile = new File(metadataPackageLocation); + //必须用GetMetadataPackageInfoFromSpecPath获取包的信息 + MetadataPackage metadataPackageInfo = MetadataCoreManager.getCurrent().getMetadataPackageInfo(packageFile.getName(), packageFile.getParent()); + //根据包具体的信息,对比metadataid,找到metadataid对应元数据的相对路径,其中找语言包元数据列表 + if (metadataPackageInfo == null || metadataPackageInfo.getMetadataList() == null) { + throw new RuntimeException("could not find reourseMetadata's metadataPackage, reoursefilename is " + resourceMdFileName); + } + + FileService fileService = SpringBeanUtils.getBean(FileService.class); + List lresMetadataList = new ArrayList<>(); + for (GspMetadata gspMetadata : metadataPackageInfo.getMetadataList()) { + if (resourceMdID.equals(gspMetadata.getHeader().getId())) { + String resourceMdFileNameWithoutExt = fileService.getFileNameWithoutExtension(gspMetadata.getHeader().getFileName()); + for (GspMetadata metadata : metadataPackageInfo.getMetadataList()) { + if (metadata.getHeader().getFileName().endsWith(Utils.getLanguageMetadataFileExtention()) && metadata.getHeader().getFileName().startsWith(resourceMdFileNameWithoutExt)) { + Metadata4Ref metadataFromPackage = MetadataCoreManager.getCurrent().getMetadataFromPackage(packageFile.getName(), packageFile.getParent(), metadata.getHeader().getId()); + lresMetadataList.add(metadataFromPackage.getMetadata()); + } + } + break; + } + } + + return lresMetadataList; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java new file mode 100644 index 0000000000000000000000000000000000000000..ac24a3b98e22f96b9d6e8a1acd89d41269caeff6 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/refi18n/SelfProjectFilter.java @@ -0,0 +1,56 @@ +/* + * 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.lcm.metadata.core.refi18n; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +public class SelfProjectFilter implements IRefI18nFilter { + @Override + public List getRefI18nMetadata(String resouceMdID, String resourceFileName, String path, + String mavenPath, String packagePath) { + List languageMetadataList = new ArrayList<>(); + + MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + MetadataProject metadataProjInfo = metadataProjectCoreService.getMetadataProjInfo(path); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + GspMetadata resourceMetadata = metadataCoreManager.loadMetadataByMetadataId(resouceMdID, metadataProjInfo.getProjectPath()); + + //查找对应的语言包元数据,语言包元数据需要文件操作,获取所有的语言包元数据文件 + //资源元数据以及资源元数据对应的语言包元数据,是平铺到一起的 + //资源元数据文件名称.languagecode.lres(SalesOrder0426.be.en.lres) + //先过滤包含资源元数据文件名称的文件,然后过滤后缀为lres的文件 + String absolutePath = ManagerUtils.getAbsolutePath(resourceMetadata.getRelativePath()); + FileService fileService = new FileServiceImp(); + String searchFileName = resourceFileName == null || resourceFileName.isEmpty() ? fileService.getFileNameWithoutExtension(resourceMetadata.getHeader().getFileName()) : fileService.getFileNameWithoutExtension(resourceFileName); + File[] files = new File(absolutePath).listFiles((dir, name) -> name.startsWith(searchFileName) && name.endsWith(Utils.getLanguageMetadataFileExtention())); + + for (File file : files) { + GspMetadata metadata = metadataCoreManager.loadMetadata(file.getName(), file.getParent()); + languageMetadataList.add(metadata); + } + return languageMetadataList; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java new file mode 100644 index 0000000000000000000000000000000000000000..b1d4b8bafe7a177527546e49bd71886f5c31cec4 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/CopyToPackagesRunnable.java @@ -0,0 +1,52 @@ +/* + * 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.lcm.metadata.core.sync; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.File; +import java.io.IOException; +import java.util.List; + +public class CopyToPackagesRunnable implements Runnable { + private List downloadMdpkgPaths; + private String packagePath; + protected final FileServiceImp fileServiceImp = new FileServiceImp(); + + @Override + public void run() { + downloadMdpkgPaths.stream().parallel().forEach(path -> { + String mdpkgName = new File(path).getName(); + String desPackageDir = fileServiceImp.getCombinePath(packagePath, mdpkgName); + if (!fileServiceImp.isDirectoryExist(desPackageDir)) { + fileServiceImp.createDirectory(desPackageDir); + } + String desPackagePath = fileServiceImp.getCombinePath(desPackageDir, mdpkgName); + try { + fileServiceImp.fileCopy(path, desPackagePath); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } + + public void setPackagePath(String packagePath) { + this.packagePath = packagePath; + } + + public void setDownloadMdpkgPaths(List downloadMdpkgPaths) { + this.downloadMdpkgPaths = downloadMdpkgPaths; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java new file mode 100644 index 0000000000000000000000000000000000000000..6cb7749e38146c0fb61abae3c05d679e5aaac431 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallJarRunnable.java @@ -0,0 +1,111 @@ +/* + * 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.lcm.metadata.core.sync; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.entity.PackageType; +import com.inspur.edp.lcm.metadata.core.manager.MavenCommandGenerator; +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class InstallJarRunnable implements Runnable { + protected String pomPath; + protected String pomDirPath; + protected String mavenPath; + protected String downloadPath; + protected boolean forceUpdateFlag; + protected final FileServiceImp fileServiceImp = new FileServiceImp(); + protected final MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + private List downloadMdpkgPaths; + private String featureInName = "-api-"; + + @Override + public void run() { + try { + List refs = getMavenPackageRefs(); + final PomManager pomManager = new PomManager(); + pomManager.updatePom(pomPath, refs, PackageType.jar.toString()); + final MavenCommandGenerator mavenCommandGenerator = new MavenCommandGenerator(); + mavenCommandGenerator.setOutputDirectory(downloadPath); + mavenCommandGenerator.setIncludeTypes(PackageType.jar.toString()); + mavenCommandGenerator.setForceUpdate(forceUpdateFlag); + mavenCommandGenerator.setExcludeTransitive(true); + final String mavenCommand = mavenCommandGenerator.generateCopydependencies(); + mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mavenCommand); + } finally { + try { + //删除pom.xml + if (fileServiceImp.isFileExist(pomPath)) { + fileServiceImp.fileDelete(pomPath); + } + //删除\projects\maven/temp + if (fileServiceImp.isDirectoryExist(downloadPath)) { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private List getMavenPackageRefs() { + List refs = new ArrayList<>(); + downloadMdpkgPaths.forEach(path -> { + if (!path.contains("SNAPSHOT")) { + return; + } + String dirName = new File(new File(path).getParent()).getName(); + MavenPackageRefs mavenPackageRefs = new MavenPackageRefs(); + String groupId = dirName.substring(0, dirName.indexOf("-")); + String version = dirName.substring(dirName.lastIndexOf(featureInName) + featureInName.length() + 1); + String artifactId = dirName.substring(dirName.indexOf("-") + 1, dirName.lastIndexOf(featureInName) + featureInName.length() - 1); + mavenPackageRefs.setGroupId(groupId); + mavenPackageRefs.setArtifactId(artifactId); + mavenPackageRefs.setVersion(version); + refs.add(mavenPackageRefs); + }); + return refs; + } + + public void setPomPath(String pomPath) { + this.pomPath = pomPath; + } + + public void setForceUpdateFlag(boolean forceUpdateFlag) { + this.forceUpdateFlag = forceUpdateFlag; + } + + public void setPomDirPath(String pomDirPath) { + this.pomDirPath = pomDirPath; + } + + public void setMavenPath(String mavenPath) { + this.mavenPath = mavenPath; + } + + public void setDownloadPath(String downloadPath) { + this.downloadPath = downloadPath; + } + + public void setDownloadMdpkgPaths(List downloadMdpkgPaths) { + this.downloadMdpkgPaths = downloadMdpkgPaths; + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java new file mode 100644 index 0000000000000000000000000000000000000000..f8292b7fe612d00bb128ed0cebae01e4c45077b3 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/sync/InstallSingleJarRunnable.java @@ -0,0 +1,45 @@ +/* + * 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.lcm.metadata.core.sync; + +import com.inspur.edp.lcm.metadata.core.manager.PomManager; +import java.io.File; +import java.io.IOException; +import org.apache.maven.model.Model; + +public class InstallSingleJarRunnable extends InstallJarRunnable { + + @Override + public void run() { + for (File file : fileServiceImp.getAllFiles(downloadPath)) { + if (file.getName().contains("SNAPSHOT") && fileServiceImp.getExtension(file).equals(".pom")) { + PomManager pomManager = new PomManager(); + Model model = pomManager.getModel(file.getPath()); + if (model != null) { + String mvnCommand = String.format(" dependency:get -DgroupId=%s -DartifactId=%s -Dversion=%s -Dskip=true -Dtransitive=false -U", model.getGroupId(), model.getArtifactId(), model.getVersion().substring(1)); + mavenUtilsCore.exeMavenCommand(pomDirPath, mavenPath, mvnCommand); + } + } + } + if (fileServiceImp.isDirectoryExist(downloadPath)) { + try { + fileServiceImp.deleteAllFilesUnderDirectory(downloadPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java new file mode 100644 index 0000000000000000000000000000000000000000..8ca93f8f1b75b80b9e36ac8accb4716d533a0519 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/core/thread/ProcessRunnable.java @@ -0,0 +1,36 @@ +/* + * 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.lcm.metadata.core.thread; + +import com.inspur.edp.lcm.metadata.common.util.CommandUtil; + +public class ProcessRunnable implements Runnable { + private String serverPath; + private String command; + + public void setServerPath(String serverPath) { + this.serverPath = serverPath; + } + + public void setCommand(String command) { + this.command = command; + } + + @Override + public void run() { + CommandUtil.newProcess(serverPath, command); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..08c4d45178681960ea8ea5e791e600ed0824d05e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/DeployActionImpl.java @@ -0,0 +1,44 @@ +/* + * 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.lcm.metadata.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.DeploymentContext; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.project.deployer.spi.DeployAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.nio.file.Paths; + +public class DeployActionImpl implements DeployAction { + @Override + public void deploy(DeploymentContext context) { + File publishFile = new File(context.getPublishPath()); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + File[] files = publishFile.listFiles(); + for (File file : files) { + if (file.getName().equals("jstack")) { + String serverRtPath = Paths.get(context.getDebugEnvironment().getServerPath(), "server").toString(); + if (fileService.isDirectoryExist(serverRtPath)) { + fileService.folderCopy(file.getPath(), serverRtPath); + } else { + fileService.folderCopy(file.getPath(), Paths.get(context.getDebugEnvironment().getServerPath(), file.getName()).toString()); + } + } else { + fileService.folderCopy(file.getPath(), Paths.get(context.getDebugEnvironment().getServerPath(), file.getName()).toString()); + } + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..2242bc56d4fc9fcaa9dfd56cb241db75947c14f2 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/ExtractActionImpl.java @@ -0,0 +1,111 @@ +/* + * 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.lcm.metadata.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.spi.ExtractAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; + +public class ExtractActionImpl implements ExtractAction { + @Override + public void extract(ExtractContext context) { + // 提取元数据包 + extractMdpkg(context); + + if (context.getDeployType() != null && !"all".equals(context.getDeployType()) && !context.getDeployType().contains("jar")) { + return; + } + + // 提取java交付物 + extractJavaProduct(context); + } + + private void extractJavaProduct(ExtractContext context) { + + String javaCodePath = Paths.get(context.getProjectPath()).resolve(Utils.getJavaProjectPath()).resolve(Utils.getCodePath()).toString(); + String deployPath = Paths.get(context.getDeployPath()).resolve(Utils.getLibsPath()).toString(); + + MetadataProjectService metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + ProcessMode processMode = metadataProjectService.getProcessMode(context.getProjectPath()); + if (ProcessMode.GENERATION.equals(processMode)) { + copyJar(javaCodePath, "api", deployPath); + copyJar(javaCodePath, "core", deployPath); + } + + copyJar(javaCodePath, "comp", deployPath); + } + + private void copyJar(String javaCodePath, String module, String deployPath) { + FileService fileService = SpringBeanUtils.getBean(FileService.class); + String moduleJarPath = getJarPath(javaCodePath, module); + if (moduleJarPath.isEmpty()) { + return; + } + String destPath = Paths.get(deployPath).resolve(new File(moduleJarPath).getName()).toString(); + fileService.createDirectory(deployPath); + try { + fileService.fileCopy(moduleJarPath, destPath); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private String getJarPath(String javaCodePath, String module) { + String targetPath = Paths.get(javaCodePath).resolve(module).resolve(Utils.getTargetPath()).toString(); + File file = new File(targetPath); + if (file.exists()) { + File[] files = file.listFiles((dir, name) -> name.endsWith(Utils.getJarSuffix())); + if (files.length > 0) { + return files[0].getPath(); + } + } + //todo +// "无" + module + "jar包。" + return ""; + } + + private void extractMdpkg(ExtractContext context) { + String binPath = Paths.get(context.getProjectPath()).resolve(Utils.getMetadataProjPath()).resolve(Utils.getMetadataBinPath()).toString(); + File binFile = new File(binPath); + String sourcePath = ""; + if (binFile.exists()) { + File[] files = binFile.listFiles((dir, name) -> name.endsWith(Utils.getMetadataPackageExtension())); + if (files.length > 0) { + sourcePath = files[0].getPath(); + } + } + if (sourcePath.isEmpty()) { + throw new RuntimeException("元数据包不存在,请先生成元数据包:" + context.getProjectPath()); + } + String targetDir = FileServiceImp.combinePath(context.getDeployPath().replace("publish\\jstack\\apps", "publish\\metadata\\apps").replace("publish/jstack/apps", "publish/metadata/apps"), "metadata"); + String targetPath = FileServiceImp.combinePath(targetDir, new File(sourcePath).getName()); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + fileService.createDirectory(targetDir); + try { + fileService.fileCopy(sourcePath, targetPath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..43203ca41001a0bbd12ebe49c46aefa5f863075e --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/extend/action/MetadataCompileActionImpl.java @@ -0,0 +1,29 @@ +/* + * 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.lcm.metadata.extend.action; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataCompilerContext; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.spi.MetadataCompileAction; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class MetadataCompileActionImpl implements MetadataCompileAction { + @Override + public void metadataCompile(MetadataCompilerContext context) { + PackageGenerateService packageGenerateService = SpringBeanUtils.getBean(PackageGenerateService.class); + packageGenerateService.generatePackage(context.getProjectPath()); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java new file mode 100644 index 0000000000000000000000000000000000000000..385b2f842b6483b14fae123afa0f4813c9fe5691 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MavenUtilsImp.java @@ -0,0 +1,43 @@ +/* + * 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.lcm.metadata.ref; + +import com.inspur.edp.lcm.metadata.api.service.MavenUtilsService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; + +/** + * Classname MavenUtils Description mvn操作工具类 Date 2019/12/9 9:49 + * + * @author zhongchq + * @version 1.0 + */ +public class MavenUtilsImp implements MavenUtilsService { + + @Override + public boolean exeMavenCommand(String javaCodePath, String goal) { + + String mavenPath = ManagerUtils.getMavenStoragePath(); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + return mavenUtilsCore.exeMavenCommand(javaCodePath, mavenPath, goal); + } + + @Override + public String getLocalRepository() { + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + return mavenUtilsCore.getLocalRepository(); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..3fcd971350715a22a9838b6813a4156f9a33bf94 --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/MdpkgServiceImp.java @@ -0,0 +1,179 @@ +/* + * 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.lcm.metadata.ref; + +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.PackageCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.List; + +/** + * 元数据服务 + */ +public class MdpkgServiceImp implements MdpkgService { + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private PackageCoreService packageCoreService = new PackageCoreService(); + + /** + * @param path 路径 + * @param modules 模块 + */ + @Override + public void compile(String path, String modules) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.compile(absolutePath, modules, mavenPath); + } + + @Override + public void compileAll(String path) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.compile(absolutePath, "all", mavenPath); + } + + @Override + public void restore(String path, Boolean force) { + if (Utils.isNullOrEmpty(path)) { + throw new IllegalArgumentException("工程路径不能为空"); + } + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.restore(absolutePath, force, mavenPath, packagePath); + } + + @Override + public void addDepedencyAndRestore(String path, List metadataPackages) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.addDependencyAndRestore(absolutePath, metadataPackages, mavenPath, packagePath); + } + + @Override + public void deployReleaseMdVersion(String path, String version, String repoId, boolean revert, + String dependenciesVersion) throws IOException { + Utils.checkEmpty(path, "工程路径不能为空"); + Utils.checkEmpty(path, "version不能为空"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = getMetadataProjectService().getProjPath(absolutePath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + final ProcessMode processMode = getMetadataProjectService().getProcessMode(projPath); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(projPath, repoId, version, dependenciesVersion, mavenPath); + break; + default: + packageCoreService.deployReleaseMdVersion(projPath, version, repoId, revert, dependenciesVersion, mavenPath); + } + } + + @Override + public void deploySnapshotMdVersion(String path, String repoId, String version, boolean revert) { + Utils.checkEmpty(path, "工程路径不能为空"); + Utils.checkEmpty(path, "version不能为空"); + String absolutePath = ManagerUtils.getAbsolutePath(path); + String projPath = getMetadataProjectService().getProjPath(absolutePath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + + final ProcessMode processMode = getMetadataProjectService().getProcessMode(projPath); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(projPath, repoId, version, null, mavenPath); + break; + default: + packageCoreService.deploySnapshotMdVersion(projPath, repoId, version, revert, mavenPath); + } + } + + @Override + public void installMdpkg(String groupId, String artifactId, String version, String proPath, + Boolean forceUpdateFlag) throws IOException { + // 创建pom文件,对应的mdproj添加依赖信息 + String absolutePath = ManagerUtils.getAbsolutePath(proPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + String packagePath = ManagerUtils.getMetadataPackageLocation(); + packageCoreService.installMdpkg(groupId, artifactId, version, absolutePath, forceUpdateFlag, mavenPath, packagePath); + } + + @Override + public void uninstallMdpkg(String projPath, String packName) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.uninstallMdpkg(absolutePath, packName, mavenPath); + } + + @Override + public void addProjectDependency(String pompAth, String groupId, String artifactId, String version) { + packageCoreService.addProjectDependency(pompAth, groupId, artifactId, version); + } + + @Override + public void deployMdpkg(String proPath, String repoId, String dependencyVersion) { + proPath = getMetadataProjectService().getProjPath(proPath); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.deployMdpkg(proPath, repoId, dependencyVersion, mavenPath); + } + + @Override + public MetadataRepo getRepoList() { + return packageCoreService.getHostedRepoList(); + } + + @Override + public String getMavenPackageLatestVersion(String groupId, String artifactId) { + return packageCoreService.getMavenPackageLatestVersion(groupId, artifactId); + } + + @Override + public MavenPackageRefs getGAByMdpkgName(String mdpkgName) { + return packageCoreService.getGAByMdpkgName(mdpkgName); + } + + @Override + public MavenComponents getVersionsOfSinglePackage(String sourceId, String packName) { + MetadataRepo metadataRepo = getRepoList(); + return metadataRepo.getRepoList().stream().filter(repo -> repo.getId().equals(sourceId)) + .findFirst() + .map(repo -> packageCoreService.getVersionsOfSinglePackage(repo.getSourceUrl(), packName)) + .orElse(null); + } + + @Override + public void batchOperate(String path, List operations) { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + packageCoreService.batchOperation(absolutePath, mavenPath, operations); + } +} diff --git a/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..483b80e3199840094196272ef0e24ae3b193393b --- /dev/null +++ b/model/framework/devtime-core/src/main/java/com/inspur/edp/lcm/metadata/ref/config/RefConfiguration.java @@ -0,0 +1,44 @@ +/* + * 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.lcm.metadata.ref.config; + +import com.inspur.edp.lcm.metadata.api.service.MavenUtilsService; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.ref.MavenUtilsImp; +import com.inspur.edp.lcm.metadata.ref.MdpkgServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RefConfiguration Description ref配置类 Date 2019/11/28 10:34 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class RefConfiguration { + @Bean + public MdpkgService createMdpkgService() { + return new MdpkgServiceImp(); + } + + @Bean + public MavenUtilsService createMavenUtilsService() { + return new MavenUtilsImp(); + } +} diff --git a/model/framework/devtime-webapi/pom.xml b/model/framework/devtime-webapi/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..23d8ae28b8c0f45c80d1bd8754b25ea788f0e1d3 --- /dev/null +++ b/model/framework/devtime-webapi/pom.xml @@ -0,0 +1,59 @@ + + + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-devtime-webapi ${project.version} + ubml-model-framework-devtime-webappi + + + + io.iec.edp + caf-boot-starter-rest-server + + + lombok + org.projectlombok + + + + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + lcm-metadata-api + com.inspur.edp + + + + + + + 8 + 8 + + \ No newline at end of file diff --git a/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..823bffcd139d848d659a52e24711a4bc59b3a638 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/FileSystemWebApi.java @@ -0,0 +1,42 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.file.system.FileSystemServiceImp; +import com.inspur.edp.lcm.metadata.api.service.FileSystemService; +import java.io.IOException; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +/** + * @author zhaoleitr + */ +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class FileSystemWebApi { + + FileSystemService fileSystemService = new FileSystemServiceImp(); + + @GET + public void showInExplorer(@QueryParam(value = "path") String path) throws IOException { + fileSystemService.showInExplorer(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..356503b31be7793e2f59ac4fc85a5e973d64fcae --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/GspProjectServiceWebApi.java @@ -0,0 +1,78 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.ConfigData.gspproject.ProjectConfiguration; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.service.GspProjectService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +public class GspProjectServiceWebApi { + private GspProjectService gspProjectService; + + private GspProjectService getGspProjectService() { + if (gspProjectService == null) { + gspProjectService = SpringBeanUtils.getBean(GspProjectService.class); + } + return gspProjectService; + } + + /** + * 获取工程信息(GSPProject.json的信息) + * + * @param path 工程路径 + * @return 工程路径 + * @throws IOException + */ + @GET + public GspProject getGspProjectInfo(@QueryParam(value = "path") String path) throws IOException { + return getGspProjectService().getGspProjectInfo(path); + } + + /** + * 获取工程类型 + * + * @return + */ + @GET + @Path("/type") + public List getGspProjectTypeInfo() { + return getGspProjectService().getGspProjectTypeInfo(); + } + + /** + * 更新工程基础技术栈 + * + * @param path 工程路径 + * @param codeLanguage 技术栈 + * @Description 暂时不用 + */ + @PUT + public void updateGspProject(@QueryParam(value = "path") String path, + @QueryParam(value = "codeLanguage") String codeLanguage) { + return; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..29480f54d198f44bd670a49e5065037d588e8a1d --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MdServiceWebApi.java @@ -0,0 +1,378 @@ +/* + * 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 webapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.Page; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +public class MdServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private RefCommonService refCommonService; + + private RefCommonService getRefCommonService() { + if (refCommonService == null) { + refCommonService = SpringBeanUtils.getBean(RefCommonService.class); + } + return refCommonService; + } + + PackageGenerateService packService; + + private PackageGenerateService getPackService() { + if (packService == null) { + packService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return packService; + } + + /** + * @param spacePath 元数据路径 + * @param metadataTypeList 元数据类型 + * @return java.util.List + * @author zhongchq + **/ + @GET + public List getMetadataList(@QueryParam(value = "path") String spacePath, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataList(spacePath, handleMetadataTypeList(metadataTypeList)); + + String projPath = getMetadataProjectService().getProjPath(spacePath); + ProcessMode processMode = ProcessMode.GENERATION; + if (projPath != null && !projPath.isEmpty()) { + processMode = getMetadataProjectService().getProcessMode(projPath); + } + List metadataDtos = asMdDtos(result, processMode); + metadataDtos.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return metadataDtos; + } + + /** + * 根据当前工程路径获取bo下的元数据列表(会根据processMode过滤) + * + * @param path + * @param metadataTypeList + * @return List + */ + @GET + @Path(value = "/metadataListInBo") + public List getMetadataListInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataListInBo(path, handleMetadataTypeList(metadataTypeList)); + result.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return result; + } + + /*** + * @author zhongchq + * @param metadataPath + * 元数据所在路径信息,当前工程下的某个路径,相对路径 + * @param metadataID + *元数据唯一标识 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataDto + **/ + @GET + @Path(value = "/relied") + public MetadataDto getRefMetadata(@QueryParam(value = "metadataPath") String metadataPath, + @QueryParam(value = "metadataID") String metadataID) { + Utils.setMetadataPath(metadataPath); + return MetadataDtoConverter.asDto(getRefCommonService().getRefMetadata(metadataID)); + } + + /** + * 获取各元数据配置的元数据类型信息及后缀信息 + * + * @return java.util.List + * @author zhongchq + **/ + @GET + @Path(value = "/typeList") + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + /** + * @param projectPath 获取工程信息 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataProject + * @author zhongchq + **/ + @GET + @Path(value = "/projectInfo") + public MetadataProject getMetadataProjInfo(@QueryParam(value = "projectPath") String projectPath) { + if (projectPath == null || projectPath.isEmpty()) { + throw new IllegalArgumentException("projectPath参数不能为空"); + } + return getMetadataService().getMetadataProjInfo(projectPath); + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param text 查询内容 + * @param path 相对于开发根路径的路径信息 + * @param metadataTypeList 可以传递想要获取的元数据类型,类型用逗号隔开,如metadataTypeList=.be,.cmp,.api 该参数可以不赋值,默认获取所有类型 + * @param conflictAvoid 冲突避免 + * @param selectedPackageSource 包源 + * @param page 是否分页 + * @param pageSize 每页大小 + * @param pageIndex 第几页 + * @return com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto + * @author zhongchq + **/ + @GET + @Path(value = "/mdlist") + public MetadataIndexDto getMetadataIndexList(@QueryParam(value = "scopeType") int scopeType, + @DefaultValue("") @QueryParam(value = "text") String text, + @QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList, + @DefaultValue("") @QueryParam(value = "selectedPackageSource") String selectedPackageSource, + @DefaultValue("true") @QueryParam(value = "page") boolean page, + @DefaultValue("10") @QueryParam(value = "pageSize") int pageSize, + @DefaultValue("0") @QueryParam(value = "pageIndex") int pageIndex, + @DefaultValue("false") @QueryParam(value = "conflictAvoid") boolean conflictAvoid) { + if (metadataTypeList != null) { + metadataTypeList = metadataTypeList.toLowerCase(); + } + MetadataIndexDto dto = new MetadataIndexDto(); + List list; + switch (scopeType) { + // 离线 + case 1: + list = getLocalMetadataList(text, path, metadataTypeList, page, pageSize, pageIndex); + break; + // 远程 + case 2: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, false, conflictAvoid); + break; + // 引用 + case 3: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, true, conflictAvoid); + break; + default: + throw new IllegalArgumentException("Param scope is invalid."); + } + if (list.size() > 0) { + dto.setMetadataIndexItems(list); + Page page1 = new Page(); + page1.setPageIndex(pageIndex); + page1.setPageSize(list.size()); + dto.setPage(page1); + } else { + Page page2 = new Page(); + page2.setPageIndex(pageIndex); + page2.setPageSize(0); + dto.setPage(page2); + } + return dto; + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param currentPath 当前路径 + * @param metadataIndexDto MetadataIndexItemDto实体 + * @param isNeedMdDto 是否需要??? + * @return com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto + * @author zhongchq + **/ + @POST + @Path(value = "pickmd") + public Metadata4RefDto pickMetadataIndex(@QueryParam(value = "scopeType") int scopeType, + @QueryParam(value = "currentPath") String currentPath, + MetadataIndexItemDto metadataIndexDto, + @DefaultValue("true") @QueryParam(value = "isNeedMdDto") boolean isNeedMdDto) { + return getMetadataService().pickMetadataIndex(scopeType, currentPath, metadataIndexDto, isNeedMdDto); + } + + @GET + @Path(value = "/metadata") + public MetadataDto loadMetadataByMetadataId(String metadataId, String path) { + final GspMetadata metadata = getMetadataService().loadMetadataByMetadataId(metadataId, path); + Utils.checkNPE(metadata, "工程" + path + "中找不到元数据:" + metadataId); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path(value = "/indexServerStatus") + public String getIndexServerStatus(@QueryParam(value = "ip") String ip, @QueryParam(value = "port") String port) { + return getMetadataService().getIndexServerStatus(ip, port); + } + + @GET + @Path(value = "/extendrule") + public String getMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + IMdExtRuleContent extendRule = getMetadataService().getMdExtRule(metadataId, path); + String result = null; + if (extendRule == null) { + return null; + } + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode extRuleNode = mdExtRulemanager.serialize(extendRule); + ObjectMapper objectMapper = Utils.getMapper(); + try { + result = objectMapper.writeValueAsString(extRuleNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + return result; + } + + @PUT + @Path(value = "/extendrule") + public void saveMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path, String extendRuleStr) { + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + IMdExtRuleContent extendRule = null; + if (mdExtRulemanager != null) { + ObjectMapper objectMapper = Utils.getMapper(); + try { + JsonNode extRuleNode = objectMapper.readTree(extendRuleStr); + extendRule = mdExtRulemanager.deSerialize(extRuleNode); + } catch (IOException e) { + e.printStackTrace(); + } + } + getMetadataService().saveMdExtRule(metadataId, path, extendRule); + } + + @GET + @Path(value = "/processMode") + public String getProcessMode(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProcessMode(path).toString(); + } + + @GET + @Path(value = "/projinpath") + public List getProjPathsInPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProjPathsInPath(path); + } + + @GET + @Path(value = "/isMetadataRefed") + public boolean isMetadataRefed(@QueryParam(value = "path") String path) { + return getMetadataService().isMetadataRefed(path); + } + + @GET + @Path(value = "/mdpkgNameExist") + public String getMdpkgNameExistInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "mdpkgName") String mdpkgName) { + return getMetadataProjectService().getMdpkgNameExistInBo(path, mdpkgName); + } + + @POST + @Path(value = "/changeProcessMode") + public void changeProcessMode(@QueryParam(value = "path") String path, + @QueryParam(value = "processMode") String processMode) { + getMetadataProjectService().changeProcessMode(path, ProcessMode.valueOf(processMode)); + } + + private List getRemoteMetadataIndexList(String text, String path, + String selectedPackageSource, + String metadataTypeList, boolean page, int pageSize, + int pageIndex, boolean isFilterByRefs, boolean conflictAvoidFlag) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getRemoteMetadataIndexList(text, path, selectedPackageSource, typeList, page, + pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + private List getLocalMetadataList(String text, String path, String metadataTypeList, + boolean page, int pageSize, int pageIndex) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getLocalMetadataList(text, path, typeList, page, pageSize, pageIndex); + } + + private List asMdDtos(List mds, ProcessMode processMode) { + if (mds == null) { + return null; + } + List list = new ArrayList<>(); + mds.forEach(md -> { + MetadataDto metadataDto = MetadataDtoConverter.asDto(md); + metadataDto.setProcessMode(processMode.toString()); + list.add(metadataDto); + }); + return list; + } + + private List handleMetadataTypeList(String metadataTypes) { + List typeList = null; + if (!(metadataTypes == null || metadataTypes.isEmpty())) { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + return typeList; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..2072d1ae5ccadb7f16aeb0668e741a9cb0758bbe --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataConfigServiceWebApi.java @@ -0,0 +1,62 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataConfigServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 获取各元数据配置的元数据类型信息及后缀信息 + * + * @return + */ + @GET + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + /** + * 更新元数据缓存路径 + * + * @param path 工程路径 + */ + @PUT + public void setMetadataUri(@QueryParam(value = "path") String path) { + getMetadataService().setMetadataUri(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..44f1fa2a673b8c6d3c167bac02c54badb3f4a0e6 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataPackageServiceWebApi.java @@ -0,0 +1,77 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageDto; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.util.List; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; + +public class MetadataPackageServiceWebApi { + PackageGenerateService metadataPackageService; + + private PackageGenerateService getMetadataPackageService() { + if (metadataPackageService == null) { + metadataPackageService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return metadataPackageService; + } + + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 生成元数据包 + * + * @param metadataPackageDto 实体中的ProjectPath必填,其他值不需要 + */ + @POST + public void generatePackage(MetadataPackageDto metadataPackageDto) { + getMetadataPackageService().generatePackage(metadataPackageDto.getProjectPath()); + } + + /** + * 获取元数据包的基本信息 + * + * @param packagePath 元数据包路径+元数据包名称,要带后缀.mdpkg,需要Encode,这里暂时定的是全路径,因为元数据包也是固定存放在开发服务器一个目录下,但是不是开发根路径 + * @return + */ + @GET + @Path("/packagePath") + public MetadataPackage getMetadataPackageInfo(@QueryParam(value = "packagePath") String packagePath) { + File file = new File(packagePath); + return getMetadataService().getMetadataPackageInfo(file.getName(), file.getParent()); + } + + @GET + @Path("local") + public List getLocalPackages(@QueryParam(value = "path") String path) { + return getMetadataPackageService().getLocalPackages(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..17cac9d91244f2cd9a204242ab61d58049761c71 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataProjectServiceWebApi.java @@ -0,0 +1,192 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageVersion; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProjectDto; +import com.inspur.edp.lcm.metadata.api.entity.bo.BOInfo; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataProjectServiceWebApi { + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + /** + * 获取元数据工程信息 + * + * @param path 元数据工程所在的路径或者下级路径 + * @return + */ + @GET + public MetadataProject getMetadataProjInfo(@QueryParam(value = "path") String path) { + MetadataProject metadataProjInfo = getMetadataProjectService().getMetadataProjInfo(path); + metadataProjInfo.setProjectPath(ManagerUtils.getRalativePath(metadataProjInfo.getProjectPath())); + return metadataProjInfo; + } + + @GET + @Path("bo") + public List getBOInfo(@QueryParam("boids") String boids) { + String[] boidArray = boids.split(","); + return getMetadataProjectService().getBOInfo(boidArray); + } + + /** + * 根据工程或者下级路径,获取工程路径 + * + * @param path 工程或者下级路径 + * @return + */ + @GET + @Path("/path") + public String getProjPath(@QueryParam(value = "path") String path) { + String projPath = getMetadataProjectService().getProjPath(path); + String ralativePath = ManagerUtils.getRalativePath(projPath); + return ralativePath; + } + + /** + * 元数据工程更新引用信息 + * + * @param metadataProjectDto 需要传递ProjectPath、DepPackageName、DepPackageVersion、DepPackageLocation等信息 + */ + @PUT + public void updateReference(MetadataProjectDto metadataProjectDto) { + MetadataPackageHeader metadataPackageHeader = new MetadataPackageHeader(); + metadataPackageHeader.setName(metadataProjectDto.getDepPackageName()); + metadataPackageHeader.setVersion(new MetadataPackageVersion(metadataProjectDto.getDepPackageVersion())); + metadataPackageHeader.setLocation(metadataProjectDto.getDepPackageLocation()); + getMetadataProjectService().updateRefs(metadataProjectDto.getProjectPath(), metadataPackageHeader); + } + + /** + * 元数据工程文件是否存在,用在前端判断是否可以执行打包操作 + * + * @param path 路径信息,相对路径 + * @return + */ + @GET + @Path("/validationrecursively") + public boolean isExistProjFileRecursively(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isExistProjFileRecursively(path); + } + + /** + * 获取bo路径 + * + * @param path 工程路径 + * @return + */ + @GET + @Path("/bopath") + public String getBoPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getBoPath(path); + } + + /** + * 获取是否解析型 + * + * @param path 工程路径 + * @return + */ + @GET + @Path("/isInterpretation") + public boolean isInterpretation(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isInterpretation(path); + } + + /** + * 当前目录是否存在,已废弃,使用getProjPath代替 + * + * @param path + * @return + */ + @Deprecated + @GET + @Path("/validation") + public boolean isExistProjectFile(@QueryParam(value = "path") String path) { + return getMetadataProjectService().isExistProjFile(path); + } + + /** + * 获取技术栈,已废弃,仅保留java技术栈 + * + * @param path 工程路径 + * @return + */ + @Deprecated + @GET + @Path("/codelanguage") + public String getCodeLanguage(@QueryParam(value = "path") String path) { + return "java"; + } + + /** + * 是否使用maven,都使用maven,所以废弃 + * + * @param path 工程路径 + * @return + */ + @Deprecated + @GET + @Path("/isMaven") + public boolean getMavenStatus(@QueryParam(value = "path") String path) { + return true; + } + + /** + * 更新元数据缓存路径 + * + * @param path 工程路径 + */ + @Deprecated + @PUT + @Path("/metadataPath") + public void setMetadataPath(@QueryParam(value = "path") String path) { + getMetadataService().setMetadataUri(path); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..a6ef4840b24f4fd7f66bfeb325a424ca7577c6c0 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/MetadataServiceWebApi.java @@ -0,0 +1,508 @@ +/* + * 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 webapi; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.IMdExtRuleContent; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataIndexItemDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataType; +import com.inspur.edp.lcm.metadata.api.entity.Page; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.api.service.MetadataService; +import com.inspur.edp.lcm.metadata.api.service.PackageGenerateService; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.MdExtRuleSerializerHelper; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class MetadataServiceWebApi { + private MetadataService metadataService; + + private MetadataService getMetadataService() { + if (metadataService == null) { + metadataService = SpringBeanUtils.getBean(MetadataService.class); + } + return metadataService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + PackageGenerateService packService; + + private PackageGenerateService getPackService() { + if (packService == null) { + packService = SpringBeanUtils.getBean(PackageGenerateService.class); + } + return packService; + } + +/******************************************************************************************/ + + /** + * 用于新建元数据之前初始化元数据实体 + * + * @param nameSpace 元数据命名空间 + * @param code 元数据编号 + * @param name 元数据名称 + * @param type 元数据类型 + * @param bizObjectID 业务对象主键 + * @param metadataPath 元数据创建路径,相对于开发根路径的路径信息 + * @param extendProperty 扩展属性,默认为空,可以不赋值 + * @return + */ + @GET + @Path("initialized") + public MetadataDto initializeMetadataEntity(@QueryParam(value = "nameSpace") String nameSpace, + @QueryParam(value = "code") String code, + @QueryParam(value = "name") String name, + @QueryParam(value = "type") String type, + @QueryParam(value = "bizObjectID") String bizObjectID, + @QueryParam(value = "metadataPath") String metadataPath, + @DefaultValue("") @QueryParam(value = "extendProperty") String extendProperty) { + GspMetadata metadata = new GspMetadata(); + metadata.setHeader(new MetadataHeader()); + metadata.getHeader().setName(name); + metadata.getHeader().setCode(code); + metadata.getHeader().setNameSpace(nameSpace); + metadata.getHeader().setType(type); + metadata.getHeader().setBizObjectId(bizObjectID); + metadata.setRelativePath(metadataPath); + metadata.setExtendProperty(extendProperty); + getMetadataService().initializeMetadataEntity(metadata); + return MetadataDtoConverter.asDto(metadata); + } + + /** + * 新建元数据,元数据设计器打开之前文件被创建 + * + * @param metadataDto 新建元数据需要的参数,新建元数据之前需要调用初始化元数据实体,因此该参数即为InitializeMetadataEntity返回的实体 + */ + @POST + public void createMetadata(MetadataDto metadataDto) { + String path = metadataDto.relativePath; + getMetadataService().createMetadata(path, MetadataDtoConverter.asMetadata(metadataDto)); + } + + @DELETE + @Path("/delete") + public void deleteUri(@QueryParam(value = "fullPath") String fullPath) { + fullPath = ManagerUtils.getAbsolutePath(fullPath); + File file = new File(fullPath); + if (file.isDirectory()) { + getMetadataService().deleteFolder(fullPath); + } else { + getMetadataService().deleteMetadata(file.getParent(), file.getName()); + } + } + + @PUT + public void saveMetadata(MetadataDto metadataDto) { + final GspMetadata metadata = MetadataDtoConverter.asMetadata(metadataDto); + String fullPath = metadataDto.getRelativePath() + File.separator + metadataDto.getFileName(); + getMetadataService().saveMetadata(metadata, fullPath); + } + + @GET + @Path("/load") + public MetadataDto loadMetadata(@QueryParam(value = "metadataFullPath") String metadataFullPath) { + File file = new File(metadataFullPath); + GspMetadata metadata = getMetadataService().loadMetadata(file.getName(), file.getParent()); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path("/metadataInBo") + public MetadataDto loadMetadata(@QueryParam(value = "metadataFullPath") String metadataFullPath, + @QueryParam(value = "currentProjPath") String currentProjPath) { + GspMetadata metadata = getMetadataService().loadMetadataInBo(metadataFullPath, currentProjPath); + return MetadataDtoConverter.asDto(metadata); + } + + /** + * @param spacePath 元数据路径 + * @param metadataTypeList 元数据类型 + * @return java.util.List + * @author zhongchq + **/ + @GET + public List getMetadataList(@QueryParam(value = "path") String spacePath, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataList(spacePath, handleMetadataTypeList(metadataTypeList)); + + String projPath = getMetadataProjectService().getProjPath(spacePath); + ProcessMode processMode = ProcessMode.GENERATION; + if (projPath != null && !projPath.isEmpty()) { + processMode = getMetadataProjectService().getProcessMode(projPath); + } + List metadataDtos = asMdDtos(result, processMode); + metadataDtos.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return metadataDtos; + } + + /** + * 根据当前工程路径获取bo下的元数据列表(会根据processMode过滤) + * + * @param path + * @param metadataTypeList + * @return List + */ + @GET + @Path(value = "/metadataListInBo") + public List getMetadataListInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList) { + List result = getMetadataService().getMetadataListInBo(path, handleMetadataTypeList(metadataTypeList)); + result.forEach(dto -> dto.setRelativePath(ManagerUtils.getRalativePath(dto.getRelativePath()))); + return result; + } + + /** + * 根据过滤条件获取元数据列表,如构件可细分为多种子构件,可根据filter精确过滤具体类型的元数据 + * + * @param path 工程路径 + * @param typeCode 需要精确获取元数据类型的元数据编号 + * @param filter 过滤条件 + * @param postfix 要获取的元数据后缀,不传则默认获取工程下所有的元数据 + * @return + */ + @GET + @Path(value = "/filter") + public List getMetadataByFilter(@QueryParam(value = "path") String path, + @QueryParam(value = "typeCode") String typeCode, @QueryParam(value = "filter") String filter, + @QueryParam(value = "postfix") String postfix) { + MetadataFilter metadataFilter = new MetadataFilter(); + metadataFilter.setFilter(filter); + metadataFilter.setTypeCode(typeCode); + metadataFilter.setMetadataPostfix(postfix); + List metadataByFilter = getMetadataService().getMetadataByFilter(path, metadataFilter); + List dtoList = new ArrayList<>(); + if (metadataByFilter != null) { + metadataByFilter.forEach(metadata -> { + dtoList.add(MetadataDtoConverter.asDto(metadata)); + }); + } + return dtoList; + } + + /*** + * @author zhongchq + * @param metadataPath + * 元数据所在路径信息,当前工程下的某个路径,相对路径 + * @param metadataID + *元数据唯一标识 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataDto + **/ + @GET + @Path(value = "/relied") + public MetadataDto getRefMetadata(@QueryParam(value = "metadataPath") String metadataPath, + @QueryParam(value = "metadataID") String metadataID) { + return MetadataDtoConverter.asDto(getMetadataService().getRefMetadata(metadataPath, metadataID)); + } + + /** + * 判断元数据新建的路径下是否有相同名称的文件存在 + * + * @param path 元数据新建的路径 + * @param fileName 元数据文件名 + * @return + */ + @GET + @Path("/validation") + public boolean validateRepeatName(@QueryParam(value = "path") String path, + @QueryParam(value = "fileName") String fileName) { + boolean canCreateFlag = getMetadataService().validateRepeatName(path, fileName); + return canCreateFlag; + } + + /*** + * 获取各元数据配置的元数据类型信息及后缀信息 + * @author zhongchq + * @return java.util.List + **/ + @GET + @Path(value = "/typeList") + public List getMetadataTypeList() { + return getMetadataService().getMetadataTypeList(); + } + + @POST + @Path(value = "/packages") + public void GeneratePackage(@QueryParam(value = "projPath") String projPath) { + getPackService().generatePackage(projPath); + } + + /*** + * @author zhongchq + * @param projectPath + * 获取工程信息 + * @return com.inspur.edp.lcm.metadata.api.entity.MetadataProject + **/ + @GET + @Path(value = "/projectInfo") + public MetadataProject getMetadataProjInfo(@QueryParam(value = "projectPath") String projectPath) { + if (projectPath == null || projectPath.isEmpty()) { + throw new IllegalArgumentException("projectPath参数不能为空"); + } + return getMetadataService().getMetadataProjInfo(projectPath); + } + + /*** + * @author zhongchq + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param text 查询内容 + * @param path 相对于开发根路径的路径信息 + * @param metadataTypeList 可以传递想要获取的元数据类型,类型用逗号隔开,如metadataTypeList=.be,.cmp,.api 该参数可以不赋值,默认获取所有类型 + * @param conflictAvoid 冲突避免 + * @param selectedPackageSource 包源 + * @param page 是否分页 + * @param pageSize 每页大小 + * @param pageIndex 第几页 + * @return com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexDto + **/ + @GET + @Path(value = "/mdlist") + public MetadataIndexDto getMetadataIndexList(@QueryParam(value = "scopeType") int scopeType, + @DefaultValue("") @QueryParam(value = "text") String text, + @QueryParam(value = "path") String path, + @QueryParam(value = "metadataTypeList") String metadataTypeList, + @DefaultValue("") @QueryParam(value = "selectedPackageSource") String selectedPackageSource, + @DefaultValue("true") @QueryParam(value = "page") boolean page, + @DefaultValue("10") @QueryParam(value = "pageSize") int pageSize, + @DefaultValue("0") @QueryParam(value = "pageIndex") int pageIndex, + @DefaultValue("false") @QueryParam(value = "conflictAvoid") boolean conflictAvoid) { + if (metadataTypeList != null) { + metadataTypeList = metadataTypeList.toLowerCase(); + } + MetadataIndexDto dto = new MetadataIndexDto(); + List list; + switch (scopeType) { + // 离线 + case 1: + list = getLocalMetadataList(text, path, metadataTypeList, page, pageSize, pageIndex); + break; + // 远程 + case 2: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, false, conflictAvoid); + break; + // 引用 + case 3: + list = getRemoteMetadataIndexList(text, path, selectedPackageSource, metadataTypeList, page, pageSize, pageIndex, true, conflictAvoid); + break; + default: + throw new IllegalArgumentException("Param scope is invalid."); + } + if (list.size() > 0) { + dto.setMetadataIndexItems(list); + Page page1 = new Page(); + page1.setPageIndex(pageIndex); + page1.setPageSize(list.size()); + dto.setPage(page1); + } else { + Page page2 = new Page(); + page2.setPageIndex(pageIndex); + page2.setPageSize(0); + dto.setPage(page2); + } + return dto; + } + + /** + * @param scopeType 查找范围0.默认 1.本地 2.已安装 3.已引用 4.仓库中 + * @param currentPath 当前路径 + * @param metadataIndexDto MetadataIndexItemDto实体 + * @param isNeedMdDto 是否需要??? + * @return com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto + * @author zhongchq + **/ + @POST + @Path(value = "pickmd") + public Metadata4RefDto pickMetadataIndex(@QueryParam(value = "scopeType") int scopeType, + @QueryParam(value = "currentPath") String currentPath, + MetadataIndexItemDto metadataIndexDto, + @DefaultValue("true") @QueryParam(value = "isNeedMdDto") boolean isNeedMdDto) { + return getMetadataService().pickMetadataIndex(scopeType, currentPath, metadataIndexDto, isNeedMdDto); + } + + @GET + @Path(value = "/metadata") + public MetadataDto loadMetadataByMetadataId(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + final GspMetadata metadata = getMetadataService().loadMetadataByMetadataId(metadataId, path); + Utils.checkNPE(metadata, "工程" + path + "中找不到元数据:" + metadataId); + return MetadataDtoConverter.asDto(metadata); + } + + @GET + @Path(value = "/indexServerStatus") + public String getIndexServerStatus(@QueryParam(value = "ip") String ip, @QueryParam(value = "port") String port) { + return getMetadataService().getIndexServerStatus(ip, port); + } + + @GET + @Path(value = "/extendrule") + public String getMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path) { + IMdExtRuleContent extendRule = getMetadataService().getMdExtRule(metadataId, path); + String result = null; + if (extendRule == null) { + return null; + } + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + if (mdExtRulemanager != null) { + JsonNode extRuleNode = mdExtRulemanager.serialize(extendRule); + ObjectMapper objectMapper = Utils.getMapper(); + try { + result = objectMapper.writeValueAsString(extRuleNode); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + return result; + } + + @PUT + @Path(value = "/extendrule") + public void saveMdExtRule(@QueryParam(value = "metadataId") String metadataId, + @QueryParam(value = "path") String path, String extendRuleStr) { + List metadataList = getMetadataService().getMetadataList(path); + Optional optMetadata = metadataList.stream().filter(item -> item.getHeader().getId() == metadataId).findAny(); + if (!optMetadata.isPresent()) { + throw new RuntimeException("不存在ID为" + metadataId + ",路径为" + path + "的元数据"); + } + MdExtendRuleSerializer mdExtRulemanager = MdExtRuleSerializerHelper.getInstance().getManager(optMetadata.get().getHeader().getType()); + IMdExtRuleContent extendRule = null; + if (mdExtRulemanager != null) { + ObjectMapper objectMapper = Utils.getMapper(); + try { + JsonNode extRuleNode = objectMapper.readTree(extendRuleStr); + extendRule = mdExtRulemanager.deSerialize(extRuleNode); + } catch (IOException e) { + e.printStackTrace(); + } + } + getMetadataService().saveMdExtRule(metadataId, path, extendRule); + } + + @GET + @Path(value = "/processMode") + public String getProcessMode(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProcessMode(path).toString(); + } + + @GET + @Path(value = "/mavensetting") + public boolean getMavenSetting() { + return true; + } + + @GET + @Path(value = "/projinpath") + public List getProjPathsInPath(@QueryParam(value = "path") String path) { + return getMetadataProjectService().getProjPathsInPath(path); + } + + @GET + @Path(value = "/isMetadataRefed") + public boolean isMetadataRefed(@QueryParam(value = "path") String path) { + return getMetadataService().isMetadataRefed(path); + } + + @GET + @Path(value = "/mdpkgNameExist") + public String getMdpkgNameExistInBo(@QueryParam(value = "path") String path, + @QueryParam(value = "mdpkgName") String mdpkgName) { + return getMetadataProjectService().getMdpkgNameExistInBo(path, mdpkgName); + } + + private List getRemoteMetadataIndexList(String text, String path, + String selectedPackageSource, + String metadataTypeList, boolean page, int pageSize, + int pageIndex, boolean isFilterByRefs, boolean conflictAvoidFlag) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getRemoteMetadataIndexList(text, path, selectedPackageSource, typeList, page, + pageSize, pageIndex, isFilterByRefs, conflictAvoidFlag); + } + + private List getLocalMetadataList(String text, String path, String metadataTypeList, + boolean page, int pageSize, int pageIndex) { + List typeList = handleMetadataTypeList(metadataTypeList); + return getMetadataService().getLocalMetadataList(text, path, typeList, page, pageSize, pageIndex); + } + + private List asMdDtos(List mds, ProcessMode processMode) { + if (mds == null) { + return null; + } + List list = new ArrayList<>(); + mds.forEach(md -> { + MetadataDto metadataDto = MetadataDtoConverter.asDto(md); + metadataDto.setProcessMode(processMode.toString()); + list.add(metadataDto); + }); + return list; + } + + private List handleMetadataTypeList(String metadataTypes) { + List typeList = null; + if (!(metadataTypes == null || metadataTypes.isEmpty())) { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + return typeList; + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..99d0d8e6aec69e3095a35186c45075a7d0765915 --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/ProjectDeployServiceWebApi.java @@ -0,0 +1,54 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.DbConnectionInfo; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.IOException; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class ProjectDeployServiceWebApi { + private ProjectExtendService projectExtendService; + + private ProjectExtendService getProjectExtendService() { + if (projectExtendService == null) { + projectExtendService = SpringBeanUtils.getBean(ProjectExtendService.class); + } + return projectExtendService; + } + + @POST + public void deploy(DbConnectionInfo dbConnectionInfo, @QueryParam("path") String path, + @QueryParam("restart") String restart) { + getProjectExtendService().deploy(dbConnectionInfo, "", path, restart); + } + + @GET + public String getDeployStatus(@QueryParam("sign") String sign) throws IOException { + return getProjectExtendService().getDeployStatus(sign); + } + +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..4c44bfc50081decac3e542ee1c4989863b16c0ab --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/ProjectExtendWebApi.java @@ -0,0 +1,67 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.entity.ExtractContext; +import com.inspur.edp.lcm.metadata.api.service.ProjectExtendService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class ProjectExtendWebApi { + private ProjectExtendService projectExtendService; + + private ProjectExtendService getProjectExtendService() { + if (projectExtendService == null) { + projectExtendService = SpringBeanUtils.getBean(ProjectExtendService.class); + } + return projectExtendService; + } + + /** + * 批量编译当前目录下的所有工程 + * + * @param path 路径 + * @param exts 扩展 + * @param disabledExts 禁用的扩展 + * @return + */ + @POST + public List BatchCompile(@QueryParam("path") String path, @QueryParam("exts") String exts, + @QueryParam("disabledExts") String disabledExts) { + return getProjectExtendService().batchCompile(path, exts, disabledExts); + } + + @PUT + public void batchExtract(@QueryParam("path") String path) { + getProjectExtendService().extract(path); + } + + @PUT + @Path("single") + public void extract(ExtractContext context) { + getProjectExtendService().extract(context.getProjectPath()); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java b/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java new file mode 100644 index 0000000000000000000000000000000000000000..3119f615bd33fc4494d674f225cc4c2679bcbf4d --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/RepoRefWebApi.java @@ -0,0 +1,246 @@ +/* + * 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 webapi; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenComponents; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo; +import com.inspur.edp.lcm.metadata.api.mvnEntity.ModuleDependencies; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +/** + * Description Maven引用设计时接口实现 + * + * @version 1.0 + */ +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public class RepoRefWebApi { + + private MdpkgService mdpkgService; + + private MdpkgService getMdpkgService() { + if (mdpkgService == null) { + mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + } + return mdpkgService; + } + + private FileService fileService; + + private FileService getFileService() { + if (fileService == null) { + fileService = SpringBeanUtils.getBean(FileService.class); + } + return fileService; + } + + private MetadataProjectService metadataProjectService; + + private MetadataProjectService getMetadataProjectService() { + if (metadataProjectService == null) { + metadataProjectService = SpringBeanUtils.getBean(MetadataProjectService.class); + } + return metadataProjectService; + } + + /** + * 部署jar到nexus私服中。 step1:将元数据包打包中jar中。 step2:推送 + * + * @param proPath 元数据工程路径 + * @param proPath 推送的仓库地址 + * @param version 工程的版本号 + * @param revert 版本号是否回退 + * @return void + **/ + @POST + public void deployMdpkg(@QueryParam(value = "proPath") String proPath, + @QueryParam(value = "repoId") String repoId, + @QueryParam(value = "version") String version, + @DefaultValue("false") @QueryParam(value = "revert") boolean revert) throws IOException { + getMdpkgService().deploySnapshotMdVersion(proPath, repoId, version, revert); + } + + /** + * @param path gsp工程路径 + * @param version 工程版本号 + * @param repoId 仓库唯一id + * @param revert 默认为true,即推送完release版,版本号revert回原版本 + */ + @POST + @Path(value = "/release") + public void deployReleaseMdVersion(@QueryParam(value = "path") String path, + @QueryParam(value = "version") String version, + @QueryParam(value = "repoId") String repoId, + @DefaultValue("false") @QueryParam(value = "revert") boolean revert, + @QueryParam(value = "depversion") String dependenciesVersion) throws IOException { + getMdpkgService().deployReleaseMdVersion(path, version, repoId, revert, dependenciesVersion); + } + + /*** + * 获取仓库列表 + * + * @return com.inspur.edp.lcm.metadata.api.mvnEntity.MetadataRepo + **/ + @GET + @Path(value = "/repolist") + public MetadataRepo getRepoList() { + return getMdpkgService().getRepoList(); + } + + /** + * 实现maven install + * + * @param path gsp工程路径 + **/ + @POST + @Path(value = "/compile") + public void compile(@QueryParam(value = "path") String path, @QueryParam(value = "modules") String modules) { + String projPath = getMetadataProjectService().getProjPath(path); + getMdpkgService().compile(projPath, modules); + } + + /** + * @param path + * @param operations + */ + @POST + @Path(value = "/batchOperate") + public void batchOperate(@QueryParam(value = "path") String path, + @QueryParam(value = "operations") String operations) { + List operationList = Arrays.asList(operations.split(",")); + getMdpkgService().batchOperate(path, operationList); + } + + /** + * 实现maven install + * + * @param path gsp工程路径 + */ + @POST + @Path(value = "/compileAll") + public void compileAll(@QueryParam(value = "path") String path) { + String projPath = getMetadataProjectService().getProjPath(path); + getMdpkgService().compileAll(projPath); + } + + /** + * @param path 工程路径 + */ + @POST + @Path(value = "/restore") + public void restore(@QueryParam(value = "path") String path, @QueryParam(value = "force") Boolean force) { + getMdpkgService().restore(path, force); + } + + /** + * 给工程添加依赖并拉取 + * + * @param path 工程路径 + * @param metadataPackages 新添加的依赖的额元数据包 + */ + @PUT + @Path(value = "/adddepedency") + public void addDepedencyAndRestore(@QueryParam(value = "path") String path, + @QueryParam(value = "metadataPackages") String metadataPackages) { + String[] packages = metadataPackages.split(","); + List packageList = new ArrayList<>(Arrays.asList(packages)); + getMdpkgService().addDepedencyAndRestore(path, packageList); + } + + @GET + @Path(value = "/projversion") + public ModuleDependencies getDependenciesVersion(@QueryParam(value = "path") String path) throws IOException { + String absolutePath = ManagerUtils.getAbsolutePath(path); + + if (getFileService().getApiModulePath(absolutePath) == null) { + throw new RuntimeException("代码未生成,请生成java代码"); + } + String apiPath = getFileService().getApiModulePath(absolutePath) + "/pom.xml"; + List list; + try (FileInputStream fis = new FileInputStream(apiPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + list = model.getDependencies(); + ModuleDependencies dependencies = new ModuleDependencies(); + if (model.getVersion() != null) { + dependencies.setProjVersion(model.getVersion()); + } else { + dependencies.setProjVersion(model.getParent().getVersion()); + } + for (Dependency dependency : list) { + if (dependency.getVersion().endsWith("SNAPSHOT")) { + dependencies.setNeedChange(true); + } + } + return dependencies; + } catch (IOException | XmlPullParserException e) { + e.printStackTrace(); + } + return new ModuleDependencies(); + } + + @GET + @Path(value = "/buildorder") + public List getBuildOrder(@QueryParam(value = "projPath") String projPath) { + return getMetadataProjectService().getBuildOrder(projPath); + } + + @GET + @Path(value = "/single") + public MavenComponents getVersionsOfSinglePackage(@QueryParam(value = "sourceId") String sourceId, + @QueryParam(value = "packName") String packName) { + return getMdpkgService().getVersionsOfSinglePackage(sourceId, packName); + } + + @PUT + @Path(value = "/install") + public void installMdpkg(@QueryParam(value = "groupId") String groupId, + @QueryParam(value = "artifactId") String artifactId, @QueryParam(value = "version") String version, + @QueryParam(value = "path") String path) throws IOException { + Boolean forceUpdateFlag = version.contains("-") ? true : false; + getMdpkgService().installMdpkg(groupId, artifactId, version, path, forceUpdateFlag); + } + + @POST + @Path(value = "/uninstall") + public void uninstallMdpkg(@QueryParam(value = "projPath") String projPath, + @QueryParam(value = "packName") String packName) { + getMdpkgService().uninstallMdpkg(projPath, packName); + } +} diff --git a/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java b/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..0a50474431a9647cda70f1071cdead918498571d --- /dev/null +++ b/model/framework/devtime-webapi/src/main/java/webapi/config/WebApiConfiguration.java @@ -0,0 +1,115 @@ +/* + * 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 webapi.config; + +import io.iec.edp.caf.rest.RESTEndpoint; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import webapi.FileSystemWebApi; +import webapi.GspProjectServiceWebApi; +import webapi.MdServiceWebApi; +import webapi.MetadataConfigServiceWebApi; +import webapi.MetadataPackageServiceWebApi; +import webapi.MetadataProjectServiceWebApi; +import webapi.MetadataServiceWebApi; +import webapi.ProjectDeployServiceWebApi; +import webapi.ProjectExtendWebApi; +import webapi.RepoRefWebApi; + +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class WebApiConfiguration { + @Bean + public RESTEndpoint gspFSEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/file-system", + new FileSystemWebApi() + ); + } + + @Bean + public RESTEndpoint gspProjectEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/gsp-projects", + new GspProjectServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/mdservice", + new MdServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspConfigEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-configs", + new MetadataConfigServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdPkgEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-packages", + new MetadataPackageServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMdProjectEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadata-projects", + new MetadataProjectServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspMetadataEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/metadatas", + new MetadataServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspDeployEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/deploy-projects", + new ProjectDeployServiceWebApi() + ); + } + + @Bean + public RESTEndpoint gspExtendEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/extend-projects", + new ProjectExtendWebApi() + ); + } + + @Bean + public RESTEndpoint gspRepoEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/repo-packages", + new RepoRefWebApi() + ); + } +} diff --git a/model/framework/entity/pom.xml b/model/framework/entity/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..d6eae6659e57406461be17e633a52a7dd2a52624 --- /dev/null +++ b/model/framework/entity/pom.xml @@ -0,0 +1,43 @@ + + + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-entity ${project.version} + ubml-model-framework-entity + + + 8 + 8 + + + + + org.openatom.ubml + ubml-model-common-definition + ${project.version} + + + + \ No newline at end of file diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java similarity index 68% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java index 27b7de7bb78a75ca15deb6404cb222854e64c8f6..a1a9db3799af5bb4bdee4f076de2f96d3f9babc0 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/BaseConfig.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/BaseConfig.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData; /** * @Classname BaseConfig @@ -24,14 +24,6 @@ package org.openatom.ubml.model.framework.definition.entity; */ public class BaseConfig { - /** - * @author zhongchq - * @description - * @date 19:04 2019/7/23 - * @param - * @throws - * @return - **/ private String name; private String assembly; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java similarity index 80% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java index 8e88bac652633570f8f25a6803187debf6470e56..48b15b35ff00cfcd7043384187fa8f1e356ccd66 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectCommonConfigData.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCommonConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,8 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData.gspproject; +/** + * 工程类型基础配置信息 + */ public class ProjectCommonConfigData { private String typeCode; private String typeName; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java similarity index 67% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java index ffb3b37ce5948e44735844ee2c831ec66a334814..393272c3cb76502165b257e95d190513fc32326f 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectConfiguration.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectConfiguration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,11 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.ConfigData.gspproject; +/** + * 工程配置信息 用于读取配置文件中的工程配置 + */ public class ProjectConfiguration { + + /** + * 工程类型基础配置信息 {@link ProjectCommonConfigData} + */ private ProjectCommonConfigData commonConfigData; + + /** + * 工程类型创建扩展配置信息 {@link ProjectCreateConfigData} + */ private ProjectCreateConfigData createConfigData; + + /** + * 工程类型中包含的开发对象类别 + */ private String includeDevObjTypes; public ProjectCommonConfigData getCommonConfigData() { diff --git a/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java new file mode 100644 index 0000000000000000000000000000000000000000..ed6ba0774289bf2a1950ab735b1285e2f514d130 --- /dev/null +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/ConfigData/gspproject/ProjectCreateConfigData.java @@ -0,0 +1,24 @@ +/* + * 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.lcm.metadata.api.ConfigData.gspproject; + +import com.inspur.edp.lcm.metadata.api.ConfigData.BaseConfig; + +/** + * 工程类型创建扩展配置信息 + */ +public class ProjectCreateConfigData extends BaseConfig { +} diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java index 81db3a32ff383c0457e57a2620d48e0e6bc341a7..d98aade34b43f50a1a09576b2d08192a7c49e2e0 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/GspProject.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/GspProject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; import java.util.Map; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java similarity index 81% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java index d7f2975ed535f6ffd3d8df8040d089fea16cb4ea..71115e4eca084a2590aa1048aaf4523bf2769e8b 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4Ref.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4Ref.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; - -import org.openatom.ubml.model.common.definition.entity.GspMetadata; +package com.inspur.edp.lcm.metadata.api.entity; /** * @Classname Metadata4Ref diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java similarity index 82% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java index a07e4f5cb64da1c6663a905110ee58c5277070ac..dcf7bb8c6254cb158b52148faa85df88477ee0fb 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/Metadata4RefDto.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/Metadata4RefDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname Metadata4RefDto Description TODO Date 2019/11/15 10:18 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java similarity index 92% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java index 7510b8a45fdea444d9ddcf4ba64df255bbcbf1ae..4a3354dc7cea2e755589955f249df29b8513d375 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataDto.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; - -import org.openatom.ubml.model.common.definition.entity.MetadataProperties; +package com.inspur.edp.lcm.metadata.api.entity; /** * Classname MetadataDto Description 通过WebApi调用时前端往后端传递元数据信息所用实体 Date 2019/11/14 19:54 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java similarity index 77% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java index 59c228c313ae10f0df50ba276a90f038a93dc98d..2ab6ff24df5e7db472ef7bed956f07bbf171b306 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataFilter.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataFilter.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class MetadataFilter { private String metadataPostfix; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java similarity index 74% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java index faf62b81f6aec002b96ea35c5b3b601e6e6a5795..a67c864b182a2ae1b806425bd4d7f52310bafabc 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexItemDto.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataIndexItemDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; +import com.inspur.edp.lcm.metadata.api.entity.metadataindex.MetadataIndexRepoItemDto; import java.util.List; /** diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java similarity index 84% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java index e9f5101147e0bbfe08f5f53ac93ccf3868642af9..b01a59fdc7c8a8f8c11cf8073053e70bc4190ef5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackage.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackage.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.util.List; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; /** * @Classname MetadataPackage diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java similarity index 81% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java index 936399855ae94103305f22e0dd2594cd7665b746..25b0807166540180d8c5c4c6a37ab734f2f0c3f9 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageHeader.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageHeader.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 元数据包的头节点,主要包含元数据包的基本描述信息 @@ -37,7 +37,7 @@ public class MetadataPackageHeader { private ProcessMode processMode; public MetadataPackageHeader() { - setProcessMode(ProcessMode.generation); + setProcessMode(ProcessMode.GENERATION); } public String getName() { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java similarity index 76% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java index 54e3a96a3e77018c2e84d835638c57c7956679da..f30e3c7b663af99c267b83fed25eb0268118f8a5 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageReference.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageReference.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * @Classname MetadataPackageReference diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java similarity index 85% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java index 3b39a508f6b1f9bfda7a0f2da6fbc806a1b81f10..7c7bdf1a1b51bb172a2d87cdac9f812ed9d4da4c 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataPackageVersion.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataPackageVersion.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; @@ -31,7 +31,7 @@ public class MetadataPackageVersion { /** * 版本号分隔符 例如版本分隔符为'.',版本号位数为3,版本号形式则为"1.0.0" */ - private static final char SEPARATOR = '.'; + private static final char SEPARATOR_SPOT = '.'; private int[] versionInt; /** @@ -73,7 +73,7 @@ public class MetadataPackageVersion { * @param position 指定位置。最左边位置号为0,向右依次增1. * @param quantity 指定数量 */ - public final void add(int position, int quantity) { + public final void addQuantityByPosition(int position, int quantity) { if (position > VERSION_LENGTH - 1) { throw new RuntimeException("指定版本号位置超出有效范围。"); } @@ -85,7 +85,7 @@ public class MetadataPackageVersion { * * @param position 指定位置。最左边位置号为1,向右依次增1. */ - public final void Add(int position) { + public final void addOneByPosition(int position) { if (position > VERSION_LENGTH) { throw new RuntimeException("指定版本号位置超出有效范围。"); } @@ -97,14 +97,14 @@ public class MetadataPackageVersion { * * @param quantity 指定数量 */ - public final void AddLast(int quantity) { + public final void addQuantityLast(int quantity) { versionInt[VERSION_LENGTH - 1] += quantity; } /** * 版本号末位增1 */ - public final void AddLast() { + public final void addOneLast() { versionInt[VERSION_LENGTH - 1] += 1; } @@ -114,11 +114,11 @@ public class MetadataPackageVersion { * @param another * @return */ - public final int CompareTo(Object another) { + public final int compareTo(Object another) { if (!(another instanceof MetadataPackageVersion)) { throw new RuntimeException("MetadataPackageVersion的CompareTo方法只能传入MetadataPackageVersion类型的参数。"); } - MetadataPackageVersion anotherVersion = (MetadataPackageVersion)another; + MetadataPackageVersion anotherVersion = (MetadataPackageVersion) another; for (int i = 0; i < VERSION_LENGTH; i++) { if (this.versionInt[i] > anotherVersion.getVersionInt()[i]) { return 1; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java similarity index 90% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java index ce17b2916caf4c12951ac26037c377c92e739d55..1fb881ef26752393667a10f687afbd767da38b95 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataProject.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataProject.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import com.fasterxml.jackson.annotation.JsonProperty; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; import java.util.List; -import org.openatom.ubml.model.framework.definition.entity.mvnEntity.MavenPackageRefs; /** * 元数据工程实体,对应.mdproj文件 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java similarity index 88% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java index b3e10de3cc7991b38b27dfda60c6ef693c5f246d..cc6831655ab7913410f232ee1199f2293633b177 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataType.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/MetadataType.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; import java.io.Serializable; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java similarity index 61% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java index 37312e6be32490fc431da94d64ff40a5b5c6fb21..c6ea1885a2bb18532023530dfe65c5eac14045cc 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProcessMode.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProcessMode.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * 处理模式 @@ -22,10 +22,10 @@ public enum ProcessMode { /** * 生成型 */ - generation, + GENERATION, /** * 解析型 */ - interpretation + INTERPRETATION } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java similarity index 73% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java index 83aacc9f8c6a236394f62e53933a743aa486eeb0..28ef44cba4e84299145349b6132c6553d3110968 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ProjectHeader.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ProjectHeader.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; public class ProjectHeader { diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java similarity index 78% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java index c4ffdd61061b6db5096cafd0750a19efce36f2e4..619a79dc4b99ca9dfd49a52752ad816b2116c3ee 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/ServiceUnitInfo.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/ServiceUnitInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity; /** * @Classname ServiceUnitInfo diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java similarity index 83% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java index 493388b5eff62c5544919055afd084409b78dc03..1dfef7cb434c8775a67a1cd92631c096a9a54c1c 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/MetadataIndexRepoItemDto.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/entity/metadataindex/MetadataIndexRepoItemDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity; +package com.inspur.edp.lcm.metadata.api.entity.metadataindex; /** * Classname MetadataIndexRepoItemDto Description 元数据索引仓库包项 Date 2019/11/26 11:22 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java similarity index 70% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java index ec5e0c8a1ff833d863c580bdfc1ef1782421378a..0fcb41a8ca05787c7f883723cb16b0facde37977 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponent.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponent.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java similarity index 69% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java index d00613d2227099a8cddbe7dbba2befed98ca9d85..9629931d82e49e1aba2f534d92ffab4b3cf78675 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenComponents.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenComponents.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.util.List; diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java similarity index 80% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java index 8b643732fa384f0df54a457c7845b2dc25912718..697d85a856d189b43bc524d3986251a2d95da09e 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MavenPackageRefs.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MavenPackageRefs.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname MavenPackageRefs Description Maven依赖关系实体类。保存在mdproj中的元数据依赖包 Date 2019/10/31 11:44 diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java similarity index 69% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java index 8749cace3fbe9a09632f1d3b0cc6ac4b2be4f6c0..93cd5f65dfc1a9267b1567162a77e39d9c33916d 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/MetadataRepo.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/MetadataRepo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; import java.util.List; @@ -31,7 +31,7 @@ public class MetadataRepo { } public void setRepoList( - List repoList) { + List repoList) { this.repoList = repoList; } } diff --git a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java similarity index 78% rename from model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java rename to model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java index 5a753b22a3cd2e3cb0036e43556fe0b0df3a6ffa..f911e04bcfd899a1a2969505f3de8732f458ff60 100644 --- a/model/framework/common/src/main/java/org/openatom/ubml/model/framework/definition/entity/mvnEntity/PackageSourceDto.java +++ b/model/framework/entity/src/main/java/com/inspur/edp/lcm/metadata/api/mvnEntity/PackageSourceDto.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.definition.entity.mvnEntity; +package com.inspur.edp.lcm.metadata.api.mvnEntity; /** * Classname PackageSourceDto Description mirrors中的条目 Date 2019/11/26 20:10 diff --git a/model/framework/generator-api/pom.xml b/model/framework/generator-api/pom.xml index a5480a93e222e5f1a0a9eb60ddd3c61c3bda7eb0..d63b4fe08b42268ea2c9ec455a86016ab2910320 100644 --- a/model/framework/generator-api/pom.xml +++ b/model/framework/generator-api/pom.xml @@ -1,4 +1,20 @@ + + @@ -13,12 +29,33 @@ ubml-model-framework-generator-api + + com.inspur.edp + caf-generator + + + lcm-metadata-api + com.inspur.edp + + + + org.openatom.ubml ubml-model-framework-common 0.9.0-SNAPSHOT compile + + org.openatom.ubml + ubml-model-framework-devtime-core + 0.9.0-SNAPSHOT + compile + + + + + diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java similarity index 70% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java index ecabfe951b16fb10c70eeb51b35b2cf01fe5be43..03492a771e57f7ce35184334c9ad3d0cf4655c1e 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/GenerateService.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/GenerateService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api; +package com.inspur.edp.jittojava.context; import java.util.List; -import org.openatom.ubml.model.framework.generator.api.entity.MavenDependency; +import com.inspur.edp.jittojava.context.entity.MavenDependency; /** * @Classname GenerateService diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java similarity index 82% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java index a325f1b9fb2abd01114cd54472f29b4e1c5820fc..3241c97431154d953e44eb062025ed3e88fd2693 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/JitContext.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/JitContext.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api; - +package com.inspur.edp.jittojava.context; + +import com.inspur.edp.caf.generator.module.ModuleGenerator; +import com.inspur.edp.jittojava.context.temp.ModuleGenerateInfo; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.core.RefCommonServiceImp; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openatom.ubml.model.common.definition.entity.GspMetadata; -import org.openatom.ubml.model.framework.api.RefCommonService; -import org.openatom.ubml.model.framework.definition.entity.GspProject; -import org.openatom.ubml.model.framework.definition.entity.MetadataProject; -import org.openatom.ubml.model.framework.generator.api.temp.ModuleGenerateInfo; -import org.openatom.ubml.model.framework.generator.api.temp.ModuleGenerator; -import org.openatom.ubml.model.framework.generator.api.temp.RefCommonServiceImp; public class JitContext { RefCommonService refCommonService; @@ -75,7 +75,7 @@ public class JitContext { } public void setMetadataCache( - Map metadataCache) { + Map metadataCache) { this.metadataCache = metadataCache; } @@ -84,7 +84,7 @@ public class JitContext { } public void setModuleInfoList( - List moduleInfoList) { + List moduleInfoList) { this.moduleInfoList = moduleInfoList; } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java similarity index 87% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java index b13a433211f4d01b61ca07445c38e61abda90167..12942ec3fed7d53121c2865924e1be04c776ef64 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/FileUtils.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/FileUtils.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.common; +package com.inspur.edp.jittojava.context.common; import java.io.File; import java.io.FileInputStream; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java similarity index 86% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java index 0d5c37d8431a0d3166716c903d5ca2f9acfd27ca..cf69188846565d6d5cdbc1078b7793eb1e640075 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/common/JitCompilerConfigLoader.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/common/JitCompilerConfigLoader.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.common; +package com.inspur.edp.jittojava.context.common; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import io.iec.edp.caf.common.environment.EnvironmentUtil; import java.io.IOException; import java.nio.file.Paths; import java.util.List; -import org.openatom.ubml.model.framework.generator.api.entity.JitCompilerConfigration; -import org.openatom.ubml.model.framework.generator.api.temp.EnvironmentUtil; /** * @Classname JitCompilerConfigLoader @@ -52,7 +52,7 @@ public class JitCompilerConfigLoader { } public static void setCompilerTypeConfigurations( - List compilerTypeConfigurations) { + List compilerTypeConfigurations) { JitCompilerConfigLoader.compilerTypeConfigurations = compilerTypeConfigurations; } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java similarity index 75% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java index 5beb354e787453af3b7c2afa5cd9ec5955a41da0..79b6d29b7b36976f16da670ec9e74d15f3b7051f 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/CompilerConfigData.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/CompilerConfigData.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname CompilerConfigData diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java similarity index 83% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java index 6a9815af849a8452397f866824c9025977ec3b55..efa781f4a7393e74601fde7ea8216f8b9532d051 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/JitCompilerConfigration.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/JitCompilerConfigration.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname JitCompilerConfigration diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java similarity index 64% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java index ff8ee027dd96499deb37d9d97493ddc977f2cbfb..67e7ea252894c2f9e965fbbd76c2a5cf5d951ca9 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/entity/MavenDependency.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/entity/MavenDependency.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.entity; +package com.inspur.edp.jittojava.context.entity; /** * @Classname MavenDependency @@ -78,11 +78,24 @@ public class MavenDependency { this.groupId = groupId; } - public boolean equals(MavenDependency source) { - if (source == null) { + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof MavenDependency)) { return false; } - return source.getGroupId().equals(getGroupId()) - && source.getArtifactId().equals(getArtifactId()); + MavenDependency md = (MavenDependency) obj; + return (groupId == null ? md.getGroupId() == null : groupId.equals(md.getGroupId())) && + (artifactId == null ? md.getArtifactId() == null : artifactId.equals(md.getArtifactId())); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + (groupId == null ? 0 : groupId.hashCode()); + result = 31 * result + (artifactId == null ? 0 : artifactId.hashCode()); + return result; } } diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java similarity index 80% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java index b914bc684bd2db0e79a34f0fa9b99010f8cb42a5..bff7d3b755f3e09652d38d724b1c9168d5e68092 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/service/CommonService.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/service/CommonService.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.service; +package com.inspur.edp.jittojava.context.service; import java.util.List; diff --git a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java similarity index 63% rename from model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java rename to model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java index f8ba97739dd1f10ea9d5852d8c1ed57d9fabaf79..7cd47848c7166c85186ee8eb2cb0094ce933841d 100644 --- a/model/framework/generator-api/src/main/java/org/openatom/ubml/model/framework/generator/api/temp/ModuleGenerateInfo.java +++ b/model/framework/generator-api/src/main/java/com/inspur/edp/jittojava/context/temp/ModuleGenerateInfo.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.api.temp; +package com.inspur.edp.jittojava.context.temp; /** * The type ModuleGenerateInfo diff --git a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java similarity index 31% rename from model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java rename to model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java index 7c06128f515481644baccbebf16ed0216b0215a4..8c6f80f0f927a6fbd2e13ace20f24bc1192aca63 100644 --- a/model/be/definition/src/main/java/org/openatom/ubml/model/be/definition/common/BefDtBeanUtil.java +++ b/model/framework/generator-api/src/test/java/com/inspur/edp/jittojava/context/common/FileUtilsTest.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,19 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.be.definition.common; -// -//import com.inspur.edp.bef.bizentity.gspbusinessentity.api.IGspBeExtendInfoService; -//import com.inspur.edp.cef.designtime.api.util.CefDtBeanUtil; -//import io.iec.edp.caf.commons.utils.SpringBeanUtils; -// -//public class BefDtBeanUtil extends CefDtBeanUtil { -// private static IGspBeExtendInfoService beExtendInfoService; -// -// public static IGspBeExtendInfoService getBEExtendInfoService() { -// if (beExtendInfoService == null) { -// beExtendInfoService = SpringBeanUtils.getBean(IGspBeExtendInfoService.class); -// } -// return beExtendInfoService; + +package com.inspur.edp.jittojava.context.common; + +//import org.junit.Assert; +//import org.junit.Test; +//import org.springframework.boot.test.context.SpringBootTest; +//import static org.hamcrest.Matchers.is; + +//@SpringBootTest +public class FileUtilsTest { + private static String TEST_FILE_NAME = "/fileUtils-test-file.txt"; + private static String EXPECT_RESULT = "junit test"; + +// @Test +// public void fileReadTest() { +// String testFilePath = this.getClass().getResource(TEST_FILE_NAME).getPath(); +// String content = FileUtils.fileRead(testFilePath); +// Assert.assertThat(content, is(EXPECT_RESULT)); // } -//} +} \ No newline at end of file diff --git a/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt b/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt new file mode 100644 index 0000000000000000000000000000000000000000..eb50260efdf8c6775799a96cdaa7f886c6eee3e0 --- /dev/null +++ b/model/framework/generator-api/src/test/resources/fileUtils-test-file.txt @@ -0,0 +1 @@ +junit test \ No newline at end of file diff --git a/model/framework/generator-core/pom.xml b/model/framework/generator-core/pom.xml index e9652f845ad82d63417e3f2a12b965eabfcae08b..548ee14f187aa6b288109429f8fd14c95b9547f5 100644 --- a/model/framework/generator-core/pom.xml +++ b/model/framework/generator-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -18,4 +34,12 @@ 8 + + + org.openatom.ubml + ubml-model-framework-generator-spi + ${project.version} + + + \ No newline at end of file diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..9dd3555337d3cc0eacf52681e2606884854244f7 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/AfterGenerator.java @@ -0,0 +1,49 @@ +/* + * 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.jittojava.action; + +import com.inspur.edp.jittojava.core.GenerateServiceCore; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.IOException; +import java.nio.file.Paths; + +/** + * @Classname AfterGenerator + * @Description TODO + * @Date 2019/12/24 17:18 + * @Created by liu_bintr + * @Version 1.0 + */ +public class AfterGenerator implements AfterGeneratorAction { + GenerateServiceCore generateService = new GenerateServiceCore(); + Utils utils = new Utils(); + + @Override + public void afterGenerator(String projPath) { + FileServiceImp fileService = new FileServiceImp(); + String runtimePath = Paths.get(projPath).resolve("java/code/runtime").toString(); + if (fileService.isDirectoryExist(runtimePath)) { + try { + fileService.deleteAllFilesUnderDirectory(runtimePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + generateService.removeRuntimeModule(projPath); + } + generateService.modifyPom(projPath, utils.getExtendDependency()); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java new file mode 100644 index 0000000000000000000000000000000000000000..fd385a869a9296acd97517b3d3ee5daa93218c8b --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/action/Utils.java @@ -0,0 +1,72 @@ +/* + * 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.jittojava.action; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.MavenDependencyConst; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +/** + * @Classname Utils + * @Description TODO + * @Date 2019/12/24 17:20 + * @Created by liu_bintr + * @Version 1.0 + */ +public class Utils { + + public ArrayList getExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/CommonExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + + private ArrayList readInternalDependency(String defaultDependencyPath) { + ArrayList result = new ArrayList<>(); + Document doc = readDocument(defaultDependencyPath); + Element rootElement = doc.getRootElement(); + List list = rootElement.elements(); + for (int i = 0; i < list.size(); i++) { + Element ele = (Element) list.get(i); + result.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version), getTagValue(ele, MavenDependencyConst.file))); + } + return result; + } + + private Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + private String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } + +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java new file mode 100644 index 0000000000000000000000000000000000000000..a75d707d9f9b4e0eff0cee61a629474b7ce23870 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceCore.java @@ -0,0 +1,101 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +/** + * Classname CommonServiceCore Description 实现类 Date 2019/8/8 16:42 + * + * @author zhongchq + * @version 1.0 + */ +public class CommonServiceCore implements CommonService { + + @Override + public String getProjectPath(String absJavaPath) { + //java目录下进行判断 + File file = new File(absJavaPath); + if (file.isDirectory()) { + File[] files = file.listFiles(); + if (files.length == 0) { + return null; + } + //遍历java目录下目录 + for (int i = 0; i < files.length; i++) { + //对目录进行判断 + if (files[i].isDirectory()) { + File[] fileInPoject = files[i].listFiles(); + for (File file1 : fileInPoject) { + if (file1.isFile() && file1.toString().contains("pom.xml")) { + return Utils.handlePath(file1.getParent().substring(file1.toString().indexOf("java"))); + } + } + } + } + } + return null; + } + + @Override + public List getJarPath(String absJavaPath) { + Path path = Paths.get(absJavaPath); + List filename = new ArrayList<>(); + try { + Files.walkFileTree(path + , new SimpleFileVisitor() { + // 访问文件时触发 + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + if (file.toString().endsWith(".jar")) { + String filepaths = file.toString(); + if (filepaths.contains("out") || filepaths.contains("target")) { + filename.add(Utils.handlePath(filepaths.substring(filepaths.indexOf("java")))); + } + return FileVisitResult.CONTINUE; + } + return FileVisitResult.CONTINUE; + } +// +// // 访问目录时触发 +// @Override +// public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { +// if (dir.endsWith("target")) { +// String targetpath = dir.getParent().toAbsolutePath().toString().su +// targetpath.substring("java"); +// list.add(targetpath); +// } +// return FileVisitResult.CONTINUE; +// } + }); + } catch (IOException e) { + e.printStackTrace(); + } + Collections.sort(filename); + return filename; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..08a4a80e4dac4252ce6ddad56137eea1954603e9 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/CommonServiceImp.java @@ -0,0 +1,61 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.util.List; + +/** + * Classname CommonServiceImp Description 实现类 Date 2019/8/8 16:42 + * + * @author zhongchq + * @version 1.0 + */ +public class CommonServiceImp implements CommonService { + + FileService fileService = new FileServiceImp(); + + MetadataProjectService metadataProjectService = new MetadataProjectServiceImp(); + + CommonServiceCore commonServiceCore = new CommonServiceCore(); + + /** + * @param proPath 相对路径 + * @return java.lang.String + * @throws + * @author zhongchq + **/ + @Override + public String getProjectPath(String proPath) { + String javaPath = fileService.getCombinePath(metadataProjectService.getProjPath(proPath), "java"); + String absJavaPath = ManagerUtils.getAbsolutePath(javaPath); + + return commonServiceCore.getProjectPath(absJavaPath); + + } + + @Override + public List getJarPath(String proPath) { + String javaPath = fileService.getCombinePath(metadataProjectService.getProjPath(proPath), "java"); + String absJavaPath = ManagerUtils.getAbsolutePath(javaPath); + return commonServiceCore.getJarPath(absJavaPath); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java new file mode 100644 index 0000000000000000000000000000000000000000..ce53fbc9e64cc4c4d882d768c64934ade4f1c943 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceCore.java @@ -0,0 +1,116 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.manager.GeneratorManager; +import com.inspur.edp.jittojava.core.manager.GeneratorManagerFactory; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.dom4j.Document; +import org.dom4j.Element; + +public class GenerateServiceCore { + public void generate(String absolutePath, String mavenPath) throws Exception { + final GeneratorManager generatorManager = GeneratorManagerFactory.createGeneratorManager(absolutePath); + generatorManager.generate(absolutePath, mavenPath); + } + + public void generateApi(String absolutePath, String mavenPath) throws Exception { + final GeneratorManager generatorManager = GeneratorManagerFactory.createGeneratorManager(absolutePath); + generatorManager.generateApi(absolutePath, mavenPath); + } + + public void removeRuntimeModule(String absolutePath) { + String pomPath = getPomFilePath(absolutePath); + Model model = getModel(pomPath); + List modules = model.getModules(); + List newMudules = modules.stream().filter(module -> !"runtime".equals(module)).collect(Collectors.toList()); + model.setModules(newMudules); + writeModel(pomPath, model); + } + + public void writeModel(String pomPath, Model model) { + File pom = new File(pomPath); + if (!pom.exists()) { + pom.getParentFile().mkdirs(); + try { + pom.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + try (FileOutputStream fileOutputStream = new FileOutputStream(pomPath)) { + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public Model getModel(String pomPath) { + try (FileInputStream fis = new FileInputStream(pomPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + final Model model = reader.read(fis); + return model; + } catch (IOException | XmlPullParserException e) { + throw new RuntimeException(e); + } + } + + public void modifyPom(String absolutePath, List mavenDependencyList) { + if (mavenDependencyList == null || mavenDependencyList.size() == 0) { + return; + } + String pomPath = getPomFilePath(absolutePath); + Document doc = JitUtils.readDocument(pomPath); + Element projectElement = doc.getRootElement(); + Element dependenciesElement = projectElement.element(MavenDependencyConst.dependencies); + + if (dependenciesElement == null) { + dependenciesElement = projectElement.addElement(MavenDependencyConst.dependencies); + } + List existValues = dependenciesElement.elements(); + ArrayList existDependencies = JitUtils.readExistDependencies(existValues); + for (MavenDependency newDependency : mavenDependencyList) { + if (JitUtils.checkContainDependency(newDependency, existDependencies)) { + continue; + } + JitUtils.addDependencyDom(newDependency, dependenciesElement); + } + JitUtils.saveDocument(doc, new File(pomPath)); + } + + private String getPomFilePath(String projPath) { + String javaPath = Paths.get(projPath).resolve("java").toString(); + String javaProjPath = Paths.get(javaPath).resolve(Utils.getMavenProName()).toString(); + String pomFilePath = Paths.get(javaProjPath).resolve("pom.xml").toString(); + + return pomFilePath; + } + +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..f2cb1e48b67eb55d44fd376ff3ff17da3fc9df86 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/GenerateServiceImp.java @@ -0,0 +1,107 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import org.codehaus.plexus.util.StringUtils; + +public class GenerateServiceImp implements GenerateService { + + GenerateServiceCore generateServiceCore = new GenerateServiceCore(); + + @Override + public void generate(String path) throws Exception { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + generateServiceCore.generate(absolutePath, mavenPath); + } + + @Override + public void generateApi(String path) throws Exception { + String absolutePath = ManagerUtils.getAbsolutePath(path); + String mavenPath = ManagerUtils.getMavenStoragePath(); + generateServiceCore.generateApi(absolutePath, mavenPath); + } + + @Override + public void modifyPom(String projPath, List mavenDependencyList) { + String absolutePath = ManagerUtils.getAbsolutePath(projPath); + generateServiceCore.modifyPom(absolutePath, mavenDependencyList); + } + + @Override + public void addProperties(String codePath, String propertyKey, String property) { + String factoriesFilePath = Paths.get(codePath).getParent().resolve(JitUtils.getSpringPeopertiesPath()).toString(); + FileService fileService = SpringBeanUtils.getBean(FileService.class); + if (!fileService.isFileExist(factoriesFilePath)) { + try { + fileService.createDirectory(Paths.get(factoriesFilePath).getParent().toString()); + fileService.createFile(factoriesFilePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + Properties properties = loadProperties(factoriesFilePath); + String valueStr = properties.getProperty(propertyKey); + if (StringUtils.isEmpty(valueStr)) { + properties.put(propertyKey, property); + updatePropertyFile(factoriesFilePath, properties); + } else { + List values = Arrays.asList(valueStr.split(",").clone()); + if (!values.contains(property)) { + valueStr = valueStr + "," + property; + properties.put(propertyKey, valueStr); + updatePropertyFile(factoriesFilePath, properties); + } + } + } + + public Properties loadProperties(String paramFile) { + Properties props = new Properties();//使用Properties类来加载属性文件 + try { + FileInputStream iFile = new FileInputStream(paramFile); + props.load(iFile); + iFile.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + + return props; + } + + private void updatePropertyFile(String filePath, Properties properties) { + try { + FileService fileService = SpringBeanUtils.getBean(FileService.class); + fileService.fileUpdate(filePath, "", false); + FileOutputStream oFile = new FileOutputStream(filePath, true); + properties.store(oFile, ""); + oFile.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java new file mode 100644 index 0000000000000000000000000000000000000000..5321a280d007a636f3503f7b7fdde5ac47d86e84 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitCompilerHelper.java @@ -0,0 +1,90 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.common.JitCompilerConfigLoader; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.jittojava.spi.JitAction; +import java.util.List; + +/** + * @Classname JitCompilerHelper + * @Description TODO + * @Date 2019/7/29 16:06 + * @Created by zhongchq + * @Version 1.0 + */ +public class JitCompilerHelper extends JitCompilerConfigLoader { + + private static JitCompilerHelper singleton = null; + + public JitCompilerHelper() { + } + + public static JitCompilerHelper getInstance() { + if (singleton == null) { + singleton = new JitCompilerHelper(); + } + return singleton; + } + + /** + * @param typeName + * @return com.inspur.edp.lcm.metadata.spi.MetadataContentSerializer + * @throws + * @author zhongchq + * @description 返回各元数据序列化器 + * @date 9:34 2019/7/24 + **/ + public JitAction getManager(String typeName) { + JitAction manager = null; + JitCompilerConfigration data = getCompilerConfigurations(typeName); + if (data != null && data.getEnable()) { + Class cls = null; + if (data.getBeforeCompiler() != null) { + try { + cls = Class.forName(data.getBeforeCompiler().getName()); + manager = (JitAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } + + public AfterGeneratorAction getAfterActionManager(String typeName) { + AfterGeneratorAction manager = null; + JitCompilerConfigration data = getCompilerConfigurations(typeName); + if (data != null && data.getEnable()) { + Class cls = null; + if (data.getAfterCompiler() != null) { + try { + cls = Class.forName(data.getAfterCompiler().getName()); + manager = (AfterGeneratorAction) cls.newInstance(); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + e.printStackTrace(); + } + } + } + return manager; + } + + public List getCompilerTypeList() { + return getCompilerConfigurations(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..bd9086c6013773b3d5cfd12524d0b28a3b3a4e99 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/JitUtils.java @@ -0,0 +1,136 @@ +/* + * 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.jittojava.core; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.OutputFormat; +import org.dom4j.io.SAXReader; +import org.dom4j.io.XMLWriter; + +/** + * @Classname JitUtils + * @Description TODO + * @Date 2019/12/16 16:30 + * @Created by liu_bintr + * @Version 1.0 + */ +public class JitUtils { + public static String getArchetypePath() { + return "platform/dev/main/libs/resources/archetypefront"; + } + + public static String getSpringPeopertiesPath() { + return "resources/META-INF/spring.factories"; + } + + public static String getArchetypeArtifactId() { + return "bf-df-bank-front-archetype"; + } + + public static String getArchetypeTarget() { + return "target/" + getArchetypeArtifactId() + "-0.1.3.jar"; + } + + public static String getCompArchetypePath() { + return "platform/dev/main/libs/resources/archetypefront-comp"; + } + + public static String getCompArchetypeArtifactId() { + return "archetype-comp"; + } + + public static String getCompArchetypeTarget() { + return "target/" + getCompArchetypeArtifactId() + "-0.1.3.jar"; + } + + public static Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + public static ArrayList readExistDependencies(List existValues) { + ArrayList list = new ArrayList<>(); + if (existValues == null || existValues.size() == 0) { + return list; + } + for (int i = 0; i < existValues.size(); i++) { + Element ele = (Element) existValues.get(i); + list.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version))); + } + return list; + } + + public static boolean checkContainDependency(MavenDependency dependency, ArrayList dependencies) { + for (MavenDependency item : dependencies) { + if (item.equals(dependency)) { + return true; + } + } + return false; + } + + public static void addDependencyDom(MavenDependency dependency, Element parentElement) { + Element element = parentElement.addElement(MavenDependencyConst.dependency); + Element gourpId = element.addElement(MavenDependencyConst.groupId); + Element artifactId = element.addElement(MavenDependencyConst.artifactId); + gourpId.setText(dependency.getGroupId()); + artifactId.setText(dependency.getArtifactId()); + if (dependency.getVersion() != null && !dependency.getVersion().isEmpty()) { + Element version = element.addElement(MavenDependencyConst.version); + version.setText(dependency.getVersion()); + } + } + + public static void saveDocument(Document document, File xmlFile) { + Writer osWrite = null;// 创建输出流 + try { + osWrite = new OutputStreamWriter(new FileOutputStream(xmlFile)); + + OutputFormat format = OutputFormat.createPrettyPrint(); // 获取输出的指定格式 + format.setEncoding("UTF-8");// 设置编码 ,确保解析的xml为UTF-8格式 + XMLWriter writer = new XMLWriter(osWrite, format);// XMLWriter + // 指定输出文件以及格式 + writer.write(document);// 把document写入xmlFile指定的文件(可以为被解析的文件或者新创建的文件) + writer.flush(); + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java new file mode 100644 index 0000000000000000000000000000000000000000..2bc8ab03fd8ee479165f5b77f9231fa3db1f2312 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/MavenDependencyConst.java @@ -0,0 +1,34 @@ +/* + * 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.jittojava.core; + +/** + * @Classname MavenDependencyConst + * @Description TODO + * @Date 2019/12/16 16:36 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenDependencyConst { + public static String groupId = "groupId"; + public static String artifactId = "artifactId"; + public static String version = "version"; + public static String file = "file"; + public static String dependency = "dependency"; + public static String dependencies = "dependencies"; + + public static String modules = "modules"; +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..9c7731ab1f28893497cd696522a35490ba02a76f --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/config/ServiceAutoConfiguration.java @@ -0,0 +1,44 @@ +/* + * 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.jittojava.core.config; + +import com.inspur.edp.jittojava.context.GenerateService; +import com.inspur.edp.jittojava.context.service.CommonService; +import com.inspur.edp.jittojava.core.CommonServiceImp; +import com.inspur.edp.jittojava.core.GenerateServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * @Classname ServiceAutoConfiguration + * @Description TODO + * @Date 2019/7/30 13:43 + * @Created by liu_bintr + * @Version 1.0 + */ +@Configuration +public class ServiceAutoConfiguration { + + @Bean + public CommonService createCommonService() { + return new CommonServiceImp(); + } + + @Bean + public GenerateService createGenerateService() { + return new GenerateServiceImp(); + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java new file mode 100644 index 0000000000000000000000000000000000000000..5f83fede228c80f8974497f779fb34395f86e300 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManager.java @@ -0,0 +1,568 @@ +/* + * 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.jittojava.core.manager; + +import com.inspur.edp.caf.generator.compileunit.CompileUnitGenerator; +import com.inspur.edp.caf.generator.module.ModuleGenerator; +import com.inspur.edp.jittojava.context.JitContext; +import com.inspur.edp.jittojava.context.entity.JitCompilerConfigration; +import com.inspur.edp.jittojava.core.CommonServiceCore; +import com.inspur.edp.jittojava.core.JitCompilerHelper; +import com.inspur.edp.jittojava.core.JitUtils; +import com.inspur.edp.jittojava.core.persistence.RepositoryFactory; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.jittojava.spi.JitAction; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.GspProject; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.MdpkgService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.core.GspProjectCoreService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; +import com.inspur.lcm.metadata.logging.LoggerDisruptorQueue; +import io.iec.edp.caf.boot.context.CAFContext; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.io.FileUtils; +import org.apache.maven.model.Model; +import org.apache.maven.model.Parent; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GeneratorManager { + private static final Logger log = LoggerFactory.getLogger(GeneratorManager.class); + + MetadataProjectCoreService metadataProjectCoreService = new MetadataProjectCoreService(); + GspProjectCoreService gspProjectCoreService = new GspProjectCoreService(); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + FileServiceImp fileService = new FileServiceImp(); + CommonServiceCore commonServiceCore = new CommonServiceCore(); + MdpkgService mdpkgService = SpringBeanUtils.getBean(MdpkgService.class); + + protected List metadataList = new ArrayList<>(); + protected JitContext jitContext; + protected final String fixedPath = "src/main/java"; + protected boolean isModelExist; + protected boolean isOldProject = false; + protected Model model; + + protected String archetypePath; + protected String archetypeTarget; + protected String archetypeArtifactId; + protected String refModule; + + public void generate(String absolutePath, String mavenPath) throws Exception { + beforeGenerate(absolutePath); + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成源代码 + generateCode(jitContext); + //生成后事件 + afterGenerate(absolutePath); + } finally { + isOldProject = false; + } + } + + public void generateApi(String absolutePath, String mavenPath) throws Exception { + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成api代码 + generateApi(jitContext); + } finally { + } + } + + protected void generateApi(JitContext jitContext) { + //获取所有注册的Jit类型 + List compilerTypeList = JitCompilerHelper.getInstance().getCompilerTypeList(); + generateApiCode(compilerTypeList, jitContext); + } + + protected void generateCode(JitContext jitContext) { + //获取所有注册的Jit类型 + List compilerTypeList = JitCompilerHelper.getInstance().getCompilerTypeList(); + + generateApiCode(compilerTypeList, jitContext); + + generateCoreCode(compilerTypeList, jitContext); + } + + protected void generateApiCode(List compilerTypeList, JitContext jitContext) { + String loStr = "开始:生成API代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //组织API生成的上下文 + generateApiCode(compilerTypeList); + //生成API代码 + jitContext.getApiModuleGenerator().initialize(); + jitContext.getApiModuleGenerator().generate(); + loStr = "完成:生成API代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void generateApiCode(List compilerTypeList) { + //组织api代码生成路径 + setPath("api"); + metadataList.forEach(item -> { + for (JitCompilerConfigration config : compilerTypeList) { + if (item.getHeader().getType().equals(config.getTypeCode())) { + // 获取元数据实体传给各元数据编译器 + if (item.getHeader().getFileName() == null) { + throw new IllegalArgumentException("路径" + item.getRelativePath() + "下有元数据FileName属性为空,请检查"); + } + GspMetadata metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); + if (metadata == null) { + String loStr = "没有拿到元数据"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + jitContext.setMetadata(metadata); + + if (jitContext.getMetadataCache(metadata.getHeader().getId()) == null) { + jitContext.setMetadataCache(metadata.getHeader().getId(), metadata); + } + + JitAction jitAction = JitCompilerHelper.getInstance().getManager(item.getHeader().getType()); + if (jitAction != null) { + String loStr = "jitInfo " + jitAction.toString(); + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + if (jitAction != null) { + jitAction.generateApi(jitContext); + } + } + } + }); + } + + protected void generateCoreCode(List compilerTypeList, JitContext jitContext) { + String loStr = "开始:生成CORE代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //组织CORE生成的上下文 + generateCoreCode(compilerTypeList); + //生成CORE代码 + jitContext.getCoreModuleGenerator().initialize(); + jitContext.getCoreModuleGenerator().generate(); + loStr = "完成:生成CORE代码"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void generateCoreCode(List compilerTypeList) { + //组织api代码生成路径 + setPath("core"); + metadataList.forEach(item -> { + for (JitCompilerConfigration config : compilerTypeList) { + if (item.getHeader().getType().equals(config.getTypeCode())) { + // 获取元数据实体传给各元数据编译器 + GspMetadata metadata = metadataCoreManager.loadMetadata(item.getHeader().getFileName(), item.getRelativePath()); + jitContext.setMetadata(metadata); + if (jitContext.getMetadataCache(metadata.getHeader().getId()) == null) { + jitContext.setMetadataCache(metadata.getHeader().getId(), metadata); + } + JitAction jitAction = JitCompilerHelper.getInstance().getManager(item.getHeader().getType()); + if (jitAction != null) { + jitAction.generateCore(jitContext); + } + } + } + }); + } + + protected void afterGenerate(String absolutePath) { + String loStr = "开始:生成后事件"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + List metadataTypes = new ArrayList<>(); + List metadataList = metadataCoreManager.getMetadataList(absolutePath); + if (metadataList == null || metadataList.size() <= 0) { + return; + } + metadataTypes.add("CommonExtend"); + metadataList.forEach(item -> { + if (!metadataTypes.contains(item.getHeader().getType())) { + metadataTypes.add(item.getHeader().getType()); + } + }); + metadataTypes.forEach(type -> { + AfterGeneratorAction action = JitCompilerHelper.getInstance().getAfterActionManager(type); + if (action != null) { + action.afterGenerator(absolutePath); + } + }); + + ArrayList types = new ArrayList<>(); + types.add("api_src"); + types.add("metadata"); + metadataProjectCoreService.setSourceDataModifiedTime(absolutePath, types); + loStr = "完成:生成后事件"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void beforeGenerate(String absolutePath) { + SpringBeanUtils.getBean(MdpkgService.class).restore(absolutePath, false); + } + + protected void setPath(String flag) { + String javaProjectPath = fileService.getCombinePath(jitContext.getGspProjectpath(), Utils.getJavaProjectPath()); + + String artifactID; + String dir; + if (isOldProject) { + artifactID = getArtifactId(jitContext); + dir = artifactID + "-" + flag; + } else { + dir = flag; + artifactID = Utils.getMavenProName(); + } + String codePath = Paths.get(javaProjectPath).resolve(artifactID).resolve(dir).resolve(fixedPath).toString(); + String resPath = Paths.get(javaProjectPath).resolve(artifactID).resolve(dir).resolve(Utils.getResourcesPath()).toString(); + jitContext.setCodePath(codePath); + jitContext.setResourcePath(resPath); + } + + protected JitContext buildJitContext(String absolutePath) { + String loStr = "开始:构建生成上下文"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + //构建上下文内容,此处需要确定是否包含工程信息,元数据信息等 + JitContext context = new JitContext(); + try { + context.setGspProjectpath(absolutePath); + Utils.setMetadataPath(absolutePath); + GspProject gspProjectInfo = gspProjectCoreService.getGspProjectInfo(absolutePath); + MetadataProject metadataProjectInfo = metadataProjectCoreService.getMetadataProjInfo(absolutePath); + context.setMetadataProjectInfo(metadataProjectInfo); + context.setGspProjectInfo(gspProjectInfo); + context.setApiModuleGenerator(new ModuleGenerator() { + @Override + protected ArrayList getCompileUnitGenrators() { + return null; + } + }); + context.setCoreModuleGenerator(new ModuleGenerator() { + @Override + protected ArrayList getCompileUnitGenrators() { + return null; + } + }); + MetadataCoreManager metadataCoreManager = new MetadataCoreManager(); + this.metadataList = metadataCoreManager.getMetadataList(absolutePath); +// MetadataDevCacheManager.setMetadataListInProjectCache(new File(absolutePath).getName(), this.metadataList); +// List refProjPaths = new ArrayList<>(); +// metadataProjectCoreService.getRefProjPaths(absolutePath, refProjPaths); +// for (String projPath : refProjPaths) { +// List metadataList = metadataCoreManager.getMetadataList(projPath); +// MetadataDevCacheManager.setMetadataListInProjectCache(new File(projPath).getName(), metadataList); +// } + } catch (Exception e) { + e.printStackTrace(); + } + loStr = "结束:构建生成上下文"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + return context; + } + + protected void createMavenProject(JitContext jitContext, String mavenPath) throws Exception { + String loStr = "开始:创建maven工程"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + + // 模板 + installArchetype(mavenPath); + + // 判断maven模板是否生成 + String javaProjectPath = fileService.getCombinePath(jitContext.getGspProjectpath(), Utils.getJavaProjectPath()); + isModelExist = isModelExist(javaProjectPath); + + // 生成模板工程的过程中如果同名工程存在,maven会报错. + if (!isModelExist) { + generateArchetype(javaProjectPath, mavenPath); + } else { + // 清理api和core + clearCode(javaProjectPath); + } + updateEdpParentVersion(javaProjectPath); + + updateModuleRefs(javaProjectPath, mavenPath); + + loStr = "完成:创建maven工程"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + + protected void updateModuleRefs(String javaProjectPath, String mavenPath) { + String refPomPath = javaProjectPath + File.separator + "code" + File.separator + refModule + File.separator + Utils.getPomFile(); + String metadataPath = javaProjectPath.substring(0, javaProjectPath.length() - 4) + "metadata"; + if (fileService.isFileExist(refPomPath)) { + MetadataProject metadataProject = metadataCoreManager.getMetadataProjInfo(metadataPath); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + final List generationMavenPackageRefs = getGenerationMavenPackageRefs(metadataProject, mavenPath); + RepositoryFactory.getInstance().getGenerateRepository().updateModuleRefs(refPomPath, generationMavenPackageRefs, true); + } + } + } + + protected List getGenerationMavenPackageRefs(MetadataProject metadataProject, String mavenPath) { + return metadataProject.getMavenPackageRefs(); + } + + protected void updateEdpParentVersion(String javaProjectPath) throws IOException { + String pomPath = javaProjectPath + File.separator + Utils.getMavenProName() + File.separator + Utils.getPomFile(); + if (fileService.isFileExist(pomPath)) { + String version = getEdpParentVersionInProject(pomPath); + String nVersion = Utils.getEdpParentVersion(); + if (checkVersion(version, nVersion)) { + updateEdpParentVersionInProject(pomPath, nVersion); + } + } + } + + protected void updateEdpParentVersionInProject(String path, String version) throws IOException { + FileOutputStream fileOutputStream = null; + try { + Parent parent = model.getParent(); + parent.setVersion(version); + model.setParent(parent); + fileOutputStream = new FileOutputStream(path); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + mavenXpp3Writer.write(fileOutputStream, model); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (!(null == fileOutputStream)) { + fileOutputStream.close(); + } + } + } + + protected String getEdpParentVersionInProject(String path) throws IOException { + FileInputStream fis = null; + try { + fis = new FileInputStream(path); + MavenXpp3Reader reader = new MavenXpp3Reader(); + model = reader.read(fis); + return model.getParent().getVersion(); + } catch (XmlPullParserException | IOException e) { + e.printStackTrace(); + } finally { + if (!(null == fis)) { + fis.close(); + } + } + return null; + } + + protected boolean checkVersion(String oldVersion, String newVersion) { + String[] minerOldVersion = oldVersion.split("\\."); + String[] minerNewVersion = newVersion.split("\\."); + for (int i = 0; i < minerNewVersion.length; i++) { + if (Integer.parseInt(minerNewVersion[i]) > Integer.parseInt(minerOldVersion[i])) { + return true; + } + } + return false; + } + + protected boolean isModelExist(String javaProjectPath) { + if (!fileService.isDirectoryExist(javaProjectPath)) { + fileService.createDirectory(javaProjectPath); + } + String relativeCodePath = commonServiceCore.getProjectPath(javaProjectPath); + if (relativeCodePath == null) { + isModelExist = false; + } else { + String absoluteCodePath = fileService.getCombinePath(jitContext.getGspProjectpath(), relativeCodePath); + List list = fileService.getAllFiles(absoluteCodePath); + for (File file : list) { + if (file.toString().endsWith(Utils.getPomFile())) { + return true; + } + } + } + return false; + } + + protected void clearCode(String javaProjectPath) throws IOException { + /** + * 由于路径过长,需要优化长度。考虑生成代码兼容问题。判断是否是老工程。老工程将代码继续生成在老工程下 + * 根据api module的名称即可 + */ + String relativeCodePath = commonServiceCore.getProjectPath(javaProjectPath); + String absoluteCodePath = fileService.getCombinePath(jitContext.getGspProjectpath(), relativeCodePath); + List allModuleName = fileService.getDirectorys(absoluteCodePath); + for (File module : allModuleName) { + if (module.getName().startsWith(jitContext.getGspProjectInfo().getAppCode().toLowerCase())) { + isOldProject = true; + } + if (module.getName().endsWith("api")) { + if (fileService.isDirectoryExist(module.toString() + File.separator + fixedPath)) { + fileService.deleteAllFilesUnderDirectory(module.toString() + File.separator + fixedPath); + clearProperties(jitContext, module.getName()); + } + } else if (module.getName().endsWith("core")) { + if (fileService.isDirectoryExist(module.toString() + File.separator + fixedPath)) { + fileService.deleteAllFilesUnderDirectory(module.toString() + File.separator + fixedPath); + clearProperties(jitContext, module.getName()); + } + } + } + } + + protected void installArchetype(String mavenPath) { + final String absoluteArchetypePath = fileService.getCombinePath(EnvironmentUtil.getServerRTPath(), archetypePath); + final String absoluteArchetypeTargetPath = fileService.getCombinePath(absoluteArchetypePath, archetypeTarget); + if (!fileService.isFileExist(absoluteArchetypeTargetPath)) { + //将程序运行目录中的maven模板安装到本地仓库 + String loStr = "开始:创建Maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + if (mavenUtilsCore.exeMavenCommand(absoluteArchetypePath, mavenPath, "install")) { + loStr = "完成:创建Maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + throw new RuntimeException("Maven模板创建失败,请检查Maven配置"); + } + } + } + + private void clearProperties(JitContext context, String module) { + String factoriesFilePath = context.getGspProjectpath() + "/java/code/" + module + "/src/main/" + JitUtils.getSpringPeopertiesPath(); + if (fileService.isFileExist(factoriesFilePath)) { + fileService.fileUpdate(factoriesFilePath, "", false); + } + } + + protected void generateArchetype(String javaProjectPath, String mavenPath) throws IOException { + String loStr = "开始:生成maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + final String groupId = getGroupId(jitContext); + final String artifactId = getArtifactId(jitContext); + String mvnCommand = String.format("archetype:generate -DarchetypeCatalog=local -DarchetypeArtifactId=%s -DarchetypeGroupId=com.inspur.edp -DarchetypeVersion=0.1.3 -DgroupId=%s -DartifactId=%s -Dversion=0.1.0-SNAPSHOT -Dpackage=com.inspur -DinteractiveMode=false", archetypeArtifactId, groupId, artifactId); + if (mavenUtilsCore.exeMavenCommand(javaProjectPath, mavenPath, mvnCommand)) { + loStr = "完成:生成maven模板"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + throw new RuntimeException("生成maven模板失败,请检查Maven配置"); + } + String javaProPath = javaProjectPath + File.separator + artifactId; + //重命名生成的目录 + renameDir(javaProjectPath, javaProPath); + } + + protected void renameDir(String basedir, String pro) throws IOException { + String finalProname = basedir + File.separator + Utils.getMavenProName(); + if (fileService.isDirectoryExist(finalProname)) { + String compPath = finalProname + File.separator + "comp"; + if (fileService.isDirectoryExist(compPath)) { + FileUtils.copyDirectory(new File(compPath), new File(pro + File.separator + "comp")); + } + try { + fileService.deleteAllFilesUnderDirectory(finalProname); + } catch (Exception e) { + + } finally { + if (fileService.isDirectoryExist(finalProname)) { + FileUtils.copyDirectory(new File(pro), new File(finalProname)); + fileService.deleteAllFilesUnderDirectory(pro); + } else { + boolean renameResult = fileService.renameDirectory(pro, finalProname); + if (!renameResult) { + throw new RuntimeException("重命名异常,原目录已存在"); + } + if (fileService.isFileExist(finalProname + File.separator + "pom.xml")) { + String loStr = "重命名目录成功!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + String loStr = "重命名目录失败!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + } + } + } else { + boolean renameResult = fileService.renameDirectory(pro, finalProname); + if (!renameResult) { + throw new RuntimeException("重命名异常,原目录已存在"); + } + if (fileService.isFileExist(finalProname + File.separator + "pom.xml")) { + String loStr = "重命名目录成功!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } else { + String loStr = "重命名目录失败!"; + log.info(loStr); + LoggerDisruptorQueue.publishEvent("[INFO] " + loStr, CAFContext.current.getUserId()); + } + } + } + + protected String getArtifactId(JitContext jitContext) { + String appCode = jitContext.getGspProjectInfo().getAppCode().toLowerCase(); + String suCode = jitContext.getGspProjectInfo().getServiceUnitCode().toLowerCase(); + String boCode = jitContext.getGspProjectInfo().getMetadataProjectName().toLowerCase(); + if (boCode.startsWith("bo-")) { + boCode = boCode.substring(boCode.indexOf("-") + 1); + } + String artifactId = String.format("%s-%s-%s", appCode, suCode, boCode); + + return artifactId; + } + + protected String getGroupId(JitContext jitContext) { + String groupId; + String prepareGroupId = jitContext.getGspProjectInfo().getProjectNameSpace().toLowerCase(); + String firstGroupId = "com."; + if (!prepareGroupId.contains(".")) { + return firstGroupId + prepareGroupId; + } + String[] subGroupId = prepareGroupId.split("\\."); + groupId = firstGroupId + (subGroupId[0] + "." + subGroupId[1]).toLowerCase(); + return groupId; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..2875594e52a9819489f8e20a99dd298e6bcba4ad --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerFactory.java @@ -0,0 +1,36 @@ +/* + * 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.jittojava.core.manager; + +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; + +public class GeneratorManagerFactory { + public static GeneratorManager createGeneratorManager(String projPath) { + final ProcessMode processMode = SpringBeanUtils.getBean(MetadataProjectService.class).getProcessMode(projPath); + GeneratorManager generatorManager; + switch (processMode.toString()) { + case "interpretation": + generatorManager = new GeneratorManagerForInterpretation(); + break; + default: + generatorManager = new GeneratorManagerForGeneration(); + break; + } + return generatorManager; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java new file mode 100644 index 0000000000000000000000000000000000000000..0712744311516c0e531da4502cbc732c4f7b67eb --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForGeneration.java @@ -0,0 +1,27 @@ +/* + * 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.jittojava.core.manager; + +import com.inspur.edp.jittojava.core.JitUtils; + +public class GeneratorManagerForGeneration extends GeneratorManager { + public GeneratorManagerForGeneration() { + archetypePath = JitUtils.getArchetypePath(); + archetypeTarget = JitUtils.getArchetypeTarget(); + archetypeArtifactId = JitUtils.getArchetypeArtifactId(); + refModule = "api"; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java new file mode 100644 index 0000000000000000000000000000000000000000..5173d5280c72d414d5aa4f900bc2ea9fe7c79b4e --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/manager/GeneratorManagerForInterpretation.java @@ -0,0 +1,117 @@ +/* + * 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.jittojava.core.manager; + +import com.inspur.edp.jittojava.context.JitContext; +import com.inspur.edp.jittojava.core.JitUtils; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackageHeader; +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.entity.ProjectHeader; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.common.Utils; +import java.io.File; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class GeneratorManagerForInterpretation extends GeneratorManager { + + public GeneratorManagerForInterpretation() { + archetypePath = JitUtils.getCompArchetypePath(); + archetypeTarget = JitUtils.getCompArchetypeTarget(); + archetypeArtifactId = JitUtils.getCompArchetypeArtifactId(); + refModule = "comp"; + } + + @Override + public void generate(String absolutePath, String mavenPath) throws Exception { + try { + //构建生成上下文 + jitContext = buildJitContext(absolutePath); + //创建maven工程与模块 + createMavenProject(jitContext, mavenPath); + //生成后事件 + afterGenerate(absolutePath); + } finally { + } + } + + @Override + public void generateApi(String absolutePath, String mavenPath) { + } + + @Override + protected void beforeGenerate(String absolutePath) { + } + + @Override + protected void clearCode(String javaProjectPath) { + } + + @Override + protected void generateCode(JitContext jitContext) { + } + + @Override + protected List getGenerationMavenPackageRefs(MetadataProject metadataProject, String mavenPath) { + List generationMavenPackageRefsWithVersion = new ArrayList<>(); + if (metadataProject.getMavenPackageRefs() != null && metadataProject.getMavenPackageRefs().size() > 0) { + for (MavenPackageRefs mavenPackageRefs : metadataProject.getMavenPackageRefs()) { + // 如果有bo内引用,可以根据bo内引用确定元数据包名 + if (metadataProject.getProjectRefs() != null && metadataProject.getProjectRefs().size() > 0) { + final String[] split = mavenPackageRefs.getArtifactId().split("-"); + String projectName = split[2]; + String projectNameOrElse = "bo-" + split[2]; + final ProjectHeader projectHeader = metadataProject.getProjectRefs().stream().filter(ref -> ref.getProjectPath().endsWith(projectName) || ref.getProjectPath().endsWith(projectNameOrElse)).findFirst().orElse(null); + if (projectHeader != null) { + final MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs().stream().filter(ref -> ref.getName().equals(projectHeader.getName())).findFirst().orElse(null); + if (metadataPackageHeader != null) { + if (metadataPackageHeader.getProcessMode() == null || ProcessMode.GENERATION.equals(metadataPackageHeader.getProcessMode())) { + generationMavenPackageRefsWithVersion.add(mavenPackageRefs); + } + continue; + } + } + } + + // 如果不是bo内引用,则去maven文件夹下去找元数据包名 + File mavenPackagePath = Paths.get(mavenPath).resolve(mavenPackageRefs.getGroupId() + "-" + mavenPackageRefs.getArtifactId() + "-" + mavenPackageRefs.getVersion()).toFile(); + // 如果不存在,先install + if (!mavenPackagePath.exists()) { + try { + mdpkgService.installMdpkg(mavenPackageRefs.getGroupId(), mavenPackageRefs.getArtifactId(), mavenPackageRefs.getVersion(), jitContext.getGspProjectpath(), false); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (!mavenPackagePath.exists()) { + continue; + } + final File mdpkgFile = Arrays.stream(mavenPackagePath.listFiles()).filter(file -> file.getName().endsWith(Utils.getMetadataPackageExtension())).findFirst().orElse(null); + if (mdpkgFile != null) { + final MetadataPackageHeader metadataPackageHeader = metadataProject.getMetadataPackageRefs().stream().filter(header -> (header.getName() + Utils.getMetadataPackageExtension()).equals(mdpkgFile.getName())).findFirst().orElse(null); + if (metadataPackageHeader != null && (metadataPackageHeader.getProcessMode() == null || ProcessMode.GENERATION.equals(metadataPackageHeader.getProcessMode()))) { + generationMavenPackageRefsWithVersion.add(mavenPackageRefs); + } + } + } + } + return generationMavenPackageRefsWithVersion; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..6420f66b2a347cc288a0ddba2062e8ed10997bf2 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/GenerateRepository.java @@ -0,0 +1,134 @@ +/* + * 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.jittojava.core.persistence; + +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; + +public class GenerateRepository { + + public void updateModuleRefs(String pomPath, List mavenPackageRefs, boolean appendFlag) { + if (mavenPackageRefs == null || mavenPackageRefs.size() < 1) { + return; + } + + Model model = getModel(pomPath); + if (model == null) { + throw new RuntimeException("解析pom失败:" + pomPath); + } + + if (appendFlag && dependenciesContainsAll(model.getDependencies(), mavenPackageRefs)) { + return; + } + + List dependencies = appendFlag ? getDependencies(model.getDependencies(), mavenPackageRefs) : getDependencies(mavenPackageRefs); + model.setDependencies(dependencies); + saveModel(pomPath, model); + } + + private boolean dependenciesContainsAll(List dependencies, List mavenPackageRefs) { + if (mavenPackageRefs == null) { + return true; + } + for (MavenPackageRefs ref : mavenPackageRefs) { + boolean existFlag = false; + for (Dependency dependency : dependencies) { + if (dependency.getGroupId().equals(ref.getGroupId()) + && dependency.getArtifactId().equals(ref.getArtifactId()) + && dependency.getVersion().equals(ref.getVersion().substring(1))) { + existFlag = true; + break; + } + } + if (!existFlag) { + return false; + } + } + return true; + } + + private List getDependencies(List mavenPackageRefs) { + ArrayList dependencies = new ArrayList<>(); + mavenPackageRefs.forEach(ref -> { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setVersion(ref.getVersion().substring(1)); + dependencies.add(dependency); + }); + return dependencies; + } + + private List getDependencies(List dependencies, List mavenPackageRefs) { + if (dependencies == null) { + dependencies = new ArrayList<>(); + } + List finalDependencies = dependencies; + mavenPackageRefs.forEach(ref -> { + int existInt = -1; + for (int i = 0; i < finalDependencies.size(); i++) { + if (ref.getArtifactId().equals(finalDependencies.get(i).getArtifactId()) + && ref.getGroupId().equals(finalDependencies.get(i).getGroupId())) { + existInt = i; + break; + } + } + if (existInt != -1) { + finalDependencies.get(existInt).setVersion(ref.getVersion().substring(1)); + } else { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + dependency.setVersion(ref.getVersion().substring(1)); + finalDependencies.add(dependency); + } + }); + return finalDependencies; + } + + private Model getModel(String pomPath) { + try { + FileInputStream fis = new FileInputStream(pomPath); + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + fis.close(); + return model; + } catch (XmlPullParserException | IOException e) { + e.printStackTrace(); + } + return null; + } + + private void saveModel(String pomPath, Model model) { + MavenXpp3Writer writer = new MavenXpp3Writer(); + try { + FileOutputStream fos = new FileOutputStream(pomPath); + writer.write(fos, model); + fos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..435959b8cd5a399e5ef2039fbb49fbd4adaa7b69 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/core/persistence/RepositoryFactory.java @@ -0,0 +1,39 @@ +/* + * 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.jittojava.core.persistence; + +public class RepositoryFactory { + private RepositoryFactory() { + } + + private static RepositoryFactory instance; + + public static RepositoryFactory getInstance() { + if (instance == null) { + instance = new RepositoryFactory(); + } + return instance; + } + + private GenerateRepository generateRepository; + + public GenerateRepository getGenerateRepository() { + if (generateRepository == null) { + generateRepository = new GenerateRepository(); + } + return generateRepository; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java new file mode 100644 index 0000000000000000000000000000000000000000..15fd3d3cfe183bc750297ee22f55fd9827fe7cdd --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/AfterGenerator.java @@ -0,0 +1,70 @@ +/* + * 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.jittojava.temp; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import com.inspur.edp.jittojava.core.GenerateServiceCore; +import com.inspur.edp.jittojava.spi.AfterGeneratorAction; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; + +/** + * @Classname AfterGenerator + * @Description TODO + * @Date 2019/12/17 16:02 + * @Created by liu_bintr + * @Version 1.0 + */ +public class AfterGenerator implements AfterGeneratorAction { + + GenerateServiceCore generateService = new GenerateServiceCore(); + Utils utils = new Utils(); + + @Override + public void afterGenerator(String projPath) { + addProjectDependency(projPath, null, utils.getDefaultDependency()); + FileServiceImp fileService = new FileServiceImp(); + String runtimePath = Paths.get(projPath).resolve("java/code/runtime").toString(); + if (fileService.isDirectoryExist(runtimePath)) { + try { + fileService.deleteAllFilesUnderDirectory(runtimePath); + } catch (IOException e) { + throw new RuntimeException(e); + } + generateService.removeRuntimeModule(projPath); + } + generateService.modifyPom(projPath, utils.getExtendDependency()); + generateService.modifyPom(projPath, utils.getSgfExtendDependency()); + } + + public void addProjectDependency(String projectPath, String currentJarPath, + ArrayList dependencyArrayList) { + String javaPath = getJavaProjPath(projectPath); + // 安装jar包到maven仓库 + Utils.installPackage(javaPath, currentJarPath, dependencyArrayList); + // 修改pom文件 + generateService.modifyPom(projectPath, dependencyArrayList); + } + + private String getJavaProjPath(String projPath) { + String javaPath = Paths.get(projPath).resolve("java").toString(); + String javaProjPath = Paths.get(javaPath).resolve(com.inspur.edp.lcm.metadata.common.Utils.getMavenProName()).toString(); + + return javaProjPath; + } +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java new file mode 100644 index 0000000000000000000000000000000000000000..19bd1f62bfe35d9309e7ed23e791d0c011974282 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/MavenDependencyConst.java @@ -0,0 +1,34 @@ +/* + * 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.jittojava.temp; + +/** + * @Classname MavenDependencyConst + * @Description TODO + * @Date 2019/12/16 16:36 + * @Created by liu_bintr + * @Version 1.0 + */ +public class MavenDependencyConst { + public static String groupId = "groupId"; + public static String artifactId = "artifactId"; + public static String version = "version"; + public static String file = "file"; + public static String dependency = "dependency"; + public static String dependencies = "dependencies"; + + public static String modules = "modules"; +} diff --git a/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java new file mode 100644 index 0000000000000000000000000000000000000000..b4080b5c1cd4aab6e0d6136cde035161dbd27084 --- /dev/null +++ b/model/framework/generator-core/src/main/java/com/inspur/edp/jittojava/temp/Utils.java @@ -0,0 +1,142 @@ +/* + * 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.jittojava.temp; + +import com.inspur.edp.jittojava.context.entity.MavenDependency; +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; + +/** + * @Classname Utils + * @Description TODO + * @Date 2019/12/17 16:05 + * @Created by liu_bintr + * @Version 1.0 + */ +public class Utils { + public static void installPackage(String projectPath, String currentJarPath, + ArrayList dependencyArrayList) { + // 组装命令 + String command = String.format("cmd /c cd %s", projectPath); + Process process = null; + if (currentJarPath != null && !currentJarPath.isEmpty()) { + String addDependencyCommand = "mvn install:install-file -DgroupId=%1$s " + + "-DartifactId=%2$s -Dversion=%3$s -Dpackaging=jar -Dfile=%4$s"; + for (MavenDependency dependency : dependencyArrayList) { + String addCommand = String.format(addDependencyCommand, dependency.getGroupId(), + dependency.getArtifactId(), dependency.getVersion(), getPathString(String.format(currentJarPath + "\\%1$s", + dependency.getFile()))); + command = command.concat(" && " + addCommand); + } + } + excecuteCommand(process, command, "添加bef相关jar包"); + } + + public static void excecuteCommand(Process process, String command, String funcMessage) { + // 执行命令 + try { + process = Runtime.getRuntime().exec(command); + log(funcMessage + "开始..."); + BufferedReader reader = new BufferedReader(new InputStreamReader( + process.getInputStream())); + String line; + while ((line = reader.readLine()) != null) { + log(line); + } + process.waitFor(); + if (process.exitValue() == 1) { + log(funcMessage + "失败"); + } + log(funcMessage + "完成"); + process.destroy(); + } catch (IOException | InterruptedException e) { + e.printStackTrace(); + } + } + + public static void log(String message) { + Boolean showLog = true; + if (showLog) { + //todo +// message + } + } + + public static String getAbsolutePathString(String path) { + return new File(path).getAbsolutePath(); + } + + public ArrayList getExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/BefExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + + private ArrayList readInternalDependency(String defaultDependencyPath) { + ArrayList result = new ArrayList<>(); + Document doc = readDocument(defaultDependencyPath); + Element rootElement = doc.getRootElement(); + List list = rootElement.elements(); + for (int i = 0; i < list.size(); i++) { + Element ele = (Element) list.get(i); + result.add(new MavenDependency(getTagValue(ele, MavenDependencyConst.groupId), getTagValue(ele, MavenDependencyConst.artifactId), + getTagValue(ele, MavenDependencyConst.version), getTagValue(ele, MavenDependencyConst.file))); + } + return result; + } + + private Document readDocument(String filePath) { + SAXReader sr = new SAXReader(); + try { + return sr.read(filePath); + } catch (DocumentException e) { + throw new RuntimeException("无效路径" + filePath); + } + } + + private String getTagValue(Element ele, String tagName) { + Element tagElement = (Element) ele.element(tagName); + if (tagElement == null) { + return null; + } + return tagElement.getText(); + } + + private static String getPathString(String path) { + return getAbsolutePathString(path); + } + + public ArrayList getDefaultDependency() { + String defaultDependencyPath = + this.getClass().getResource("/BefProjectMavenDependency.xml").toString(); + return readInternalDependency(defaultDependencyPath); + } + + public ArrayList getSgfExtendDependency() { + String extendDependencyPath = + this.getClass().getResource("/SgfExtendMavenDependency.xml").toString(); + return readInternalDependency(extendDependencyPath); + } + +} diff --git a/model/framework/generator-spi/pom.xml b/model/framework/generator-spi/pom.xml index 88aadabdf8ec1e8b7012e50b23a4e87a32a56c74..3acbd380ec3a7b059276d771d3033de25f720a07 100644 --- a/model/framework/generator-spi/pom.xml +++ b/model/framework/generator-spi/pom.xml @@ -1,4 +1,20 @@ + + diff --git a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java similarity index 68% rename from model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java rename to model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java index 330357d47d4424a78a403246ac80af2318adc9ef..b78e9631207caf899b43699ad9373e11f2afdc6b 100644 --- a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/AfterGeneratorAction.java +++ b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/AfterGeneratorAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.spi; +package com.inspur.edp.jittojava.spi; /** * @Classname AfterGeneratorAction diff --git a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java similarity index 59% rename from model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java rename to model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java index 19ef3eebbc4c91b4658881649e21a8c37ac35ba9..4c6f87947c9f903ae4a410587b1ff61610d8cd65 100644 --- a/model/framework/generator-spi/src/main/java/org/openatom/ubml/model/framework/generator/spi/JitAction.java +++ b/model/framework/generator-spi/src/main/java/com/inspur/edp/jittojava/spi/JitAction.java @@ -1,9 +1,9 @@ /* - * Copyright © OpenAtom Foundation. + * 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 + * 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 * @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.openatom.ubml.model.framework.generator.spi; +package com.inspur.edp.jittojava.spi; -import org.openatom.ubml.model.framework.generator.api.JitContext; +import com.inspur.edp.jittojava.context.JitContext; public interface JitAction { void generateApi(JitContext context); diff --git a/model/framework/generator-webapi/pom.xml b/model/framework/generator-webapi/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..cbc6e74cd2bcf35c4999c71a8f8c3ab6e057d2d4 --- /dev/null +++ b/model/framework/generator-webapi/pom.xml @@ -0,0 +1,52 @@ + + + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-generator-webapi ${project.version} + ubml-model-framework-generator-webapi + + + + org.openatom.ubml + ubml-model-framework-generator-api + ${project.version} + + + io.iec.edp + caf-boot-starter-rest-server + + + lombok + org.projectlombok + + + + + + 8 + 8 + + + \ No newline at end of file diff --git a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java new file mode 100644 index 0000000000000000000000000000000000000000..baaa2d375b0db2e291439f4b3ab43d26b8f4d684 --- /dev/null +++ b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/GenerateController.java @@ -0,0 +1,48 @@ +/* + * 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.jittojava.webapi; + +import com.inspur.edp.jittojava.context.GenerateService; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; + +/** + * @Classname GenerateServiceWebApiImp + * @Description TODO + * @Date 2019/12/16 17:21 + * @Created by liu_bintr + * @Version 1.0 + */ +@Path("/") +@Produces(MediaType.APPLICATION_JSON) +public class GenerateController { + GenerateService generateService = SpringBeanUtils.getBean(GenerateService.class); + + @POST + public void generate(@QueryParam(value = "path") String path) throws Exception { + generateService.generate(path); + } + + @POST + @Path("/generateapi") + public void generateApi(@QueryParam(value = "path") String path) throws Exception { + generateService.generateApi(path); + } +} diff --git a/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java new file mode 100644 index 0000000000000000000000000000000000000000..4b2747fc578c316e7e43615ca43ad46d61465c20 --- /dev/null +++ b/model/framework/generator-webapi/src/main/java/com/inspur/edp/jittojava/webapi/config/Configuration.java @@ -0,0 +1,38 @@ +/* + * 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.jittojava.webapi.config; + +import com.inspur.edp.jittojava.webapi.GenerateController; +import io.iec.edp.caf.rest.RESTEndpoint; +import org.springframework.context.annotation.Bean; + +/** + * Classname Configuration Description TODO Date 2019/12/17 10:19 + * + * @author zhongchq + * @version 1.0 + */ +public class Configuration { + + @Bean + public RESTEndpoint generateEndpoint() { + return new RESTEndpoint( + "/dev/main/v1.0/generator", + new GenerateController() + ); + } + +} diff --git a/model/framework/metadata-shell/pom.xml b/model/framework/metadata-shell/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..df09de5a50d267cc4774efb9fc6f10a4d2bb4500 --- /dev/null +++ b/model/framework/metadata-shell/pom.xml @@ -0,0 +1,52 @@ + + + + + + ubml-model-framework + org.openatom.ubml + 0.9.0-SNAPSHOT + + 4.0.0 + ubml-model-framework-metadata-shell ${project.version} + ubml-model-framework-metadata-shell + + + 8 + 8 + + + + + org.springframework.boot + spring-boot-starter + + + org.springframework.shell + spring-shell-starter + + + + org.openatom.ubml + ubml-model-framework-devtime-core + ${project.version} + + + + \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..e05d517e05fca6f187d60077e842a256509c327e --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/ShellApplication.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata; + +import org.jline.utils.AttributedString; +import org.jline.utils.AttributedStyle; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +import static com.inspur.edp.lcm.metadata.shell.Utils.SPRING_SHELL_FLAG_NAME; +import static com.inspur.edp.lcm.metadata.shell.Utils.SPRING_SHELL_FLAG_TRUE; + +@SpringBootApplication(scanBasePackages = {"io.iec.edp", "com.inspur"}) +public class ShellApplication { + public static void main(String[] args) { + System.setProperty(SPRING_SHELL_FLAG_NAME, SPRING_SHELL_FLAG_TRUE); + SpringApplication.run(ShellApplication.class, args); + } + + @Bean + public org.springframework.shell.jline.PromptProvider myPromptProvider() { + return () -> new AttributedString("lcm-metadata-shell:>", AttributedStyle.DEFAULT.foreground(AttributedStyle.YELLOW)); + } +} diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..78ee06af133e5165031e8c5ac59e2525aad9a127 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/MetadataCommand.java @@ -0,0 +1,206 @@ +/* + * 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.lcm.metadata.shell; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataProject; +import com.inspur.edp.lcm.metadata.api.entity.ProcessMode; +import com.inspur.edp.lcm.metadata.api.mvnEntity.MavenPackageRefs; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.api.service.MetadataProjectService; +import com.inspur.edp.lcm.metadata.core.MavenUtilsCore; +import com.inspur.edp.lcm.metadata.core.MetadataCoreManager; +import com.inspur.edp.lcm.metadata.core.MetadataProjectServiceImp; +import com.inspur.edp.lcm.metadata.core.PackageCoreService; +import com.inspur.edp.lcm.metadata.core.PackageGenerateCoreService; +import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.model.io.xpp3.MavenXpp3Reader; +import org.apache.maven.model.io.xpp3.MavenXpp3Writer; +import org.codehaus.plexus.util.xml.pull.XmlPullParserException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.shell.standard.ShellComponent; +import org.springframework.shell.standard.ShellMethod; +import org.springframework.shell.standard.ShellOption; +import org.springframework.util.StringUtils; + +/** + * @author zhongchq + */ +@ShellComponent +public class MetadataCommand { + private static final Logger log = LoggerFactory.getLogger(MetadataCommand.class); + + MetadataProjectService metadataProjectService = new MetadataProjectServiceImp(); + + @Autowired + FileService fileService; + + String gspprojectJson = "gspproject.json"; + String defaultVersion = "0.1.0-SNAPSHOT"; + String code = "code"; + + @ShellMethod(key = "compile", value = "Compile Projects") + public void compile(String path, String mavenPath) { + path = path + File.separator + "java" + File.separator + "code"; + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + mavenUtilsCore.exeMavenCommand(path, mavenPath, "clean install"); + } + + //version为该工程的版本号。对于解析型,生成型默认的版本号为0.1.0-SNAPSHOT + @ShellMethod(key = "push", value = "Push Metadata.") + public void pushMetadata(String path, String repoId, String mavenPath, + @ShellOption(defaultValue = "0.1.0-SNAPSHOT") String version) { + ManagerUtils.setMavenStoragePath(mavenPath); + final ProcessMode processMode = metadataProjectService.getProcessMode(path); + PackageCoreService packageCoreService = new PackageCoreService(); + switch (processMode.toString()) { + case "interpretation": + packageCoreService.deployMdpkgForInterpretation(path, repoId, version, null, mavenPath); + break; + default: + packageCoreService.deploySnapshotMdVersion(path, repoId, version, false, mavenPath); + } + } + + /*** + * @author zhongchq + * @param path 工程路径 + **/ + @ShellMethod(key = "compileall", value = "Compile All Projects UnderDir") + public void compileAllProjects(String path, String mavenPath) { + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(path, allDirectories, gspprojectJson); + MavenUtilsCore mavenUtilsCore = new MavenUtilsCore(); + for (String proDir : directories) { + proDir = proDir + File.separator + "java" + File.separator + "code"; + mavenUtilsCore.exeMavenCommand(proDir, mavenPath, "clean install"); + } + } + + @ShellMethod(key = "extract", value = "Extract Package.") + public void extract(String path, String desDir) { + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(path, allDirectories, gspprojectJson); + for (String directory : directories) { + String publishDir = directory + File.separator + "publish"; + if (new File(publishDir).exists()) { + fileService.folderCopy(publishDir, desDir); + } + } + } + + @ShellMethod(key = "restore", value = "Pull Metadata Package.") + public void restore(String path, String mavenPath) { + String packagePathT = Utils.createTempDir(); + try { + PackageCoreService mdPkgService = new PackageCoreService(); + mdPkgService.restore(path, true, mavenPath, packagePathT); + log.info("restore complete"); + } finally { + log.info("clear temp files"); + Utils.delDir(packagePathT); + log.info("clear complete"); + } + } + + @ShellMethod(key = "restoreWithPath", value = "Pull Metadata Package with packagePath.") + public void restore(String path, String mavenPath, String packagePath) { + String packagePathT = ""; + if (StringUtils.isEmpty(packagePath)) { + packagePathT = Utils.createTempDir(); + } + try { + PackageCoreService mdPkgService = new PackageCoreService(); + mdPkgService.restore(path, true, mavenPath, packagePathT); + } finally { + if (StringUtils.isEmpty(packagePath)) { + Utils.delDir(packagePathT); + } + } + } + +// @ShellMethod(key = "generatecode",value = "Generate Code.") +//// public void generateCode(String path) throws Exception { +//// generateService.generate(path); +//// } + + @ShellMethod(key = "packmd", value = "Generate Metadata Package.") + public void generateMdPack(String path) { + path = path + File.separator + "metadata"; +// ManagerUtils.setDevRootPath(devPath); + PackageGenerateCoreService packageGenerateCoreService = new PackageGenerateCoreService(); + packageGenerateCoreService.generatePackage(path); + log.info("元数据打包完成!"); + } + + /** + * @param boPath bo工程所在路径,相对于projects.eg:bf/df + * @throws IOException IO异常 + * @author zhongchq + **/ + @ShellMethod("Update Api Modules Dependencies Version.") + void updateApiDependencies(String boPath) throws IOException { + File projDir = new File(boPath); + List allDirectories = new ArrayList<>(); + List directories = fileService.getAllProjectsDirectories(boPath, allDirectories, gspprojectJson); + for (String dir : directories) { + File file = new File(dir); + String mdprojPath = "metadata" + File.separator + file.getName() + ".mdproj"; + MetadataCoreManager manager = new MetadataCoreManager(); + MetadataProject metadataProjInfo = manager.getMetadataProjInfo(file.getPath() + File.separator + mdprojPath); + List refs = metadataProjInfo.getMavenPackageRefs(); + String apiPath = file.getPath() + "/java/code/api/pom.xml"; + if (!(refs == null)) { + try (FileInputStream fis = new FileInputStream(apiPath)) { + MavenXpp3Reader reader = new MavenXpp3Reader(); + Model model = reader.read(fis); + List dependencies = model.getDependencies(); + dependencies.clear(); + if (refs.size() > 0) { + for (MavenPackageRefs ref : refs) { + Dependency dependency = new Dependency(); + dependency.setGroupId(ref.getGroupId()); + dependency.setArtifactId(ref.getArtifactId()); + if (ref.getVersion().startsWith("m")) { + dependency.setVersion(ref.getVersion().substring(1)); + } else { + dependency.setVersion(ref.getVersion()); + } + dependencies.add(dependency); + } + } + model.setDependencies(dependencies); + MavenXpp3Writer mavenXpp3Writer = new MavenXpp3Writer(); + try (FileOutputStream fileOutputStream = new FileOutputStream(apiPath)) { + mavenXpp3Writer.write(fileOutputStream, model); + } + } catch (IOException | XmlPullParserException e) { + throw new IOException("update apimodules error!", e); + } + } + + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java new file mode 100644 index 0000000000000000000000000000000000000000..0918d768f1397d9840328e70d1594bcb13c606b4 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringCommandRunner.java @@ -0,0 +1,69 @@ +/* + * 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.lcm.metadata.shell; + +import java.util.List; +import java.util.PriorityQueue; +import java.util.Queue; +import java.util.stream.Collectors; +import org.jline.reader.Parser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.annotation.Order; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.shell.Shell; +import org.springframework.shell.jline.InteractiveShellApplicationRunner; + +/** + * @Description: 自定义命令Runner, 启动应用后直接执行多条命令, 执行后结束 + */ +@Order(InteractiveShellApplicationRunner.PRECEDENCE - 50) // order 越小, 越先执行 +public class StringCommandRunner implements ApplicationRunner { + + @Lazy + @Autowired + private Parser parser; + + @Lazy + @Autowired + private Shell shell; + + @Lazy + @Autowired + private ConfigurableEnvironment environment; + + @Override + public void run(ApplicationArguments args) throws Exception { + //过滤掉所有@开头的参数, @开头的参数交给ScriptShellApplicationRunner 处理 + List cmds = args.getNonOptionArgs().stream() + .filter(s -> !s.startsWith("@")) + .collect(Collectors.toList()); + + //如果启动参数中, 命令不为空, 则执行 + if (cmds.size() > 0) { + // 关闭交互式应用: 确保关闭应用后, 直接退出应用, 不停留在交互式窗口中 + InteractiveShellApplicationRunner.disable(environment); + + // 将所有命令存储到队列中 + Queue queue = new PriorityQueue<>(cmds); + + // 执行命令 + shell.run(new StringInputProvider(parser, queue)); + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java new file mode 100644 index 0000000000000000000000000000000000000000..cbfdc992b9ca9625a14d36fb596f38347511ac4a --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringInputProvider.java @@ -0,0 +1,50 @@ +/* + * 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.lcm.metadata.shell; + +import java.util.Queue; +import org.jline.reader.ParsedLine; +import org.jline.reader.Parser; +import org.springframework.shell.Input; +import org.springframework.shell.InputProvider; + +/* + * 读取命令 + */ +public class StringInputProvider implements InputProvider { + + // 存储要执行的所有命令 + private Queue commands; + + private final Parser parser; + + public StringInputProvider(Parser parser, Queue commands) { + this.parser = parser; + this.commands = commands; + } + + @Override + public Input readInput() { + String command = commands.poll(); + if (command == null) { + // return null 时退出应用 + return null; + } else { + ParsedLine parsedLine = parser.parse(command, command.length()); + return new StringParsedLineInput(parsedLine); + } + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java new file mode 100644 index 0000000000000000000000000000000000000000..6446d0eebd15787b4be3f52183daf7eeac91cb48 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/StringParsedLineInput.java @@ -0,0 +1,51 @@ +/* + * 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.lcm.metadata.shell; + +import java.util.List; +import java.util.stream.Collectors; +import org.jline.reader.ParsedLine; +import org.springframework.shell.Input; + +/* + * 自定义行解析, 复制的底层代码: org.springframework.shell.jline.ParsedLineInput + */ +public class StringParsedLineInput implements Input { + + private final ParsedLine parsedLine; + + StringParsedLineInput(ParsedLine parsedLine) { + this.parsedLine = parsedLine; + } + + @Override + public String rawText() { + return parsedLine.line(); + } + + @Override + public List words() { + return sanitizeInput(parsedLine.words()); + } + + static List sanitizeInput(List words) { + words = words.stream() + .map(s -> s.replaceAll("^\\n+|\\n+$", "")) + .map(s -> s.replaceAll("\\n+", " ")) + .collect(Collectors.toList()); + return words; + } +} \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java new file mode 100644 index 0000000000000000000000000000000000000000..c2cbdf53530ac750562d70496f0703a8bffc9b71 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/Utils.java @@ -0,0 +1,49 @@ +/* + * 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.lcm.metadata.shell; + +import java.io.File; + +public class Utils { + public static final String SPRING_SHELL_FLAG_NAME = "spring-shell"; + public static final String SPRING_SHELL_FLAG_TRUE = "1"; + + public static void delDir(String filePath) { + File file = new File(filePath); + if (file.exists()) + delDir(file); + } + + public static void delDir(File file) { + if (file.isDirectory()) { + File zFiles[] = file.listFiles(); + for (File file2 : zFiles) { + delDir(file2); + } + file.delete(); + } else { + file.delete(); + } + } + + public static String createTempDir() { + File file = new File("packages"); + if (file.exists()) + file = new File("packages" + Runtime.getRuntime()); + file.mkdir(); + return file.getPath(); + } +} diff --git a/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..c510efff921f1ad7d8b9773692d4e2d4dd1d8dc5 --- /dev/null +++ b/model/framework/metadata-shell/src/main/java/com/inspur/edp/lcm/metadata/shell/config/ShellConfiguration.java @@ -0,0 +1,34 @@ +/* + * 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.lcm.metadata.shell.config; + +import com.inspur.edp.lcm.metadata.shell.StringCommandRunner; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RefConfiguration Description ref配置类 Date 2019/11/28 10:34 + * + * @author zhongchq + * @version 1.0 + */ +@Configuration +public class ShellConfiguration { + @Bean + public StringCommandRunner create() { + return new StringCommandRunner(); + } +} diff --git a/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories b/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000000000000000000000000000000000000..6c7a393e91ed7db54c7e2b2e6b73779bb446e7fd --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/META-INF/spring.factories @@ -0,0 +1 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.inspur.edp.lcm.metadata.shell.config.ShellConfiguration \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/resources/application.yaml b/model/framework/metadata-shell/src/main/resources/application.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e6724a62ebc73f6b58a388a6d1fa5ddc37de3f4c --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/application.yaml @@ -0,0 +1,8 @@ +application: + version: 0.1.0-SNAPSHOT +logging: + pattern: + console: "%date{yyyy-MM-dd HH:mm:ss.SSS}[%level][%thread]-%msg%n" + level: + root: warn + com.inspur.edp.lcm.metadata.shell.ShellApplication: warn \ No newline at end of file diff --git a/model/framework/metadata-shell/src/main/resources/banner.txt b/model/framework/metadata-shell/src/main/resources/banner.txt new file mode 100644 index 0000000000000000000000000000000000000000..08bdee9d0f116a4601d17c1937ddc9f8463dfd13 --- /dev/null +++ b/model/framework/metadata-shell/src/main/resources/banner.txt @@ -0,0 +1,10 @@ +${AnsiColor.BRIGHT_YELLOW} ${AnsiStyle.BOLD} +Welcome to +// .__ ________ .___ ____ ___ ______ +// |__| / _____/ | |\ \/ / \ \ \ \ +// | |/ \ ___ | | \ / \ \ \ \ +// | |\ \_\ \| | / \ ) ) ) ) +// |__| \______ /|___|/___/\ \ / / / / +// ==============\/============\_/ /_/_/_/ + +iGIX Development Kit (${application.version}) \ No newline at end of file diff --git a/model/framework/pom.xml b/model/framework/pom.xml index 2bbf042619be79b617e81d1fa9c3435108c7c88d..b29908a04f3ffd3b31706f05fef6ba80fba52939 100644 --- a/model/framework/pom.xml +++ b/model/framework/pom.xml @@ -1,4 +1,20 @@ + + @@ -14,8 +30,10 @@ ubml-model-framework pom + entity devtime-api devtime-core + devtime-webapi runtime-spi runtime-api runtime-core @@ -23,7 +41,142 @@ generator-api generator-spi generator-core + generator-webapi + metadata-shell + + 2.2.0.RELEASE + 1.2.62 + 2.0.1.RELEASE + + 0.3.7-SNAPSHOT + 0.3.2 + 0.3.3 + 0.1.4 + 0.1.2 + 0.3.2 + 0.3.8 + 0.3.2 + 0.1.0-SNAPSHOT + + 0.1.4 + 0.1.25 + 0.1.0 + 3.6.1 + 0.1.4 + 0.1.3 + 0.1.0 + + + + + + + + + + + com.alibaba + fastjson + ${fastjson.version} + + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + + org.springframework.shell + spring-shell-starter + ${spring-shell-starter.version} + + + + io.iec.edp + caf-boot-commons-environment + ${caf-boot-commons-environment.version} + + + io.iec.edp + caf-boot-commons-layeringcache + ${caf-boot-commons-layeringcache.version} + + + io.iec.edp + caf-boot-starter-context + ${caf-boot-starter-context.version} + compile + + + io.iec.edp + caf-business-object-api + ${caf-business-object-api.version} + + + com.inspur.edp + i18n-resource-api + ${i18n-resource-api.version} + + + io.iec.edp + caf-boot-starter-rest-server + ${caf-boot-starter-rest-server.version} + + + io.iec.edp + caf-sumgr-core + ${caf-sumgr-core.version} + + + io.iec.edp + caf-rpc-api + ${caf-rpc-api.version} + + + com.inspur.edp + caf-generator + ${caf-generator.version} + + + + com.inspur.edp + lcm-logging-service + ${lcm-logging-service.version} + + + com.inspur.edp + lcm-metadata-spi + ${lcm-metadata-spi.version} + compile + + + com.inspur.edp + lcm-project-deployer-spi + ${lcm-project-deployer-spi.version} + compile + + + org.apache.maven + maven-settings + ${maven-settings.version} + + + com.inspur.edp + ide-setting-core + ${ide-setting-core.version} + + + com.inspur.edp + metadata-to-java-context + ${metadata-to-java-context.version} + + + com.inspur.edp + workspace-api + ${workspace-api.version} + + + \ No newline at end of file diff --git a/model/framework/runtime-api/pom.xml b/model/framework/runtime-api/pom.xml index b66e305035a358a46d34b49b895def7cf843ece4..579c68693b43f7c9d7bcb1e0c0803d872a1b04e7 100644 --- a/model/framework/runtime-api/pom.xml +++ b/model/framework/runtime-api/pom.xml @@ -1,4 +1,20 @@ + + @@ -11,6 +27,17 @@ ubml-model-framework-runtime-api ${project.version} + + + io.iec.edp + caf-rpc-api + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + ubml-model-framework-runtime-api diff --git a/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java b/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java new file mode 100644 index 0000000000000000000000000000000000000000..bed0f78ff3cd64e5019eea8387920b11b74b4761 --- /dev/null +++ b/model/framework/runtime-api/src/main/java/com/inspur/edp/lcm/metadata/serverapi/MetadataRTServerService.java @@ -0,0 +1,161 @@ +/* + * 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.lcm.metadata.serverapi; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import io.iec.edp.caf.rpc.api.annotation.GspServiceBundle; +import io.iec.edp.caf.rpc.api.annotation.RpcParam; +import java.util.List; +import java.util.Map; + +@GspServiceBundle(applicationName = "runtime", serviceUnitName = "Lcm", serviceName = "metadata-rt") +public interface MetadataRTServerService { + + /** + * 根据元数据id获取运行时元数据 + * + * @param id 元数据id + * @return 元数据内容实体 + */ + MetadataDto getMetadataDtoRTByID(@RpcParam(paramName = "id") String id); + + /** + * 根据元数据ID获取元数据 + * + * @param id 元数据id + * @return 元数据内容实体 + */ + MetadataDto getMetadataDto(@RpcParam(paramName = "id") String id); + + /** + * 根据元数据id获取元数据 + * + * @param id 元数据ID + * @return 元数据内容实体 + */ + GspMetadata getMetadata(String id); + + /** + * @Author Robin + * @Description 加载服务端所有的元数据 + * @Date 10:02 2019/8/20 + * @Param [] + **/ + void loadAllMetadata(); + + /** + * 根据元数据类型获取元数据 + * + * @param metadataTypes 元数据类型类别,以逗号拼接 + * @return 序列化的元数据信息列表 + */ + String getMetadataRefDtoListWithTypes(String metadataTypes); + + /** + * @return 元数据信息列表 + */ + String getMetadataRefDtoList(); + + /** + * 获取所有元数据信息列表 + * + * @return 元数据信息列表 + */ + List getMetadataRefList(); + + /** + * 根据类型获取元数据信息列表 + * + * @param metadataTypes + * @return + */ + List getMetadataRefListWithTypes(@RpcParam(paramName = "metadataTypes") String metadataTypes); + + /** + * 根据过滤条件获取元数据信息列表 + * + * @param filter 过滤条件 + * @return 元数据信息列表 + */ + String getMetadataDtoListByFilter(@RpcParam(paramName = "filter") String filter); + + /** + * 根据逻辑ID获取元数据 + * + * @param metadataNamespace 命名空间 + * @param metadataCode 元数据编号 + * @param metadataTypeCode 元数据类型 + * @return 元数据实体 + */ + MetadataDto getMetadataDtoBySemanticID(@RpcParam(paramName = "metadataNamespace") String metadataNamespace, + @RpcParam(paramName = "metadataCode") String metadataCode, + @RpcParam(paramName = "metadataTypeCode") String metadataTypeCode); + + /** + * 根据过滤条件虎丘元数据信息列表 + * + * @param filter 过滤条件 + * @return 元数据信息列表 + */ + List getMetadataListByFilter(MetadataRTFilter filter); + + /** + * 根据元数据ID获取SU信息 + * + * @param metadataId 元数据ID + * @return 元数据所属SU信息 + */ + ServiceUnitInfo getServiceUnitInfo(@RpcParam(paramName = "metadataId") String metadataId); + + /** + * 获取元数据 + * + * @param metadataCustomizationFilter 运行时定制元数据过滤器 + * @return 元数据内容实体 + */ + String getMetadataString( + @RpcParam(paramName = "metadataCustomizationFilter") MetadataCustomizationFilter metadataCustomizationFilter); + + /** + * 根据路径递归获取路径下元数据包中元数据列表 + * + * @param path 路径 + * @return 元数据列表 + */ + List getMetadataListRecursivly(String path); + + /** + * 获取路径下元数据包列表 + * + * @param path 路径 + * @return 元数据包列表 + */ + Map getMetadataPackagesRecursivly(String path); + + /** + * 根据元数据包路径及元数据包信息获取元数据列表 + * + * @param packagePath 元数据包路径 + * @return 元数据列表 + */ + List getMetadataListFromPackage(String packagePath); +} diff --git a/model/framework/runtime-core/pom.xml b/model/framework/runtime-core/pom.xml index ce61f0dd22749b658c3a34c42d7bec18eb8bbf21..7225e80631b4d59caf476a01215f4bfbb8b549a1 100644 --- a/model/framework/runtime-core/pom.xml +++ b/model/framework/runtime-core/pom.xml @@ -1,4 +1,20 @@ + + @@ -12,7 +28,36 @@ ubml-model-framework-runtime-core ubml-model-framework-runtime-core ${project.version} + + + com.inspur.edp + i18n-resource-api + + + lcm-metadata-api + com.inspur.edp + + + + + org.openatom.ubml + ubml-model-framework-common + ${project.version} + + + org.openatom.ubml + ubml-model-framework-runtime-spi + 0.9.0-SNAPSHOT + compile + + + org.openatom.ubml + ubml-model-framework-runtime-api + 0.9.0-SNAPSHOT + compile + + \ No newline at end of file diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java new file mode 100644 index 0000000000000000000000000000000000000000..75cac36e43a2a3822efd61572c82631e2a36bc0b --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRTServiceImp.java @@ -0,0 +1,161 @@ +/* + * 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.lcm.metadata.rtservice; + +import com.inspur.edp.i18n.resource.api.II18nResourceRTManager; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.MetadataRTService; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.rpc.api.service.RpcClient; +import java.util.LinkedHashMap; +import java.util.List; + +public class MetadataRTServiceImp implements MetadataRTService { + MetadataRtUtils utils = new MetadataRtUtils(); + + private Cache cacheManager; + + @Override + public GspMetadata getMetadataRTByID(String id) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("id", id); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoRTByID", "Lcm", params, null); + return MetadataDtoConverter.asMetadata(response); + } + + @Override + public GspMetadata getMetadata(String id) { + String language = RuntimeContext.getLanguage(); + String metadataKey = RtCacheHandler.getMetadataCacheKey(id, language); + Cache cacheManager = MetadataDistCacheManager.getMetadataCache(); + GspMetadata metadata = cacheManager.get(metadataKey, GspMetadata.class); + if (metadata != null) { + return metadata; + } + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("id", id); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDto", "Lcm", params, null); + metadata = MetadataDtoConverter.asMetadata(response); + if (metadata != null) { + cacheManager.put(metadataKey, metadata); + } + return metadata; + } + + @Override + public GspMetadata getMetadata(MetadataCustomizationFilter metadataCustomizationFilter) { + String language = metadataCustomizationFilter.isI18n() ? RuntimeContext.getLanguage() : ""; + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataCustomizationFilter.getMetadataId(), language); + cacheManager = MetadataDistCacheManager.getMetadataCache(); + GspMetadata metadata = cacheManager.get(metadataKey, GspMetadata.class); + if (metadata != null) { + return metadata; + } + + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataCustomizationFilter", metadataCustomizationFilter); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataString", "Lcm", params, null); + metadata = new MetadataSerializer().deserialize(response, GspMetadata.class); + + if (metadataCustomizationFilter.isI18n()) { + try { + List resources = SpringBeanUtils.getBean(II18nResourceRTManager.class).getI18nResource(metadata, language); + MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(metadata.getHeader().getType()); + if (service != null && resources != null && resources.size() > 0) { + GspMetadata result = service.merge(metadata, resources); + RtCacheHandler.updateMetadataCache(metadataKey, result); + return result; + } + } catch (Exception e) { + //TODO 表单强制获取资源项,获取不到时会报错,异常太多,暂时catch住 + } + } + + if (metadata != null) { + cacheManager.put(metadataKey, metadata); + } + return metadata; + } + + @Override + public void loadAllMetadata() { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.loadAllMetadata", "Lcm", params, null); + } + + @Override + public List getMetadataRefList(String metadataTypes) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataTypes", metadataTypes); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataRefDtoListWithTypes", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public List getMetadataRefList() { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataRefDtoList", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public List getMetadataListByFilter(MetadataRTFilter filter) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("filter", utils.serializerMetadataRtFilter(filter)); + String response = client.invoke(String.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoListByFilter", "Lcm", params, null); + return utils.buildMetadata4RefList(response); + } + + @Override + public GspMetadata getMetadataBySemanticID(String metadataNamespace, String metadataCode, String metadataTypeCode) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataNamespace", metadataNamespace); + params.put("metadataCode", metadataCode); + params.put("metadataTypeCode", metadataTypeCode); + MetadataDto response = client.invoke(MetadataDto.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getMetadataDtoBySemanticID", "Lcm", params, null); + return MetadataDtoConverter.asMetadata(response); + } + + @Override + public ServiceUnitInfo getServiceUnitInfo(String metadataId) { + RpcClient client = SpringBeanUtils.getBean(RpcClient.class); + LinkedHashMap params = new LinkedHashMap<>(); + params.put("metadataId", metadataId); + return client.invoke(ServiceUnitInfo.class, "com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService.getServiceUnitInfo", "Lcm", params, null); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..ca1f3e918a29c0cc03e5a1e6f70d73506c2d27d5 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/rtservice/MetadataRtUtils.java @@ -0,0 +1,83 @@ +/* + * 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.lcm.metadata.rtservice; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.springframework.util.StringUtils; + +/** + * @author zhaoleitr + */ +public class MetadataRtUtils { + public List buildMetadata4RefList(String dtosStr) { + if (StringUtils.isEmpty(dtosStr)) { + return null; + } + List dtoList = deserializerMetadata4RefDto(dtosStr); + if (dtoList == null || dtoList.size() <= 0) { + return null; + } + List metadataList = new ArrayList<>(); + for (Metadata4RefDto dto : dtoList) { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setPackageHeader(dto.getPackageHeader()); + metadata4Ref.setMetadata(MetadataDtoConverter.asMetadata(dto.getMetadata())); + metadata4Ref.setServiceUnitInfo(dto.getServiceUnitInfo()); + metadataList.add(metadata4Ref); + } + return metadataList; + } + + private List deserializerMetadata4RefDto(String content) { + List result = new ArrayList<>(); + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + try { + result = mapper.readValue(content, new TypeReference>() { + }); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + public String serializerMetadataRtFilter(MetadataRTFilter filter) { + String result = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + try { + result = mapper.writeValueAsString(filter); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..e6f944a56670d0e1cf5f09633fd04a5b6a9e123c --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/MetadataRTServerServiceImpl.java @@ -0,0 +1,694 @@ +/* + * 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.lcm.metadata.servermanager; + +import com.inspur.edp.i18n.resource.api.II18nResourceRTManager; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.I18nResource; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataCustomizationFilter; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.api.entity.ServiceUnitInfo; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.cache.MetadataCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataRtDistCache; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import com.inspur.edp.lcm.metadata.common.MetadataSerializer; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.common.configuration.I18nManagerHelper; +import com.inspur.edp.lcm.metadata.common.configuration.MetadataSerializerHelper; +import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; +import com.inspur.edp.lcm.metadata.serverapi.MetadataRTServerService; +import com.inspur.edp.lcm.metadata.servermanager.persistent.RepositoryFactory; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataServerManagerUitls; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataUtils; +import com.inspur.edp.lcm.metadata.spi.MetadataI18nService; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import javax.annotation.PostConstruct; +import org.codehaus.plexus.util.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author zhaoleitr + */ +public class MetadataRTServerServiceImpl implements MetadataRTServerService { + private static final Logger log = LoggerFactory.getLogger(MetadataRTServerServiceImpl.class); + + FileService fileService = new FileServiceImp(); + + private II18nResourceRTManager i18nResourceRtManager; + + private II18nResourceRTManager getI18nResourceRtManager() { + if (i18nResourceRtManager == null) { + i18nResourceRtManager = SpringBeanUtils.getBean(II18nResourceRTManager.class); + } + return i18nResourceRtManager; + } + + private final Lock lock = new ReentrantLock(); + private static String serverBasePath = ""; + private static String metadataAppPath = ""; + private static String metadataPlatformPath = ""; + private final MetadataServerManagerUitls utils = new MetadataServerManagerUitls(); + + /** + * 启动时加载所有元数据 + */ + @PostConstruct + private void init() { + log.info("Loading Metadata..."); + try { + ExecutorService executor = Executors.newCachedThreadPool(); + executor.submit( + this::loadAllMetadata); + } catch (Exception e) { + log.error("Loading Metadata Failed", e); + } + } + + @Override + public MetadataDto getMetadataDtoRTByID(String id) { + GspMetadata metadata = getMetadataRTByID(id); + return MetadataDtoConverter.asDto(metadata); + } + + private GspMetadata getMetadataRTByID(String metadataID) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataID, ""); + GspMetadata metadataCache = (GspMetadata) MetadataCacheManager.getMetadataInfo(metadataKey); + if (metadataCache != null) { + return metadataCache; + } + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { +// throw new IllegalArgumentException("Could not find metadata, metadataid is " + metadataID); + return null; + } + GspMetadata metadata = getMetadataByIdAndMetadataPath(metadataID, metadataPackagePath); + RtCacheHandler.updateMetadataCache(metadataKey, metadata); + return metadata; + } + + public GspMetadata getMetadataByIdAndMetadataPath(String metadataId, String metadataPath) { + String entryName = metadataPath.substring(metadataPath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPath = metadataPath.substring(0, metadataPath.indexOf(entryName) - 1); + GspMetadata metadata = null; + lock.lock(); + try { + String manifestStr = ""; + StringBuilder sb = new StringBuilder(); + File file = new File(metadataPath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(metadataPath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + if (zipEntry.toString().equals(entryName)) { + BufferedReader br; + br = new BufferedReader(new InputStreamReader(zf.getInputStream(zipEntry), utf8)); + try { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + manifestStr = sb.toString(); + } catch (IOException e) { + log.error("Error in reading metadata"); + throw new IOException("Error in reading metadata in " + metadataPath, e); + } finally { + br.close(); + } + } + } + zipInputStream.close(); + in.close(); + zf.close(); + if (!manifestStr.isEmpty()) { + metadata = new MetadataSerializer().deserialize(manifestStr, GspMetadata.class); + } + + } catch (IOException ioe) { + log.error("构建元数据失败,元数据位置:" + metadataPath + "元数据id:" + metadataId, ioe); + } finally { + lock.unlock(); + } + if (metadata == null) { + throw new RuntimeException("Could not find metadata content!"); + } + return metadata; + } + + private GspMetadata getI18nMetadata(String metadataId, String language) { + if (language == null) { + language = RuntimeContext.getLanguage(); + } + //从缓存中获取元数据,缓存中的元数据认为是国际化的元数据内容 + //缓存中不存在元数据,获取基础元数据内容, + //根据基础元数据内容,获取国际化资源, + //根据合并接口合并元数据,并返回内容,添加缓存。 + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataId, language); + GspMetadata metadataCache = (GspMetadata) MetadataCacheManager.getMetadataInfo(metadataKey); + if (metadataCache != null) { + return metadataCache; + } + GspMetadata originalData = getMetadataRTByID(metadataId); + //获取多语资源,此处try为兼容各个未国际化的元数据 + try { + List resources = getI18nResourceRtManager().getI18nResource(originalData, language); + MetadataI18nService service = I18nManagerHelper.getInstance().getI18nManager(originalData.getHeader().getType()); + if (service != null && resources != null && resources.size() > 0) { + GspMetadata result = service.merge(originalData, resources); + RtCacheHandler.updateMetadataCache(metadataKey, result); + return result; + } + } catch (Exception e) { + //TODO 表单强制获取资源项,获取不到时会报错,异常太多,暂时catch住 + } + return originalData; + } + + @Override + public MetadataDto getMetadataDto(String id) { + String language = RuntimeContext.getLanguage(); + return MetadataDtoConverter.asDto(getI18nMetadata(id, language)); + } + + @Override + public GspMetadata getMetadata(String id) { + String language = RuntimeContext.getLanguage(); + return getI18nMetadata(id, language); + } + + @Override + public List getMetadataListRecursivly(String path) { + List result = new ArrayList<>(); + try { + Map packages = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + if (packages != null && packages.size() > 0) { + for (Map.Entry valuePair : packages.entrySet()) { + MetadataPackage metadataPackage = valuePair.getValue(); + String metadataPackagePath = valuePair.getKey(); + for (GspMetadata item : metadataPackage.getMetadataList()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), metadataPackagePath + item.getRelativePath()); + result.add(metadata); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + public List getExtendableMetadataListRecursivly(String path) { + List result = new ArrayList<>(); + try { + Map packages = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + if (packages != null && packages.size() > 0) { + for (Map.Entry valuePair : packages.entrySet()) { + MetadataPackage metadataPackage = valuePair.getValue(); + String metadataPackagePath = valuePair.getKey(); + for (GspMetadata item : metadataPackage.getMetadataList()) { + if (item.getHeader().isExtendable()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), metadataPackagePath + item.getRelativePath()); + result.add(metadata); + } + } + } + } + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + @Override + public List getMetadataListFromPackage(String packagePath) { + List result = new ArrayList<>(); + + if (!fileService.isFileExist(packagePath)) { + throw new RuntimeException("元数据包不存在,元数据包路径为" + packagePath); + } + try { + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(new File(packagePath)); + for (GspMetadata item : metadataPackage.getMetadataList()) { + GspMetadata metadata = getMetadataByIdAndMetadataPath(item.getHeader().getId(), packagePath + item.getRelativePath()); + result.add(metadata); + } + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + public List getMetadataListInfoFromPackage(String packagePath) { + List result = new ArrayList<>(); + + if (!fileService.isFileExist(packagePath)) { + throw new RuntimeException("元数据包不存在,元数据包路径为" + packagePath); + } + try { + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(new File(packagePath)); + if (Objects.isNull(metadataPackage)) { + return null; + } + return metadataPackage.getMetadataList(); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } + + @Override + public Map getMetadataPackagesRecursivly(String path) { + Map result; + try { + result = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(path)); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("递归获取路径下元数据包中元数据列表报错,路径为" + path, e); + } + return result; + } + + @Override + public void loadAllMetadata() { + String basePath = EnvironmentUtil.getBasePath(); + FileServiceImp fileService = new FileServiceImp(); + metadataAppPath = fileService.getCombinePath(basePath, "metadata/apps"); + metadataPlatformPath = fileService.getCombinePath(basePath, "metadata/platform"); + + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDic; + List metadataInfoList = new ArrayList<>(); + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + Map packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + packageDic = Stream.concat(packageDicInApps.entrySet().stream(), packageDicInPlatform.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + } catch (Exception e) { + log.error("Error in reading metadata in metadata/apps or platform", e); + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + if (packageDic.size() > 0) { + for (Map.Entry valuePair : packageDic.entrySet()) { + String metadataPackagePath = valuePair.getKey(); + MetadataPackage metadataPackage = valuePair.getValue(); + if (metadataPackage != null) { + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + } + for (GspMetadata item : metadataPackage.getMetadataList()) { + // + languageID; + String metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + metadataInfoList.add(item); + } + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, metadataInfoList); + } + } + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + metadataCache.clear(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + metadataRtCache.clear(); + + // 预加载序反列化器 + MetadataSerializerHelper.getInstance(); + } + + public void loadAllMetadataByPath(String path, String packagePath) { + FileServiceImp fileService = new FileServiceImp(); + String metadataAppPath = fileService.getCombinePath(path, "metadata/apps"); + String metadataPlatformPath = fileService.getCombinePath(path, "metadata/platform"); + + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDic; + List metadataInfoList = new ArrayList<>(); + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + Map packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + Map packegeDicInDeployPath = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(packagePath)); + Map serverPackageDic = Stream.concat(packageDicInApps.entrySet().stream(), packageDicInPlatform.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + packageDic = Stream.concat(serverPackageDic.entrySet().stream(), packegeDicInDeployPath.entrySet().stream()) + .collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue, + (value1, value2) -> value1)); + } catch (Exception e) { + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + if (packageDic.size() > 0) { + for (Map.Entry valuePair : packageDic.entrySet()) { + String metadataPackagePath = valuePair.getKey(); + MetadataPackage metadataPackage = valuePair.getValue(); + if (metadataPackage != null) { + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + } + for (GspMetadata item : metadataPackage.getMetadataList()) { + // + languageID; + String metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + metadataInfoList.add(item); + } + } + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, metadataInfoList); + } + // 预加载序反列化器 + MetadataSerializerHelper.getInstance(); + } + + public List getMetadataList(String metadataTypes) { + List result = getMetadataRefListWithTypes(metadataTypes); + return utils.buildMetadata4RefDto(result); + } + + @Override + public String getMetadataRefDtoList() { + List metadataList = getMetadataRefList(); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadataList)); + } + + @Override + public List getMetadataRefList() { + List metadataList = new ArrayList<>(); + //首先从缓存获取 + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); + if (packagesCache != null && packagesCache.size() > 0) { + for (MetadataPackage pack : packagesCache) { + List metadata4Ref = getMetadata4Ref(pack, null); + metadataList.addAll(metadata4Ref); + } + return metadataList; + } + List metadataPackages = getMetadataPackages(); + for (MetadataPackage metadataPackage : metadataPackages) { + List metadata4Ref = getMetadata4Ref(metadataPackage, null); + metadataList.addAll(metadata4Ref); + } + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY, metadataPackages); + return metadataList; + } + + private List getMetadataPackages() { + + serverBasePath = EnvironmentUtil.getBasePath(); + FileServiceImp fileService = new FileServiceImp(); + metadataAppPath = fileService.getCombinePath(serverBasePath, "metadata/apps"); + metadataPlatformPath = fileService.getCombinePath(serverBasePath, "metadata/platform"); + + //元数据部署目录下遍历 + //List paths = new ArrayList<>(); + //找到目录下的所有元数据包mdpkg + //RepositoryFactory.getInstance().getMetadataPackageRepository().getMdpkgFilesPath(Utils.handlePath("metadata/apps"), paths); + //RepositoryFactory.getInstance().getMetadataPackageRepository().getMdpkgFilesPath(Utils.handlePath("metadata/platform"), paths); + + //缓存的包列表 + List metadataPackages = new ArrayList<>(); + //元数据包信息,<元数据包绝对路径,元数据包信息> + Map packageDicInApps; + Map packageDicInPlatform; + + try { + packageDicInApps = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataAppPath)); + packageDicInPlatform = RepositoryFactory.getInstance().getMetadataPackageRepository().retrieveAllMdPkg(Utils.handlePath(metadataPlatformPath)); + } catch (Exception e) { + log.error("Error in reading metadata in metadata/apps or platform", e); + throw new RuntimeException("Error in reading metadata in metadata/apps or platform", e); + } + + if (packageDicInApps.values().size() > 0) { + metadataPackages.addAll(packageDicInApps.values()); + } + if (packageDicInPlatform.values().size() > 0) { + metadataPackages.addAll(packageDicInPlatform.values()); + } + return metadataPackages; + } + + @Override + public String getMetadataDtoListByFilter(String filter) { + MetadataRTFilter filterInfo = utils.deserializerMetadataRTFilter(filter); + List metadataList = getMetadataListByFilter(filterInfo); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadataList)); + } + + @Override + public List getMetadataListByFilter(MetadataRTFilter filter) { + + List metadataList; + // 获取所有元数据包 + metadataList = getMetadataRefList(); + // 根据AppCode进行过滤 + if (filter.getAppCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getServiceUnitInfo() == null || item.getServiceUnitInfo().getAppCode().equals(filter.getAppCode())).collect(Collectors.toList()); + } + // 根据ServiceUnitCode进行过滤 + if (filter.getServiceUnitCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getServiceUnitInfo() == null || item.getServiceUnitInfo().getServiceUnitCode().equals(filter.getServiceUnitCode())).collect(Collectors.toList()); + } + // 根据BizobjectID进行过滤 + if (filter.getBizobjectId() != null && filter.getBizobjectId().size() > 0) { + for (String eachBizobjectId : filter.getBizobjectId()) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getBizObjectId().equals(eachBizobjectId)).collect(Collectors.toList()); + } + } + if (filter.getCode() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getCode() != null && item.getMetadata().getHeader().getCode().equals(filter.getCode())).collect(Collectors.toList()); + } + if (filter.getNameSpace() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getNameSpace() != null && item.getMetadata().getHeader().getNameSpace().equals(filter.getNameSpace())).collect(Collectors.toList()); + } + if (filter.getType() != null) { + metadataList = metadataList.stream().filter(item -> item.getMetadata().getHeader().getType() != null && item.getMetadata().getHeader().getType().equals(filter.getType())).collect(Collectors.toList()); + } + return metadataList; + } + + /*** + * @author zhongchq + * @param metadataTypes 想要获取的元数据类型 + * @return java.util.List + **/ + @Override + public String getMetadataRefDtoListWithTypes(String metadataTypes) { + List metadata4Refs = getMetadataRefListWithTypes(metadataTypes); + return utils.serializeMetadata4RefDtos(utils.buildMetadata4RefDto(metadata4Refs)); + + } + + @Override + public List getMetadataRefListWithTypes(String metadataTypes) { + List typeList; + if (metadataTypes == null || metadataTypes.isEmpty()) { + throw new RuntimeException("传入参数不能为空"); + } else { + String[] types = metadataTypes.split(","); + typeList = new ArrayList<>(Arrays.asList(types)); + } + List metadataList = new ArrayList<>(); + //首先从缓存获取 + List packagesCache = (List) MetadataCacheManager.getAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); + if (packagesCache != null && packagesCache.size() > 0) { + for (MetadataPackage pack : packagesCache) { + List metadata4Ref = getMetadata4Ref(pack, typeList); + metadataList.addAll(metadata4Ref); + } + return metadataList; + } + + List metadataPackages = getMetadataPackages(); + for (MetadataPackage metadataPackage : metadataPackages) { + List metadata4Ref = getMetadata4Ref(metadataPackage, typeList); + metadataList.addAll(metadata4Ref); + } + + MetadataCacheManager.addAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY, metadataPackages); + return metadataList; + } + + private List getMetadata4Ref(MetadataPackage packageInfo, List metadataTypes) { + List metadata4RefList = new ArrayList<>(); + if (metadataTypes != null && metadataTypes.size() > 0) { + metadataTypes.forEach(type -> + { + List result = packageInfo.getMetadataList().stream().filter(item -> item.getHeader().getType().toLowerCase().equals(type.toLowerCase())).collect(Collectors.toList()); + if (result.size() > 0) { + result.forEach(metadata -> { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setMetadata(metadata); + metadata4Ref.setServiceUnitInfo(packageInfo.getServiceUnitInfo()); + metadata4Ref.setPackageHeader(packageInfo.getHeader()); + metadata4RefList.add(metadata4Ref); + }); + } + } + ); + } else { + packageInfo.getMetadataList().forEach(metadata -> { + Metadata4Ref metadata4Ref = new Metadata4Ref(); + metadata4Ref.setMetadata(metadata); + metadata4Ref.setServiceUnitInfo(packageInfo.getServiceUnitInfo()); + metadata4Ref.setPackageHeader(packageInfo.getHeader()); + metadata4RefList.add(metadata4Ref); + }); + } + return metadata4RefList; + } + + @Override + public MetadataDto getMetadataDtoBySemanticID(String metadataNamespace, String metadataCode, + String metadataTypeCode) { + GspMetadata metadata = getMetadataBySemanticId(metadataNamespace, metadataCode, metadataTypeCode); + return MetadataDtoConverter.asDto(metadata); + } + + private GspMetadata getMetadataBySemanticId(String metadataNamespace, String metadataCode, + String metadataTypeCode) { + List allMetadataInfo = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); + if (allMetadataInfo != null) { + for (GspMetadata item : allMetadataInfo) { + if (item.getHeader().getNameSpace().toLowerCase().equals(metadataNamespace.toLowerCase()) + && item.getHeader().getCode().toLowerCase().equals(metadataCode.toLowerCase()) + && item.getHeader().getType().toLowerCase().equals(metadataTypeCode.toLowerCase())) { + return getMetadataRTByID(item.getHeader().getId()); + } + } + } + List allMetadataList = getMetadataList(metadataTypeCode); + if (allMetadataList != null) { + for (Metadata4RefDto item : allMetadataList) { + if (item.getMetadata().getNameSpace().toLowerCase().equals(metadataNamespace.toLowerCase()) + && item.getMetadata().getCode().toLowerCase().equals(metadataCode.toLowerCase())) { + return getMetadataRTByID(item.getMetadata().getId()); + } + } + } + return null; + } + + @Override + public ServiceUnitInfo getServiceUnitInfo(String metadataId) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataId, ""); + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { + throw new IllegalArgumentException("Could not find metadata, metadataid is " + metadataId); + } + String entryName = metadataPackagePath.substring(metadataPackagePath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPackagePath = metadataPackagePath.substring(0, metadataPackagePath.indexOf(entryName) - 1); + String metadataPackageName = new File(metadataPackagePath).getName(); + String metadataPackageNameWithoutSuffix = metadataPackageName.substring(0, metadataPackageName.indexOf(MetadataUtils.getMetadataPackageExtension())); + MetadataPackage metadataPackage = (MetadataPackage) MetadataCacheManager.getMetadataPackageInfo(metadataPackageNameWithoutSuffix); + return metadataPackage.getServiceUnitInfo(); + } + + @Override + public String getMetadataString(MetadataCustomizationFilter metadataCustomizationFilter) { + return getMetadataStrFromPackage(metadataCustomizationFilter.getMetadataId()); + } + + private String getMetadataStrFromPackage(String metadataID) { + String metadataKey = RtCacheHandler.getMetadataCacheKey(metadataID, ""); + String metadataPackagePath = (String) MetadataCacheManager.getMetadataPathMapping(metadataKey); + if (metadataPackagePath == null || metadataPackagePath.isEmpty()) { + return null; + } + String entryName = metadataPackagePath.substring(metadataPackagePath.indexOf(MetadataUtils.getMetadataPackageExtension()) + MetadataUtils.getMetadataPackageExtension().length() + 1); + metadataPackagePath = metadataPackagePath.substring(0, metadataPackagePath.indexOf(entryName) - 1); + String metadataStr = ""; + + lock.lock(); + try { + StringBuilder sb = new StringBuilder(); + File file = new File(metadataPackagePath); + ZipFile zf = new ZipFile(file); + InputStream in = new BufferedInputStream(new FileInputStream(metadataPackagePath)); + Charset utf8 = StandardCharsets.UTF_8; + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + if (zipEntry.toString().equals(entryName)) { + BufferedReader br; + br = new BufferedReader(new InputStreamReader(zf.getInputStream(zipEntry), utf8)); + try { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + metadataStr = sb.toString(); + } catch (IOException e) { + log.error("Error in reading metadata"); + throw new IOException("Error in reading metadata in " + metadataPackagePath, e); + } finally { + br.close(); + } + } + } + zipInputStream.close(); + in.close(); + zf.close(); + } catch (IOException ioe) { + log.error("构建元数据失败,元数据位置:" + metadataPackagePath + "元数据id:" + metadataID, ioe); + } finally { + lock.unlock(); + } + if (StringUtils.isEmpty(metadataStr)) { + throw new RuntimeException("Could not find metadata " + metadataID + " from " + metadataPackagePath); + } + return metadataStr; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java new file mode 100644 index 0000000000000000000000000000000000000000..e835dd918dac5a8274f6c69a5e6d7d75d03e66f4 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/configuration/RestConfiguarion.java @@ -0,0 +1,47 @@ +/* + * 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.lcm.metadata.servermanager.configuration; + +import com.inspur.edp.lcm.metadata.api.service.MetadataRTService; +import com.inspur.edp.lcm.metadata.rtservice.MetadataRTServiceImp; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * Classname RestConfiguarion Description TODO Date 2019/8/28 14:14 + * + * @author zhongchq + * @version 1.0 + */ +//todo +//@Configuration(proxyBeanMethods = false) +@Configuration() +public class RestConfiguarion { + + @Bean + public MetadataRTService createMetadataRTService() { + return new MetadataRTServiceImp(); + } + +// @Bean +// public MetadataRT4WebApiService createMetadata4WebApiService(){ +// return new MetadataRT4WebApiServiceImp(); +// } +// @Bean +// public RESTEndpoint restEndpoint(MetadataRT4WebApiService metadataRT4WebApiService){ +// return new RESTEndpoint("/runtime/sys/v1.0/rt-metadatas",metadataRT4WebApiService); +// } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java new file mode 100644 index 0000000000000000000000000000000000000000..52f78baf7e07037735c006e4bca1596400fd49c0 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventBroker.java @@ -0,0 +1,66 @@ +/* + * 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.lcm.metadata.servermanager.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventBroker; +import io.iec.edp.caf.commons.event.IEventListener; +import io.iec.edp.caf.commons.event.config.EventListenerData; +import io.iec.edp.caf.commons.event.config.EventListenerSettings; + +/** + * @author zhaoleitr + */ +public class MdPkgChangedEventBroker extends EventBroker { + + public MdPkgChangedEventManager mdPkgChangedEventManager; + + public MdPkgChangedEventBroker(EventListenerSettings settings) { + super(settings); + this.mdPkgChangedEventManager = new MdPkgChangedEventManager(); + this.init(); + } + + @Override + protected void onInit() { + this.eventManagerCollection.add(mdPkgChangedEventManager); + } + + public void fireMdPkgAddedEvent(CAFEventArgs e) { + this.mdPkgChangedEventManager.fireMdPkgAddedEvent(e); + + } + + public void fireMdPkgChangedEvent(CAFEventArgs e) { + this.mdPkgChangedEventManager.fireMdPkgChangedEvent(e); + } + + /** + * 测试异常是否被抛出 + */ + public IEventListener createEventListenerTest(EventListenerData eventListenerData) { + return this.createEventListener(eventListenerData); + } + + /** + * 测试注销事件 + * + * @param eventListener + */ + public void removeListenerTest(IEventListener eventListener) { + this.removeListener(eventListener); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java new file mode 100644 index 0000000000000000000000000000000000000000..9f2a8f1ea44038fd495aa75f1da0c1b516b96cf3 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/event/MdPkgChangedEventManager.java @@ -0,0 +1,76 @@ +/* + * 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.lcm.metadata.servermanager.event; + +import com.inspur.edp.lcm.metadata.spi.event.MdPkgChangedEventListener; +import io.iec.edp.caf.commons.event.CAFEventArgs; +import io.iec.edp.caf.commons.event.EventManager; +import io.iec.edp.caf.commons.event.IEventListener; + +/** + * 元数据包变更监听mangaer + * + * @author zhaoleitr + */ +public class MdPkgChangedEventManager extends EventManager { + + /** + * 内部枚举类 + */ + enum MetadataRtEventType { + fireMdPkgAddedEvent, + fireMdPkgChangedEvent + } + + @Override + public String getEventManagerName() { + return "MdpkgChangedEventManager"; + } + + @Override + public boolean isHandlerListener(IEventListener iEventListener) { + return iEventListener instanceof MdPkgChangedEventListener; + } + + @Override + public void addListener(IEventListener iEventListener) { + if (!(iEventListener instanceof MdPkgChangedEventListener)) { + throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); + } + MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; + this.addEventHandler(MetadataRtEventType.fireMdPkgAddedEvent, mdPkgChangedEventListener, "fireMdPkgAddedEvent"); + this.addEventHandler(MetadataRtEventType.fireMdPkgChangedEvent, mdPkgChangedEventListener, "fireMdPkgChangedEvent"); + } + + @Override + public void removeListener(IEventListener iEventListener) { + if (!(iEventListener instanceof MdPkgChangedEventListener)) { + throw new RuntimeException("指定的监听者没有实现IDemoEventListener接口"); + } + MdPkgChangedEventListener mdPkgChangedEventListener = (MdPkgChangedEventListener) iEventListener; + this.removeEventHandler(MetadataRtEventType.fireMdPkgAddedEvent, mdPkgChangedEventListener, "fireMdPkgAddedEvent"); + this.removeEventHandler(MetadataRtEventType.fireMdPkgChangedEvent, mdPkgChangedEventListener, "fireMdPkgChangedEvent"); + + } + + public void fireMdPkgAddedEvent(CAFEventArgs e) { + this.fire(MetadataRtEventType.fireMdPkgAddedEvent, e); + } + + public void fireMdPkgChangedEvent(CAFEventArgs e) { + this.fire(MetadataRtEventType.fireMdPkgChangedEvent, e); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java new file mode 100644 index 0000000000000000000000000000000000000000..732c679b81446bd6257bdbd1a22f23f0fc69c483 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgAlterationMonitor.java @@ -0,0 +1,105 @@ +/* + * 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.lcm.metadata.servermanager.monitor; + +import org.apache.commons.io.filefilter.FileFilterUtils; +import org.apache.commons.io.filefilter.HiddenFileFilter; +import org.apache.commons.io.filefilter.IOFileFilter; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; +import org.apache.commons.io.monitor.FileAlterationMonitor; +import org.apache.commons.io.monitor.FileAlterationObserver; + +public class MdpkgAlterationMonitor { + private String path; // 文件夹目录 + + private String fileSuffix; // 需要监听的文件名后缀 + + private long interval; // 监听间隔 + + private static final long DEFAULT_INTERVAL = 10 * 1000; // 默认监听间隔10s + + private boolean running = false; + + private FileAlterationListenerAdaptor listener; // 事件处理类对象 + + private FileAlterationMonitor monitor; + + public MdpkgAlterationMonitor() { + this.interval = DEFAULT_INTERVAL; + } + + public MdpkgAlterationMonitor(String path, String fileSuffix, FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = DEFAULT_INTERVAL; + this.listener = listenerAdaptor; + } + + public MdpkgAlterationMonitor(String path, String fileSuffix, long interval, + FileAlterationListenerAdaptor listenerAdaptor) { + this.path = path; + this.fileSuffix = fileSuffix; + this.interval = interval; + this.listener = listenerAdaptor; + } + + /*** + * 开启监听 + */ + public void start() { + if (path == null) { + throw new IllegalStateException("Listen path must not be null"); + } + if (listener == null) { + throw new IllegalStateException("Listener must not be null"); + } + + IOFileFilter directories = FileFilterUtils.and( + FileFilterUtils.directoryFileFilter(), + HiddenFileFilter.VISIBLE); + IOFileFilter files = FileFilterUtils.and( + FileFilterUtils.fileFileFilter(), + FileFilterUtils.suffixFileFilter(fileSuffix)); + IOFileFilter filter = FileFilterUtils.or(directories, files); + // 设定观察者,监听文件 + FileAlterationObserver observer = new FileAlterationObserver(path, filter); + // 给观察者添加监听事件 + observer.addListener(listener); + + // 开启一个监视器,监听频率是5s一次 + // FileAlterationMonitor本身实现了 Runnable,是单独的一个线程,按照设定的时间间隔运行,默认间隔是 10s + monitor = new FileAlterationMonitor(interval); + + monitor.addObserver(observer); + + try { + monitor.start(); + running = true; + } catch (Exception e) { + e.printStackTrace(); + } + } + +// public void checkAndNotify() { +// if (running) { +// Iterator i$ = this.monitor.getObservers().iterator(); +// while(i$.hasNext()) { +// FileAlterationObserver observer = (FileAlterationObserver)i$.next(); +// observer.checkAndNotify(); +// } +// } +// } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java new file mode 100644 index 0000000000000000000000000000000000000000..2fbeb99e5cd2d51dbce4f84afa63c04c963f41db --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MdpkgListenerAdapter.java @@ -0,0 +1,195 @@ +/* + * 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.lcm.metadata.servermanager.monitor; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.cache.MetadataCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataDistCacheManager; +import com.inspur.edp.lcm.metadata.cache.MetadataRtDistCache; +import com.inspur.edp.lcm.metadata.cache.RtCacheHandler; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.servermanager.event.MdPkgChangedEventBroker; +import com.inspur.edp.lcm.metadata.servermanager.persistent.RepositoryFactory; +import com.inspur.edp.lcm.metadata.spi.event.MdPkgChangedArgs; +import io.iec.edp.caf.commons.layeringcache.cache.Cache; +import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.i18n.framework.api.language.EcpLanguage; +import io.iec.edp.caf.i18n.framework.api.language.ILanguageService; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; + +public class MdpkgListenerAdapter extends FileAlterationListenerAdaptor { + + public MdpkgListenerAdapter() { + + } +// @Override +// public void onStart(FileAlterationObserver observer) { +// super.onStart(observer); +// } +// +// @Override +// public void onStop(FileAlterationObserver observer) { +// super.onStop(observer); +// } + + @Override + public void onFileCreate(File file) { + try { + super.onFileCreate(file); + updateMdpkgAndMetadataCache(file, true); + + } catch (Exception e) { + //todo + } + } + + @Override + public void onFileDelete(File file) { + try { + //更新缓存信息,文件删除时,具体缓存应该移除 + super.onFileDelete(file); + deleteMdpkgAndMetadataCache(file); + } catch (Exception e) { + //todo + } + } + + @Override + public void onFileChange(File file) { + try { + //更新缓存信息 + super.onFileChange(file); + updateMdpkgAndMetadataCache(file, false); + } catch (Exception e) { + //todo + } + + } + + private void updateMdpkgAndMetadataCache(File file, boolean isAdd) { + //更新缓存信息:包的信息会更新,因为所有后续获取内容,都依赖于已知的包的信息;所有的元数据内容不需要更新,仅需要移除。 + //当获取元数据时,如果缓存中没有元数据信息,会重新根据已知的包信息,重新加载元数据。 + //在更新元数据包缓存前,需要根据原有包的缓存信息,清理已有的元数据信息。 + //更新所有元数据信息列表 + //清理元数据信息、清理元数据引用信息 + //更新元数据包的信息:元数据包位置信息、元数据包中元数据列表信息、元数据包引用信息 + //更新元数据所在元数据包信息 + try { + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + MetadataPackage metadataPackage = RepositoryFactory.getInstance().getMetadataPackageRepository().getMetadataPackage(file); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); + //清理元数据内容缓存,将原有缓存的包中元数据列表从元数据内容缓存移除 + String metadataKey = ""; + List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(metadataPackage.getHeader().getName()); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); + if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { + for (GspMetadata item : oldPackageMetadataList) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.removeMetadataPathMapping(metadataKey); + + List languages = getLanguages(); + for (String language : languages) { + String key = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), language); + MetadataCacheManager.removeMetadataInfo(key); + metadataCache.evict(key); + metadataRtCache.evict(key);//把指定的缓存对象清除 + } + } + //清理并更新所有元数据缓存 + allMetadataList.removeAll(oldPackageMetadataList); + } + allMetadataList.addAll(metadataPackage.getMetadataList()); + MetadataCacheManager.addAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY, allMetadataList); + //清理并更新包中<元数据标识,元数据所在位置信息缓存>,清理过程在旧包处理过程中 + String metadataPackagePath = Utils.handlePath(file.toString()); + for (GspMetadata item : metadataPackage.getMetadataList()) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.addMetadataPathMapping(metadataKey, metadataPackagePath + item.getRelativePath()); + } + //更新包缓存 + RtCacheHandler.updateMetadataPackageCache(metadataPackage.getHeader().getName(), metadataPackage); + + MdPkgChangedEventBroker broker = SpringBeanUtils.getBean(MdPkgChangedEventBroker.class); + MdPkgChangedArgs args = new MdPkgChangedArgs(); + args.setMetadataPackage(metadataPackage); + + if (isAdd) { + broker.fireMdPkgAddedEvent(args); + } else { + broker.fireMdPkgChangedEvent(args); + } + } catch (IOException e) { + throw new RuntimeException("update metadatapackage cache filed, package is " + file, e); + } + } + + private void deleteMdpkgAndMetadataCache(File file) { + //这时不需要获取元数据包中的内容,仅需要根据元数据包文件名称,移除内容即可。 + String packageFileName = file.getName(); + String packageName = packageFileName.substring(0, packageFileName.lastIndexOf(".")); + //清理元数据内容缓存,将原有缓存的包中元数据列表从元数据内容缓存移除 + String metadataKey = ""; + Cache metadataCache = MetadataDistCacheManager.getMetadataCache(); + Cache metadataRtCache = MetadataRtDistCache.getMetadataCache(); + + List oldPackageMetadataList = (List) MetadataCacheManager.getMDManifestInfo(packageName); + List allMetadataList = (List) MetadataCacheManager.getAllMetadataInfo(RtCacheHandler.ALL_METADATA_INFO_CACHE_KEY); + if (oldPackageMetadataList != null && oldPackageMetadataList.size() > 0) { + for (GspMetadata item : oldPackageMetadataList) { + metadataKey = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), ""); + MetadataCacheManager.removeMetadataInfo(metadataKey); + MetadataCacheManager.removeMDDependence(metadataKey); + MetadataCacheManager.removeMetadataPathMapping(metadataKey); + List languages = getLanguages(); + for (String language : languages) { + String key = RtCacheHandler.getMetadataCacheKey(item.getHeader().getId(), language); + MetadataCacheManager.removeMetadataInfo(key); + metadataCache.evict(key); + metadataRtCache.evict(key); + } + } + //清理并更新所有元数据缓存 + allMetadataList.removeAll(oldPackageMetadataList); + } + //更新包缓存 + MetadataCacheManager.removeMetadataPackageInfo(packageName); + MetadataCacheManager.removeMDManifestInfo(packageName); + MetadataCacheManager.removeMPDependence(packageName); + MetadataCacheManager.removeAllMetadataPackageInfo(RtCacheHandler.ALL_PACKAGES_CACHE_KEY); + } + + private static List languages; + + private static List getLanguages() { + if (languages == null || languages.size() <= 0) { + languages = new ArrayList<>(); + ILanguageService laguageService = SpringBeanUtils.getBean(ILanguageService.class); + List ecpLanguages = laguageService.getEnabledLanguages(); + for (EcpLanguage language : ecpLanguages) { + languages.add(language.getCode()); + } + } + return languages; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java new file mode 100644 index 0000000000000000000000000000000000000000..75d85c4bfc1f9d8b1f98d02dc093eb8812a89694 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/monitor/MonitorInitializer.java @@ -0,0 +1,44 @@ +/* + * 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.lcm.metadata.servermanager.monitor; + +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import io.iec.edp.caf.common.environment.EnvironmentUtil; +import javax.annotation.PostConstruct; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MonitorInitializer { + private static final Logger log = LoggerFactory.getLogger(MonitorInitializer.class); + + private final String mdpkgSuffix = ".mdpkg"; + private final String metatdataPath = "metadata"; + + @PostConstruct + public void initMonitor() { + log.info("Start MdpkgMonitor..."); + + FileServiceImp fileService = new FileServiceImp(); + String monitorFilePath = fileService.getCombinePath(EnvironmentUtil.getBasePath(), metatdataPath); + // 创建过滤器 + + MdpkgAlterationMonitor monitor = new MdpkgAlterationMonitor( + monitorFilePath, + mdpkgSuffix, + new MdpkgListenerAdapter()); + monitor.start(); + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java new file mode 100644 index 0000000000000000000000000000000000000000..7a7971a41f7d9f9f34f69418a10d91fa199bf65e --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepository.java @@ -0,0 +1,107 @@ +/* + * 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.lcm.metadata.servermanager.persistent; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Classname IMetadataPackageRepository Description TODO Date 2019/8/21 16:55 + * + * @author zhongchq + * @version 1.0 + */ +public interface MetadataPackageRepository { + + /** + * 生成元数据包实体 从manifest中读取包信息 + * + * @param packagePath 包的manifest文件所在的目录 + * @return + */ + MetadataPackage getPackageEntity(String packagePath); + + /** + * 从包中获取元数据 + * + * @param metadataPath 元数据文件具体路径 + * @return + */ + GspMetadata getMetadataFromPackage(String metadataPath); + + /** + * 从指定目录下检索包文件 + * + * @param path 指定位置(目录),一般从服务端环境信息获取包部署路径。部署路径按照应用隔离,部署路径有多个 + * @param packageName 包名称 + * @return + */ + Map retrieveSingleMetadataPackage(String path, String packageName); + + /** + * 从指定目录下检索包文件 + * + * @param path 指定位置(目录),一般从服务端环境信息获取包部署路径。部署路径按照应用隔离,部署路径有多个 + * @return + */ + Map retrieveAllMdPkg(String path) throws IOException; + + /** + * 获取某一路径下的所有元数据包清单文件信息 + * + * @param originalPath + * @param manifestPath + */ + void getManifestFilesPath(String originalPath, List manifestPath); + + /** + * 获取某一路径下的所有元数据包清单文件信息 + * + * @param originalPath + * @param mdpkgPath + */ + void getMdpkgFilesPath(String originalPath, List mdpkgPath); + + /** + * 获取拼接路径信息 + * + * @param path1 + * @param path2 + * @return + */ + String getCombinePath(String path1, String path2); + + /** + * 获取目录名 + * + * @param path + * @return + */ + String getDirectoryName(String path); + + /** + * 根据元数据包文件,获取元数据包信息,读取manifest文件 + * + * @param packageFile + * @return MetadataPackage + */ + MetadataPackage getMetadataPackage(File packageFile) throws IOException; + +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java new file mode 100644 index 0000000000000000000000000000000000000000..81518f422a8b1f26732a43430dca2d9fcddc2372 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/MetadataPackageRepositoryImp.java @@ -0,0 +1,198 @@ +/* + * 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.lcm.metadata.servermanager.persistent; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import com.inspur.edp.lcm.metadata.api.service.FileService; +import com.inspur.edp.lcm.metadata.common.FileServiceImp; +import com.inspur.edp.lcm.metadata.common.Utils; +import com.inspur.edp.lcm.metadata.servermanager.util.MetadataUtils; +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Classname MetadataPackageRepositoryImp Description TODO Date 2019/8/21 17:04 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataPackageRepositoryImp implements MetadataPackageRepository { + private static final Logger log = LoggerFactory.getLogger(MetadataPackageRepositoryImp.class); + + // @Autowired //TODO 依赖注入会是null,此类还未被初始化。 + FileService fileService = new FileServiceImp(); + + ObjectMapper mapper = Utils.getMapper(); + + @Override + public MetadataPackage getPackageEntity(String packagePath) { + return null; + } + + @Override + public GspMetadata getMetadataFromPackage(String metadataPath) { + return null; + } + + @Override + public HashMap retrieveSingleMetadataPackage(String path, String packageName) { + return null; + } + + @Override + public HashMap retrieveAllMdPkg(String path) throws IOException { + HashMap packageDic = new HashMap<>(); + retrieveMdPkgRecursively(path, packageDic); + return packageDic; + } + + public void retrieveMdPkgRecursively(String path, HashMap packageDic) throws IOException { + if (path.isEmpty() || new File(path).getName().toLowerCase().equals("web")) { + return; + } + List files = fileService.getAllFiles(path); + if (files.size() > 0) { + List fileList = new ArrayList<>(); + for (File file : files) { + if (fileService.getExtension(file.toString()).equals(MetadataUtils.getMetadataPackageExtension())) { + fileList.add(file); + } + } + if (fileList != null && fileList.size() > 0) { + for (File file1 : fileList) { + try { + MetadataPackage metadataPackage = getMetadataPackage(file1); + packageDic.put(Utils.handlePath(file1.toString()), metadataPackage); + } catch (IOException e) { + e.printStackTrace(); + //todo +// e.getMessage() + ":" + file1.getAbsolutePath() + log.error(e.getMessage() + ":" + file1.getAbsolutePath()); + } + } + } + } + // 路径中目录 + List dirs = fileService.getDirectorys(path); + for (int i = 0; i < dirs.size(); i++) { + retrieveMdPkgRecursively(dirs.get(i).toString(), packageDic); + } + } + + @Override + public MetadataPackage getMetadataPackage(File packageFile) throws IOException { + String manifestStr = ""; + MetadataPackage metadataPackage; + StringBuilder sb = new StringBuilder(); + InputStream in = new BufferedInputStream(new FileInputStream(packageFile)); + ZipFile zf = new ZipFile(packageFile); + Charset utf8 = Charset.forName("UTF-8"); + ZipInputStream zipInputStream = new ZipInputStream(in, utf8); + ZipEntry zipEntry; + try { + while ((zipEntry = zipInputStream.getNextEntry()) != null) { + BufferedReader br = new BufferedReader( + new InputStreamReader(zf.getInputStream(zipEntry), "UTF-8")); + if (zipEntry.toString().equals(MetadataUtils.getManifestFileName())) { + String line; + while ((line = br.readLine()) != null) { + sb.append(line); + } + manifestStr = sb.toString(); + } + br.close(); + } + } catch (IOException e) { + log.error("Error in reading mdpkg, Package is " + packageFile.getAbsolutePath(), e); + throw new RuntimeException("Error in reading mdpkg, Package is " + packageFile.getAbsolutePath(), e); + } finally { + zipInputStream.close(); + zf.close(); + in.close(); + } +// String jsonString = handleJsonString(manifestStr);//TODO可能会引起序列化失败 + try { + metadataPackage = mapper.readValue(manifestStr, MetadataPackage.class); + log.debug("元数据包:" + packageFile + "已加载。"); + } catch (Exception e) { + log.error("元数据包中manifest.json反序列化失败,元数据包为" + packageFile, e); + throw new RuntimeException("元数据包中manifest.json反序列化失败,元数据包为" + packageFile, e); + } + return metadataPackage; + } + + @Override + public void getManifestFilesPath(String originalPath, List manifestPath) { + + } + + @Override + public void getMdpkgFilesPath(String originalPath, List mdpkgPath) { + File dir = new File(originalPath); + List paths = fileService.getAllFiles(originalPath); + if (paths.size() > 0) { + paths.forEach(path -> { + String extension = fileService.getExtension(path); + if (extension.equals(MetadataUtils.getMetadataPackageExtension())) { + mdpkgPath.add(handlePath(path.toString())); + } + }); + searchChildPath4Mdpkg(originalPath, mdpkgPath, dir); + } else { + searchChildPath4Mdpkg(originalPath, mdpkgPath, dir); + } + } + + private void searchChildPath4Mdpkg(String originalPath, List mdpkgPath, File dir) { + List dirs = fileService.getDirectorys(dir.toString()); + if (dirs.size() > 0) { + for (int i = 0; i < dirs.size(); i++) { + String temPath = originalPath + "/" + fileService.getFileName(handlePath(dirs.get(i).toString())); + getMdpkgFilesPath(temPath, mdpkgPath); + } + } + } + + private String handlePath(String path) { + return path.replace("\\", "/"); + } + + @Override + public String getCombinePath(String path1, String path2) { + return null; + } + + @Override + public String getDirectoryName(String path) { + return null; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..e7d803643cd40ebc674024ac771e9ecf5c805f07 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/persistent/RepositoryFactory.java @@ -0,0 +1,46 @@ +/* + * 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.lcm.metadata.servermanager.persistent; + +/** + * Classname RepositoryFactory Description TODO Date 2019/8/21 16:47 + * + * @author zhongchq + * @version 1.0 + */ +public class RepositoryFactory { + + private static RepositoryFactory singleton = null; + + public RepositoryFactory() { + } + + public static RepositoryFactory getInstance() { + if (singleton == null) { + singleton = new RepositoryFactory(); + } + return singleton; + } + + private MetadataPackageRepository metadataPackageRepository; + + public MetadataPackageRepository getMetadataPackageRepository() { + if (metadataPackageRepository == null) { + metadataPackageRepository = new MetadataPackageRepositoryImp(); + } + return metadataPackageRepository; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java new file mode 100644 index 0000000000000000000000000000000000000000..258a9a126c6fb64da1e1d272af126d857d6a96d6 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataServerManagerUitls.java @@ -0,0 +1,77 @@ +/* + * 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.lcm.metadata.servermanager.util; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4Ref; +import com.inspur.edp.lcm.metadata.api.entity.Metadata4RefDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataDto; +import com.inspur.edp.lcm.metadata.api.entity.MetadataRTFilter; +import com.inspur.edp.lcm.metadata.common.MetadataDtoConverter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class MetadataServerManagerUitls { + + public List buildMetadata4RefDto(List metadata4Refs) { + if (metadata4Refs == null || metadata4Refs.size() <= 0) { + return null; + } + List metadata4RefDtos = new ArrayList<>(); + for (Metadata4Ref metadata4Ref : metadata4Refs) { + Metadata4RefDto dto = new Metadata4RefDto(); + MetadataDto metadataDto = MetadataDtoConverter.asDto(metadata4Ref.getMetadata()); + dto.setPackageHeader(metadata4Ref.getPackageHeader()); + dto.setMetadata(metadataDto); + dto.setServiceUnitInfo(metadata4Ref.getServiceUnitInfo()); + metadata4RefDtos.add(dto); + } + + return metadata4RefDtos; + } + + public String serializeMetadata4RefDtos(List metadataDtos) { + String result = ""; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + try { + result = mapper.writeValueAsString(metadataDtos); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + return result; + } + + public MetadataRTFilter deserializerMetadataRTFilter(String content) { + MetadataRTFilter result = null; + ObjectMapper mapper = new ObjectMapper(); + mapper.setPropertyNamingStrategy(PropertyNamingStrategy.UPPER_CAMEL_CASE); + mapper.configure(MapperFeature.ACCEPT_CASE_INSENSITIVE_PROPERTIES, true); + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + try { + result = mapper.readValue(content, MetadataRTFilter.class); + } catch (IOException e) { + e.printStackTrace(); + } + return result; + } +} diff --git a/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java new file mode 100644 index 0000000000000000000000000000000000000000..27287c8fdc8e4e7f770e9efe816a6d68a6e33d03 --- /dev/null +++ b/model/framework/runtime-core/src/main/java/com/inspur/edp/lcm/metadata/servermanager/util/MetadataUtils.java @@ -0,0 +1,35 @@ +/* + * 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.lcm.metadata.servermanager.util; + +/** + * Classname MetadataUtils Description TODO Date 2019/8/20 16:43 + * + * @author zhongchq + * @version 1.0 + */ +public class MetadataUtils { + + public static String manifestFileName = "manifest.json"; + + public static String getManifestFileName() { + return manifestFileName; + } + + public static String getMetadataPackageExtension() { + return ".mdpkg"; + } +} diff --git a/model/framework/runtime-spi/pom.xml b/model/framework/runtime-spi/pom.xml index 489c7c4af1700f7655b373d7fb39367464189d36..966df874b8f69d72fe4376421743a5a4b40a71d5 100644 --- a/model/framework/runtime-spi/pom.xml +++ b/model/framework/runtime-spi/pom.xml @@ -1,4 +1,20 @@ + + @@ -10,8 +26,20 @@ 4.0.0 ubml-model-framework-runtime-spi - - ubml-model-framework-runtime-spi ${project.version} + + + io.iec.edp + caf-boot-commons-event + 0.3.2 + + + org.openatom.ubml + ubml-model-framework-common + 0.9.0-SNAPSHOT + compile + + + \ No newline at end of file diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java new file mode 100644 index 0000000000000000000000000000000000000000..49f20a809aa886bc689d48b9310c54458a840cd7 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventArgs.java @@ -0,0 +1,30 @@ +/* + * 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.lcm.metadata.spi.event; + +import io.iec.edp.caf.commons.event.CAFEventArgs; + +public class DirEventArgs extends CAFEventArgs { + private String path; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..8d10e460aa4cb9bc826d38421c9e04137a4513c3 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/DirEventListener.java @@ -0,0 +1,34 @@ +/* + * 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.lcm.metadata.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface DirEventListener extends IEventListener { + /** + * 文件夹删除前事件 + * + * @param args 文件夹事件参数 + */ + void fireDirDeletingEvent(DirEventArgs args); + + /** + * 文件夹删除后事件 + * + * @param args 文件夹事件参数 + */ + void fireDirDeletedEvent(DirEventArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java new file mode 100644 index 0000000000000000000000000000000000000000..773a0cad555d214bb267d9d92b8a6e556118235a --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedArgs.java @@ -0,0 +1,35 @@ +/* + * 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.lcm.metadata.spi.event; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataPackage; +import io.iec.edp.caf.commons.event.CAFEventArgs; + +/** + * @author zhaoleitr + */ +public class MdPkgChangedArgs extends CAFEventArgs { + + private MetadataPackage metadataPackage; + + public MetadataPackage getMetadataPackage() { + return metadataPackage; + } + + public void setMetadataPackage(MetadataPackage metadataPackage) { + this.metadataPackage = metadataPackage; + } +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..80eed320d5e95e4f24cf5b6565e5176a516d05a5 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MdPkgChangedEventListener.java @@ -0,0 +1,38 @@ +/* + * 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.lcm.metadata.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +/** + * @author zhaoleitr + */ +public interface MdPkgChangedEventListener extends IEventListener { + + /** + * 元数据包新增后事件 + * + * @param args 元数据变更参数 + */ + void fireMdPkgAddedEvent(MdPkgChangedArgs args); + + /** + * 元数据更新后事件 + * + * @param args 元数据变更参数 + */ + void fireMdPkgChangedEvent(MdPkgChangedArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..8463167ddaa377d97027ab9beb48923d4593d745 --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataCreateEventListener.java @@ -0,0 +1,34 @@ +/* + * 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.lcm.metadata.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface MetadataCreateEventListener extends IEventListener { + /** + * 元数据创建前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataCreatingEvent(MetadataEventArgs args); + + /** + * 元数据创建后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataCreatedEvent(MetadataEventArgs args); +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java new file mode 100644 index 0000000000000000000000000000000000000000..536b150b88f12a81c185cd697d5f050d9c3a52ac --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventArgs.java @@ -0,0 +1,40 @@ +/* + * 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.lcm.metadata.spi.event; + +import com.inspur.edp.lcm.metadata.api.entity.GspMetadata; +import io.iec.edp.caf.commons.event.CAFEventArgs; + +public class MetadataEventArgs extends CAFEventArgs { + private String path; + private GspMetadata metadata; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public GspMetadata getMetadata() { + return metadata; + } + + public void setMetadata(GspMetadata metadata) { + this.metadata = metadata; + } +} diff --git a/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java new file mode 100644 index 0000000000000000000000000000000000000000..f60474b74d92ddd1ca1e558e467bce7f65a525fb --- /dev/null +++ b/model/framework/runtime-spi/src/main/java/com/inspur/edp/lcm/metadata/spi/event/MetadataEventListener.java @@ -0,0 +1,48 @@ +/* + * 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.lcm.metadata.spi.event; + +import io.iec.edp.caf.commons.event.IEventListener; + +public interface MetadataEventListener extends IEventListener { + /** + * 元数据保存前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataSavingEvent(MetadataEventArgs args); + + /** + * 元数据保存后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataSavedEvent(MetadataEventArgs args); + + /** + * 元数据删除前事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataDeletingEvent(MetadataEventArgs args); + + /** + * 元数据删除后事件 + * + * @param args 元数据事件参数 + */ + void fireMetadataDeletedEvent(MetadataEventArgs args); +} diff --git a/model/pom.xml b/model/pom.xml index 5beef649eccb1f27a1d88c2513ba28a747a847b4..022bcf9c32974da2d35cf5ddbcb4577da1d4e0db 100644 --- a/model/pom.xml +++ b/model/pom.xml @@ -1,21 +1,19 @@ + ~ 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. + --> @@ -48,9 +46,6 @@ ubml-common ${project.version} - - - \ No newline at end of file diff --git a/model/vo/definition/pom.xml b/model/vo/definition/pom.xml index 3850ebf7e6ec457e1217b85cd253feea2329146a..f0588b89e9898a495f731cbe2b6dd06a2f9cb23a 100644 --- a/model/vo/definition/pom.xml +++ b/model/vo/definition/pom.xml @@ -1,21 +1,19 @@ + ~ 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. + --> diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java index b3d09147b119453599c5b59f1934928fabb374cb..54bb640cddb0d24d7c3822ddec3027eac540e057 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/DotNetToJavaStringHelper.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition; /** diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java index 59881c677f8f352c0e13723180c9d02a00cc4137..1ce3b1975cca847719062f4c0d95a01b43b7bf97 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModel.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -7,7 +22,7 @@ import java.util.HashMap; import java.util.function.Predicate; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonObject; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonModel; -import org.openatom.ubml.model.common.definition.entity.IMetadataContent; +import com.inspur.edp.lcm.metadata.api.IMetadataContent; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; import org.openatom.ubml.model.vo.definition.collection.ValueHelpConfigCollection; import org.openatom.ubml.model.vo.definition.common.TemplateVoInfo; @@ -27,350 +42,303 @@ import org.openatom.ubml.model.vo.definition.json.model.ViewModelSerializer; @JsonDeserialize(using = ViewModelDeserializer.class) @JsonSerialize(using = ViewModelSerializer.class) public class GspViewModel extends GspCommonModel implements IMetadataContent, Cloneable { - ///#region 属性 - - /** - * 启用标准日期时间格式 - * - */ - private Boolean enableStdTimeFormat = false; - - public Boolean getEnableStdTimeFormat() { - return enableStdTimeFormat; - } - - public void setEnableStdTimeFormat(Boolean enableStdTimeFormat) { - this.enableStdTimeFormat = enableStdTimeFormat; - } - - /** - * 描述 - * - */ - private String privateDescription; - - public final String getDescription() { - return privateDescription; - } - - public final void setDescription(String value) { - privateDescription = value; - } - - /** - * 模型映射:VM可以通过映射规则映射到BE或者其他数据源上 - * - */ - private ViewModelMapping privateMapping; - - public final ViewModelMapping getMapping() { - - return privateMapping; - } - - public final void setMapping(ViewModelMapping value) { - privateMapping = value; - } - - /** - * 根节点 - * - */ - public GspViewObject getMainObject() { - return (GspViewObject) super.getMainObject(); - } - - void setMainObject(GspViewObject value) { - super.setMainObject(value); - } - - /** - * 获取扩展类型,总是返回为"视图对象"类型 - * - */ - @Override - public String getExtendType() { - return "GspViewModel"; - } - - - /** - * 值帮助配置集合 - */ - private ValueHelpConfigCollection valueHelpConfigs = new ValueHelpConfigCollection(); - - /** - * 值帮助配置集合 - * - */ - public ValueHelpConfigCollection getValueHelpConfigs() { - return this.valueHelpConfigs; - } - - public void setValueHelpConfigs(ValueHelpConfigCollection value) { - this.valueHelpConfigs = value; - } - - /** - * 操作集合 - */ - private VMActionCollection actions; - - /** - * 操作集合 - * - */ - public final VMActionCollection getActions() { - if (actions == null) { - actions = new VMActionCollection(); - } - - return actions; - } - - public void setActions(VMActionCollection value) { - this.actions = value; - } - - private java.util.HashMap extendProperties; - - /** - * 表单拓展节点 - */ - public final java.util.HashMap getExtendProperties() { - if (extendProperties == null) { - extendProperties = new java.util.HashMap(); - } - return extendProperties; - } - - public void setExtendProperties(java.util.HashMap value) { - this.extendProperties = value; - } - - private VoDataExtendInfo dataExtendInfo; - - /** - * 数据逻辑扩展 - */ - public final VoDataExtendInfo getDataExtendInfo() { - if (dataExtendInfo == null) { - dataExtendInfo = new VoDataExtendInfo(); - } - return dataExtendInfo; - } - - public void setDataExtendInfo(VoDataExtendInfo value) { - this.dataExtendInfo = value; - } - - private TemplateVoInfo templateVoInfo; - - /** - * 模板VO信息 - */ - public final TemplateVoInfo getTemplateVoInfo() { - if (templateVoInfo == null) { - templateVoInfo = new TemplateVoInfo(); - } - return templateVoInfo; - } - - public void setTemplateVoInfo(TemplateVoInfo value) { - this.templateVoInfo = value; - } - - private boolean autoConvertMessage; - public boolean getAutoConvertMessage(){ - return autoConvertMessage; - } - - public void setAutoConvertMessage(boolean value){ - autoConvertMessage = value; - } - ///#endregion - - ///#region 方法 - - ///#region 复写 - - /** - * 重载Equals方法 - * - * @param obj 要比较的对象 - * @return - * 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (obj.equals(this)) { - return true; - } - if (obj.getClass() != getClass()) { - return false; - } - - return equals((GspViewModel) obj); - } - - /** - * 当前对象是否等于同一类型的另一个对象。 - * - * @param vo 与此对象进行比较的对象。 - * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(GspViewModel vo) { - if (vo.equals(null)) { - return false; - } - //&& this.DevLevelCode == other.DevLevelCode - //&& this.ForwardMappingID == other.ForwardMappingID - if (getID() == vo.getID() && getCode() == vo.getCode() && getName() == vo.getName() && getDescription().equals(vo.getDescription()) && getActions().equals(vo.getActions()) && vo.getMapping().equals(getMapping()) && getMainObject().equals(vo.getMainObject())) - //&& this.SrcDevLevelCode == other.SrcDevLevelCode) - { - return true; - } - - - return false; - } - - /** - * Serves as a hash function for a particular type. - * - * @return A hash code for the current . - * 2 - */ - @Override - public int hashCode() { - { - int hashCode = (getMainObject() != null ? getMainObject().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getValueHelpConfigs() != null ? getValueHelpConfigs().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getDescription() != null ? getDescription().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); - hashCode = (hashCode * 397) ^ (actions != null ? actions.hashCode() : 0); - hashCode = (hashCode * 397) ^ (getMainObject() != null ? getMainObject().hashCode() : 0); - return hashCode; - } - } - - /** - * 克隆 - * - * @return - */ -//ORIGINAL LINE: public new object Clone() - public final GspViewModel clone() { - Object tempVar = null; - tempVar = super.clone(); - - GspViewModel vo = (GspViewModel) ((tempVar instanceof GspViewModel) ? tempVar : null); - if (vo == null) { - throw new RuntimeException("克隆GSPViewObject失败"); - } - if (getMainObject() != null) { - Object tempVar2 = getMainObject().clone(); - vo.setMainObject((GspViewObject) ((tempVar2 instanceof GspViewObject) ? tempVar2 : null)); - ArrayList objList = vo.getAllObjectList(); - if (objList != null && objList.size() > 0) { - for (IGspCommonObject obj : objList) { - obj.setBelongModel(vo); - obj.setBelongModelID(vo.getID()); - } - } - } - if (getMapping() != null) { - Object tempVar2 = getMapping().clone(); - vo.setMapping((ViewModelMapping) ((tempVar2 instanceof ViewModelMapping) ? tempVar2 : null)); - } - return vo; - } - - - /** - * 重载ToString方法 - * - * @return - */ - @Override - public String toString() { - return String.format("ID:%1$s,Code:%2$s,Name:%3$s,RootNode:%4$s", getID(), getCode(), getName(), getMainObject().getCode()); - } - - ///#endregion - - ///#region 获取节点 - - /** - * 查找指定的VM节点 - *

- * // @param viewObjectCode 节点编号 - * - * @return - */ - public final GspViewObject getNode(String nodeCode) { - return getNode(pre -> pre.getCode().equals(nodeCode)); - } - - public final GspViewObject getNode(Predicate predicate) { - ArrayList result = getAllNodes(predicate); - if (result.size() > 0) { - return result.get(0); - } - return null; - } -// return GetNodes(node => node.Code.equals(viewObjectCode, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); -//GetNodes(); -// ArrayList bizObjs = getAllNodes(); -// ArrayList result = new ArrayList(); -// for (GspBizEntityObject item : bizObjs) { -// if (predicate.test(item)) { -// result.add(item); -// } -// } -// return result; -// for(GspViewObject node:){ -// if(node.getCode().equals(viewObjectCode)){ -// return node; -// } + /** + * 启用标准日期时间格式 + */ + private Boolean enableStdTimeFormat = false; -// return GetNodes(node => node.Code.equals(viewObjectCode, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); + public Boolean getEnableStdTimeFormat() { + return enableStdTimeFormat; + } + public void setEnableStdTimeFormat(Boolean enableStdTimeFormat) { + this.enableStdTimeFormat = enableStdTimeFormat; + } - /** - * 查询符合条件的节点 - *

- * // @param predict - * - * @return - * - */ + /** + * 描述 + */ + private String privateDescription; -// public final ArrayList getAllNodes(Predicate predicate) { -// -// ArrayList bizObjs = getAllNodes(); -// ArrayList result = new ArrayList(); -// for (GspBizEntityObject item : bizObjs) { -// if (predicate.test(item)) { -// result.add(item); -// } -// } -// return result; -// } - public ArrayList getAllNodes(Predicate predicate) { - ArrayList bizObjs = getAllNodes(null); - ArrayList result = new ArrayList(); - for (GspViewObject item : bizObjs) { - if (predicate.test(item)) { - result.add(item); - } - } - return result; - } + public final String getDescription() { + return privateDescription; + } + + public final void setDescription(String value) { + privateDescription = value; + } + + /** + * 模型映射:VM可以通过映射规则映射到BE或者其他数据源上 + * + */ + private ViewModelMapping privateMapping; + + public final ViewModelMapping getMapping() { + + return privateMapping; + } + + public final void setMapping(ViewModelMapping value) { + privateMapping = value; + } + + /** + * 根节点 + */ + @Override + public GspViewObject getMainObject() { + return (GspViewObject)super.getMainObject(); + } + + void setMainObject(GspViewObject value) { + super.setMainObject(value); + } + + /** + * 获取扩展类型,总是返回为"视图对象"类型 + * + */ + @Override + public String getExtendType() { + return "GspViewModel"; + } + + + /** + * 值帮助配置集合 + */ + private ValueHelpConfigCollection valueHelpConfigs = new ValueHelpConfigCollection(); + + /** + * 值帮助配置集合 + * + */ + public ValueHelpConfigCollection getValueHelpConfigs() { + return this.valueHelpConfigs; + } + + public void setValueHelpConfigs(ValueHelpConfigCollection value) { + this.valueHelpConfigs = value; + } + + /** + * 操作集合 + */ + private VMActionCollection actions; + + /** + * 操作集合 + * + */ + public final VMActionCollection getActions() { + if (actions == null) { + actions = new VMActionCollection(); + } + + return actions; + } + + public void setActions(VMActionCollection value) { + this.actions = value; + } + + private java.util.HashMap extendProperties; + + /** + * 表单拓展节点 + */ + public final java.util.HashMap getExtendProperties() { + if (extendProperties == null) { + extendProperties = new java.util.HashMap(); + } + return extendProperties; + } + + public void setExtendProperties(java.util.HashMap value) { + this.extendProperties = value; + } + + private VoDataExtendInfo dataExtendInfo; + + /** + * 数据逻辑扩展 + */ + public final VoDataExtendInfo getDataExtendInfo() { + if (dataExtendInfo == null) { + dataExtendInfo = new VoDataExtendInfo(); + } + return dataExtendInfo; + } + + public void setDataExtendInfo(VoDataExtendInfo value) { + this.dataExtendInfo = value; + } + + private TemplateVoInfo templateVoInfo; + + /** + * 模板VO信息 + */ + public final TemplateVoInfo getTemplateVoInfo() { + if (templateVoInfo == null) { + templateVoInfo = new TemplateVoInfo(); + } + return templateVoInfo; + } + + public void setTemplateVoInfo(TemplateVoInfo value) { + this.templateVoInfo = value; + } + + private boolean autoConvertMessage; + + public boolean getAutoConvertMessage() { + return autoConvertMessage; + } + + public void setAutoConvertMessage(boolean value) { + autoConvertMessage = value; + } + + + /** + * 重载Equals方法 + * + * @param obj 要比较的对象 + * @return + * 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.equals(this)) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } + + return equals((GspViewModel)obj); + } + + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param vo 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(GspViewModel vo) { + if (vo.equals(null)) { + return false; + } + //&& this.DevLevelCode == other.DevLevelCode + //&& this.ForwardMappingID == other.ForwardMappingID + if (getID() == vo.getID() && getCode() == vo.getCode() && getName() == vo.getName() && getDescription().equals(vo.getDescription()) && getActions().equals(vo.getActions()) && vo.getMapping().equals(getMapping()) && getMainObject().equals(vo.getMainObject())) + //&& this.SrcDevLevelCode == other.SrcDevLevelCode) + { + return true; + } + + + return false; + } + + /** + * Serves as a hash function for a particular type. + */ + @Override + public int hashCode() { + { + int hashCode = (getMainObject() != null ? getMainObject().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getValueHelpConfigs() != null ? getValueHelpConfigs().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getDescription() != null ? getDescription().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); + hashCode = (hashCode * 397) ^ (actions != null ? actions.hashCode() : 0); + hashCode = (hashCode * 397) ^ (getMainObject() != null ? getMainObject().hashCode() : 0); + return hashCode; + } + } + + /** + * 克隆 + * + * @return + */ + @Override + public final GspViewModel clone() { + Object tempVar = null; + tempVar = super.clone(); + + GspViewModel vo = (GspViewModel)((tempVar instanceof GspViewModel) ? tempVar : null); + if (vo == null) { + throw new RuntimeException("克隆GSPViewObject失败"); + } + if (getMainObject() != null) { + Object tempVar2 = getMainObject().clone(); + vo.setMainObject((GspViewObject)((tempVar2 instanceof GspViewObject) ? tempVar2 : null)); + ArrayList objList = vo.getAllObjectList(); + if (objList != null && objList.size() > 0) { + for (IGspCommonObject obj : objList) { + obj.setBelongModel(vo); + obj.setBelongModelID(vo.getID()); + } + } + } + if (getMapping() != null) { + Object tempVar2 = getMapping().clone(); + vo.setMapping((ViewModelMapping)((tempVar2 instanceof ViewModelMapping) ? tempVar2 : null)); + } + return vo; + } + + + /** + * 重载ToString方法 + * + * @return + */ + @Override + public String toString() { + return String.format("ID:%1$s,Code:%2$s,Name:%3$s,RootNode:%4$s", getID(), getCode(), getName(), getMainObject().getCode()); + } + + + ///获取节点 + + /** + * 查找指定的VM节点 + *

+ * // @param viewObjectCode 节点编号 + * + * @return + */ + public final GspViewObject getNode(String nodeCode) { + return getNode(pre -> pre.getCode().equals(nodeCode)); + } + + public final GspViewObject getNode(Predicate predicate) { + ArrayList result = getAllNodes(predicate); + if (result.size() > 0) { + return result.get(0); + } + return null; + } + + + public ArrayList getAllNodes(Predicate predicate) { + ArrayList bizObjs = getAllNodes(null); + ArrayList result = new ArrayList(); + for (GspViewObject item : bizObjs) { + if (predicate.test(item)) { + result.add(item); + } + } + return result; + } // public final java.util.List GetNodes(HashMap predict) // { @@ -381,36 +349,35 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // return GetAllObjectList().Select(item => (GspViewObject)((item instanceof GspViewObject) ? item : null)).ToList(); // } - /** - * 查询当前VM所有节点的字典 - * 其中Key是节点Code - * - * @return - * - * - */ - public final java.util.HashMap getNodesDic() { + /** + * 查询当前VM所有节点的字典 + * 其中Key是节点Code + * + * @return + * + * + */ + public final java.util.HashMap getNodesDic() { // return GetNodes(null).ToDictionary(item => item.Code, item => item); - HashMap toDic = new HashMap(); - for (IGspCommonObject item : getAllObjectList()) { - toDic.put(item.getCode(), item); + HashMap toDic = new HashMap(); + for (IGspCommonObject item : getAllObjectList()) { + toDic.put(item.getCode(), item); - } + } // return GetNodes(null).ToDictionary(item => item.Code, item => item); - return toDic; + return toDic; - } + } - ///#endregion - ///#region 联动-弃用 - /** - * 与业务实体建立连接 - *

- * // @param bizEntity - * - * @return - */ + ///联动-弃用 + /** + * 与业务实体建立连接 + *

+ * // @param bizEntity + * + * @return + */ // public final GspViewModel LinkWithBizEntity(GspBusinessEntity bizEntity) // { //// java.util.HashMap viewElements = GetAllElementList(true).ToDictionary(item => item.getID(), item => (GspViewModelElement)((item instanceof GspViewModelElement) ? item : null)); @@ -450,7 +417,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// GspViewModel transViewModel = ConvertUtils.ConvertToViewModel(bizEntity, null, null); // GspViewModel transViewModel = ConvertUtils.ConvertToViewModel(bizEntity, null, null); // -// ///#region 联动对象上的属性 +// ///联动对象上的属性 // // java.util.List tempVar = GetNodes(null); // java.util.ArrayList viewObjects = (java.util.ArrayList)((tempVar instanceof java.util.ArrayList) ? tempVar : null); @@ -467,7 +434,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// GSPBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); // GspBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); // -// ///#region 分级信息 +// ///分级信息 //// if (beObject.HirarchyInfo != null) //// { //// objectItem.HirarchyInfo = beObject.HirarchyInfo; @@ -549,9 +516,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// } //// } // -// ///#endregion +// / // -// ///#region 创建人等信息 +// ///创建人等信息 //// if (elementMappings.containsKey(beObject.CreatorElementID)) //// if (elementMappings.containsKey(beObject.getCreateID())) //// { @@ -569,22 +536,22 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl //// { //// objectItem.ModifiedDateElementID = elementMappings.get(beObject.ModifiedDateElementID); //// } -// ///#endregion +// / //// objectItem.Code = beObject.Code; // objectItem.setCode(beObject.getCode()); // objectItem.setIsVirtual(false); //be带出,IsVirtual=false // objectItem.setIsReadOnly(beObject.getIsReadOnly()); // -// ///#region ID生成规则 +// ///ID生成规则 //// if (elementMappings.containsKey(beObject.ColumnGenerateID.ElementID)) // if (elementMappings.containsKey(beObject.getColumnGenerateID().getElementID())) // { // objectItem.ColumnGenerateID.ElementID = elementMappings.get(beObject.ColumnGenerateID.ElementID); // } // objectItem.ColumnGenerateID.GernerateType = beObject.ColumnGenerateID.GernerateType; -// ///#endregion +// / // -// ///#region 唯一性约束 +// ///唯一性约束 // //objectItem.ContainConstraints = beObject.ContainConstraints; // if (objectItem.ContainConstraints != null && objectItem.ContainConstraints.size() > 0) // { @@ -614,9 +581,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // objectItem.ContainConstraints.Add(viewModelConstraint); // } -// ///#endregion +// / // -// ///#region 关联信息 +// ///关联信息 // if (objectItem.getParent() != null) // { // objectItem.keySet().Clear(); @@ -643,11 +610,11 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // objectItem.keySet().Add(associationKey); // } // } -// ///#endregion +// / // } -// ///#endregion +// / // -// ///#region 联动字段上的属性 +// ///联动字段上的属性 // // for (java.util.Map.Entry item : viewElements.entrySet()) // { @@ -737,9 +704,9 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // } // -// ///#endregion +// / // -// ///#region 联动be带出操作 +// ///联动be带出操作 // // var mappedBeActions = getActions().Where(item=>item.Type==ViewModel.Action.ViewModelActionType.BEAction).ToList(); // VMActionCollection tranVmActions = transViewModel.getActions(); @@ -756,7 +723,7 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // } // -// ///#endregion +// / // return this; // } // @@ -832,21 +799,21 @@ public class GspViewModel extends GspCommonModel implements IMetadataContent, Cl // } // return null; // } - ///#endregion - ///#region manager - private static final String ItemNameTemplate = "I%1$sManager"; - public final String getMgrInterfaceName() { - return String.format(ItemNameTemplate, getCode()); - } + ///manager + private static final String ItemNameTemplate = "I%1$sManager"; + + public final String getMgrInterfaceName() { + return String.format(ItemNameTemplate, getCode()); + } - public final String getChangesetClassName() { - return String.format("%1$s%2$s", getCode(), "ViewModelChange"); - } + public final String getChangesetClassName() { + return String.format("%1$s%2$s", getCode(), "ViewModelChange"); + } - public final String getDefaultValueClassName() { - return String.format("%1$s%2$s", getCode(), "DefaultValue"); - } + public final String getDefaultValueClassName() { + return String.format("%1$s%2$s", getCode(), "DefaultValue"); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java index a253d393ab506efbca40afad03eedcfc62b713ba..ead733d0ef9d1d8b8a55427556462150eeee48f4 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewModelElement.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -18,311 +33,311 @@ import org.openatom.ubml.model.vo.definition.json.element.ViewElementDeserialize */ @JsonDeserialize(using = ViewElementDeserializer.class) public class GspViewModelElement extends GspCommonElement implements Serializable { - public GspViewModelElement() { - } - - ///#region 属性 - - /** - * 是否启用多语输入 - * - */ - private boolean enableMultiLanguageInput; - - public boolean isEnableMultiLanguageInput() { - return enableMultiLanguageInput; - } - - public void setEnableMultiLanguageInput(boolean enableMultiLanguageInput) { - this.enableMultiLanguageInput = enableMultiLanguageInput; - } - - /** - * 是否vm新增的虚拟字段 - * - */ - private boolean privateIsVirtualViewElement; - - public final boolean getIsVirtualViewElement() { - return privateIsVirtualViewElement; - } - - public final void setIsVirtualViewElement(boolean value) { - privateIsVirtualViewElement = value; - } - - /** - 是否只读属性 - - - //public bool IsReadOnly { get; set; } - */ - - /** - * 是否只用于服务端 - * - */ - private boolean privateIsBeckendOnly; - - public final boolean getIsBeckendOnly() { - return privateIsBeckendOnly; - } - - public final void setIsBeckendOnly(boolean value) { - privateIsBeckendOnly = value; - } - - /** - * 隶属的VO节点 - * - */ - //[Newtonsoft.Json.JsonIgnore()] - GspViewObject getOwner() { - return (GspViewObject) getBelongObject(); - - } - - void setOwner(GspViewObject value) { - setBelongObject(value); - } - - /** - * 属性映射,VMElement可以映射到BE,或者DM Element上 - * - */ + public GspViewModelElement() { + } + + ///属性 + + /** + * 是否启用多语输入 + * + */ + private boolean enableMultiLanguageInput; + + public boolean isEnableMultiLanguageInput() { + return enableMultiLanguageInput; + } + + public void setEnableMultiLanguageInput(boolean enableMultiLanguageInput) { + this.enableMultiLanguageInput = enableMultiLanguageInput; + } + + /** + * 是否vm新增的虚拟字段 + * + */ + private boolean privateIsVirtualViewElement; + + public final boolean getIsVirtualViewElement() { + return privateIsVirtualViewElement; + } + + public final void setIsVirtualViewElement(boolean value) { + privateIsVirtualViewElement = value; + } + + /** + 是否只读属性 + + + //public bool IsReadOnly { get; set; } + */ + + /** + * 是否只用于服务端 + * + */ + private boolean privateIsBeckendOnly; + + public final boolean getIsBeckendOnly() { + return privateIsBeckendOnly; + } + + public final void setIsBeckendOnly(boolean value) { + privateIsBeckendOnly = value; + } + + /** + * 隶属的VO节点 + * + */ + //[Newtonsoft.Json.JsonIgnore()] + GspViewObject getOwner() { + return (GspViewObject)getBelongObject(); + + } + + void setOwner(GspViewObject value) { + setBelongObject(value); + } + + /** + * 属性映射,VMElement可以映射到BE,或者DM Element上 + * + */ // private GspVoElementMapping privateMapping; - GspVoElementMapping mapping; - - public final GspVoElementMapping getMapping() { - return mapping; - } - - public final void setMapping(GspVoElementMapping value) { - mapping = value; - } - - /** - * 是否立即提交 - * - *

- * 表单上设置了立即提交控制的属性发生变更后,会自动执行Modfiy将累积变更提交到应用服务器 - */ - private boolean privateImmediateSubmission; - - public final boolean getImmediateSubmission() { - return privateImmediateSubmission; - } - - public final void setImmediateSubmission(boolean value) { - privateImmediateSubmission = value; - } - - private boolean showInFilter = true; - - /** - * 是否在过滤中显示 - * - */ - public boolean getShowInFilter() { - return this.showInFilter; - } - - public void setShowInFilter(boolean value) { - this.showInFilter = value; - } - - private boolean showInSort = true; - - /** - * 是否在排序中显示 - * - */ - public boolean getShowInSort() { - return this.showInSort; - } - - public void setShowInSort(boolean value) { - this.showInSort = value; - } - - // - private VMHelpConfig privateVMHelpConfig; - - // @Deprecated - public final VMHelpConfig getVMHelpConfig() { - return privateVMHelpConfig; - } - - // @Deprecated - public final void setVMHelpConfig(VMHelpConfig value) { - privateVMHelpConfig = value; - } - - // - private VMActionCollection privateHelpActions; - - // @Deprecated - public final VMActionCollection getHelpActions() { - return privateHelpActions; - } - - // @Deprecated - public final void setHelpActions(VMActionCollection value) { - privateHelpActions = value; - } - - private java.util.HashMap extendProperties; - - /** - * 表单拓展节点 - */ - public final java.util.HashMap getExtendProperties() { - if (extendProperties == null) { - extendProperties = new java.util.HashMap(); - } - return extendProperties; - } - - public void setExtendProperties(java.util.HashMap value) { - extendProperties = value; - } - - ///#region 帮助信息 - //private ElementHelpType helpType = ElementHelpType.None; - /////

- ///// 帮助类型 - ///// - //public ElementHelpType HelpType - //{ - // get { return helpType; } - // set { helpType = value; } - //} - - //private BaseDictInfo helpDefine; - ///// - ///// 帮助定义 - ///// - //public BaseDictInfo HelpDefine - //{ - // get { return helpDefine; } - // set { helpDefine = value; } - //} - ///#endregion 帮助信息 - - ///#endregion - - ///#region 方法 - - /** - * 重载Equals方法 - * - * @param obj 要比较的对象 - * @return - * 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (obj.equals(this)) { - return true; - } - if (obj.getClass() != getClass()) { - return false; - } - - return equals((GspViewModelElement) obj); - } - - /** - * 当前对象是否等于同一类型的另一个对象。 - * - * @param other 与此对象进行比较的对象。 - * @return - * 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(GspViewModelElement other) { - //&& IsReadOnly == other.IsReadOnly - if (getID() == other.getID() && getCode() == other.getCode() && getName() == other.getName() && getObjectType() == other.getObjectType() && getIsRequire() == other.getIsRequire() && getLabelID() == other.getLabelID() && getLength() == other.getLength() && getPrecision() == other.getPrecision() && getShowInFilter() == other.getShowInFilter() && getShowInSort() == other.getShowInSort()) { - if ((getOwner() == null && other.getOwner() == null) || (getOwner() != null && other.getOwner() != null && getOwner().getID() == other.getOwner().getID())) { - return true; - } - } - - return false; - } - - /** - * Serves as a hash function for a particular type. - * - * @return . - * A hash code for the current - * 2 - */ - @Override - public int hashCode() { + GspVoElementMapping mapping; + + public final GspVoElementMapping getMapping() { + return mapping; + } + + public final void setMapping(GspVoElementMapping value) { + mapping = value; + } + + /** + * 是否立即提交 + * + *

+ * 表单上设置了立即提交控制的属性发生变更后,会自动执行Modfiy将累积变更提交到应用服务器 + */ + private boolean privateImmediateSubmission; + + public final boolean getImmediateSubmission() { + return privateImmediateSubmission; + } + + public final void setImmediateSubmission(boolean value) { + privateImmediateSubmission = value; + } + + private boolean showInFilter = true; + + /** + * 是否在过滤中显示 + * + */ + public boolean getShowInFilter() { + return this.showInFilter; + } + + public void setShowInFilter(boolean value) { + this.showInFilter = value; + } + + private boolean showInSort = true; + + /** + * 是否在排序中显示 + * + */ + public boolean getShowInSort() { + return this.showInSort; + } + + public void setShowInSort(boolean value) { + this.showInSort = value; + } + + // + private VMHelpConfig privateVMHelpConfig; + + // @Deprecated + public final VMHelpConfig getVMHelpConfig() { + return privateVMHelpConfig; + } + + // @Deprecated + public final void setVMHelpConfig(VMHelpConfig value) { + privateVMHelpConfig = value; + } + + // + private VMActionCollection privateHelpActions; + + // @Deprecated + public final VMActionCollection getHelpActions() { + return privateHelpActions; + } + + // @Deprecated + public final void setHelpActions(VMActionCollection value) { + privateHelpActions = value; + } + + private java.util.HashMap extendProperties; + + /** + * 表单拓展节点 + */ + public final java.util.HashMap getExtendProperties() { + if (extendProperties == null) { + extendProperties = new java.util.HashMap(); + } + return extendProperties; + } + + public void setExtendProperties(java.util.HashMap value) { + extendProperties = value; + } + + ///帮助信息 + //private ElementHelpType helpType = ElementHelpType.None; + /////

+ ///// 帮助类型 + ///// + //public ElementHelpType HelpType + //{ + // get { return helpType; } + // set { helpType = value; } + //} + + //private BaseDictInfo helpDefine; + ///// + ///// 帮助定义 + ///// + //public BaseDictInfo HelpDefine + //{ + // get { return helpDefine; } + // set { helpDefine = value; } + //} + + + ///方法 + + /** + * 重载Equals方法 + * + * @param obj 要比较的对象 + * @return + * 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.equals(this)) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } + + return equals((GspViewModelElement)obj); + } + + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return + * 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(GspViewModelElement other) { + //&& IsReadOnly == other.IsReadOnly + if (getID() == other.getID() && getCode() == other.getCode() && getName() == other.getName() && getObjectType() == other.getObjectType() && getIsRequire() == other.getIsRequire() && getLabelID() == other.getLabelID() && getLength() == other.getLength() && getPrecision() == other.getPrecision() && getShowInFilter() == other.getShowInFilter() && getShowInSort() == other.getShowInSort()) { + if ((getOwner() == null && other.getOwner() == null) || (getOwner() != null && other.getOwner() != null && getOwner().getID() == other.getOwner().getID())) { + return true; + } + } + + return false; + } + + /** + * Serves as a hash function for a particular type. + * + * @return . + * A hash code for the current + * 2 + */ + @Override + public int hashCode() { // unchecked - { - //var hashCode = IsReadOnly.GetHashCode(); - int hashCode = (new Boolean(getIsBeckendOnly())).hashCode(); - hashCode = (hashCode * 397) ^ (getOwner() != null ? getOwner().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); - return hashCode; - } - } - - /** - * 克隆 - * - * @return - */ - public final GspViewModelElement clone() { + { + //var hashCode = IsReadOnly.GetHashCode(); + int hashCode = (new Boolean(getIsBeckendOnly())).hashCode(); + hashCode = (hashCode * 397) ^ (getOwner() != null ? getOwner().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); + return hashCode; + } + } + + /** + * 克隆 + * + * @return + */ + public final GspViewModelElement clone() { // Object tempVar = MemberwiseClone(); - Object tempVar = null; - try { - tempVar = super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } + Object tempVar = null; + try { + tempVar = super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } // var element = (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? tempVar : null); - GspViewModelElement element = (GspViewModelElement) ((tempVar instanceof GspViewModelElement) ? tempVar : null); - if (element == null) { - throw new RuntimeException("克隆Element失败"); - } - - if (getMapping() != null) { - Object tempVar2 = getMapping().clone(); - element.setMapping((GspVoElementMapping) ((tempVar2 instanceof GspVoElementMapping) ? tempVar2 : null)); - } - if (getVMHelpConfig() != null) - try { - Object tempVar3 = super.clone(); - element.setVMHelpConfig((VMHelpConfig) ((tempVar3 instanceof VMHelpConfig) ? tempVar3 : null)); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - - if (getHelpActions() != null) - try { - Object tempVar4 = super.clone(); - element.setHelpActions((VMActionCollection) ((tempVar4 instanceof VMActionCollection) ? tempVar4 : - null)); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - - - return element; - } - - /** - * 重载ToString方法 - * - * @return - */ - @Override - public String toString() { - return String.format("ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); - } + GspViewModelElement element = (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? tempVar : null); + if (element == null) { + throw new RuntimeException("克隆Element失败"); + } + + if (getMapping() != null) { + Object tempVar2 = getMapping().clone(); + element.setMapping((GspVoElementMapping)((tempVar2 instanceof GspVoElementMapping) ? tempVar2 : null)); + } + if (getVMHelpConfig() != null) { + try { + Object tempVar3 = super.clone(); + element.setVMHelpConfig((VMHelpConfig)((tempVar3 instanceof VMHelpConfig) ? tempVar3 : null)); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + } + + if (getHelpActions() != null) { + try { + Object tempVar4 = super.clone(); + element.setHelpActions((VMActionCollection)((tempVar4 instanceof VMActionCollection) ? tempVar4 : + null)); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + } + + + return element; + } + + /** + * 重载ToString方法 + * + * @return + */ + @Override + public String toString() { + return String.format("ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java index b3c84073bfc5953065fa73f6c4ee1e4b9239f894..55d05bfbd31272389de152f658c7ba7215d215a6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/GspViewObject.java @@ -1,10 +1,24 @@ +/* + * 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 org.openatom.ubml.model.vo.definition; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.Serializable; import java.util.ArrayList; import java.util.function.Predicate; -import lombok.var; import org.openatom.ubml.model.common.definition.cef.IGspCommonField; import org.openatom.ubml.model.common.definition.cef.entity.ClassInfo; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; @@ -38,8 +52,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { } } - ///#region 属性 - /** * 服务器使用 * @@ -86,11 +98,12 @@ public class GspViewObject extends GspCommonObject implements Serializable { } // @Override + @Override public void setParentObject(IGspCommonObject value) { if (value != null && !(value instanceof GspViewObject)) { throw new RuntimeException("类型不兼容异常"); } - setParent((GspViewObject) value); + setParent((GspViewObject)value); } /** @@ -134,8 +147,9 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 元素集合 * */ + @Override public VMElementCollection getContainElements() { - return (VMElementCollection) super.getContainElements(); + return (VMElementCollection)super.getContainElements(); } private void setContainElements(VMElementCollection value) { @@ -146,8 +160,9 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 子节点集合 * */ + @Override public ViewObjectCollection getContainChildObjects() { - return (ViewObjectCollection) super.getContainChildObjects(); + return (ViewObjectCollection)super.getContainChildObjects(); } private void setContainChildObjects(ViewObjectCollection value) { @@ -184,9 +199,8 @@ public class GspViewObject extends GspCommonObject implements Serializable { public void setExtendProperties(java.util.HashMap value) { extendProperties = value; } - ///#endregion - ///#region 重载方法 + ///重载方法 /** * 重载Equals方法 @@ -207,7 +221,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { return false; } - return equals((GspViewObject) obj); + return equals((GspViewObject)obj); } /** @@ -260,7 +274,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { @Override public GspViewObject clone() { Object tempVar = super.clone(); - GspViewObject node = (GspViewObject) ((tempVar instanceof GspViewObject) ? tempVar : null); + GspViewObject node = (GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null); if (node == null) { throw new RuntimeException("克隆GSPViewObject失败"); } @@ -268,7 +282,7 @@ public class GspViewObject extends GspCommonObject implements Serializable { // node.Parent = Parent.Clone() as GspViewObject; if (getContainChildObjects() != null) { Object tempVar2 = getContainChildObjects().clone(); - node.setContainChildObjects((ViewObjectCollection) ((tempVar2 instanceof ViewObjectCollection) ? tempVar2 : null)); + node.setContainChildObjects((ViewObjectCollection)((tempVar2 instanceof ViewObjectCollection) ? tempVar2 : null)); for (IGspCommonObject ChildObj : node.getContainChildObjects()) { ChildObj.setParentObject(node); @@ -276,20 +290,16 @@ public class GspViewObject extends GspCommonObject implements Serializable { } if (getContainElements() != null && getContainElements().size() > 0) { - Object tempVar3 = getContainElements().clone(); - node.setContainElements((VMElementCollection) ((tempVar3 instanceof VMElementCollection) ? tempVar3 : null)); + VMElementCollection tempVar3 = getContainElements().clone(); + node.setContainElements(tempVar3); for (IGspCommonField BelongObj : node.getContainElements()) { BelongObj.setBelongObject(node); } } - //if (Association != null) - //{ - // node.Association = Association.Clone() as IVOAssociation; - //} - if (mapping != null){ - var map = mapping.clone() ; - node.setMapping((GspVoObjectMapping) ((map instanceof GspVoObjectMapping) ? map : null)); + if (mapping != null) { + GspVoObjectMapping map = mapping.clone(); + node.setMapping((GspVoObjectMapping)(map)); } @@ -306,7 +316,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { return String.format("ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); } - ///#endregion /** * 获取符合条件的属性列表 @@ -320,14 +329,14 @@ public class GspViewObject extends GspCommonObject implements Serializable { java.util.List toList = new ArrayList(); if (predicate != null) { for (IGspCommonElement item : temp) { - if (predicate.test((GspViewModelElement) item)) { - toList.add((GspViewModelElement) item); + if (predicate.test((GspViewModelElement)item)) { + toList.add((GspViewModelElement)item); } } return toList; } for (IGspCommonElement item2 : temp) { - GspViewModelElement tempVar2 = ((item2 instanceof GspViewModelElement) ? (GspViewModelElement) item2 : null); + GspViewModelElement tempVar2 = ((item2 instanceof GspViewModelElement) ? (GspViewModelElement)item2 : null); if (tempVar2 != null) { toList.add(tempVar2); } @@ -347,22 +356,30 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 排序条件` */ private String orderbyCondition; + + @Override public String getOrderbyCondition() { return orderbyCondition; } + @Override public void setOrderbyCondition(String value) { - orderbyCondition=value; + orderbyCondition = value; } + /** * 过滤条件 */ private String filterCondition; - public String getFilterCondition(){ + + @Override + public String getFilterCondition() { return filterCondition; } - public void setFilterCondition(String value){ - filterCondition=value; + + @Override + public void setFilterCondition(String value) { + filterCondition = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java index 10f71b7089904df86113d70977c355c30fb83de5..6ce6c9984143acab415a89c18fdbcc24fb4501f9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ActionFormatParameter.java @@ -1,84 +1,83 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; /** * The Definition Of Action Format Parameter - * - * @ClassName: ActionFormatParameter - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 */ -public class ActionFormatParameter implements Cloneable, Serializable -{ - ///#region 属性 +public class ActionFormatParameter implements Cloneable, Serializable { + /** + * ID + */ + private String privateID; + + public final String getID() { + + return privateID; + } + + public final void setID(String value) { - /** - ID - - */ - private String privateID; - public final String getID() - { + privateID = value; + } - return privateID; - } - public final void setID(String value) - { + /** + * Code + */ + private String privateCode; - privateID = value; - } + public final String getCode() { + return privateCode; + } - /** - Code - - */ - private String privateCode; - public final String getCode() - { - return privateCode; - } - public final void setCode(String value) - { - privateCode = value; - } + public final void setCode(String value) { + privateCode = value; + } - /** - Name - - */ - private String privateName; - public final String getName() - { - return privateName; - } - public final void setName(String value) - { - privateName = value; - } + /** + * Name + */ + private String privateName; - ///#endregion + public final String getName() { + return privateName; + } - ///#region 方法 + public final void setName(String value) { + privateName = value; + } - /** - 克隆 - - @return Action执行参数 - */ - public final ActionFormatParameter clone() - { - Object tempVar = null; - try { - tempVar = super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - ActionFormatParameter obj = (ActionFormatParameter)((tempVar instanceof ActionFormatParameter) ? tempVar : null); + /** + * 克隆 + * + * @return Action执行参数 + */ + @Override + public final ActionFormatParameter clone() { + Object tempVar = null; + try { + tempVar = super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + ActionFormatParameter obj = (ActionFormatParameter) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); - return obj; - } + return obj; + } - ///#endregion -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java index db93219019b956ebe8e8c8f42058860a4c560ad3..d60c2f1f1c961264d7b63049c6dddf8b2cca209f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameter.java @@ -1,3 +1,19 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.Interface; package org.openatom.ubml.model.vo.definition.action; @@ -14,106 +30,105 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterType; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public interface IViewModelParameter -{ - - /** - * @return The Id Of The Parameter - */ - String getID(); - - /** - * @param value The Id Of The Parameter - */ - void setID(String value); - - /** - * @return The Code Of The Parameter - */ - String getParamCode(); - - /** - * @param value The Code Of The Parameter - */ - void setParamCode(String value); - - /** - * @return The Name Of The Parameter - */ - String getParamName(); - - /** - * @param value The Name Of The Parameter - */ - void setParamName(String value); - - /** - * @return The Type Of The Parameter - */ - VMParameterType getParameterType(); - - /** - * @param value The Type Of The Parameter - */ - void setParameterType(VMParameterType value); - - /** - * @return The Assembly Of The Parameter,It`s Useful For Dotnet - */ - String getAssembly(); - - /** - * @param value The Assembly Of The Parameter,It`s Useful For Dotnet - */ - void setAssembly(String value); - - /** - * @return The Class Name Of The Parameter Type - */ - String getClassName(); - - /** - * @param value The Class Name Of The Parameter Type - */ - void setClassName(String value); - - /** - * @return The Parameter Mode Of The Parameter,The Default Value Is In - */ - VMParameterMode getMode(); - - /** - * @param value The Parameter Mode Of The Parameter,The Default Value Is In - */ - void setMode(VMParameterMode value); - - /** - * @return The Description Of The Parameter - */ - String getParamDescription(); - - /** - * @param value The Description Of The Parameter - */ - void setParamDescription(String value); - - /** - * @return The Collection Type Of The Parameter - */ - VMCollectionParameterType getCollectionParameterType(); - - /** - * @param value The Collection Type Of The Parameter - */ - void setCollectionParameterType(VMCollectionParameterType value); - - /** - * @return The Actual Value Of The Parameter,It`s Not Required - */ - ViewModelParActualValue getActualValue(); - - /** - * @param value The Actual Value Of The Parameter,It`s Not Required - */ - void setActualValue(ViewModelParActualValue value); -} \ No newline at end of file +public interface IViewModelParameter { + + /** + * @return The Id Of The Parameter + */ + String getID(); + + /** + * @param value The Id Of The Parameter + */ + void setID(String value); + + /** + * @return The Code Of The Parameter + */ + String getParamCode(); + + /** + * @param value The Code Of The Parameter + */ + void setParamCode(String value); + + /** + * @return The Name Of The Parameter + */ + String getParamName(); + + /** + * @param value The Name Of The Parameter + */ + void setParamName(String value); + + /** + * @return The Type Of The Parameter + */ + VMParameterType getParameterType(); + + /** + * @param value The Type Of The Parameter + */ + void setParameterType(VMParameterType value); + + /** + * @return The Assembly Of The Parameter,It`s Useful For Dotnet + */ + String getAssembly(); + + /** + * @param value The Assembly Of The Parameter,It`s Useful For Dotnet + */ + void setAssembly(String value); + + /** + * @return The Class Name Of The Parameter Type + */ + String getClassName(); + + /** + * @param value The Class Name Of The Parameter Type + */ + void setClassName(String value); + + /** + * @return The Parameter Mode Of The Parameter,The Default Value Is In + */ + VMParameterMode getMode(); + + /** + * @param value The Parameter Mode Of The Parameter,The Default Value Is In + */ + void setMode(VMParameterMode value); + + /** + * @return The Description Of The Parameter + */ + String getParamDescription(); + + /** + * @param value The Description Of The Parameter + */ + void setParamDescription(String value); + + /** + * @return The Collection Type Of The Parameter + */ + VMCollectionParameterType getCollectionParameterType(); + + /** + * @param value The Collection Type Of The Parameter + */ + void setCollectionParameterType(VMCollectionParameterType value); + + /** + * @return The Actual Value Of The Parameter,It`s Not Required + */ + ViewModelParActualValue getActualValue(); + + /** + * @param value The Actual Value Of The Parameter,It`s Not Required + */ + void setActualValue(ViewModelParActualValue value); +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java index 37b5d3de9b9d6d41d3e8a58aeb660fe63946cc0d..de214f1522a7a508bff85bc286c4ace786d0802d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/IViewModelParameterCollection.java @@ -1,4 +1,18 @@ -//package org.openatom.ubml.model.vo.definition.Interface; +/* + * 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 org.openatom.ubml.model.vo.definition.action; import java.util.List; @@ -13,15 +27,16 @@ import java.util.List; */ public interface IViewModelParameterCollection extends List { - /** - * @return The Parameters Count In The Collection - */ - int getCount(); + /** + * @return The Parameters Count In The Collection + */ + int getCount(); - /** - * Get A Parameter With The Input Index - * @param index The Parameter To Get - * @return The Got Parameter - */ - T getItem(int index); -} \ No newline at end of file + /** + * Get A Parameter With The Input Index + * + * @param index The Parameter To Get + * @return The Got Parameter + */ + T getItem(int index); +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java index 030bd9a8075e0bbb7d2f7cf54377a867122986d1..3f0f86a01535eaf00ebd4d1aad6677c81dd57d7f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedBizAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; import com.fasterxml.jackson.core.JsonProcessingException; @@ -5,10 +20,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; +import java.io.Serializable; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameterCollection; import org.openatom.ubml.model.vo.definition.json.operation.MappedBizActionDeserializer; import org.openatom.ubml.model.vo.definition.json.operation.MappedBizActionSerializer; -import java.io.Serializable; /** * The Definition Of The Mapped Biz Action @@ -22,41 +37,37 @@ import java.io.Serializable; @JsonDeserialize(using = MappedBizActionDeserializer.class) public class MappedBizAction extends ViewModelAction implements Cloneable, Serializable { - ///#region 属性 - private MappedBizActionParameterCollection mappedBizActionParams; - /** - * 类型 - */ - //@Override - public ViewModelActionType Type = ViewModelActionType.BEAction; -// public ViewModelActionType Type => ViewModelActionType.BEAction; + private MappedBizActionParameterCollection mappedBizActionParams; + /** + * 类型 + */ + //@Override + public ViewModelActionType Type = ViewModelActionType.BEAction; - ///#endregion - public MappedBizAction() { - mappedBizActionParams = new MappedBizActionParameterCollection(); - } - ///#region 方法 + public MappedBizAction() { + mappedBizActionParams = new MappedBizActionParameterCollection(); + } + ///方法 - /** - * 克隆 - * - * @return VM节点映射 - */ - @Override - public final MappedBizAction clone() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedBizAction.class); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); + /** + * 克隆 + * + * @return VM节点映射 + */ + @Override + public final MappedBizAction clone() { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedBizAction.class); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } } - } - @Override - protected IViewModelParameterCollection getParameters() { - return mappedBizActionParams; - } - ///#endregion + @Override + protected IViewModelParameterCollection getParameters() { + return mappedBizActionParams; + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java index a5cd3f2a811d93159f81ae0c5b5c6ca30c53f987..51234f3bb3384b63cc7ab11c65ce7c7d31368617 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; import com.fasterxml.jackson.core.JsonProcessingException; @@ -5,10 +20,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; +import java.io.Serializable; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameterCollection; import org.openatom.ubml.model.vo.definition.json.operation.MappedCdpActionDeserializer; import org.openatom.ubml.model.vo.definition.json.operation.MappedCdpActionSerializer; -import java.io.Serializable; /** * The Definition Of The Parameter With Component @@ -21,44 +36,40 @@ import java.io.Serializable; @JsonSerialize(using = MappedCdpActionSerializer.class) @JsonDeserialize(using = MappedCdpActionDeserializer.class) public class MappedCdpAction extends MappedCdpActionBase implements Cloneable, Serializable { - ///#region 属性 - private MappedCdpActionParameterCollection mappedCdpActionParams; + private MappedCdpActionParameterCollection mappedCdpActionParams; - /** - * 类型 - */ - @Override - public ViewModelActionType getType() { - return ViewModelActionType.VMAction; - } + /** + * 类型 + */ + @Override + public ViewModelActionType getType() { + return ViewModelActionType.VMAction; + } - ///#endregion - public MappedCdpAction() { - mappedCdpActionParams = new MappedCdpActionParameterCollection(); - } - ///#region 方法 + public MappedCdpAction() { + mappedCdpActionParams = new MappedCdpActionParameterCollection(); + } - /** - * 克隆 - * - * @return VO节点映射 - */ - @Override - public MappedCdpAction clone() { - ObjectMapper objectMapper = new ObjectMapper(); - try { - return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedCdpAction.class); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } catch (IOException e) { - throw new RuntimeException(e); + /** + * 克隆 + * + * @return VO节点映射 + */ + @Override + public MappedCdpAction clone() { + ObjectMapper objectMapper = new ObjectMapper(); + try { + return objectMapper.readValue(objectMapper.writeValueAsString(this), MappedCdpAction.class); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } catch (IOException e) { + throw new RuntimeException(e); + } } - } - @Override - protected IViewModelParameterCollection getParameters() { - return mappedCdpActionParams; - } - ///#endregion + @Override + protected IViewModelParameterCollection getParameters() { + return mappedCdpActionParams; + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java index b32155c81231e2121f9052c6ea0da9d5305755c5..5c39d2b0c723fa885ae6fc6c10c0c378133e386e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/MappedCdpActionBase.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; @@ -10,81 +25,70 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public abstract class MappedCdpActionBase extends ViewModelAction implements Serializable -{ - ///#region 属性 - private String componentEntityId = ""; - /** - 对应构件实体Id - - */ - public String getComponentEntityId(){ - return componentEntityId; - } - public void setComponentEntityId(String value){ - this.componentEntityId=value; - } - /** - 对应构件实体包名 - - */ - private String privateComponentPkgName; - public String getComponentPkgName() - { - return privateComponentPkgName; - } - public void setComponentPkgName(String value) - { - privateComponentPkgName = value; - } +public abstract class MappedCdpActionBase extends ViewModelAction implements Serializable { + private String componentEntityId = ""; + + /** + * 对应构件实体Id + */ + public String getComponentEntityId() { + return componentEntityId; + } + + public void setComponentEntityId(String value) { + this.componentEntityId = value; + } + + /** + * 对应构件实体包名 + */ + private String privateComponentPkgName; + + public String getComponentPkgName() { + return privateComponentPkgName; + } - private boolean privateIsGenerateComponent; - public boolean getIsGenerateComponent() - { - return privateIsGenerateComponent; - } - public void setIsGenerateComponent(boolean value) - { - privateIsGenerateComponent = value; - } + public void setComponentPkgName(String value) { + privateComponentPkgName = value; + } - ///#endregion + private boolean privateIsGenerateComponent; - ///#region 方法 + public boolean getIsGenerateComponent() { + return privateIsGenerateComponent; + } - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(ViewModelAction other) - { + public void setIsGenerateComponent(boolean value) { + privateIsGenerateComponent = value; + } - MappedCdpActionBase cdpAction = (MappedCdpActionBase)((other instanceof MappedCdpActionBase) ? other : null); - if (cdpAction == null) - { - return false; - } - if (getID().equals(cdpAction.getComponentEntityId()) && getCode().equals(cdpAction.getCode()) && getName().equals(cdpAction.getName()) && getType() == cdpAction.getType() && getComponentPkgName().equals(cdpAction.getComponentPkgName()) && getComponentName().equals(cdpAction.getComponentName()) && getIsGenerateComponent() == cdpAction.getIsGenerateComponent() && getComponentEntityId().equals(cdpAction.getComponentEntityId())) - { - return true; - } + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(ViewModelAction other) { - return false; - } + MappedCdpActionBase cdpAction = (MappedCdpActionBase) ((other instanceof MappedCdpActionBase) ? other : null); + if (cdpAction == null) { + return false; + } + if (getID().equals(cdpAction.getComponentEntityId()) && getCode().equals(cdpAction.getCode()) && getName().equals(cdpAction.getName()) && getType() == cdpAction.getType() && getComponentPkgName().equals(cdpAction.getComponentPkgName()) && getComponentName().equals(cdpAction.getComponentName()) && getIsGenerateComponent() == cdpAction.getIsGenerateComponent() && getComponentEntityId().equals(cdpAction.getComponentEntityId())) { + return true; + } - /** - 重载ToString方法 - - @return 描述 - */ - @Override - public String toString() - { - return String.format("[VM action] ID:%1$s, Code:%2$s, Name:%3$s", getID(), getCode(), getName()); - } + return false; + } - ///#endregion -} \ No newline at end of file + /** + * 重载ToString方法 + * + * @return 描述 + */ + @Override + public String toString() { + return String.format("[VM action] ID:%1$s, Code:%2$s, Name:%3$s", getID(), getCode(), getName()); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java index f1c229feaaee01b69dc26e2029c1d875c596546a..18e2933b3632e6387361bcdd7b57986061be9ae9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/VMActionResult.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; import java.io.Serializable; @@ -10,46 +25,36 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMActionResult implements Cloneable, Serializable -{ - ///#region 属性 - - /** - 类型名称 - - */ - private String privateTypeName; - public final String getTypeName() - { - return privateTypeName; - } - public final void setTypeName(String value) - { - privateTypeName = value; - } - - ///#endregion - - ///#region 方法 - - /** - 克隆 - - @return Action执行结果 - */ - public final VMActionResult clone() - { -// return MemberwiseClone(); - Object tempVar = null; - try { - tempVar = super.clone(); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - VMActionResult obj = (VMActionResult) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); - - return obj; - - ///#endregion +public class VMActionResult implements Cloneable, Serializable { + + /** + * 类型名称 + */ + private String privateTypeName; + + public final String getTypeName() { + return privateTypeName; + } + + public final void setTypeName(String value) { + privateTypeName = value; + } + + /** + * 克隆 + * + * @return Action执行结果 + */ + @Override + public final VMActionResult clone() { + Object tempVar = null; + try { + tempVar = super.clone(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + VMActionResult obj = (VMActionResult) ((tempVar instanceof ActionFormatParameter) ? tempVar : null); + return obj; + + } } -} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java index 1b58784ba27860cf40034576357f44be0b989134..52ebff12abb358758ba8beda145661c986b167c6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelAction.java @@ -1,9 +1,24 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; +import java.io.Serializable; import org.openatom.ubml.model.common.definition.cef.entity.CustomizationInfo; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelReturnValue; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; -import java.io.Serializable; /** * The Definition Of The View Model Action @@ -14,215 +29,214 @@ import java.io.Serializable; * @Version: V1.0 */ public abstract class ViewModelAction implements Cloneable, Serializable { - ///#region 属性 - - /** - * 标识 - */ - private String privateID; - - public String getID() { - return privateID; - } - - public void setID(String value) { - privateID = value; - } - - /** - * 编号 - */ - private String privateCode; - - public String getCode() { - return privateCode; - } - - public void setCode(String value) { - privateCode = value; - } - - /** - * 名称 - */ - private String privateName; - - public String getName() { - return privateName; - } - - public void setName(String value) { - privateName = value; - } - - /** - * 类型 - */ - private ViewModelActionType privateType = ViewModelActionType.forValue(0); - - public ViewModelActionType getType() { - return privateType; - } - - public void setType(ViewModelActionType value) { - privateType = value; - } - - /** - * 参数列表 - */ - public IViewModelParameterCollection getParameterCollection() { - return getParameters(); - } - - /** - * 返回值 - */ - private ViewModelReturnValue privateReturnValue; - - public final ViewModelReturnValue getReturnValue() { - return privateReturnValue; - } - - public final void setReturnValue(ViewModelReturnValue value) { - privateReturnValue = value; - } - - protected abstract IViewModelParameterCollection getParameters(); - - /** - * 操作映射 - */ - private ViewModelMapping privateMapping; - public final ViewModelMapping getMapping() { - return privateMapping; - } - - public final void setMapping(ViewModelMapping value) { - privateMapping = value; - } - - /** - * 对应构件名 - */ - private String privateComponentName; - - public final String getComponentName() { - return privateComponentName; - } - - public final void setComponentName(String value) { - privateComponentName = value; - } - - private java.util.HashMap extendProperties; - - /** - * 表单拓展节点 - */ - public final java.util.HashMap getExtendProperties() { - if (extendProperties == null) { - extendProperties = new java.util.HashMap(); + /** + * 标识 + */ + private String privateID; + + public String getID() { + return privateID; + } + + public void setID(String value) { + privateID = value; + } + + /** + * 编号 + */ + private String privateCode; + + public String getCode() { + return privateCode; + } + + public void setCode(String value) { + privateCode = value; + } + + /** + * 名称 + */ + private String privateName; + + public String getName() { + return privateName; + } + + public void setName(String value) { + privateName = value; + } + + /** + * 类型 + */ + private ViewModelActionType privateType = ViewModelActionType.forValue(0); + + public ViewModelActionType getType() { + return privateType; + } + + public void setType(ViewModelActionType value) { + privateType = value; + } + + /** + * 参数列表 + */ + public IViewModelParameterCollection getParameterCollection() { + return getParameters(); } - return extendProperties; - } - - public void setExtendProperties(java.util.HashMap value) { - extendProperties = value; - } - - private boolean privateIsAutoSave; - public final boolean getIsAutoSave() { - return privateIsAutoSave; - } + /** + * 返回值 + */ + private ViewModelReturnValue privateReturnValue; - public final void setIsAutoSave(boolean value) { - privateIsAutoSave = value; - } + public final ViewModelReturnValue getReturnValue() { + return privateReturnValue; + } + + public final void setReturnValue(ViewModelReturnValue value) { + privateReturnValue = value; + } + + protected abstract IViewModelParameterCollection getParameters(); + + /** + * 操作映射 + */ + private ViewModelMapping privateMapping; + + public final ViewModelMapping getMapping() { + return privateMapping; + } - private CustomizationInfo customizationInfo = new CustomizationInfo(); - public CustomizationInfo getCustomizationInfo() { - return this.customizationInfo; - } + public final void setMapping(ViewModelMapping value) { + privateMapping = value; + } + + /** + * 对应构件名 + */ + private String privateComponentName; + + public final String getComponentName() { + return privateComponentName; + } + + public final void setComponentName(String value) { + privateComponentName = value; + } - public void setCustomizationInfo(CustomizationInfo customizationInfo) { - this.customizationInfo = customizationInfo; - } - ///#endregion - - ///#region 方法 + private java.util.HashMap extendProperties; - /** - * 重写Clone - */ - public abstract ViewModelAction clone(); + /** + * 表单拓展节点 + */ + public final java.util.HashMap getExtendProperties() { + if (extendProperties == null) { + extendProperties = new java.util.HashMap(); + } + return extendProperties; + } - /** - * 重写相等判断 - */ - @Override - public boolean equals(Object obj) { - if (obj.equals(null)) { - return false; + public void setExtendProperties(java.util.HashMap value) { + extendProperties = value; } - if (obj.equals(this)) { - return true; + + private boolean privateIsAutoSave; + + public final boolean getIsAutoSave() { + return privateIsAutoSave; } - if (obj.getClass() != getClass()) { - return false; + + public final void setIsAutoSave(boolean value) { + privateIsAutoSave = value; } - return equals((ViewModelAction) obj); - } - /** - * 强类型相等判断 - */ - public boolean equals(ViewModelAction other) { + private CustomizationInfo customizationInfo = new CustomizationInfo(); - if (other == null) { - return false; + public CustomizationInfo getCustomizationInfo() { + return this.customizationInfo; } - if (getID().equals(other.getID()) && getCode().equals(other.getCode()) && getName() - .equals(other.getName()) && getType() == other.getType() && getMapping() - .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { - return true; + public void setCustomizationInfo(CustomizationInfo customizationInfo) { + this.customizationInfo = customizationInfo; } - return false; - } + ///方法 + + /** + * 重写Clone + */ + @Override + public abstract ViewModelAction clone(); + + /** + * 重写相等判断 + */ + @Override + public boolean equals(Object obj) { + if (obj.equals(null)) { + return false; + } + if (obj.equals(this)) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } + return equals((ViewModelAction) obj); + } + + /** + * 强类型相等判断 + */ + public boolean equals(ViewModelAction other) { + + if (other == null) { + return false; + } - /** - * 重写HashCode - */ - @Override - public int hashCode() { + if (getID().equals(other.getID()) && getCode().equals(other.getCode()) && getName() + .equals(other.getName()) && getType() == other.getType() && getMapping() + .equals(other.getMapping()) && getComponentName().equals(other.getComponentName())) { + return true; + } + + return false; + } + + /** + * 重写HashCode + */ + @Override + public int hashCode() { // unchecked - { - int hashCode = (getID() != null ? getID().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getCode() != null ? getCode().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getName() != null ? getName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getReturnValue() != null ? getReturnValue().hashCode() : 0); - hashCode = (hashCode * 397) ^ getType().getValue(); - hashCode = - (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); - - return hashCode; - } - } - - /** - * 重载ToString方法 - * - * @return 描述 - */ - @Override - public String toString() { - return String - .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); - } - ///#endregion -} \ No newline at end of file + { + int hashCode = (getID() != null ? getID().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getCode() != null ? getCode().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getName() != null ? getName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getReturnValue() != null ? getReturnValue().hashCode() : 0); + hashCode = (hashCode * 397) ^ getType().getValue(); + hashCode = + (hashCode * 397) ^ (getComponentName() != null ? getComponentName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getMapping() != null ? getMapping().hashCode() : 0); + + return hashCode; + } + } + + /** + * 重载ToString方法 + * + * @return 描述 + */ + @Override + public String toString() { + return String + .format("[VM BizAction] ID:%1$s,Code:%2$s,Name:%3$s", getID(), getCode(), getName()); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java index e693acf3f2a9a3a8c85363dcf4ce00d831fd5c51..858dd51116816b3952c4580ebccd5cadcdf9369b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/ViewModelActionType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action; /** @@ -8,33 +23,25 @@ package org.openatom.ubml.model.vo.definition.action; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum ViewModelActionType -{ - /** - BE 的业务操作 - - */ - BEAction, - - /** - VM 操作 - - */ - VMAction, - - /** - 自定义操作 - - */ - Custom; +public enum ViewModelActionType { + /** + * BE 的业务操作 + */ + BEAction, + /** + * VM 操作 + */ + VMAction, + /** + * 自定义操作 + */ + Custom; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static ViewModelActionType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static ViewModelActionType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java index 80df087dabc19c05899f9fc3358faf4f1080be6b..ef63605539b56db7a17cc2497a9e50e0696c5e83 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetMappingAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -10,15 +25,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ChangesetMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "5798f884-c222-47f4-8bbe-685c7013dee4"; - public static final String code = "ChangesetMapping"; - public static final String name = "内置变更集Mapping操作"; +public class ChangesetMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "5798f884-c222-47f4-8bbe-685c7013dee4"; + public static final String CODE = "ChangesetMapping"; + public static final String NAME = "内置变更集Mapping操作"; public ChangesetMappingAction() { - setID(id); - setCode(code); - setName(name); + setID(ID); + setCode(CODE); + setName(NAME); } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java index 62403639ea058f6cd6f19ff3c8b9035512d7f6a9..25e7f6c9774df029ead9f201c7537ba2e4907d19 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ChangesetReversalMappingAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -10,15 +25,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ChangesetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "301c5991-a32d-4221-88bf-8c9d07bdd884"; - public static final String code = "ChangesetReversalMapping"; - public static final String name = "内置变更集反向Mapping操作"; - public ChangesetReversalMappingAction() - { - setID(id); - setCode(code); - setName(name); - } +public class ChangesetReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "301c5991-a32d-4221-88bf-8c9d07bdd884"; + public static final String CODE = "ChangesetReversalMapping"; + public static final String NAME = "内置变更集反向Mapping操作"; + + public ChangesetReversalMappingAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java index 97842297dbdaa795a4f7205828a284469b3aaf2b..d23be6eb3af9b3369aefdde2995299c34a6a48d2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/CreateAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -10,15 +25,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class CreateAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "52479451-8e22-4751-8684-80489ce5786b"; - public static final String code = "Create"; - public static final String name = "内置新增数据操作"; - public CreateAction() - { - setID(id); - setCode(code); - setName(name); - } +public class CreateAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "52479451-8e22-4751-8684-80489ce5786b"; + public static final String CODE = "Create"; + public static final String NAME = "内置新增数据操作"; + + public CreateAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java index 0f976726805cb073c6c2d643ad32c4df8b094fa5..824d9ac003acba5cdb5edeb664c0070b22c1e46b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataMappingAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -9,15 +24,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DataMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; - public static final String code = "DataMapping"; - public static final String name = "内置数据Mapping操作"; - public DataMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DataMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "42221ca3-9ee4-40af-89d2-ff4c8b466ac3"; + public static final String CODE = "DataMapping"; + public static final String NAME = "内置数据Mapping操作"; + + public DataMappingAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java index e040827ff652b8187e5b7f7610cbf56ef26a7e1d..5e4d4b86ec8ce6553f982a50727b09d84b40118e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DataReversalMappingAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -9,15 +24,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DataReversalMappingAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; - public static final String code = "DataReversalMapping"; - public static final String name = "内置数据反向Mapping操作"; - public DataReversalMappingAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DataReversalMappingAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "991bf216-f55b-40bf-bb42-1b831b6ef3e9"; + public static final String CODE = "DataReversalMapping"; + public static final String NAME = "内置数据反向Mapping操作"; + + public DataReversalMappingAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java index feb2d5538e790b2a2dff286bdb13a0201f619670..2a428ea9a82c4817295c03ba9c4e4df0fe77fef9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/DeleteAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -9,15 +24,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class DeleteAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "9a17e935-7366-489d-b110-0ae103e5648e"; - public static final String code= "Delete"; - public static final String name = "内置删除操作"; - public DeleteAction() - { - setID(id); - setCode(code); - setName(name); - } -} \ No newline at end of file +public class DeleteAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "9a17e935-7366-489d-b110-0ae103e5648e"; + public static final String CODE = "Delete"; + public static final String NAME = "内置删除操作"; + + public DeleteAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java index 675ef855b9d6ad224e315489cdc03c279c5397f2..c4599a454683ccc1aee9471506abb0150ab3b3a5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/IInternalExtendAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; /** @@ -8,6 +23,5 @@ package org.openatom.ubml.model.vo.definition.action.internalexternalaction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public interface IInternalExtendAction -{ +public interface IInternalExtendAction { } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java index 7468eb8116fcea6d7d1ec7e485d7040c5b9e1a52..8823f70570918e7b837562a683d7682864d7d813 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/ModifyAction.java @@ -1,6 +1,22 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; + /** * The Definition Of Modify Action * @@ -9,16 +25,15 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ModifyAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; - public static final String code = "Modify"; - public static final String name = "内置修改操作"; - public ModifyAction() - { - setID(id); - setCode(code); - setName(name); - } +public class ModifyAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "47dd3752-72a3-4c56-81c0-ae8ccfe5eb98"; + public static final String CODE = "Modify"; + public static final String NAME = "内置修改操作"; + + public ModifyAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java index b66d87648f584cd6cf7f4de62be0ecf3140e2cb7..6b8cb9f49afff919abab50dfde3a29456b7f44fc 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/MultiDeleteAction.java @@ -1,22 +1,37 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; /** - * The Definition Of Mutly Delete Action + * The Definition Of Multi Delete Action * * @ClassName: MultiDeleteAction * @Author: Benjamin Gong * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MultiDeleteAction extends MappedCdpAction implements IInternalExtendAction{ - public static final String id = "7b1c3c4l-t1a4-4dyc-b75b-7695hcb3we7e"; - public static final String code= "MultiDelete"; - public static final String name = "内置批量删除操作"; - public MultiDeleteAction() - { - setID(id); - setCode(code); - setName(name); +public class MultiDeleteAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "7b1c3c4l-t1a4-4dyc-b75b-7695hcb3we7e"; + public static final String CODE = "MultiDelete"; + public static final String NAME = "内置批量删除操作"; + + public MultiDeleteAction() { + setID(ID); + setCode(CODE); + setName(NAME); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java index 2736415fab40b08d74b2e491590bf1608cec82e6..3260dcbe2b50b80a547c8312a259373f63847d75 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/QueryAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -10,16 +25,15 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class QueryAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; - public static final String code = "Query"; - public static final String name = "内置查询操作"; - public QueryAction() - { - setID(id); - setCode(code); - setName(name); - } +public class QueryAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "6fe68bfa-7c1b-4d6b-a7ef-14654168ae75"; + public static final String CODE = "Query"; + public static final String NAME = "内置查询操作"; + + public QueryAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java index ffc3dce9cfdaf14b09f197ed8dd0b33e40608065..691986a1a521800c9b152999468c94761ba95d35 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/internalexternalaction/RetrieveAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.internalexternalaction; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -10,15 +25,14 @@ import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class RetrieveAction extends MappedCdpAction implements IInternalExtendAction -{ - public static final String id = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; - public static final String code = "Retrieve"; - public static final String name = "内置检索操作"; - public RetrieveAction() - { - setID(id); - setCode(code); - setName(name); - } +public class RetrieveAction extends MappedCdpAction implements IInternalExtendAction { + public static final String ID = "7a02f472-5bbd-424b-9d9e-f82e3f9f448e"; + public static final String CODE = "Retrieve"; + public static final String NAME = "内置检索操作"; + + public RetrieveAction() { + setID(ID); + setCode(CODE); + setName(NAME); + } } \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java index 0361f35df94cc8951a0c34f99114cd62427689bf..d091ae351ede21191bac99365fecb94d2fc88bea 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameter.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.mappedbiz; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; @@ -10,10 +25,8 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedBizActionParameter extends ViewModelParameter -{ - public MappedBizActionParameter() - { +public class MappedBizActionParameter extends ViewModelParameter { + public MappedBizActionParameter() { - } -} \ No newline at end of file + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java index 4cdfc717499cc548ee59cf6c6cd4ec428c7fcbc9..8acc5f56daa6ac008809acb10f15f34c1e0d88b4 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedbiz/MappedBizActionParameterCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.mappedbiz; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameterCollection; @@ -10,10 +25,8 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedBizActionParameterCollection extends ViewModelParameterCollection -{ - public MappedBizActionParameterCollection() - { +public class MappedBizActionParameterCollection extends ViewModelParameterCollection { + public MappedBizActionParameterCollection() { - } -} \ No newline at end of file + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java index e103cf6074dc4d38c69316a7b0f75e05050dea6a..0cdec489123e86b2f66d11b1ad1eb42988f11a6f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameter.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.mappedcdp; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; @@ -10,9 +25,7 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedCdpActionParameter extends ViewModelParameter -{ - public MappedCdpActionParameter() - { - } -} \ No newline at end of file +public class MappedCdpActionParameter extends ViewModelParameter { + public MappedCdpActionParameter() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java index fbc412747b5fec0564920709fe7073a7fe6b88c6..dc008ea9d2b2c006f212c77d5d5fe4b2cfbe3ae5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/mappedcdp/MappedCdpActionParameterCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.mappedcdp; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameterCollection; @@ -10,9 +25,7 @@ import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParam * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class MappedCdpActionParameterCollection extends ViewModelParameterCollection -{ - public MappedCdpActionParameterCollection() - { - } -} \ No newline at end of file +public class MappedCdpActionParameterCollection extends ViewModelParameterCollection { + public MappedCdpActionParameterCollection() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java index 0f764970d65693f0fd912cf90d405c7144f518e2..6f8ab06d5e9c6b1c1540fe1e4602a79aca801b54 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValue.java @@ -1,49 +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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; - import com.fasterxml.jackson.annotation.JsonProperty; /** - * The Definition Of View Model Parameter Action Value.In A View Model Action,The Parameter Value From The Component Can Be Transfer From Outer Invoke Or Fixed - * When The Value Is Fixed, The Actual Value Is Required. + * The Definition Of View Model Parameter Action Value.In A View Model Action,The Parameter Value From The Component Can + * Be Transfer From Outer Invoke Or Fixed When The Value Is Fixed, The Actual Value Is Required. * * @ClassName: ViewModelParActualValue * @Author: Benjamin Gong * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelParActualValue { +public class ViewModelParActualValue { - private String value = ""; + private String value = ""; - @JsonProperty("Value") - public String getValue() { - return value; - } + @JsonProperty("Value") + public String getValue() { + return value; + } - public void setValue(String value) { - this.value = value; - } + public void setValue(String value) { + this.value = value; + } - private boolean hasValue = false; + private boolean hasValue = false; - @JsonProperty("HasValue") - public boolean getHasValue() { - return hasValue; - } + @JsonProperty("HasValue") + public boolean getHasValue() { + return hasValue; + } - public void setHasValue(boolean value) { - hasValue = value; - } + public void setHasValue(boolean value) { + hasValue = value; + } - private ViewModelParActualValueType valueType = ViewModelParActualValueType.Constant; + private ViewModelParActualValueType valueType = ViewModelParActualValueType.Constant; - @JsonProperty("ValueType") - public ViewModelParActualValueType getValueType() { - return valueType; - } + @JsonProperty("ValueType") + public ViewModelParActualValueType getValueType() { + return valueType; + } - public void setValueType(ViewModelParActualValueType value) { - this.valueType = value; - } -} \ No newline at end of file + public void setValueType(ViewModelParActualValueType value) { + this.valueType = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java index a53c6f24d0917ffe004ddc714a2abfe9054036b1..e7d61a9f07fa1a1ea6b9c74c66148c40227ab99e 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParActualValueType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; /** @@ -9,15 +24,24 @@ package org.openatom.ubml.model.vo.definition.action.viewmodelbase; * @Version: V1.0 */ public enum ViewModelParActualValueType { - Constant,//常量 - Expression, //表达式 - Variable;//vo变量 + /** + * 常量 + */ + Constant, + /** + * 表达式 + */ + Expression, + /** + * vo变量 + */ + Variable; - public int getValue() { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static ViewModelParActualValueType forValue(int value) { - return values()[value]; - } -} \ No newline at end of file + public static ViewModelParActualValueType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java index 1f8a51deee56ae87343f07a2cc59d3420044a3dc..b363b6f3ffb8c3f2d5bff94bba6c5b93bf3b6add 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameter.java @@ -1,6 +1,20 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; - import org.openatom.ubml.model.vo.definition.action.IViewModelParameter; import org.openatom.ubml.model.vo.definition.common.VMCollectionParameterType; import org.openatom.ubml.model.vo.definition.common.VMParameterMode; @@ -140,14 +154,15 @@ public abstract class ViewModelParameter implements IViewModelParameter { } private ViewModelParActualValue actualValue; - public ViewModelParActualValue getActualValue(){ - if(actualValue == null){ + + public ViewModelParActualValue getActualValue() { + if (actualValue == null) { actualValue = new ViewModelParActualValue(); } return actualValue; } - public void setActualValue(ViewModelParActualValue value){ + public void setActualValue(ViewModelParActualValue value) { actualValue = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java index dc18265f0234afdbe0a13c2b34e53d1e9069a64b..aeaa7d183567b9c717dcb0cc5564aa1d015d5cba 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelParameterCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; import org.openatom.ubml.model.common.definition.cef.collection.BaseList; @@ -15,6 +30,6 @@ import org.openatom.ubml.model.vo.definition.action.IViewModelParameterCollectio public class ViewModelParameterCollection extends BaseList implements IViewModelParameterCollection { - public ViewModelParameterCollection() { - } -} \ No newline at end of file + public ViewModelParameterCollection() { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java index 63a6605e8638af1becb4ab5d3d169ae01f32de5b..4d948937e4917cf8860e731831cbc0994b0e83fd 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelReturnValue.java @@ -1,7 +1,20 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; - - import org.openatom.ubml.model.vo.definition.common.VMParameterMode; /** @@ -12,32 +25,29 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterMode; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelReturnValue extends ViewModelParameter -{ - /** - 参数名 - - */ - @Override - public String getParamName(){ - return null; - } - @Override - public void setParamName(String value) - { +public class ViewModelReturnValue extends ViewModelParameter { + /** + * 参数名 + */ + @Override + public String getParamName() { + return null; + } + + @Override + public void setParamName(String value) { + + } - } + /** + * 参数模式 + */ + @Override + public VMParameterMode getMode() { + return VMParameterMode.OUT; + } - /** - 参数模式 - - */ - @Override - public VMParameterMode getMode(){ - return VMParameterMode.OUT; - } - @Override - public void setMode(VMParameterMode value) - { - } -} \ No newline at end of file + @Override + public void setMode(VMParameterMode value) { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java index 86a8e90c835b991d8c0a6172ef17539310786248..3e897d7f729d5ec39cd2fdff7afb91329f954dd8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/action/viewmodelbase/ViewModelVoidReturnValue.java @@ -1,7 +1,20 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.action.viewmodelbase; - - import org.openatom.ubml.model.vo.definition.common.VMParameterType; /** @@ -12,51 +25,44 @@ import org.openatom.ubml.model.vo.definition.common.VMParameterType; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelVoidReturnValue extends ViewModelReturnValue -{ - public static final String assembly = "mscorlib.dll"; - public static final String className = "Void"; - - /** - 参数类对应程序集类 - - */ - @Override - public String getAssembly(){ - return assembly; - } - - @Override - public void setAssembly(String value) - { - } - - /** - 参数类名 - - */ - @Override - public String getClassName(){ - return className; - } - - @Override - public void setClassName(String value) - { - } - - /** - 参数类型,与Assembly和ClassName关联 - - */ - @Override - public VMParameterType getParameterType() - { - return VMParameterType.Custom; - - } - @Override - public void setParameterType(VMParameterType value) - { - } -} \ No newline at end of file +public class ViewModelVoidReturnValue extends ViewModelReturnValue { + public static final String assembly = "mscorlib.dll"; + public static final String className = "Void"; + + /** + * 参数类对应程序集类 + */ + @Override + public String getAssembly() { + return assembly; + } + + @Override + public void setAssembly(String value) { + } + + /** + * 参数类名 + */ + @Override + public String getClassName() { + return className; + } + + @Override + public void setClassName(String value) { + } + + /** + * 参数类型,与Assembly和ClassName关联 + */ + @Override + public VMParameterType getParameterType() { + return VMParameterType.Custom; + + } + + @Override + public void setParameterType(VMParameterType value) { + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java index d2cd0f13316e2ae12e609ad29edc8f0524c26155..edfd6ccc4a3c9e9888939992108791c6251b98f7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMActionCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; @@ -12,9 +27,7 @@ import org.openatom.ubml.model.vo.definition.action.ViewModelAction; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMActionCollection extends BaseList implements Cloneable, - Serializable { - ///#region 属性 +public class VMActionCollection extends BaseList implements Cloneable, Serializable { /** * 根据ID获取操作 @@ -23,7 +36,6 @@ public class VMActionCollection extends BaseList implements Clo * @return 操作 */ public final ViewModelAction getItem(String id) { -// return this.FirstOrDefault(i => id.equals(i.ID)); for (ViewModelAction item : this) { if (item.getID().equals(id)) { return item; @@ -32,21 +44,17 @@ public class VMActionCollection extends BaseList implements Clo return null; } - ///#endregion - - ///#region 方法 - /** * 克隆 * * @return VO上的操作集合 */ -// public final Object clone() + @Override public final VMActionCollection clone() { VMActionCollection collections = new VMActionCollection(); for (ViewModelAction op : this) { ViewModelAction tempVar = op.clone(); - collections.add((ViewModelAction) ((tempVar instanceof ViewModelAction) ? tempVar : null)); + collections.add((ViewModelAction) tempVar); } return collections; @@ -63,10 +71,6 @@ public class VMActionCollection extends BaseList implements Clo if (obj == null) { return false; } - // if (obj.equals(this)) - //{ - //return true; - //} if (obj.getClass() != getClass()) { return false; } @@ -81,7 +85,6 @@ public class VMActionCollection extends BaseList implements Clo * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 */ protected boolean equals(VMActionCollection other) { -// if (Count != other.size()) if (this.size() != other.size()) { return false; } @@ -107,8 +110,7 @@ public class VMActionCollection extends BaseList implements Clo if (id == null) { return false; } - super.removeIf(item -> - id.equals(item.getID()) + super.removeIf(item -> id.equals(item.getID()) ); return true; } @@ -119,20 +121,9 @@ public class VMActionCollection extends BaseList implements Clo return false; } super.removeIf(item -> - actionId.equals(item.getID()) + actionId.equals(item.getID()) ); return true; } - ///// - ///// 设置Action集合所属的结点 - ///// - ///// - //public void SetOwner(GspViewObject node) - //{ - // foreach (var item in this) - // { - // item.Owner = node; - // } - //} - ///#endregion -} \ No newline at end of file + +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java index 7eb496dc2331f70f7a0f662013fb95a1435a3f76..52aa28ab5aae1c833a445979ca6b9350edf01807 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/VMElementCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; @@ -14,121 +29,85 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMElementCollection extends GspElementCollection implements Serializable -{ - ///#region 构造函数 - - /** - 字段集合构造函数 - - @param owner 所属视图对象结点 - */ -//ORIGINAL LINE: public VMElementCollection(GspViewObject owner = null) - public VMElementCollection(GspViewObject owner) - { - super(owner); - } - - ///#endregion - - ///#region 属性 - - /** - 根据ID获取节点元素 - - @param id 节点元素ID - @return 节点元素 - */ - @Override//不能override final的類 - public final GspViewModelElement getItem(String id) - { - for(IGspCommonField item:this){ - if(item instanceof GspViewModelElement){ - return (GspViewModelElement)item; - } - } - return null; -// Object tempVar = this.FirstOrDefault(i => id.equals(i.ID)); -// return (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? tempVar : null); - } - - ///#endregion - - ///#region 方法 - - /** - 重载Equals方法 - - @param obj 要比较的对象 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - // if (obj.equals(this)) - //{ - //return true; - //} - if (obj.getClass() != getClass()) - { - return false; - } +public class VMElementCollection extends GspElementCollection implements Serializable { - return equals((VMElementCollection)obj); - } + /** + * 字段集合构造函数 + * + * @param owner 所属视图对象结点 + */ + public VMElementCollection(GspViewObject owner) { + super(owner); + } - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(VMElementCollection other) - { -// if (Count != other.size()) - if (this.size() != other.size()) - { - return false; - } - for (IGspCommonField item : this) - { - IGspCommonField otherItem = other.getItem(item.getID()); - if (otherItem == null) - { - return false; - } - if (!item.equals(otherItem)) - { - return false; - } - } + /** + * 根据ID获取节点元素 + * + * @param id 节点元素ID + * @return 节点元素 + */ + @Override + public final GspViewModelElement getItem(String id) { + for (IGspCommonField item : this) { + if (item instanceof GspViewModelElement) { + return (GspViewModelElement) item; + } + } + return null; + } - return true; - } + /** + * 重载Equals方法 + * + * @param obj 要比较的对象 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.getClass() != getClass()) { + return false; + } + return equals((VMElementCollection) obj); + } - /** - 克隆 - - @return VO节点元素集合 - */ - public final VMElementCollection clone() - { - VMElementCollection collections; - collections = new VMElementCollection((GspViewObject) getParentObject()); + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(VMElementCollection other) { + if (this.size() != other.size()) { + return false; + } + for (IGspCommonField item : this) { + IGspCommonField otherItem = other.getItem(item.getID()); + if (otherItem == null) { + return false; + } + if (!item.equals(otherItem)) { + return false; + } + } + return true; + } -// collections.addAll(this); -// (this.Select(element => (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? -// tempVar : null))); - for(IGspCommonField item:this){ -// Object item; - GspViewModelElement obj = ((GspViewModelElement)item).clone(); - GspViewModelElement tempVar = ((obj instanceof GspViewModelElement) ? obj : null); - collections.add(tempVar); - } - return collections; - } -} \ No newline at end of file + /** + * 克隆 + * + * @return VO节点元素集合 + */ + @Override + public final VMElementCollection clone() { + VMElementCollection collections; + collections = new VMElementCollection((GspViewObject) getParentObject()); + for (IGspCommonField item : this) { + GspViewModelElement tempVar = ((GspViewModelElement) item).clone(); + collections.add(tempVar); + } + return collections; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java index d24c6489dcf7a27d32a5ea4f9029b3f160900919..fd6089d2527d5a0ab6df37e3119cddbec8226056 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ValueHelpConfigCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; @@ -12,88 +27,64 @@ import org.openatom.ubml.model.vo.definition.common.ValueHelpConfig; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ValueHelpConfigCollection extends BaseList implements Cloneable, Serializable -{ - ///#region 构造函数 - - /** - 构造函数 - - */ - public ValueHelpConfigCollection() - { - super(); - } - - ///#endregion - - ///#region 属性 - - /** - 获取指定ID的值帮助配置 - - @param elementId Element标识 - @return 值帮助配置 - */ - public final ValueHelpConfig getItem(String elementId) - { - for(ValueHelpConfig item:this){ - if(item.getElementId().equals(elementId)){ - return item; - } - } - return null; -// return Items.firstOrDefault(i => elementId.equals(i.ElementId)); - } - - ///#endregion - - ///#region 方法 +public class ValueHelpConfigCollection extends BaseList implements Cloneable, Serializable { - /** - 批量添加值帮助配置 - - @param items 值帮助配置集合 - */ - public final void addRange(ValueHelpConfig[] items) - { - for (ValueHelpConfig item : items) - { - add(item); - } - } + /** + * 构造函数 + */ + public ValueHelpConfigCollection() { + super(); + } - /** - 批量添加值帮助配置 - - @param items 值帮助配置集合 - */ - public final void addRange(Iterable items) - { - for (ValueHelpConfig item : items) - { - add(item); - } - } + /** + * 获取指定ID的值帮助配置 + * + * @param elementId Element标识 + * @return 值帮助配置 + */ + public final ValueHelpConfig getItem(String elementId) { + for (ValueHelpConfig item : this) { + if (item.getElementId().equals(elementId)) { + return item; + } + } + return null; + } - /** - 克隆 - - @return 值帮助配置集合的副本 - */ -// public final Object clone() - @Override - public final ValueHelpConfigCollection clone() - { - ValueHelpConfigCollection newCollection = new ValueHelpConfigCollection(); + /** + * 批量添加值帮助配置 + * + * @param items 值帮助配置集合 + */ + public final void addRange(ValueHelpConfig[] items) { + for (ValueHelpConfig item : items) { + super.add(item); + } + } - for (ValueHelpConfig item : this) - { - add(item); - } + /** + * 批量添加值帮助配置 + * + * @param items 值帮助配置集合 + */ + public final void addRange(Iterable items) { + for (ValueHelpConfig item : items) { + add(item); + } + } - return newCollection; - } + /** + * 克隆 + * + * @return 值帮助配置集合的副本 + */ + @Override + public final ValueHelpConfigCollection clone() { + ValueHelpConfigCollection newCollection = new ValueHelpConfigCollection(); + for (ValueHelpConfig item : this) { + super.add(item); + } + return newCollection; + } - ///#endregion -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java index 3c853ca2db9a7b021b8ffc688c8528440605bd89..49eda02e1280afa778874ed78f325baa5445635c 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/collection/ViewObjectCollection.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.collection; import java.io.Serializable; @@ -13,122 +28,102 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewObjectCollection extends GspObjectCollection implements Serializable -{ - /** - 结点集合构造函数 - - @param parentObject 父节点 - */ -// public ViewObjectCollection(IGSPCommonObject parentObject) - public ViewObjectCollection(IGspCommonObject parentObject) - { - super(parentObject); - } - - /** - 根据ID获取节点 - - @param id 节点ID - @return 节点 - */ - public final GspViewObject getItem(String id) - { -// Object tempVar = this.FirstOrDefault(i => id.equals(i.ID)); - for ( IGspCommonObject item : this){ - if(item.getID().equals(id)){ - IGspCommonObject tempVar=item; - return (GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null); - } - } - return null; - - } +public class ViewObjectCollection extends GspObjectCollection implements Serializable { + /** + * 结点集合构造函数 + * + * @param parentObject 父节点 + */ + public ViewObjectCollection(IGspCommonObject parentObject) { + super(parentObject); + } - /** - 重载Equals方法 - - @param obj 要比较的对象 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - @Override - public boolean equals(Object obj) - { - if ( obj.equals(null)) - { - return false; - } - if ( obj.equals(this)) - { - return true; - } - if (obj.getClass() != getClass()) - { - return false; - } + /** + * 根据ID获取节点 + * + * @param id 节点ID + * @return 节点 + */ + public final GspViewObject getItem(String id) { + for (IGspCommonObject item : this) { + if (item.getID().equals(id)) { + return (GspViewObject) ((item instanceof GspViewObject) ? item : null); + } + } + return null; + } - return equals((ViewObjectCollection)obj); - } + /** + * 重载Equals方法 + * + * @param obj 要比较的对象 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.equals(this)) { + return true; + } + if (obj.getClass() != getClass()) { + return false; + } - /** - 获取HashCode - - @return hashCode - */ - @Override - public int hashCode() - { - return super.hashCode(); - } + return equals((ViewObjectCollection) obj); + } - /** - 当前对象是否等于同一类型的另一个对象。 - - @param other 与此对象进行比较的对象。 - @return 如果当前对象等于 other 参数,则为 true;否则为 false。 - */ - protected boolean equals(ViewObjectCollection other) - { -// if (Count != other.size()) - if (this.size() != other.size()) - { - return false; - } -// for (var item : this) - for (IGspCommonObject item : this) - { - IGspCommonObject otherItem = other.getItem(item.getID()); - if (otherItem == null) - { - return false; - } - if (!item.equals(otherItem)) - { - return false; - } - } + /** + * 获取HashCode + * + * @return hashCode + */ + @Override + public int hashCode() { + return super.hashCode(); + } - return true; - } + /** + * 当前对象是否等于同一类型的另一个对象。 + * + * @param other 与此对象进行比较的对象。 + * @return 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + protected boolean equals(ViewObjectCollection other) { + if (this.size() != other.size()) { + return false; + } + for (IGspCommonObject item : this) { + IGspCommonObject otherItem = other.getItem(item.getID()); + if (otherItem == null) { + return false; + } + if (!item.equals(otherItem)) { + return false; + } + } + return true; + } - /** - 克隆 - - @return VO节点元素集合 - */ -// public final Object clone() - public final ViewObjectCollection clone() - { -// ViewObjectCollection collections = new ViewObjectCollection(ParentObject); - ViewObjectCollection collections = new ViewObjectCollection(getParentObject()); -// for (var node : this) - for (IGspCommonObject node : this) - { - Object tempVar = ((GspViewObject)((node instanceof GspViewObject) ? node : null)).clone(); - collections.add((GspViewObject)((tempVar instanceof GspViewObject) ? tempVar : null)); - } + /** + * 克隆 + * + * @return VO节点元素集合 + */ + public final ViewObjectCollection clone() { + ViewObjectCollection collections = new ViewObjectCollection(getParentObject()); + for (IGspCommonObject node : this) { + if (node == null) { + collections.add(null); + } else { + if (node instanceof GspViewObject) { + collections.add(((GspViewObject) node).clone()); + } + } - return collections; - } + } + return collections; + } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java index 62bfc2b7b474e5bd21a7b771d0f9ab598171f106..726d4094b036935e2a034fb77bdb51d8d97845bd 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ConvertUtils.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; // //import com.inspur.edp.bef.bizentity.GspBusinessEntity; @@ -57,7 +72,6 @@ //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoElementSourceType; //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoObjectMapping; //import org.openatom.ubml.model.vo.definition.common.mapping.GspVoObjectSourceType; -//import lombok.var; // //import java.util.ArrayList; //import java.util.List; @@ -154,7 +168,7 @@ // vm.setMapping(tempVar); // } // -// // //#region Object +// // //Object //////ORIGINAL LINE: public static GspViewObject toObject(IGspCommonObject cmObject, string pkgName, string metadataId, string parentObjIDElementId, GspVoObjectSourceType sourceType = GspVoObjectSourceType.BeObject) // public static GspViewObject toObject(IGspCommonObject cmObject, String pkgName, String metadataId, String parentObjIDElementId, GspVoObjectSourceType sourceType) { // GspViewObject vmObject = new GspViewObject(); @@ -225,7 +239,7 @@ // } // // -// //#region 字段相关属性,需额外处理 +// //字段相关属性,需额外处理 // // /** // * vo对象转换时,更新字段相关属性 @@ -423,7 +437,7 @@ // } // throw new RuntimeException("无外键关联。"); // } -// //#endregion +// // // /** // * 更新分级信息 @@ -550,9 +564,9 @@ // } // } // -// //#endregion // -// //#region Element +// +// //Element // public static GspViewModelElement toElement(IGspCommonElement element, String pkgName, String metadataId) { // return toElement(element, pkgName, metadataId); // } @@ -681,7 +695,7 @@ // //TODO 后续UDt中集成VM属性后,需要获取UDT后赋值 // } // -// //#region 关联 +// //关联 // private static void convertAssociation(IGspCommonElement cmEle, GspViewModelElement vmEle, String pkgName, String metadataId, GspVoElementSourceType sourceType) { // // 关联带出字段,无关联信息 // if (cmEle.getIsRefElement()) { @@ -722,10 +736,10 @@ // // return vmAssociation; // } -// //#endregion -// //#endregion // -// //#region Action +// +// +// //Action // private static void buildVmActions(BizMgrActionCollection beMgrActions, GspViewModel vm, String pkgName, String metadataId) { // if (beMgrActions == null) { // return; @@ -838,16 +852,16 @@ // // // } -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +////TODO TASK: There is no preprocessor in Java: +// //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Vo -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// //Vo +////TODO TASK: There is no preprocessor in Java: //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Qo +//// +////TODO TASK: There is no preprocessor in Java: +//// //Qo //// //// //public static GspViewModel convertQoToViewModel(QueryObject qo, string pkgName, string metadataId, string idElementId, List eleIdList=null) //// //{ @@ -908,11 +922,11 @@ //// // }; //// //} //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// //// -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#region Tool +////TODO TASK: There is no preprocessor in Java: +//// //Tool //// //// /** //// * 根据输入字段ID列表将co字段转换为vo字段集合 @@ -940,7 +954,7 @@ //// } //// return voElements; //// } -//////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -//// //#endregion -//// //#endregion +////TODO TASK: There is no preprocessor in Java: +//// +//// //} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java index 5a64d3c741dd7695bcc94c9635d43b95d7e83c62..e34c99631aaae134613b490ab89fc9251f3bff5f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ElementHelpType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,40 +23,37 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum ElementHelpType -{ - /** 无 - */ - None(0), +public enum ElementHelpType { + /** + * 无 + */ + None(0), + + /** + * 数据表帮助 + */ + SmartHelp(1); - /** 数据表帮助 - */ - SmartHelp(1); + private int intValue; + private static java.util.HashMap mappings; - private int intValue; - private static java.util.HashMap mappings; - private synchronized static java.util.HashMap getMappings() - { - if (mappings == null) - { - mappings = new java.util.HashMap(); - } - return mappings; - } + private synchronized static java.util.HashMap getMappings() { + if (mappings == null) { + mappings = new java.util.HashMap(); + } + return mappings; + } - ElementHelpType(int value) - { - intValue = value; - ElementHelpType.getMappings().put(value, this); - } + ElementHelpType(int value) { + intValue = value; + ElementHelpType.getMappings().put(value, this); + } - public int getValue() - { - return intValue; - } + public int getValue() { + return intValue; + } - public static ElementHelpType forValue(int value) - { - return getMappings().get(value); - } -} \ No newline at end of file + public static ElementHelpType forValue(int value) { + return getMappings().get(value); + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java index 3eab81c22cd7aabe913b70d19aa2c33607a6dce3..42e8aa034d476e30c0ed55a2b4b016f0ab45e9a0 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/HelpExtendAction.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; @@ -10,24 +25,21 @@ import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class HelpExtendAction -{ - private VMActionCollection beforeHelp; - /** - 帮助前扩展 - - */ - public final VMActionCollection getBeforeHelp() - { - if (beforeHelp == null) - { - beforeHelp = new VMActionCollection(); - } - return beforeHelp; - } - public final void setBeforeHelp(VMActionCollection value) - { - beforeHelp = value; - } +public class HelpExtendAction { + private VMActionCollection beforeHelp; + + /** + * 帮助前扩展 + */ + public final VMActionCollection getBeforeHelp() { + if (beforeHelp == null) { + beforeHelp = new VMActionCollection(); + } + return beforeHelp; + } + + public final void setBeforeHelp(VMActionCollection value) { + beforeHelp = value; + } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java index 27e12897427477b9f3d692c04c5150b02d2f128c..b00caf43ebb9cffa4a696f8385fd610ec93ef6f0 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InitVoUtil.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.common.definition.cef.element.GspElementDataType; @@ -17,12 +32,14 @@ import org.openatom.ubml.model.vo.definition.GspViewObject; * @Version: V1.0 */ public final class InitVoUtil { - public static GspViewModel BuildVirtualVo(String metadataID, String metadataName, String metadataCode, String metadataAssembly) { + public static GspViewModel BuildVirtualVo(String metadataID, String metadataName, String metadataCode, + String metadataAssembly) { GspViewModel vo = InitVo(metadataID, metadataName, metadataCode, metadataAssembly, true); return vo; } - private static GspViewModel InitVo(String metadataID, String metadataName, String metadataCode, String metadataAssembly, boolean isVirtual) { + private static GspViewModel InitVo(String metadataID, String metadataName, String metadataCode, + String metadataAssembly, boolean isVirtual) { GspViewModel vo = new GspViewModel(); vo.setID(metadataID); vo.setCode(metadataCode); @@ -45,7 +62,7 @@ public final class InitVoUtil { mainObj.setID(Guid.newGuid().toString()); mainObj.setCode(objCode); mainObj.setName(objName); - GspColumnGenerate columnGenerate=new GspColumnGenerate(); + GspColumnGenerate columnGenerate = new GspColumnGenerate(); columnGenerate.setElementID(idElement.getID()); columnGenerate.setGenerateType("Guid"); mainObj.setColumnGenerateID(columnGenerate); @@ -69,7 +86,7 @@ public final class InitVoUtil { idElement.setLength(36); idElement.setPrecision(0); idElement.setIsRequire(true); - // voElemet + // voElement if (isVirtual) { idElement.setIsVirtual(true); idElement.setIsVirtualViewElement(true); @@ -78,4 +95,4 @@ public final class InitVoUtil { return idElement; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java index b4011d4995c1ed20aefbe131c9c82d42ba85461e..0c0f5420ec2a038cfa65f8b9fecaba5b8c1f8d74 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/InternalExtendActionUtil.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; import org.openatom.ubml.model.vo.definition.action.MappedCdpAction; @@ -66,4 +81,4 @@ public class InternalExtendActionUtil { throw new RuntimeException(String.format("无id='%1$s'的内置扩展操作。", actionId)); } } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java index dc6c82d1ba84a9500d8fbc14c3fb5c00eb7e22fb..0d2e3ebf7efb2be2387e3c744f18ee9d3f2355f5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/LinkBeUtils.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; // //import com.inspur.edp.bef.bizentity.GspBizEntityElement; @@ -101,8 +116,8 @@ // } // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#region 对象 +//TODO TASK: There is no preprocessor in Java: +// //对象 // // private void linkMainObj(GspViewObject viewObj) { // // 虚拟对象无映射bizObj @@ -172,9 +187,9 @@ // //ConvertUtils.UpdateViewObjectKeys(bizObject, viewObj, parentObjectElementId); // } // -// //#endregion // -// //#region 字段 +// +// //字段 // // private void linkElements(GspViewObject viewObj) { // ArrayList elementList = viewObj.getContainElements().getAllItems(item -> item.getIsVirtual() == false); @@ -416,9 +431,9 @@ // } // return null; // } -// //#endregion // -// //#region 操作 +// +// //操作 // // private void linkActions(GspViewModel vm) { // ArrayList list = vm.getActions().getAllItems(item -> item.getType() == ViewModelActionType.BEAction); @@ -450,11 +465,11 @@ // targetAction.setReturnValue(sourceAction.getReturnValue()); // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +//TODO TASK: There is no preprocessor in Java: // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#region 业务实体缓存 +// +//TODO TASK: There is no preprocessor in Java: +// //业务实体缓存 // // private GspBusinessEntity getBe(String id) { // return getBizEntity(id); @@ -520,6 +535,6 @@ //// } // } // -////C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java: -// //#endregion +//TODO TASK: There is no preprocessor in Java: +// //} \ No newline at end of file diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java index 5cd092d59d45cbf3c42e0361b27fd2ef07a8900a..30e7ae0a767bc2d0e9af6b3c9042e9fd37447c27 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MappingType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,76 +23,62 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum MappingType -{ - /** - Vo - - */ - ViewObject, - - /** - BE - - */ - BizEntity, +public enum MappingType { + /** + * Vo + */ + ViewObject, - /** - DM - - */ - DataModel, + /** + * BE + */ + BizEntity, - /** - BE节点 - - */ - BEObject, + /** + * DM + */ + DataModel, - /** - GspDataModel节点 - - */ - DMObject, + /** + * BE节点 + */ + BEObject, - /** - 节点元素 - - */ - Element, + /** + * GspDataModel节点 + */ + DMObject, - /** - BE 操作 - - */ - BizOperation, + /** + * 节点元素 + */ + Element, - /** - 构件方法 - - */ - ComponentMethod, + /** + * BE 操作 + */ + BizOperation, - /** - 数据对象 - - */ - DataObject, + /** + * 构件方法 + */ + ComponentMethod, - /** - 数据对象列 - - */ - GSPColumn; + /** + * 数据对象 + */ + DataObject, + /** + * 数据对象列 + */ + GSPColumn; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static MappingType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static MappingType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java index a4e14bb3b9c9a83e5032a08deb945f8030388c59..1e3135255259e9fe560d72562cc8802487204ec9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/MetadataType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,27 +23,22 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum MetadataType -{ - /** - BE - - */ - BizEntity, +public enum MetadataType { + /** + * BE + */ + BizEntity, - /** - QO - - */ - QueryObject; + /** + * QO + */ + QueryObject; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static MetadataType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static MetadataType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java index 53c953f00daf28fdf71078058071ad69c80aa1af..1671180760652e3078d8868f990cf8877e4cb647 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/TemplateVoInfo.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; import com.fasterxml.jackson.annotation.JsonProperty; @@ -13,45 +28,45 @@ import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; */ public class TemplateVoInfo { - private String templateVoServiceUnit; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoServiceUnit) - public final String getTemplateVoServiceUnit() { - return templateVoServiceUnit; - } - - public void setTemplateVoServiceUnit(String value) { - this.templateVoServiceUnit = value; - } - - private String templateVoPkgName; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoPkgName) - public final String getTemplateVoPkgName() { - return templateVoPkgName; - } - - public void setTemplateVoPkgName(String value) { - this.templateVoPkgName = value; - } - - private String templateVoId; - - /** - * 模板VO信息 - */ - @JsonProperty(ViewModelJsonConst.TemplateVoId) - public final String getTemplateVoId() { - return templateVoId; - } - - public void setTemplateVoId(String value) { - this.templateVoId = value; - } + private String templateVoServiceUnit; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoServiceUnit) + public final String getTemplateVoServiceUnit() { + return templateVoServiceUnit; + } + + public void setTemplateVoServiceUnit(String value) { + this.templateVoServiceUnit = value; + } + + private String templateVoPkgName; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoPkgName) + public final String getTemplateVoPkgName() { + return templateVoPkgName; + } + + public void setTemplateVoPkgName(String value) { + this.templateVoPkgName = value; + } + + private String templateVoId; + + /** + * 模板VO信息 + */ + @JsonProperty(ViewModelJsonConst.TemplateVoId) + public final String getTemplateVoId() { + return templateVoId; + } + + public void setTemplateVoId(String value) { + this.templateVoId = value; + } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java index dbb6fdc83b7fa1325dba0db0ce7b91404ff845ef..d36012fa9403f64997d1f077fdb9c48274ad93f6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMCollectionParameterType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,31 +23,25 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMCollectionParameterType -{ - /** - 未使用集合形式 - - */ - None, - /** - 列表 - - */ - List, - /** - 数组 - - */ - Array; +public enum VMCollectionParameterType { + /** + * 未使用集合形式 + */ + None, + /** + * 列表 + */ + List, + /** + * 数组 + */ + Array; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMCollectionParameterType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMCollectionParameterType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java index 93e0dfbd6f9fabe3714b0954d5c9109aafcbe43f..237408686dfe07f356fcbba5b89e459614568cc6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMHelpConfig.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,23 +23,20 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class VMHelpConfig implements Cloneable -{ - private String helpId; - public final String getHelpId() - { - return helpId; - } - public final void setHelpId(String value) - { - helpId = value; - } +public class VMHelpConfig implements Cloneable { + private String helpId; + + public final String getHelpId() { + return helpId; + } + + public final void setHelpId(String value) { + helpId = value; + } -// public final Object clone() - public Object clone() - { - VMHelpConfig config = new VMHelpConfig(); - config.helpId = helpId; - return config; - } -} \ No newline at end of file + public Object clone() { + VMHelpConfig config = new VMHelpConfig(); + config.helpId = helpId; + return config; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java index c61124d50286a148b989d9edb62151af2e888439..c531062f26e8861441301183da70e5884b5e01c3 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterMode.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,31 +23,25 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMParameterMode -{ - /** - 传入参数 - - */ - IN, - /** - 传出参数 - - */ - OUT, - /** - 传入传出参数 - - */ - INOUT; +public enum VMParameterMode { + /** + * 传入参数 + */ + IN, + /** + * 传出参数 + */ + OUT, + /** + * 传入传出参数 + */ + INOUT; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMParameterMode forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMParameterMode forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java index c42f94e73bfd697ae51f9c215d4a3d554c187323..7b9c9376ee23f59a4b3d918cad160551627dace2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/VMParameterType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; /** @@ -8,39 +23,43 @@ package org.openatom.ubml.model.vo.definition.common; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum VMParameterType -{ - /**字符型 - */ - String, - /**布尔型 - */ - Boolean, - /**整数 - */ - Int32, - /**浮点数字 - */ - Decimal, - /**双浮点 - */ - Double, - /**时间 - */ - DateTime, - //对象类型 - Object, - /**自定义 - */ - Custom; +public enum VMParameterType { + /** + * 字符型 + */ + String, + /** + * 布尔型 + */ + Boolean, + /** + * 整数 + */ + Int32, + /** + * 浮点数字 + */ + Decimal, + /** + * 双浮点 + */ + Double, + /** + * 时间 + */ + DateTime, + //对象类型 + Object, + /** + * 自定义 + */ + Custom; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static VMParameterType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static VMParameterType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java index f2127625c78a3476c399ca21e2c25544738bb86d..daf12301c6766df164b7c0973bf6d1b2e4428c8b 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ValueHelpConfig.java @@ -1,6 +1,20 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; - import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.Serializable; @@ -20,7 +34,6 @@ import org.openatom.ubml.model.vo.definition.json.model.ValueHelpConfigSerizlize @JsonSerialize(using = ValueHelpConfigSerizlizer.class) public class ValueHelpConfig implements Cloneable, Serializable { - //region 字段 /** * VM元素ID */ @@ -45,11 +58,9 @@ public class ValueHelpConfig implements Cloneable, Serializable { private CustomizationInfo customizationInfo; - //endregion - - - ///#region 构造函数 - + /** + * constructor + */ public ValueHelpConfig() { } @@ -67,10 +78,6 @@ public class ValueHelpConfig implements Cloneable, Serializable { setFilterExpression(filterExpression); } - ///#endregion - - ///#region 属性 - public final String getElementId() { return elementId; } @@ -125,17 +132,13 @@ public class ValueHelpConfig implements Cloneable, Serializable { this.customizationInfo = customizationInfo; } - ///#endregion - - ///#region 方法 - /** * 克隆 * * @return 值帮助配置 */ + @Override public final ValueHelpConfig clone() { -// return MemberwiseClone(); Object tempVar = null; try { tempVar = super.clone(); @@ -146,5 +149,4 @@ public class ValueHelpConfig implements Cloneable, Serializable { return obj; } - ///#endregion -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java index e4a220a7533b525d20ba6fcc7cf90a98258cb29a..d8acf75a8fe5a0f2196f763d4fa300d88596fff2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/ViewModelMapping.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common; import java.io.Serializable; @@ -10,154 +25,133 @@ import java.io.Serializable; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class ViewModelMapping implements Cloneable, Serializable -{ - /** - 映射类型 - - */ - private MappingType privateMapType = MappingType.forValue(0); - public final MappingType getMapType() - { - return privateMapType; - } - public final void setMapType(MappingType value) - { - privateMapType = value; - } - - /** - 映射的对方元数据ContentId,用于唯一确定元数据 - - */ - private String privateTargetMetadataId; - public final String getTargetMetadataId() - { - return privateTargetMetadataId; - } - public final void setTargetMetadataId(String value) - { - privateTargetMetadataId = value; - } - - ///// - ///// 映射的对方元数据类型,BE或QO - ///// - //public MetadataType TargetMetadataType { get; set; } - - /** - 映射的对方元数据包名,用于唯一确定元数据 - - */ - private String privateTargetMetadataPkgName; - public final String getTargetMetadataPkgName() - { - return privateTargetMetadataPkgName; - } - public final void setTargetMetadataPkgName(String value) - { - privateTargetMetadataPkgName = value; - } - - /** - 映射的元素ID,用于确定具体的元数据成员 - - */ - private String privateTargetObjId; - public final String getTargetObjId() - { - return privateTargetObjId; - } - public final void setTargetObjId(String value) - { - privateTargetObjId = value; - } - - /** - 重载的相等运算符 - - @param other - @return - */ - protected final boolean equals(ViewModelMapping other) - { - return getMapType() == other.getMapType() && other.getTargetMetadataId().equals(getTargetMetadataId()) &&other.getTargetMetadataPkgName().equals(getTargetMetadataPkgName()) && other.getTargetObjId().equals(getTargetObjId()); - } - - /** - 重写相等判断 - - @param obj - @return - */ - @Override - public boolean equals(Object obj) - { - if (obj == null) - { - return false; - } - // if (obj.equals(this)) - //{ - //return true; - //} - if (obj.getClass() != getClass()) - { - return false; - } - return equals((ViewModelMapping)obj); - } - - /** - 创建作为当前实例副本的新对象。 - - @return - 作为此实例副本的新对象。 - - 2 - */ - public Object clone() - { - try { - ViewModelMapping mapping = (ViewModelMapping)super.clone(); - return mapping; - } catch (CloneNotSupportedException e) { - return null; - } - } - - /** - 返回表示当前 。 - - @return - ,表示当前的 。 - - 2 - */ - @Override - public String toString() - { - return String.format("[MappingInfo]MapType: %1$s, TargetMetadataId: %2$s, TargetMetadataPkgName:%3$s, TargetObjId: %4$s", getMapType(), getTargetMetadataId(), getTargetMetadataPkgName(), getTargetObjId()); - } - - /** - 用作特定类型的哈希函数。 - - @return - 当前 的哈希代码。 - - 2 - */ - @Override - public int hashCode() - { -// unchecked - { - int hashCode = getMapType().getValue(); - hashCode = (hashCode * 397) ^ (getTargetMetadataId() != null ? getTargetMetadataId().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getTargetMetadataPkgName() != null ? getTargetMetadataPkgName().hashCode() : 0); - hashCode = (hashCode * 397) ^ (getTargetObjId() != null ? getTargetObjId().hashCode() : 0); - return hashCode; - } - } -} \ No newline at end of file +public class ViewModelMapping implements Cloneable, Serializable { + /** + * 映射类型 + */ + private MappingType privateMapType = MappingType.forValue(0); + + public final MappingType getMapType() { + return privateMapType; + } + + public final void setMapType(MappingType value) { + privateMapType = value; + } + + /** + * 映射的对方元数据ContentId,用于唯一确定元数据 + */ + private String privateTargetMetadataId; + + public final String getTargetMetadataId() { + return privateTargetMetadataId; + } + + public final void setTargetMetadataId(String value) { + privateTargetMetadataId = value; + } + + ///// + ///// 映射的对方元数据类型,BE或QO + ///// + //public MetadataType TargetMetadataType { get; set; } + + /** + * 映射的对方元数据包名,用于唯一确定元数据 + */ + private String privateTargetMetadataPkgName; + + public final String getTargetMetadataPkgName() { + return privateTargetMetadataPkgName; + } + + public final void setTargetMetadataPkgName(String value) { + privateTargetMetadataPkgName = value; + } + + /** + * 映射的元素ID,用于确定具体的元数据成员 + */ + private String privateTargetObjId; + + public final String getTargetObjId() { + return privateTargetObjId; + } + + public final void setTargetObjId(String value) { + privateTargetObjId = value; + } + + /** + * 重载的相等运算符 + * + * @param other + * @return + */ + protected final boolean equals(ViewModelMapping other) { + return getMapType() == other.getMapType() && other.getTargetMetadataId().equals(getTargetMetadataId()) && other.getTargetMetadataPkgName().equals(getTargetMetadataPkgName()) && other.getTargetObjId().equals(getTargetObjId()); + } + + /** + * 重写相等判断 + * + * @param obj + * @return + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj.getClass() != getClass()) { + return false; + } + return equals((ViewModelMapping) obj); + } + + /** + * 创建作为当前实例副本的新对象。 + * + * @return 作为此实例副本的新对象。 + * + * 2 + */ + public Object clone() { + try { + ViewModelMapping mapping = (ViewModelMapping) super.clone(); + return mapping; + } catch (CloneNotSupportedException e) { + return null; + } + } + + /** + * 返回表示当前 。 + * + * @return ,表示当前的 。 + * + * 2 + */ + @Override + public String toString() { + return String.format("[MappingInfo]MapType: %1$s, TargetMetadataId: %2$s, TargetMetadataPkgName:%3$s, TargetObjId: %4$s", getMapType(), getTargetMetadataId(), getTargetMetadataPkgName(), getTargetObjId()); + } + + /** + * 用作特定类型的哈希函数。 + * + * @return 当前 的哈希代码。 + * + * 2 + */ + @Override + public int hashCode() { + int hashCode = getMapType().getValue(); + hashCode = (hashCode * 397) ^ (getTargetMetadataId() != null ? getTargetMetadataId().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getTargetMetadataPkgName() != null ? getTargetMetadataPkgName().hashCode() : 0); + hashCode = (hashCode * 397) ^ (getTargetObjId() != null ? getTargetObjId().hashCode() : 0); + return hashCode; + + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java index bc93a5f4c3f98721a851601ab12d31668abfc0be..9c5c8bc807f561926c2b2203aade1841879470e1 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/copy/CopyContext.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.copy; import org.openatom.ubml.model.vo.definition.GspViewModel; @@ -10,53 +25,48 @@ import org.openatom.ubml.model.vo.definition.GspViewModel; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class CopyContext -{ - /** - 源Vo - - */ - private GspViewModel privateOriginVo; - public final GspViewModel getOriginVo() - { - return privateOriginVo; - } - public final void setOriginVo(GspViewModel value) - { - - privateOriginVo = value; - } - - /** - 新Vo的元数据头节点 - - */ -// private MetadataHeader privateMetadataHeader; - private CopyContext privateMetadataHeader; - public final CopyContext getMetadataHeader() - { - - return privateMetadataHeader; - } - public final void setMetadataHeader(CopyContext value) - { - privateMetadataHeader = value; - } - - private boolean includeVoActions = false; - /** - 是否拷贝Vo操作 - - */ - boolean getIncludeVoActions(){ - return this.includeVoActions; - } - public final void setIncludeVoActions(boolean value) - { - if (value) - { - throw new RuntimeException("vo元数据拷贝暂不支持拷贝操作。"); - } - includeVoActions = value; - } -} \ No newline at end of file +public class CopyContext { + /** + * 源Vo + */ + private GspViewModel privateOriginVo; + + public final GspViewModel getOriginVo() { + return privateOriginVo; + } + + public final void setOriginVo(GspViewModel value) { + + privateOriginVo = value; + } + + /** + * 新Vo的元数据头节点 + */ + private CopyContext privateMetadataHeader; + + public final CopyContext getMetadataHeader() { + + return privateMetadataHeader; + } + + public final void setMetadataHeader(CopyContext value) { + privateMetadataHeader = value; + } + + private boolean includeVoActions = false; + + /** + * 是否拷贝Vo操作 + */ + boolean getIncludeVoActions() { + return this.includeVoActions; + } + + public final void setIncludeVoActions(boolean value) { + if (value) { + throw new RuntimeException("vo元数据拷贝暂不支持拷贝操作。"); + } + includeVoActions = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java index 449989a2316ca7f26455b9a22d592a1d90654cad..d536da1c8bbace5c41efa13af2598f949d42af7d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspQoObjectMapping.java @@ -1,25 +1,39 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.mapping; -public class GspQoObjectMapping extends GspVoObjectMapping -{ - /** - * The Definition Of The Qo Object Mapping - * - * @ClassName: GspVoObjectSourceType - * @Author: Benjamin Gong - * @Date: 2021/1/11 17:13 - * @Version: V1.0 - */ - public GspVoObjectSourceType SourceType = - GspVoObjectSourceType.QoObject; +public class GspQoObjectMapping extends GspVoObjectMapping { + /** + * The Definition Of The Qo Object Mapping + * + * @ClassName: GspVoObjectSourceType + * @Author: Benjamin Gong + * @Date: 2021/1/11 17:13 + * @Version: V1.0 + */ + public GspVoObjectSourceType SourceType = + GspVoObjectSourceType.QoObject; - private String privateIndexVoId; - public final String getIndexVoId() - { - return privateIndexVoId; - } - public final void setIndexVoId(String value) - { - privateIndexVoId = value; - } -} \ No newline at end of file + private String privateIndexVoId; + + public final String getIndexVoId() { + return privateIndexVoId; + } + + public final void setIndexVoId(String value) { + privateIndexVoId = value; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java index 4f9c61d6e65e4b9567731bfa20c1fd14fca890dc..6658763b397ebc8872cae0d3310818ff514f5660 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementMapping.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.mapping; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; @@ -10,53 +25,48 @@ import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public class GspVoElementMapping extends ViewModelMapping -{ - /** - 映射节点ID - - */ - private String targetObjectId; - public final String getTargetObjectId() - { - return targetObjectId; - } - public final void setTargetObjectId(String value) - { - targetObjectId = value; - } - - /** - 映射字段ID - - */ - private String targetElementId; - public final String getTargetElementId() - { - return targetElementId; - } - public final void setTargetElementId(String value) - { - targetElementId = value; - } - - /** - 数据源(be或qo) - - */ - private GspVoElementSourceType sourceType = - GspVoElementSourceType.forValue(0); - public final GspVoElementSourceType getSourceType() - { - return sourceType; - } - public final void setSourceType(GspVoElementSourceType value) - { - sourceType = value; - } - - public GspVoElementMapping clone() { - return (GspVoElementMapping)super.clone(); - } - -} \ No newline at end of file +public class GspVoElementMapping extends ViewModelMapping { + /** + * 映射节点ID + */ + private String targetObjectId; + + /** + * 映射字段ID + */ + private String targetElementId; + + /** + * 数据源(be或qo) + */ + private GspVoElementSourceType sourceType = GspVoElementSourceType.forValue(0); + + public final String getTargetObjectId() { + return targetObjectId; + } + + public final void setTargetObjectId(String value) { + targetObjectId = value; + } + + public final String getTargetElementId() { + return targetElementId; + } + + public final void setTargetElementId(String value) { + targetElementId = value; + } + + public final GspVoElementSourceType getSourceType() { + return sourceType; + } + + public final void setSourceType(GspVoElementSourceType value) { + sourceType = value; + } + + public GspVoElementMapping clone() { + return (GspVoElementMapping) super.clone(); + } + +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java index 4f725ebfe0f3b6205837a25d889d6c73a6708b17..903f4fdcc8ea2d83951e9d115d0031cfdc355c44 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoElementSourceType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.mapping; /** @@ -8,33 +23,27 @@ package org.openatom.ubml.model.vo.definition.common.mapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum GspVoElementSourceType -{ - /** - BE - - */ - BeElement, +public enum GspVoElementSourceType { + /** + * BE + */ + BeElement, - /** - QO - - */ - QoElement, + /** + * QO + */ + QoElement, - /** - VO - - */ - VoElement; + /** + * VO + */ + VoElement; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static GspVoElementSourceType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static GspVoElementSourceType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java index 5f9b85160de91da3c7e2ae75096c97b5d2208ccf..4712c237cde3bfc935a4194b4e20bae82b5fe053 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectMapping.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.mapping; import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; @@ -11,8 +26,7 @@ import org.openatom.ubml.model.vo.definition.common.ViewModelMapping; * @Version: V1.0 */ public class GspVoObjectMapping extends ViewModelMapping { - private GspVoObjectSourceType type = - GspVoObjectSourceType.forValue(0); + private GspVoObjectSourceType type = GspVoObjectSourceType.forValue(0); /** * 数据源(be或qo或vo) @@ -29,6 +43,6 @@ public class GspVoObjectMapping extends ViewModelMapping { } public GspVoObjectMapping clone() { - return (GspVoObjectMapping)super.clone(); + return (GspVoObjectMapping) super.clone(); } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java index 977fc6d75b9bbaab953321658f6228b64766d30c..f3d7ef828cef3285455a3e1de78d7464e6162053 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/common/mapping/GspVoObjectSourceType.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.common.mapping; /** @@ -8,33 +23,27 @@ package org.openatom.ubml.model.vo.definition.common.mapping; * @Date: 2021/1/11 17:13 * @Version: V1.0 */ -public enum GspVoObjectSourceType -{ - /** - BE - - */ - BeObject, +public enum GspVoObjectSourceType { + /** + * BE + */ + BeObject, - /** - QO - - */ - QoObject, + /** + * QO + */ + QoObject, - /** - VO - - */ - VoObject; + /** + * VO + */ + VoObject; - public int getValue() - { - return this.ordinal(); - } + public int getValue() { + return this.ordinal(); + } - public static GspVoObjectSourceType forValue(int value) - { - return values()[value]; - } -} \ No newline at end of file + public static GspVoObjectSourceType forValue(int value) { + return values()[value]; + } +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java index 22f570ffa537cf48b354f6f27612f1922e8958e1..8d95f9868ec1727576af40215b65bf21000b6193 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/dataextendinfo/VoDataExtendInfo.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.dataextendinfo; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; @@ -11,7 +26,6 @@ import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; * @Version: V1.0 */ public class VoDataExtendInfo { - ///#region 私有字段 private VMActionCollection dataMappingActions; private VMActionCollection beforeQueryActions; @@ -38,7 +52,6 @@ public class VoDataExtendInfo { private VMActionCollection multiDeleteActions; private VMActionCollection afterMultiDeleteActions; - ///#endregion public final VMActionCollection getBeforeMultiDeleteActions() { if (beforeMultiDeleteActions == null) { beforeMultiDeleteActions = new VMActionCollection(); @@ -167,7 +180,6 @@ public class VoDataExtendInfo { return retrieveActions; } - // public void setRetrieveActions(VMActionCollection value) public void setRetrieveActions(VMActionCollection value) { this.retrieveActions = value; } @@ -269,7 +281,6 @@ public class VoDataExtendInfo { this.beforeCreateActions = value; } - /** * 新增数据 * @@ -298,7 +309,6 @@ public class VoDataExtendInfo { return afterCreateActions; } - // public void setAfterCreateActions(VMActionCollection value) public void setAfterCreateActions(VMActionCollection value) { this.afterCreateActions = value; } @@ -320,7 +330,6 @@ public class VoDataExtendInfo { this.beforeDeleteActions = value; } - /** * 删除数据 * @@ -353,7 +362,6 @@ public class VoDataExtendInfo { this.afterDeleteActions = value; } - /** * 保存数据前 * @@ -402,7 +410,6 @@ public class VoDataExtendInfo { this.afterSaveActions = value; } - /** * 变更集反向Mapping * @@ -418,4 +425,4 @@ public class VoDataExtendInfo { public void setChangesetReversalMappingActions(VMActionCollection value) { this.changesetReversalMappingActions = value; } -} \ No newline at end of file +} diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java index b1d7b7c5396390ba2f72ea4aa60e6360aaf2c05b..1d138ad5d0b058bbdbc6615a3385e1194286e0a1 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/api/GspVoExtendInfoService.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.extendinfo.api; import java.util.List; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java index 43a198f526bfaea053da85c36e425c53d770a377..38ca5fedfe3d92209fa81673c8807c6dc18853e5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/extendinfo/entity/GspVoExtendInfo.java @@ -1,14 +1,25 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.extendinfo.entity; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - +import java.util.Date; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; -import java.util.Date; /** * The Josn Deserializer Of Biz Operation @@ -20,11 +31,12 @@ import java.util.Date; */ @Entity @Table(name = "GspViewModel") -@NoArgsConstructor @JsonIgnoreProperties(ignoreUnknown = true) -@Data public class GspVoExtendInfo { + public GspVoExtendInfo() { + } + public GspVoExtendInfo(String id, String extendInfo, String configId, String createdBy, Date createdOn, String lastChangedBy, Date lastChangedOn) { this.id = id; @@ -38,7 +50,7 @@ public class GspVoExtendInfo { public GspVoExtendInfo(String id, String extendInfo, String configId, String createdBy, Date createdOn, String lastChangedBy, Date lastChangedOn, String beSourceId) { - this(id,extendInfo,configId,createdBy,createdOn,lastChangedBy,lastChangedOn); + this(id, extendInfo, configId, createdBy, createdOn, lastChangedBy, lastChangedOn); this.beSourceId = beSourceId; } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java index 006ada24f9a83673824a1e2a74690dca846e63be..45a32d4a06c9eefcd12c5b1a445903633c86cad2 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ExtendPropertiesDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java index a497d66b538fcb6393ef022be89886e4ed91290c..5f4a0472ff2195b0f113dc97927958244df9fb8d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/ViewModelJsonConst.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json; /** * The Serializer Property Names Of diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java index aa560cb8a62520adeee0b42a0cbbf089645578ca..4a961d6ed8471777266b6637163e0212a5d56aa0 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.element; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java index 7da29ad5bae4f6d8978dc25e5bd93fe2f8f71851..e3750146ccf511b8ff713cf05eb3373fee9ff947 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/element/ViewElementSerializer.java @@ -1,7 +1,23 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.element; import com.fasterxml.jackson.core.JsonGenerator; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonElement; import org.openatom.ubml.model.common.definition.commonmodel.json.element.CmElementSerializer; @@ -9,6 +25,7 @@ import org.openatom.ubml.model.vo.definition.GspViewModelElement; import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; import org.openatom.ubml.model.vo.definition.json.mapping.GspVoElementMappingSerializer; import org.openatom.ubml.model.vo.definition.json.operation.VmActionCollectionSerializer; + /** * The Josn Serializer Of View Model Elemnet * @@ -68,10 +85,10 @@ public class ViewElementSerializer extends CmElementSerializer { private void writeExtendProperties(JsonGenerator writer, GspViewModelElement vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java index 900b4596ff3c94503ae27cdd3b5ed9d2a363f34f..fdb3732a1ceb4d2b0e8f714490d88cf821350c58 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspQoObjectMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java index 985c56039690cec3e8608197f066d7c5583aa580..5cb979722efddedf02fdbef20f4b42236d079c48 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java index f98c659f1b169e470e204c1fb85443e0c10dfbd6..e67c5b03e700d87ccea5581fc186dc2f3c7bdfec 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoElementMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java index aa6c50063b0df4b4768fedc8ba7401da8368289b..dd228e08eb5c47f2774f187dbc41751a7f9a82a9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java index 9bcc1b94b4d77c558c3aa35547b82ebb1c2d4ce8..0a0ce11444b132f1b6c30bdd977ad32657fdc154 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/GspVoObjectMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java index a035f3d4f1c5c392c09367ab5ce5dfd42b9147aa..ac5863db6cbe7812eb166342a6ff46cfb166cae0 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java index ad3d7966677a383a096289a118339228f521124b..677965419d9523c6d9bb0b9875ffe446d4afee07 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/mapping/ViewModelMappingSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.mapping; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java index 00e6ee2a0e1b67bcb3b297c4790ba07f5feb4a1a..46a0ca1d456c0260a850c8caa71b433fa52e41eb 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ValueHelpConfigDeserizlizer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; @@ -41,7 +56,7 @@ public class ValueHelpConfigDeserizlizer extends JsonDeserializer { SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.FilterExpression, helpConfig.getFilterExpression()); SerializerUtils - .writePropertyValue(writer, CefNames.CustomizationInfo, helpConfig.getCustomizationInfo()); + .writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO, helpConfig.getCustomizationInfo()); SerializerUtils.writePropertyName(writer,ViewModelJsonConst.EnableCustomHelpAuth); SerializerUtils.writePropertyValue_boolean(writer,helpConfig.getEnableCustomHelpAuth()); writeHelpExtend(writer, helpConfig.getHelpExtend()); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java index 18b6ef93354b8614c0c3ed80afc6c159dcdc95d7..57afff5c0088774c1c71e1b7db578727948e5bc6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java index 30191a2a74bf6abe5a321d6f41f0f8baed0da5e6..c0803951f7cbfeb0fd294c8693618652ea2ae786 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/ViewModelSerializer.java @@ -1,7 +1,23 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.IGspCommonModel; import org.openatom.ubml.model.common.definition.commonmodel.json.model.CommonModelSerializer; @@ -22,8 +38,6 @@ import org.openatom.ubml.model.vo.definition.json.operation.VmActionCollectionSe */ public class ViewModelSerializer extends CommonModelSerializer { - - //region BaseProp @Override protected void writeExtendModelProperty(IGspCommonModel commonModel, JsonGenerator writer) { GspViewModel vm = (GspViewModel) commonModel; @@ -70,17 +84,16 @@ public class ViewModelSerializer extends CommonModelSerializer { private void writeValueHelpConfigs(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ValueHelpConfigs); - SerializerUtils.writeArray(writer,new ValueHelpConfigSerizlizer(), vm.getValueHelpConfigs()); + SerializerUtils.writeArray(writer, new ValueHelpConfigSerizlizer(), vm.getValueHelpConfigs()); } - private void writeExtendProperties(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } @@ -89,20 +102,15 @@ public class ViewModelSerializer extends CommonModelSerializer { private void writeVoDataExtendInfo(JsonGenerator writer, GspViewModel vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.DataExtendInfo); - var converter = new VoDataExtendInfoSerializer(); + VoDataExtendInfoSerializer converter = new VoDataExtendInfoSerializer(); converter.serialize(vm.getDataExtendInfo(), writer, null); } - - //endregion - - //region SelfProp @Override protected void writeExtendModelSelfProperty(IGspCommonModel commonModel, JsonGenerator writer) { } - //endregion @Override protected CmObjectSerializer getCmObjectSerializer() { return new ViewObjectSerializer(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java index f6a7db02d8dfc3efe8e931a81396452fe7f0e762..d0f7236e6428904f2e4821e2fd04d7232d1b37d8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java index 55a5a72cad797384bd720c18d47a737e208991d1..20cb9e0fb6f47fa6931047c01ca073554be400f6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/model/VoDataExtendInfoSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.model; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java index 8f2771bbcd62ad20991b36e324d734e1d4789d78..334c279e19c0d6b3be26ab988bb551382d8587a6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectDeserializer.java @@ -1,9 +1,9 @@ /* - * Copyright 1999-2020 org.openatom.ubml Group. + * 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 + * 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 * @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openatom.ubml.model.vo.definition.json.object; import org.openatom.ubml.model.common.definition.commonmodel.entity.GspCommonObject; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java index 22c19f243e70597d7eab944523c5c25be2842735..da80aed4a705d25769dd876e40d238bd09a465ed 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/object/ViewObjectSerializer.java @@ -1,9 +1,9 @@ /* - * Copyright 1999-2020 org.openatom.ubml Group. + * 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 + * 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 * @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.openatom.ubml.model.vo.definition.json.object; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java index 67fdb405b48917fcab26d85326f55a4b96173bc1..0e9b638865c733bc88604508addb9d53c1331ba8 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.MappedBizAction; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java index c12bbea1c6a7581a4b2566865c670e2ea1bff644..d49dfa54bf53837c5861910946d8331fc2f26fa7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java index 205673cb458fdd57f745c23fd4a31c0db4d2f95a..e7f4e1a8d710b0ef01317330ffb393cdd538e42d 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionParaSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedbiz.MappedBizActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java index b4eb31019c2e82e76836f17efa09128dbc5abf52..2fb7f22913e80d5ca735ed043093aa05dffaedd7 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedBizActionSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java index 4a7a2bdd543243f64eba206108e8fe4c84d90de7..9270964fdc69e3fd464fee80526b3a3a7b1e26e3 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java index 93f102616ba01a45962911da9c8ab019955548a4..beb9fb233edd588d51e3e8f2ced462d1f67704df 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpActionSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java index 48fddef05c3f93d68b6e9fbef58bc938f6ca7bc2..ddb13df2af7d239b8bda522877119aa1527f253f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java index 4fbac84153de5f53401cebcb2ab85c7a26a1bab8..49c2357dd008d89fbaf7addc5375e92a4619064f 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/MappedCdpParaSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import org.openatom.ubml.model.vo.definition.action.mappedcdp.MappedCdpActionParameter; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java index 62d424d386c811fcac48e8f35fb0f500c90ccb27..53290e9b46f5f4a600439357d96a1dcde6988ec9 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java index 5d5dcdd618f41c32c01a4544f4b1b72e1b10c724..30e1d29cedc8f9e399b17d34e5746e3601c1e106 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionCollectionSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; @@ -7,7 +22,6 @@ import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.vo.definition.action.ViewModelAction; import org.openatom.ubml.model.vo.definition.action.ViewModelActionType; import org.openatom.ubml.model.vo.definition.collection.VMActionCollection; -import lombok.var; /** * The Josn Serializer Of View Model Action Collection * diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java index 300b751779949a7eb2ccb2c2f682bb2374a520da..0cae38fbf7d4d5ce5b282bd4fbf72c0ef816873a 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import static com.fasterxml.jackson.core.JsonToken.FIELD_NAME; @@ -77,7 +92,7 @@ public abstract class VmActionDeserializer extends Js case ViewModelJsonConst.IsAutoSave: op.setIsAutoSave(SerializerUtils.readPropertyValue_boolean(jsonParser)); break; - case CefNames.CustomizationInfo: + case CefNames.CUSTOMIZATION_INFO: op.setCustomizationInfo(SerializerUtils.readPropertyValue_Object(CustomizationInfo.class,jsonParser)); try { jsonParser.nextToken(); diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java index 78781b534a73ac7c5be767b2f2b10498251b34b8..ffc04b82b2885a021aa7fd9602efeb0facaf01d6 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmActionSerializer.java @@ -1,12 +1,30 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; -import lombok.var; +import java.util.HashMap; +import java.util.Map; import org.openatom.ubml.model.common.definition.cef.json.CefNames; import org.openatom.ubml.model.common.definition.cef.json.SerializerUtils; import org.openatom.ubml.model.common.definition.commonmodel.json.CommonModelNames; +import org.openatom.ubml.model.vo.definition.action.IViewModelParameter; +import org.openatom.ubml.model.vo.definition.action.IViewModelParameterCollection; import org.openatom.ubml.model.vo.definition.action.ViewModelAction; import org.openatom.ubml.model.vo.definition.action.viewmodelbase.ViewModelParameter; import org.openatom.ubml.model.vo.definition.json.ViewModelJsonConst; @@ -29,7 +47,7 @@ public abstract class VmActionSerializer extends Json SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.ComponentName, value.getComponentName()); SerializerUtils.writePropertyValue(writer, CommonModelNames.TYPE, value.getType().toString()); SerializerUtils.writePropertyValue(writer, ViewModelJsonConst.IsAutoSave, value.getIsAutoSave()); - SerializerUtils.writePropertyValue(writer, CefNames.CustomizationInfo,value.getCustomizationInfo()); + SerializerUtils.writePropertyValue(writer, CefNames.CUSTOMIZATION_INFO,value.getCustomizationInfo()); writeParameters(writer, value); writeReturnValue(writer, value); writeMapping(writer, value); @@ -46,7 +64,7 @@ public abstract class VmActionSerializer extends Json //[ SerializerUtils.WriteStartArray(writer); if (action.getParameterCollection().getCount() > 0) { - for (var item : action.getParameterCollection()) { + for (Object item : action.getParameterCollection()) { getParaConvertor().serialize((ViewModelParameter)item, writer, null); } } @@ -75,10 +93,10 @@ public abstract class VmActionSerializer extends Json private void writeExtendProperties(JsonGenerator writer, ViewModelAction vm) { SerializerUtils.writePropertyName(writer, ViewModelJsonConst.ExtendProperties); - var dic = vm.getExtendProperties(); + HashMap dic = vm.getExtendProperties(); SerializerUtils.writeStartObject(writer); if (dic != null && dic.size() > 0) { - for (var item : dic.entrySet()) { + for (Map.Entry item : dic.entrySet()) { SerializerUtils.writePropertyValue(writer, item.getKey(), item.getValue()); } } diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java index ea2f5535a9b9b53544d17c4f913f07af6cadafaa..643d9efc1cf31a606d6ca5a66b98d05c8b9f84c5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import static com.fasterxml.jackson.core.JsonToken.FIELD_NAME; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java index 2d9e43f9a1337f06774b42077d7a8375d73969c8..00d3ac4c6a26443cc7da026e49ef3ead6f57ef36 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmParameterSerializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonGenerator; diff --git a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java index 7e59ca146a6ec30bdd3aa4df74723d380432e9ca..a29360bc3a86fb7b33bc8bf50507c01f55998bf5 100644 --- a/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java +++ b/model/vo/definition/src/main/java/org/openatom/ubml/model/vo/definition/json/operation/VmReturnValueDeserializer.java @@ -1,3 +1,18 @@ +/* + * 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 org.openatom.ubml.model.vo.definition.json.operation; import com.fasterxml.jackson.core.JsonParser; diff --git a/model/vo/pom.xml b/model/vo/pom.xml index 214b6001241d51fd5cd38d239681643552bec382..57716d82f47e43e5448dd59d9439e22b68c59822 100644 --- a/model/vo/pom.xml +++ b/model/vo/pom.xml @@ -1,21 +1,19 @@ + ~ 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. + --> + ~ 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. + --> 4.0.0 @@ -159,6 +157,7 @@ false + diff --git a/style/ubml_checkstyle.xml b/style/ubml_checkstyle.xml index 4e242280f1b30902a4b5eff04d45f5d2e1766fdd..6435f2dd3ca8367d409d9f27ed8ea160cf36ce32 100644 --- a/style/ubml_checkstyle.xml +++ b/style/ubml_checkstyle.xml @@ -1,10 +1,10 @@