diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/createvmmetadata/MappedCdpActionComponentGenerator.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/createvmmetadata/MappedCdpActionComponentGenerator.java index 1984177a5f6158ebf25a712472bcfb192d66041e..38ab1feca2e12d4efebd8e6b6be3f75d3fb0488c 100644 --- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/createvmmetadata/MappedCdpActionComponentGenerator.java +++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/createvmmetadata/MappedCdpActionComponentGenerator.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.createvmmetadata; @@ -22,16 +38,12 @@ import com.inspur.edp.formserver.vmmanager.exception.VoManagerErrorCodes; import com.inspur.edp.formserver.vmmanager.generatacmpcode.JavaCompCodeNames; 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.service.GspProjectService; import com.inspur.edp.lcm.metadata.api.service.MetadataService; import io.iec.edp.caf.commons.utils.SpringBeanUtils; import org.apache.commons.lang3.StringUtils; import java.util.Iterator; - -import java.io.IOException; - public class MappedCdpActionComponentGenerator { /** * 业务实体编号 @@ -96,17 +108,9 @@ public class MappedCdpActionComponentGenerator { */ private String getPackagePrefix(String relativePath) { DataValidator.checkForEmptyString(relativePath,"relativePath"); - - GspProjectService gspProjectService = SpringBeanUtils.getBean(GspProjectService.class); - try { - GspProject gspProject = gspProjectService.getGspProjectInfo(relativePath); - if (gspProject == null) { - throw new NullPointerException("GspProject is null"); - } - return gspProject.getPackagePrefix(); - } catch (IOException e) { - throw new RuntimeException(e); - } + GspProject gspProject = SpringBeanUtils.getBean(MetadataService.class).getGspProjectInfo(relativePath); + DataValidator.checkForNullReference(gspProject, "gspProject"); + return gspProject.getPackagePrefix(); } /**