From ac0e7c9b6ff79273c2a130686365f3f41157e4ef Mon Sep 17 00:00:00 2001 From: liuyuxin01 Date: Thu, 14 Nov 2024 09:46:38 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=AE=A1=E7=90=86=E5=99=A8=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=A1=A5=E5=85=85properties=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../edp/lcm/metadata/core/MetadataCoreManager.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index 09e1f4c..bb2423f 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -36,6 +36,7 @@ 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.MetadataProperties; 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.OperationEnum; @@ -71,6 +72,7 @@ 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.MetadataRTService; import com.inspur.edp.lcm.metadata.api.service.RefCommonService; +import com.inspur.edp.lcm.metadata.common.SerializerUtils; import com.inspur.edp.lcm.metadata.common.context.RuntimeContext; import com.inspur.edp.metadata.rtcustomization.api.entity.Metadata4RefPageQueryParam; import com.inspur.edp.metadata.rtcustomization.api.entity.Metadata4RefPageQueryResult; @@ -671,6 +673,7 @@ public class MetadataCoreManager { String cacheMetadataNameKey = mdRelativePath + ".metadataName_"+currentLanguage; String cacheMetadataIdKey = mdRelativePath + ".metadataId"; String cacheMetadataCodeKey = mdRelativePath + ".metadataCode"; + String cacheMetadataPropertiesKey = mdRelativePath + ".metadataProperties"; // 缓存文件key集合中移除 deletedPropKeySet.remove(cacheLastChangeOnKey); deletedPropKeySet.remove(cacheMetadataNameKey); @@ -691,14 +694,18 @@ public class MetadataCoreManager { String metadataNameProperty = properties.getProperty(cacheMetadataNameKey); String metadataIdProperty = properties.getProperty(cacheMetadataIdKey); String metadataCodeProperty = properties.getProperty(cacheMetadataCodeKey); + String metadataProperties = properties.getProperty(cacheMetadataPropertiesKey); // 若文件更新时间未发生改变且 缓存中存在元数据名称(防止数据缺失),则使用缓存中的元数据名称 if (fileLastModify.equals(lastChangeOn) && !StringUtils.isEmpty(metadataNameProperty) && !StringUtils.isEmpty(metadataIdProperty) - && !StringUtils.isEmpty(metadataCodeProperty)) { + && !StringUtils.isEmpty(metadataCodeProperty)){ metadataDto.setName(metadataNameProperty); metadataDto.setId(metadataIdProperty); metadataDto.setCode(metadataCodeProperty); + if (StringUtils.hasText(metadataProperties)) { + metadataDto.setProperties(SerializerUtils.deserialize(metadataProperties, MetadataProperties.class)); + } } else { if (".dbo".equals(extension)) { AbstractDatabaseObject databaseObject = databaseObjectService.getDatabaseObject(metadataPath); @@ -711,6 +718,7 @@ public class MetadataCoreManager { metadataDto.setName(metadataWithoutContent.getHeader().getName()); metadataDto.setId(metadataWithoutContent.getHeader().getId()); metadataDto.setCode(metadataWithoutContent.getHeader().getCode()); + metadataDto.setProperties(metadataWithoutContent.getProperties()); } // 标识缓存文件需要更新 @@ -721,6 +729,9 @@ public class MetadataCoreManager { properties.setProperty(cacheMetadataNameKey, metadataDto.getName()); properties.setProperty(cacheMetadataIdKey, metadataDto.getId()); properties.setProperty(cacheMetadataCodeKey, metadataDto.getCode()); + if(metadataDto.getProperties() != null){ + properties.setProperty(cacheMetadataPropertiesKey, SerializerUtils.serialize(metadataDto.getProperties())); + } } // 若存在元数据名称过滤条件, 则判断是否符合 -- Gitee From d15ef9de81fdd37e1d99af663d1673dc57da7a62 Mon Sep 17 00:00:00 2001 From: liuyuxin01 Date: Thu, 14 Nov 2024 14:21:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9C=80=E8=BF=91=E6=89=93=E5=BC=80?= =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A1=A5=E5=85=85properties=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lcm/metadata/core/MdRecentOpService.java | 9 ++- .../core/domain/GspMdRecentOpDto.java | 67 +++++++++++++++++++ .../webapi/MetadataServiceWebApi.java | 6 +- 3 files changed, 78 insertions(+), 4 deletions(-) create mode 100644 metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/domain/GspMdRecentOpDto.java diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MdRecentOpService.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MdRecentOpService.java index 28d517b..257f412 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MdRecentOpService.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MdRecentOpService.java @@ -22,6 +22,7 @@ import com.inspur.edp.lcm.metadata.common.Utils; import com.inspur.edp.lcm.metadata.common.configuration.MetadataServiceHelper; import com.inspur.edp.lcm.metadata.core.dao.MdRecentOpDao; import com.inspur.edp.lcm.metadata.core.domain.GspMdRecentOp; +import com.inspur.edp.lcm.metadata.core.domain.GspMdRecentOpDto; import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; import com.inspur.edp.lcm.metadata.inner.api.WsService; import com.inspur.edp.lcm.metadata.inner.api.utils.WsUtils; @@ -112,7 +113,7 @@ public class MdRecentOpService { * @param boId 业务对象id * @return */ - public List getRecnetMdOp(String boId) { + public List getRecnetMdOp(String boId) { if (Objects.isNull(boId)) { return null; } @@ -132,7 +133,11 @@ public class MdRecentOpService { //根据可新建的元数据类型过滤 List typeList = loadShowMdRecentOpTypeList(); - return gspMdRecentOpList.stream().filter(opInfo -> typeList.contains(opInfo.getMdPath().substring(opInfo.getMdPath().lastIndexOf(".")))).sorted(Comparator.comparing(GspMdRecentOp::getLastModifiedTime).reversed()).collect(Collectors.toList()); + List mdRecentOpDtoList = gspMdRecentOpList.stream().filter(opInfo -> typeList.contains(opInfo.getMdPath().substring(opInfo.getMdPath().lastIndexOf(".")))) + .sorted(Comparator.comparing(GspMdRecentOp::getLastModifiedTime).reversed()) + .map(gspMdRecentOp -> new GspMdRecentOpDto(gspMdRecentOp)) + .collect(Collectors.toList()); + return mdRecentOpDtoList; } /** diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/domain/GspMdRecentOpDto.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/domain/GspMdRecentOpDto.java new file mode 100644 index 0000000..2d4d453 --- /dev/null +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/domain/GspMdRecentOpDto.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.domain; + +import com.inspur.edp.lcm.metadata.api.entity.MetadataProperties; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.time.LocalDateTime; + +/** + * 记录用户最近打开元数据操作 + */ +@Data +public class GspMdRecentOpDto { + private String id; + // 用户id + private String userId; + // 工作空间id + private String wsId; + // 业务对象id + private String boID; + // 元数据全路径 + private String mdPath; + // 元数据编号 + private String mdCode; + // 元数据名称 + private String mdName; + private LocalDateTime createdTime; + private LocalDateTime lastModifiedTime; + /** + * 元数据属性 + */ + private MetadataProperties properties; + + public GspMdRecentOpDto() { + } + public GspMdRecentOpDto(GspMdRecentOp gspMdRecentOp) { + this.id = gspMdRecentOp.getId(); + this.userId = gspMdRecentOp.getUserId(); + this.wsId = gspMdRecentOp.getWsId(); + this.boID = gspMdRecentOp.getBoID(); + this.mdPath = gspMdRecentOp.getMdPath(); + this.mdCode = gspMdRecentOp.getMdCode(); + this.mdName = gspMdRecentOp.getMdName(); + this.createdTime = gspMdRecentOp.getCreatedTime(); + this.lastModifiedTime = gspMdRecentOp.getLastModifiedTime(); + } + +} diff --git a/metadata-service-dev-webapi/src/main/java/com/inspur/edp/lcm/metadata/webapi/MetadataServiceWebApi.java b/metadata-service-dev-webapi/src/main/java/com/inspur/edp/lcm/metadata/webapi/MetadataServiceWebApi.java index 3f1ddbc..c7d77df 100644 --- a/metadata-service-dev-webapi/src/main/java/com/inspur/edp/lcm/metadata/webapi/MetadataServiceWebApi.java +++ b/metadata-service-dev-webapi/src/main/java/com/inspur/edp/lcm/metadata/webapi/MetadataServiceWebApi.java @@ -47,6 +47,7 @@ import com.inspur.edp.lcm.metadata.common.util.ClassifierUtils; import com.inspur.edp.lcm.metadata.core.MdRecentOpService; import com.inspur.edp.lcm.metadata.core.MetadataProjectCoreService; import com.inspur.edp.lcm.metadata.core.domain.GspMdRecentOp; +import com.inspur.edp.lcm.metadata.core.domain.GspMdRecentOpDto; import com.inspur.edp.lcm.metadata.core.thread.BoGraphThreadLocalHolder; import com.inspur.edp.lcm.metadata.devcommon.ManagerUtils; import com.inspur.edp.lcm.metadata.spi.MdExtendRuleSerializer; @@ -292,8 +293,8 @@ public class MetadataServiceWebApi { @GET @Path("/mdrecentop") - public List getRecnetMdOp(@QueryParam(value = "boId") String boId, @DefaultValue("")@QueryParam(value = "path") String path) { - List recnetMdOpList = getMdRecentOpService().getRecnetMdOp(boId); + public List getRecnetMdOp(@QueryParam(value = "boId") String boId, @DefaultValue("")@QueryParam(value = "path") String path) { + List recnetMdOpList = getMdRecentOpService().getRecnetMdOp(boId); if(!CollectionUtils.isEmpty(recnetMdOpList) && StringUtils.hasText(path)){ List metadataListInBoForIDE = getMetadataService().getMetadataListInBoForIDE(path, null, null); if(!CollectionUtils.isEmpty(metadataListInBoForIDE)){ @@ -301,6 +302,7 @@ public class MetadataServiceWebApi { metadataListInBoForIDE.forEach(metadataDto -> { if(metadataDto.getRelativePath().equals(recnetMdOp.getMdPath())){ recnetMdOp.setMdName(metadataDto.getName()); + recnetMdOp.setProperties(metadataDto.getProperties()); return; } }); -- Gitee From ccbaaa8fed3b4ab5b4c4edd930ef347b610823f0 Mon Sep 17 00:00:00 2001 From: liuyuxin01 Date: Thu, 14 Nov 2024 19:26:44 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=85=83=E6=95=B0=E6=8D=AE=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=AE=A1=E7=90=86=E5=99=A8=E4=B8=8D=E8=BF=94=E5=9B=9E?= =?UTF-8?q?properties=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index bb2423f..abc66a2 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -679,6 +679,7 @@ public class MetadataCoreManager { deletedPropKeySet.remove(cacheMetadataNameKey); deletedPropKeySet.remove(cacheMetadataIdKey); deletedPropKeySet.remove(cacheMetadataCodeKey); + deletedPropKeySet.remove(cacheMetadataPropertiesKey); // 获取缓存中的 元数据更新时间 和元数据文件的更新时间 String lastChangeOn = properties.getProperty(cacheLastChangeOnKey); -- Gitee From d02b505bbf82ae13f2252934527c352b9ace3fca Mon Sep 17 00:00:00 2001 From: liuyuxin01 Date: Thu, 23 Jan 2025 18:15:18 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=A8=E6=89=BE=E4=B8=8D=E5=88=B0=E5=85=83?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E6=97=B6=E5=80=99=E6=8D=95=E8=8E=B7?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index c37f582..ae03559 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -1404,7 +1404,7 @@ public class MetadataCoreManager { metadata4Ref.getMetadata().setRelativePath(null); } } - } catch (Exception e) { + } catch (Throwable e) { invalidList.add(mdop); } if(Objects.nonNull(metadata4Ref)) { -- Gitee From e0d99e0b2180061078354ad2ed2d36a0b36c78fa Mon Sep 17 00:00:00 2001 From: liuyuxin01 Date: Mon, 10 Feb 2025 14:29:20 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9C=80=E8=BF=91=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=9C=A8=E6=89=BE=E4=B8=8D=E5=88=B0=E5=85=83?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=97=B6=E6=8D=95=E8=8E=B7=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java index ae03559..c37f582 100644 --- a/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java +++ b/metadata-service-dev-core/src/main/java/com/inspur/edp/lcm/metadata/core/MetadataCoreManager.java @@ -1404,7 +1404,7 @@ public class MetadataCoreManager { metadata4Ref.getMetadata().setRelativePath(null); } } - } catch (Throwable e) { + } catch (Exception e) { invalidList.add(mdop); } if(Objects.nonNull(metadata4Ref)) { -- Gitee