diff --git a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java index 92666de1db51167a211672db72de3adc7a51b61e..7c0523dadef6de45d03f44b57516f4f530513a0c 100644 --- a/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.java +++ b/view-object-manager/src/main/java/com/inspur/edp/formserver/vmmanager/validate/ViewModelValidator.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.validate; import com.inspur.edp.bef.bizentity.GspBizEntityElement; @@ -23,7 +39,11 @@ import com.inspur.edp.das.commonmodel.entity.object.GspCommonObjectType; import com.inspur.edp.formserver.viewmodel.GspViewModel; import com.inspur.edp.formserver.viewmodel.GspViewModelElement; import com.inspur.edp.formserver.viewmodel.GspViewObject; -import com.inspur.edp.formserver.viewmodel.action.*; +import com.inspur.edp.formserver.viewmodel.action.IViewModelParameter; +import com.inspur.edp.formserver.viewmodel.action.MappedCdpAction; +import com.inspur.edp.formserver.viewmodel.action.MappedCdpActionBase; +import com.inspur.edp.formserver.viewmodel.action.ViewModelAction; +import com.inspur.edp.formserver.viewmodel.action.ViewModelActionType; import com.inspur.edp.formserver.viewmodel.action.viewmodelbase.ViewModelReturnValue; import com.inspur.edp.formserver.viewmodel.collection.VMActionCollection; import com.inspur.edp.formserver.viewmodel.collection.ValueHelpConfigCollection; @@ -295,7 +315,8 @@ public class ViewModelValidator { if (allElementList != null && allElementList.size() > 0) { //字段[编号][名称][标签]不允许为空 for (IGspCommonElement element : allElementList) { - String errorMessagePrefix = VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_PREFIX, aObject.getName(), element.getName()); + String errorMessagePrefix = VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_PREFIX, + aObject.getName(), element.getName()); validateElementBasicInfo(element, sb, errorMessagePrefix); } @@ -505,7 +526,7 @@ public class ViewModelValidator { } } if (!isValidate) { - sb.append(VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_DEFAULT_DATATYPE_NOT_FIT)) + sb.append(VMI8nResourceUtil.getMessage(VoResourceKeyNames.VALIDATE_ELEMENT_DEFAULT_DATATYPE_NOT_FIT, errorMessage)) .append("\n"); } return sb.toString(); @@ -638,7 +659,7 @@ public class ViewModelValidator { sb.append("\n"); return sb.toString(); } - ICompParameterCollection compParameterCollection = null; + ICompParameterCollection compParameterCollection; if (metadata.getContent() instanceof VMComponent) { VMComponent component = (VMComponent) metadata.getContent(); compParameterCollection = component.getMethod().getCompParameterCollection(); diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java index e973e4135f8664e91cf09e9c303a567434fb5879..037077763d89122043347164bfb3678c382b6ddf 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/VMI8nResourceUtil.java @@ -1,8 +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.i18n; import com.inspur.edp.formserver.viewmodel.i18n.names.VoResourceKeyNames; import io.iec.edp.caf.commons.utils.SpringBeanUtils; +import io.iec.edp.caf.commons.utils.StringUtils; import io.iec.edp.caf.i18n.api.ResourceLocalizer; + import java.text.MessageFormat; public class VMI8nResourceUtil { @@ -27,6 +45,9 @@ public class VMI8nResourceUtil { public static String getMessage(String msgCode, Object... messageParams) { // 获取资源文件中对应消息编码的文本内容 String message = getResourceValue(msgCode); + if (StringUtils.isEmpty(message)) { + return msgCode; + } // 如果消息参数为空,则直接返回消息编码 if (messageParams == null || messageParams.length < 1) { return message; diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java index 79c064082649c70f31a7fbc0f208b0c835073773..a193f7f8d518c641afbd9d87d521ba20bc070e72 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/i18n/names/VoResourceKeyNames.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.viewmodel.i18n.names; import lombok.Getter; @@ -595,9 +611,8 @@ public enum VoResourceKeyNames { @Getter private final String errorCode; - + private final static String PREFIX = "GSP_VIEWOBJECT_MSGTEMP_"; VoResourceKeyNames() { - String prefix = ""; - this.errorCode = prefix + this.name(); + this.errorCode = PREFIX + this.name(); } }