diff --git a/pom.xml b/pom.xml
index 015717579989f7c048a491126137747bfff14260..4cc2c2ae0f3af633c14e84aeb60138ee466ad0c5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,6 +74,7 @@
0.1.0
0.1.9
0.3.5
+ 0.2.55
@@ -266,6 +267,12 @@
wf-bizprocess-api
${wf-bizprocess-server.version}
+
+
+ io.iec.edp
+ caf-framework-securityentry-api
+ ${caf-runtime-framework.version}
+
diff --git a/resources/en/viewobject_model_designtime.en.properties b/resources/en/viewobject_model_designtime.en.properties
index 69a5f99092b40f664c302929c01097829b24af4d..6cb0ac1301998c763e0f60a446aaaa423c24da73 100644
--- a/resources/en/viewobject_model_designtime.en.properties
+++ b/resources/en/viewobject_model_designtime.en.properties
@@ -106,6 +106,7 @@ GSP_VIEWOBJECT_MANAGER_0107=The field [{1}] on the object [{0}] has no mapped fi
GSP_VIEWOBJECT_MANAGER_0108=The [length] of the field [{1}] on the object [{0}] cannot be greater than the length of the field on the business entity [{2}].
GSP_VIEWOBJECT_MANAGER_0109=The [precision] of the field [{1}] on the object [{0}] cannot be greater than the precision of the field on the business entity [{2}].
GSP_VIEWOBJECT_MANAGER_0110=The operation [{0}] has no mapped operation on the business entity, the ID of the custom operation on the business entity is [{1}], please check if it has been deleted.
+GSP_VIEWOBJECT_MANAGER_0111=View Object [{0}] save failed
GSP_VIEWOBJECT_MANAGER_MESSAGE_0001=View object [{0}:{1}] synchronization code check for operation [{2}:{3}]
# view-object-model
GSP_VIEWOBJECT_MODEL_1001=View operations on view object are currently not supported for clone operation
diff --git a/resources/viewobject_model_designtime.properties b/resources/viewobject_model_designtime.properties
index a620301eb8ea66b2e5703d62f29688ba11079e7f..6b86dc44b1c3bd8137e2288956df7137381806e1 100644
--- a/resources/viewobject_model_designtime.properties
+++ b/resources/viewobject_model_designtime.properties
@@ -106,6 +106,7 @@ GSP_VIEWOBJECT_MANAGER_0107=\u5BF9\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u5728
GSP_VIEWOBJECT_MANAGER_0108=\u5BF9\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u7684[\u957F\u5EA6]\u4E0D\u80FD\u5927\u4E8E\u4E1A\u52A1\u5B9E\u4F53\u4E0A\u5B57\u6BB5\u957F\u5EA6[{2}]\u3002
GSP_VIEWOBJECT_MANAGER_0109=\u5BF9\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u7684[\u7CBE\u5EA6]\u4E0D\u80FD\u5927\u4E8E\u4E1A\u52A1\u5B9E\u4F53\u4E0A\u5B57\u6BB5\u7CBE\u5EA6[{2}]\u3002
GSP_VIEWOBJECT_MANAGER_0110=\u64CD\u4F5C[{0}]\u5728\u4E1A\u52A1\u5B9E\u4F53\u4E0A\u65E0\u6620\u5C04\u64CD\u4F5C\uFF0C\u4E1A\u52A1\u5B9E\u4F53\u81EA\u5B9A\u4E49\u64CD\u4F5C\u7684ID=[{1}],\u8BF7\u68C0\u67E5\u662F\u5426\u5DF2\u5220\u9664\u3002
+GSP_VIEWOBJECT_MANAGER_0111=\u89C6\u56FE\u5BF9\u8C61[{0}]\u4FDD\u5B58\u5931\u8D25
GSP_VIEWOBJECT_MANAGER_MESSAGE_0001=\u89C6\u56FE\u5BF9\u8C61[{0}:{1}]\u4E0A\u64CD\u4F5C[{2}:{3}]\u540C\u6B65\u4EE3\u7801\u68C0\u67E5
# view-object-model
GSP_VIEWOBJECT_MODEL_1001=\u89C6\u56FE\u5BF9\u8C61\u4E0A\u7684\u89C6\u56FE\u64CD\u4F5C\u6682\u4E0D\u652F\u6301\u62F7\u8D1D\u64CD\u4F5C
diff --git a/resources/zh-CHT/viewobject_model_designtime.zh-CHT.properties b/resources/zh-CHT/viewobject_model_designtime.zh-CHT.properties
index 5b67ae09f0d732e79acfc8c9f723ccecad527c28..387b8ae58931538ed2729f7fe2670da693816841 100644
--- a/resources/zh-CHT/viewobject_model_designtime.zh-CHT.properties
+++ b/resources/zh-CHT/viewobject_model_designtime.zh-CHT.properties
@@ -106,6 +106,7 @@ GSP_VIEWOBJECT_MANAGER_0107=\u5C0D\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u5728
GSP_VIEWOBJECT_MANAGER_0108=\u5C0D\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u7684[\u9577\u5EA6]\u4E0D\u80FD\u5927\u65BC\u696D\u52D9\u5BE6\u9AD4\u4E0A\u5B57\u6BB5\u9577\u5EA6[{2}]\u3002
GSP_VIEWOBJECT_MANAGER_0109=\u5C0D\u8C61[{0}]\u4E0A\u7684\u5B57\u6BB5[{1}]\u7684[\u7CBE\u5EA6]\u4E0D\u80FD\u5927\u65BC\u696D\u52D9\u5BE6\u9AD4\u4E0A\u5B57\u6BB5\u7CBE\u5EA6[{2}]\u3002
GSP_VIEWOBJECT_MANAGER_0110=\u64CD\u4F5C[{0}]\u5728\u696D\u52D9\u5BE6\u9AD4\u4E0A\u7121\u6620\u5C04\u64CD\u4F5C\uFF0C\u696D\u52D9\u5BE6\u9AD4\u81EA\u5B9A\u7FA9\u64CD\u4F5C\u7684ID=[{1}],\u8ACB\u6AA2\u67E5\u662F\u5426\u5DF2\u522A\u9664\u3002
+GSP_VIEWOBJECT_MANAGER_0111=\u8996\u5716\u5C0D\u8C61[{0}]\u4FDD\u5B58\u5931\u6557
GSP_VIEWOBJECT_MANAGER_MESSAGE_0001=\u8996\u5716\u5C0D\u8C61[{0}:{1}]\u4E0A\u64CD\u4F5C[{2}:{3}]\u540C\u6B65\u4EE3\u78BC\u6AA2\u67E5
# view-object-model
GSP_VIEWOBJECT_MODEL_1001=\u8996\u5716\u5C0D\u8C61\u4E0A\u7684\u8996\u5716\u64CD\u4F5C\u66AB\u4E0D\u652F\u6301\u62F7\u8C9D\u64CD\u4F5C
diff --git a/view-object-api/pom.xml b/view-object-api/pom.xml
index 5bae2b57d6773a4b75b005981d06d8e90e379574..4be6bb5c2a4eb6bf7e6e43130d8e3add921eca5b 100644
--- a/view-object-api/pom.xml
+++ b/view-object-api/pom.xml
@@ -32,6 +32,10 @@
compile
${project.version}
+
+ io.iec.edp
+ caf-framework-securityentry-api
+
\ No newline at end of file
diff --git a/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/ViewModelService.java b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/ViewModelService.java
new file mode 100644
index 0000000000000000000000000000000000000000..cfa06e5acce71012c060c1098dd1c2f03fee978c
--- /dev/null
+++ b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/ViewModelService.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.formserver.vmapi;
+
+import com.inspur.edp.formserver.vmapi.dto.ViewModelAuthInfoDto;
+import com.inspur.edp.formserver.vmapi.dto.ViewModelExtendDto;
+
+import java.util.Set;
+
+/**
+ * 视图模型服务
+ * @author sunhongfei01
+ * @since 2025-02-26
+ */
+public interface ViewModelService {
+ /**
+ * 加载视图模型扩展信息
+ * @param viewModelId 视图模型id
+ * @return 视图模型扩展信息
+ */
+ ViewModelExtendDto getViewModelExtendInfo(String viewModelId);
+
+ /**
+ * 保存视图模型扩展信息
+ * @param viewModelId 视图模型id
+ * @param viewModelExtendInfo 待保存的视图模型扩展信息
+ * @param authIdsToDelete 待删除的权限id集合
+ */
+ void saveViewModelExtendInfo(String viewModelId, ViewModelExtendDto viewModelExtendInfo, Set authIdsToDelete);
+
+ /**
+ * 获取视图模型权限信息
+ * @param viewModelId 视图模型id
+ * @return 视图模型权限信息
+ */
+ ViewModelAuthInfoDto loadViewModelAuthInfo(String viewModelId);
+}
diff --git a/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthInfoDto.java b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthInfoDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..7d3a6b4bddc676b80b944e8137e9bd240c48f054
--- /dev/null
+++ b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthInfoDto.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.formserver.vmapi.dto;
+
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry;
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry4RuleDTO;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 视图模型权限信息DTO
+ * @author sunhongfei01
+ * @since 2025-02-26
+ */
+@Getter
+@Setter
+public class ViewModelAuthInfoDto {
+ // 功能权限
+ private SecurityEntry funcSecurity;
+ // 数据权限, key为节点编码路径
+ private Map authSecurityMap = new HashMap<>();
+ // 列权限, key为节点编码路径
+ private SecurityEntry columnSecurity;
+
+ /**
+ * 添加数据权限
+ * @param code 数据权限归属的节点编码
+ * @param securityEntry 数据权限
+ * @param entry4RuleDTO 规则权限
+ */
+ public void addAuthSecurityEntry(String code, SecurityEntry securityEntry, SecurityEntry4RuleDTO entry4RuleDTO) {
+ // 如果数据权限和规则权限都为空,则不添加
+ if (securityEntry == null && entry4RuleDTO == null) {
+ return;
+ }
+ authSecurityMap.put(code, new ViewModelAuthSecurityDto(securityEntry, entry4RuleDTO));
+ }
+}
diff --git a/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthSecurityDto.java b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthSecurityDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..66fd07238ef0d300cba85caf294367452f9c186c
--- /dev/null
+++ b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelAuthSecurityDto.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.formserver.vmapi.dto;
+
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry;
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry4RuleDTO;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+
+/**
+ * 视图模型数据权限信息DTO
+ * @author sunhongfei01
+ * @since 2025-02-26
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+public class ViewModelAuthSecurityDto {
+ // 是否使用规则权限
+ private boolean permRule;
+ // 普通数据权限
+ private SecurityEntry authSecurityEntry;
+ // 规则权限
+ private SecurityEntry4RuleDTO permSecurityEntry;
+
+ /**
+ * 构造函数
+ * @param securityEntry 数据权限
+ * @param entry4RuleDTO 规则权限
+ */
+ public ViewModelAuthSecurityDto(SecurityEntry securityEntry, SecurityEntry4RuleDTO entry4RuleDTO) {
+ this.authSecurityEntry = securityEntry;
+ this.permSecurityEntry = entry4RuleDTO;
+ // 是否使用规则权限: 如果规则权限不为空,则使用规则权限
+ this.permRule = entry4RuleDTO != null;
+ }
+}
diff --git a/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelExtendDto.java b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelExtendDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..21f1eb0081d2b3a4f51107dc290545a521d79f06
--- /dev/null
+++ b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelExtendDto.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.formserver.vmapi.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 视图模型扩展信息DTO
+ * @author sunhongfei01
+ * @since 2025-02-26
+ */
+@Getter
+@Setter
+public class ViewModelExtendDto {
+ // 权限信息
+ private ViewModelAuthInfoDto authInfo;
+ // 帮助信息
+ private ViewModelHelpInfoDto helpInfo;
+}
+
diff --git a/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelHelpInfoDto.java b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelHelpInfoDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..d46fef04da6a69fef7c2bee1dbe293826994d2b9
--- /dev/null
+++ b/view-object-api/src/main/java/com/inspur/edp/formserver/vmapi/dto/ViewModelHelpInfoDto.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.formserver.vmapi.dto;
+
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+/**
+ * 视图模型帮助信息DTO
+ * @author sunhongfei01
+ * @since 2025-02-26
+ */
+@Getter
+@Setter
+public class ViewModelHelpInfoDto {
+ // 帮助权限集合
+ private List helpSecurityEntries;
+}
diff --git a/view-object-manager/pom.xml b/view-object-manager/pom.xml
index 7512825f65a5afd6901defe14f1d0b074bc650bb..d167808f5c5f36196745420aad4703d97710822a 100644
--- a/view-object-manager/pom.xml
+++ b/view-object-manager/pom.xml
@@ -27,6 +27,10 @@
view-object-manager
+
+ com.inspur.edp
+ view-object-api
+
com.inspur.edp
view-object-model
@@ -141,5 +145,10 @@
com.inspur.edp
lcm-mimic-api
+
+
+ io.iec.edp
+ caf-framework-securityentry-api
+
diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/BffMetadataEventListener.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/BffMetadataEventListener.java
index ff76e9550ad39696cd4ee8a15ab7f7664a9e57ce..e2b6befd349a59902c7178db219a456df8692d20 100644
--- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/BffMetadataEventListener.java
+++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/BffMetadataEventListener.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 com.inspur.edp.formserver.vmmanager;
@@ -22,7 +38,7 @@ public class BffMetadataEventListener implements MetadataEventListener {
return;
}
- GspViewModel vm = (GspViewModel) ((e.getMetadata().getContent() instanceof GspViewModel) ? e.getMetadata().getContent() : null);
+ GspViewModel vm = (GspViewModel) e.getMetadata().getContent();
//保存前校验
ViewModelValidator validator = new ViewModelValidator();
diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/config/VMManagerConfig.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/config/VMManagerConfig.java
index 459c637fe7a08e85227f06ea273072aca4a27fe2..569666e053d7acd352a406c4567ba066e7b0e960 100644
--- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/config/VMManagerConfig.java
+++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/config/VMManagerConfig.java
@@ -1,7 +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.formserver.vmmanager.config;
import com.inspur.edp.caf.cef.dt.spi.CommonStructureSchemaExtension;
+import com.inspur.edp.formserver.vmapi.ViewModelService;
import com.inspur.edp.formserver.vmmanager.commonstructure.VMComStructureSchemaExtension;
+import com.inspur.edp.formserver.vmmanager.service.ViewModelServiceImpl;
+import io.iec.edp.caf.securityentry.api.manager.SecurityEntryService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -12,5 +31,10 @@ public class VMManagerConfig {
return new VMComStructureSchemaExtension();
}
+ @Bean("com.inspur.edp.formserver.vmmanager.service.ViewModelServiceImpl")
+ public ViewModelService getViewModelService(SecurityEntryService securityEntryService) {
+ return new ViewModelServiceImpl(securityEntryService);
+ }
+
}
diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/exception/VoManagerErrorCodes.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/exception/VoManagerErrorCodes.java
index 42a9b9ddd2bcf18248bb0105505a1290936cb258..72e02027e0adddd425b30c205b96e5b5ee13d5c3 100644
--- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/exception/VoManagerErrorCodes.java
+++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/exception/VoManagerErrorCodes.java
@@ -129,4 +129,8 @@ public class VoManagerErrorCodes {
* 操作[{0}]在业务实体上无映射操作,业务实体自定义操作的ID=[{1}],请检查是否已删除。
*/
public static final String GSP_VIEWOBJECT_MANAGER_0110 = "GSP_VIEWOBJECT_MANAGER_0110";
+ /**
+ * 视图对象[{0}]保存失败
+ */
+ public static final String GSP_VIEWOBJECT_MANAGER_0111 = "GSP_VIEWOBJECT_MANAGER_0111";
}
diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/ViewModelServiceImpl.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/ViewModelServiceImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..649cdf46a2869c182df14a80efb394e9b17fce76
--- /dev/null
+++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/ViewModelServiceImpl.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2020 - present, Inspur Genersoft Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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.formserver.vmmanager.service;
+
+import com.inspur.edp.formserver.viewmodel.exception.ViewModelException;
+import com.inspur.edp.formserver.vmapi.ViewModelService;
+import com.inspur.edp.formserver.vmapi.dto.ViewModelAuthInfoDto;
+import com.inspur.edp.formserver.vmapi.dto.ViewModelAuthSecurityDto;
+import com.inspur.edp.formserver.vmapi.dto.ViewModelExtendDto;
+import com.inspur.edp.formserver.vmmanager.exception.VoManagerErrorCodes;
+import io.iec.edp.caf.commons.transaction.JpaTransaction;
+import io.iec.edp.caf.commons.utils.CollectionUtils;
+import io.iec.edp.caf.securityentry.api.common.AuthType;
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry;
+import io.iec.edp.caf.securityentry.api.data.SecurityEntry4RuleDTO;
+import io.iec.edp.caf.securityentry.api.manager.SecurityEntryService;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 视图对象服务实现类
+ */
+public class ViewModelServiceImpl implements ViewModelService {
+ // 功能权限extType
+ private static final String FUNC_SECURITY_EXTTYPE = "VM";
+ // 权限规则extType
+ private static final String PERMRULE_AUTH_SECURITY_EXTTYPE = "VMRule";
+ // 数据权限extType
+ private static final String AUTH_SECURITY_EXTTYPE = "VM";
+ // 权限服务
+ private final SecurityEntryService securityEntryService;
+
+ public ViewModelServiceImpl(SecurityEntryService securityEntryService) {
+ this.securityEntryService = securityEntryService;
+ }
+
+ /**
+ * 获取视图对象扩展信息(非元数据内容, 目前主要为权限信息)
+ *
+ * @param viewModelId 视图对象id
+ * @return 视图对象扩展信息
+ */
+ @Override
+ public ViewModelExtendDto getViewModelExtendInfo(String viewModelId) {
+ // 组织返回数据结构
+ ViewModelExtendDto viewModelExtendDto = new ViewModelExtendDto();
+ // 加载权限信息
+ viewModelExtendDto.setAuthInfo(this.loadViewModelAuthInfo(viewModelId));
+ return viewModelExtendDto;
+ }
+
+ /**
+ * 保存视图对象的扩展信息
+ *
+ * @param viewModelId 待保存的视图对象ID
+ * @param viewModelExtendInfo 待保存的扩展信息
+ * @param authIdsToDelete 需要删除的权限ID
+ */
+ @Override
+ public void saveViewModelExtendInfo(String viewModelId, ViewModelExtendDto viewModelExtendInfo,
+ Set authIdsToDelete) {
+ // 获取权限信息
+ ViewModelAuthInfoDto authInfo = viewModelExtendInfo.getAuthInfo();
+ JpaTransaction tran = JpaTransaction.getTransaction();
+ try {
+ // 事务开始
+ tran.begin();
+ // 保存功能权限
+ SecurityEntry funcSecurity = authInfo.getFuncSecurity();
+ // 若权限ID不为空且待删除的权限ID集合中包含当前权限ID时应将其移除不做保存
+ if (funcSecurity != null && (StringUtils.isBlank(funcSecurity.getId()) || !authIdsToDelete.contains(funcSecurity.getId()))) {
+ funcSecurity.setEx1(viewModelId);
+ funcSecurity.setExtType(FUNC_SECURITY_EXTTYPE);
+ securityEntryService.saveFuncSecurityEntry(funcSecurity);
+ }
+
+ // 保存数据权限信息
+ Map authSecurityMap = authInfo.getAuthSecurityMap();
+ if (!CollectionUtils.isEmpty(authSecurityMap)) {
+ for (ViewModelAuthSecurityDto value : authSecurityMap.values()) {
+ if (value == null) {
+ continue;
+ }
+ // 判断是否为权限规则
+ if (value.isPermRule()) {
+ // 保存权限规则
+ SecurityEntry4RuleDTO permSecurityEntry = value.getPermSecurityEntry();
+ // 若权限ID不为空且待删除的权限ID集合中包含当前权限ID时应将其移除不做保存
+ if (permSecurityEntry != null
+ && (StringUtils.isBlank(permSecurityEntry.getId())
+ || !authIdsToDelete.contains(permSecurityEntry.getId()))) {
+ permSecurityEntry.setEx1(viewModelId);
+ permSecurityEntry.setExtType(PERMRULE_AUTH_SECURITY_EXTTYPE);
+ securityEntryService.saveAuthRuleSecurityEntryDTO(permSecurityEntry);
+ }
+ } else {
+ // 保存数据权限
+ SecurityEntry authSecurityEntry = value.getAuthSecurityEntry();
+ // 若权限ID不为空且待删除的权限ID集合中包含当前权限ID时应将其移除不做保存
+ if (authSecurityEntry != null && (StringUtils.isBlank(authSecurityEntry.getId())
+ || !authIdsToDelete.contains(authSecurityEntry.getId()))) {
+ authSecurityEntry.setEx1(viewModelId);
+ authSecurityEntry.setExtType(AUTH_SECURITY_EXTTYPE);
+ securityEntryService.saveAuthSecurityEntry(authSecurityEntry);
+ }
+ }
+ }
+ }
+
+ // 删除权限
+ if (!CollectionUtils.isEmpty(authIdsToDelete)) {
+ for (String authId : authIdsToDelete) {
+ securityEntryService.deleteById(authId);
+ }
+ }
+
+ // 保存帮助信息
+ if (viewModelExtendInfo.getHelpInfo() != null
+ && !CollectionUtils.isEmpty(viewModelExtendInfo.getHelpInfo().getHelpSecurityEntries())) {
+ viewModelExtendInfo.getHelpInfo().getHelpSecurityEntries().forEach(securityEntryService::saveAuthSecurityEntry);
+ }
+ tran.commit();
+ } catch (Throwable t) {
+ tran.rollback();
+ throw new ViewModelException(VoManagerErrorCodes.GSP_VIEWOBJECT_MANAGER_0111, t, viewModelId);
+ }
+ }
+
+ @Override
+ public ViewModelAuthInfoDto loadViewModelAuthInfo(String viewModelId) {
+ ViewModelAuthInfoDto authInfo = new ViewModelAuthInfoDto();
+ // 组织视图对象的权限信息
+ SecurityEntry funcSecuritySelect = new SecurityEntry();
+
+ // 查询视图对象的功能权限
+ funcSecuritySelect.setEx1(viewModelId);
+ funcSecuritySelect.setExtType(FUNC_SECURITY_EXTTYPE);
+ funcSecuritySelect.setAuthType(AuthType.Func);
+ SecurityEntry funcSecurityEntry = securityEntryService.getFuncSecurityEntry(funcSecuritySelect);
+ authInfo.setFuncSecurity(funcSecurityEntry);
+
+ // 查询视图对象的数据权限
+ SecurityEntry4RuleDTO permAuthSecuritySelect = new SecurityEntry4RuleDTO();
+ permAuthSecuritySelect.setEx1(viewModelId);
+ permAuthSecuritySelect.setExtType(PERMRULE_AUTH_SECURITY_EXTTYPE);
+ SecurityEntry4RuleDTO permRuleSecurityEntry = securityEntryService.getAuthRuleSecurityEntryDTO(permAuthSecuritySelect);
+
+ SecurityEntry authSecuritySelect = new SecurityEntry();
+ authSecuritySelect.setEx1(viewModelId);
+ authSecuritySelect.setExtType(AUTH_SECURITY_EXTTYPE);
+ authSecuritySelect.setAuthType(AuthType.Auth);
+ SecurityEntry authSecurityEntry = securityEntryService.getAuthSecurityEntry(authSecuritySelect);
+ authInfo.addAuthSecurityEntry(viewModelId, authSecurityEntry, permRuleSecurityEntry);
+ return authInfo;
+ }
+}
diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/WebControllerService.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/WebControllerService.java
index cf157f87746abd7e6c0a11941837e58043b54ff9..b88e462156e464bcb94edef61ac5ddfdf5877753 100644
--- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/WebControllerService.java
+++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/service/WebControllerService.java
@@ -77,11 +77,7 @@ import java.util.regex.Pattern;
import static com.inspur.edp.formserver.viewmodel.common.ConvertUtils.toElement;
-;
-
public class WebControllerService {
- private String EXCEPTIONCODE = "WebControllerService";
-
public static WebControllerService getInstance() {
return new WebControllerService();
}
@@ -94,9 +90,7 @@ public class WebControllerService {
module.addSerializer(IGspCommonDataType.class, new BizObjectSerializer());
mapper.registerModule(module);
try {
-
- String objJson = mapper.writeValueAsString(bebject);
- return objJson;
+ return mapper.writeValueAsString(bebject);
} catch (JsonProcessingException e) {
throw new ViewModelException(VoManagerErrorCodes.GSP_VIEWOBJECT_MANAGER_0048, e);
}
@@ -105,14 +99,14 @@ public class WebControllerService {
/**
* 检查关键字
*
- * @param jsonObject
+ * @param jsonObject 视图对象Json结构
*/
public void checkKeywords(String jsonObject) {
if (jsonObject == null || jsonObject.isEmpty()) {
throw new ViewModelException(VoManagerErrorCodes.GSP_VIEWOBJECT_MANAGER_0049, null);
}
ObjectMapper mapper = new ObjectMapper();
- GspViewModel viewModel = null;
+ GspViewModel viewModel;
try {
viewModel = mapper.readValue(jsonObject, GspViewModel.class);
} catch (JsonProcessingException e) {
@@ -124,8 +118,8 @@ public class WebControllerService {
/**
* 获取虚拟vo关联
*
- * @param info
- * @return
+ * @param info 待获取关联信息结构
+ * @return 虚拟vo关联字段信息
*/
public String getVirtualVoAsso(String info, EntityFunction func) {
ObjectMapper mapper = new ObjectMapper();
@@ -230,11 +224,11 @@ public class WebControllerService {
throw new ViewModelException(VoManagerErrorCodes.GSP_VIEWOBJECT_MANAGER_0101,null);
} else {
// LabelID在表单和报表中用作XML的标签,要限制非法字符
- String regex = "\"^[A-Za-z_][A-Za-z_\\d-.]*$\"";
+ String regex = "^[A-Za-z_][A-Za-z_\\d-.]*$";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(voElementLabelId.trim());
boolean isMatch = matcher.matches();
- if (isMatch) {
+ if (!isMatch) {
throw new ViewModelException(VoManagerErrorCodes.GSP_VIEWOBJECT_MANAGER_0102,null);
}
}
diff --git a/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/dto/SaveViewModelDto.java b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/dto/SaveViewModelDto.java
new file mode 100644
index 0000000000000000000000000000000000000000..717065c7b88e39a66aa7a21be2ada55ea75f5eec
--- /dev/null
+++ b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/dto/SaveViewModelDto.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.formserver.viewmodel.dto;
+
+import com.inspur.edp.formserver.vmapi.dto.ViewModelExtendDto;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Set;
+
+/**
+ * 保存视图模型请求DTO
+ */
+@Getter
+@Setter
+public class SaveViewModelDto {
+ /**
+ * 视图模型ID
+ */
+ private String viewModelId;
+ /**
+ * 待保存的视图模型扩展信息
+ */
+ private ViewModelExtendDto viewModelExtendInfo;
+ /**
+ * 需要删除的权限ID集合
+ */
+ private Set authIdsToDelete;
+}
\ No newline at end of file
diff --git a/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/BffWebApiServiceConfig.java b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/BffWebApiServiceConfig.java
index 5cbe2604c3b9d9f42073d9d467c1120fd238c220..d4a4496db517a5e4cceca63ac2ef75297c48c9e8 100644
--- a/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/BffWebApiServiceConfig.java
+++ b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/BffWebApiServiceConfig.java
@@ -1,5 +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.formserver.viewmodel.webapi;
+import com.inspur.edp.formserver.vmapi.ViewModelService;
+import com.inspur.edp.lcm.metadata.api.service.FileService;
+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.RefCommonService;
import io.iec.edp.caf.rest.RESTEndpoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -7,8 +28,12 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class BffWebApiServiceConfig {
@Bean
- public ViewModelController getBffWebApi() {
- return new ViewModelController();
+ public ViewModelController getBffWebApi(MetadataService metadataService,
+ RefCommonService refCommonService,
+ MetadataProjectService metadataProjectService,
+ FileService fileService,
+ ViewModelService viewModelService) {
+ return new ViewModelController(metadataService, refCommonService, metadataProjectService, fileService, viewModelService);
}
@Bean
diff --git a/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/ViewModelController.java b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/ViewModelController.java
index ef030a4074807f8d72b6c15483f58b79da541e69..70d4319a21dc7e2711cee157ef63ccb1c5cbbb74 100644
--- a/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/ViewModelController.java
+++ b/view-object-webapi/src/main/java/com/inspur/edp/formserver/viewmodel/webapi/ViewModelController.java
@@ -53,6 +53,7 @@ import com.inspur.edp.formserver.viewmodel.common.MappingType;
import com.inspur.edp.formserver.viewmodel.common.mapping.GspVoElementMapping;
import com.inspur.edp.formserver.viewmodel.common.mapping.GspVoElementSourceType;
import com.inspur.edp.formserver.viewmodel.common.mapping.GspVoObjectSourceType;
+import com.inspur.edp.formserver.viewmodel.dto.SaveViewModelDto;
import com.inspur.edp.formserver.viewmodel.exception.ViewModelException;
import com.inspur.edp.formserver.viewmodel.i18n.VMI8nResourceUtil;
import com.inspur.edp.formserver.viewmodel.i18n.names.VoResourceKeyNames;
@@ -61,6 +62,8 @@ import com.inspur.edp.formserver.viewmodel.json.model.ViewModelDeserializer;
import com.inspur.edp.formserver.viewmodel.json.model.ViewModelSerializer;
import com.inspur.edp.formserver.viewmodel.json.operation.VmActionCollectionSerializer;
import com.inspur.edp.formserver.viewmodel.util.ViewModelUtils;
+import com.inspur.edp.formserver.vmapi.ViewModelService;
+import com.inspur.edp.formserver.vmapi.dto.ViewModelExtendDto;
import com.inspur.edp.formserver.vmmanager.compcodebutton.CompButton;
import com.inspur.edp.formserver.vmmanager.service.UpdateVariableWithUdtService;
import com.inspur.edp.formserver.vmmanager.service.UpdateVirtualVoElementWithUdtService;
@@ -78,10 +81,10 @@ import com.inspur.edp.lcm.metadata.api.service.MetadataService;
import com.inspur.edp.lcm.metadata.api.service.RefCommonService;
import com.inspur.edp.web.help.metadata.HelpMetadataContent;
import io.iec.edp.caf.commons.utils.CollectionUtils;
-import io.iec.edp.caf.commons.utils.SpringBeanUtils;
import lombok.var;
import javax.ws.rs.GET;
+import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -94,22 +97,41 @@ import java.util.List;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
+
import static com.inspur.edp.formserver.viewmodel.common.ConvertUtils.toElement;
import static com.inspur.edp.formserver.viewmodel.common.ConvertUtils.toObject;
@Path("")
@Produces(MediaType.APPLICATION_JSON)
public class ViewModelController {
-
- private final String EXCEPTIONCODE = "vmWebApi";
-
+ // 元数据服务
+ private final MetadataService metadataService;
+ // 元数据依赖服务
+ private final RefCommonService refCommonService;
+ // 元数据工程服务
+ private final MetadataProjectService metadataProjectService;
+ // 文件服务
+ private final FileService fileService;
+ // 元数据视图模型服务
+ private final ViewModelService viewModelService;
+
+ public ViewModelController(MetadataService metadataService,
+ RefCommonService refCommonService,
+ MetadataProjectService metadataProjectService,
+ FileService fileService,
+ ViewModelService viewModelService) {
+ this.metadataService = metadataService;
+ this.refCommonService = refCommonService;
+ this.metadataProjectService = metadataProjectService;
+ this.fileService = fileService;
+ this.viewModelService = viewModelService;
+ }
@Path("sysn")
@PUT
@Produces(MediaType.APPLICATION_JSON)
public void saveAndSysn(String metadataInfo) {
ObjectMapper mapper = getViewModelMapper();
- MetadataService service = SpringBeanUtils.getBean(MetadataService.class);
try {
JsonNode node = mapper.readTree(metadataInfo);
@@ -119,7 +141,7 @@ public class ViewModelController {
if (!CheckInfoUtil.checkNull(node.get("name"))) {
metadataName = node.get("name").textValue();
}
- GspMetadata metadata = service.loadMetadata(metadataName, path);
+ GspMetadata metadata = metadataService.loadMetadata(metadataName, path);
//生成构件元数据
ArrayList list = VmManagerService.generateComponent(metadata, path, true);
//构件代码模板
@@ -154,8 +176,7 @@ public class ViewModelController {
String metadataAssembly = node.get("metadataAssembly").textValue();
GspViewModel vm = InitVoUtil
.BuildVirtualVo(metadataID, metadataName, metadataCode, metadataAssembly);
- String vmJson = mapper.writeValueAsString(vm);
- return vmJson;
+ return mapper.writeValueAsString(vm);
} catch (Exception e) {
throw new ViewModelException(VoWebApiErrorCodes.GSP_VIEWOBJECT_WEBAPI_1002, e);
}
@@ -307,15 +328,14 @@ public class ViewModelController {
try {
JsonNode node = mapper.readTree(convertBeInfo);
String helperId = node.get("helperId").textValue();
- RefCommonService service = SpringBeanUtils.getBean(RefCommonService.class);
MetadataURI targetHelpURI = new MetadataURI();
targetHelpURI.setId(helperId);
- GspMetadata helpMetadata = service.getRefMetadata(targetHelpURI, null, "");
+ GspMetadata helpMetadata = refCommonService.getRefMetadata(targetHelpURI, null, "");
HelpMetadataContent helpMetadataContent = (HelpMetadataContent) helpMetadata.getContent();
String voId = helpMetadataContent.getDataSource().getVoSourceId();
MetadataURI targetVOURI = new MetadataURI();
targetVOURI.setId(voId);
- GspMetadata refVOMetadata = service.getRefMetadata(targetVOURI, null, "");
+ GspMetadata refVOMetadata = refCommonService.getRefMetadata(targetVOURI, null, "");
GspViewModel helpVo = (GspViewModel) refVOMetadata.getContent();
if (helpVo == null) {
throw new ViewModelException(VoWebApiErrorCodes.GSP_VIEWOBJECT_WEBAPI_1010, null,
@@ -661,7 +681,7 @@ public class ViewModelController {
if (ViewModelUtils.checkNull(beId)) {
throw new ViewModelException(VoWebApiErrorCodes.GSP_VIEWOBJECT_WEBAPI_1024, null);
}
- GspMetadata metadata = SpringBeanUtils.getBean(RefCommonService.class).getRefMetadata(beId);
+ GspMetadata metadata = refCommonService.getRefMetadata(beId);
if (!(metadata.getContent() instanceof GspBusinessEntity)) {
throw new ViewModelException(VoWebApiErrorCodes.GSP_VIEWOBJECT_WEBAPI_1025, null, beId);
}
@@ -684,11 +704,11 @@ public class ViewModelController {
String action = info.get("actionCode").textValue();
ArrayList actionList = new ArrayList<>();
actionList.add(action);
- GspMetadata metadata = SpringBeanUtils.getBean(MetadataService.class).loadMetadataByMetadataId(id, projectpath);
+ GspMetadata metadata = metadataService.loadMetadataByMetadataId(id, projectpath);
GspViewModel vo = (GspViewModel) metadata.getContent();
String relativePath = metadata.getRelativePath();
- GspProject metadataProj = SpringBeanUtils.getBean(MetadataService.class).getGspProjectInfo(relativePath);
+ GspProject metadataProj = metadataService.getGspProjectInfo(relativePath);
String compAssemblyName = metadataProj.getProjectNameSpace();
CompButton button = new CompButton();
@@ -717,10 +737,10 @@ public class ViewModelController {
String action = info.get("actionCode").textValue();
ArrayList actionList = new ArrayList<>();
actionList.add(action);
- GspMetadata metadata = SpringBeanUtils.getBean(MetadataService.class).loadMetadataByMetadataId(id, projectpath);
+ GspMetadata metadata = metadataService.loadMetadataByMetadataId(id, projectpath);
GspViewModel vo = (GspViewModel) metadata.getContent();
String relativePath = metadata.getRelativePath();
- GspProject metadataProj = SpringBeanUtils.getBean(MetadataService.class).getGspProjectInfo(relativePath);
+ GspProject metadataProj = metadataService.getGspProjectInfo(relativePath);
String compAssemblyName = metadataProj.getProjectNameSpace();
CompButton button = new CompButton();
@@ -746,8 +766,7 @@ public class ViewModelController {
}
String path = info.get("path").textValue();
String metadataFileName = info.get("metadataFileName").textValue();
- MetadataService service = SpringBeanUtils.getBean(com.inspur.edp.lcm.metadata.api.service.MetadataService.class);
- return service.isMetadataExist(path, metadataFileName);
+ return metadataService.isMetadataExist(path, metadataFileName);
}
private void isMetadataCodeExist(JsonNode info) {
@@ -757,15 +776,14 @@ public class ViewModelController {
String metadataName = info.get("name").textValue();
String projectPath = info.get("path").textValue();
- GspMetadata metadata = SpringBeanUtils.getBean(MetadataService.class).loadMetadata(metadataName, projectPath);
+ GspMetadata metadata = metadataService.loadMetadata(metadataName, projectPath);
GspViewModel vo = (GspViewModel) metadata.getContent();
List checkInfo = new ArrayList<>();
CompButton button = new CompButton();
button.getNewActions(vo, checkInfo);
String relativePath = metadata.getRelativePath();
- MetadataProjectService service = SpringBeanUtils.getBean(MetadataProjectService.class);
- String compModulePath = service.getJavaCompProjectPath(relativePath);
- GspProject metadataProj = SpringBeanUtils.getBean(MetadataService.class).getGspProjectInfo(relativePath);
+ String compModulePath = metadataProjectService.getJavaCompProjectPath(relativePath);
+ GspProject metadataProj = metadataService.getGspProjectInfo(relativePath);
String compAssemblyName = metadataProj.getProjectNameSpace();
if (checkInfo.size() <= 0) {
return;
@@ -777,8 +795,7 @@ public class ViewModelController {
String filePath = button.getFilePath(vo, checkComUtil, compModulePath, compAssemblyName);
filePath.replaceAll("\\\\", Matcher.quoteReplacement(File.separator));
filePath.replaceAll("/", Matcher.quoteReplacement(File.separator));
- FileService fsService = SpringBeanUtils.getBean(FileService.class);
- if (fsService.isFileExist(filePath)) {
+ if (fileService.isFileExist(filePath)) {
String fileName = "";
if (!"VarDeterminations".equals(checkComUtil.getType())) {
fileName = checkComUtil.getAction() + "VOAction.java";
@@ -789,4 +806,20 @@ public class ViewModelController {
}
}
}
+
+ @Path("loadViewModel")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public ViewModelExtendDto loadViewModel(@QueryParam(value = "viewModelId")String viewModelId) {
+ return viewModelService.getViewModelExtendInfo(viewModelId);
+ }
+ @Path("saveViewModel")
+ @POST
+ @Produces(MediaType.APPLICATION_JSON)
+ public void saveViewModel(SaveViewModelDto saveViewModelAuthInfo) {
+ viewModelService.saveViewModelExtendInfo(
+ saveViewModelAuthInfo.getViewModelId(),
+ saveViewModelAuthInfo.getViewModelExtendInfo(),
+ saveViewModelAuthInfo.getAuthIdsToDelete());
+ }
}