From 2ba78de5713acc2e457c585ee00cc5a1438e503c Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Mon, 10 Oct 2022 14:50:33 +0800 Subject: [PATCH 1/3] =?UTF-8?q?style:=20=E8=A7=86=E5=9B=BE=E5=AF=B9?= =?UTF-8?q?=E8=B1=A1=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去除冗余代码,优化代码格式。 --- .../formserver/viewmodel/GspViewObject.java | 36 ++++++------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewObject.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewObject.java index 423e948..668de8a 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewObject.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewObject.java @@ -216,15 +216,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { */ @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((GspViewObject) obj); } @@ -237,9 +228,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { * 如果当前对象等于 other 参数,则为 true;否则为 false。 */ protected boolean equals(GspViewObject other) { - //&& this.HasAssociation == other.HasAssociation - //&& Object.Equals(this.Mapping, other.Mapping) - //&& Object.Equals(Association, other.Association) if (getID() == other.getID() && getCode() == other.getCode() && getName() == other.getName() && getIsReadOnly() == other.getIsReadOnly() && isRootNode() == other.isRootNode() && getPrimaryKey().equals(other.getPrimaryKey()) && hasChildNode() == other.hasChildNode() && getContainElements().equals(other.getContainElements()) && getContainChildObjects().equals(other.getContainChildObjects())) { if ((getParent() == null && other.getParent() == null) || (getParent() != null && other.getParent() != null && getParent().getID() == other.getParent().getID())) { return true; @@ -283,8 +271,6 @@ public class GspViewObject extends GspCommonObject implements Serializable { if (node == null) { throw new RuntimeException("克隆GSPViewObject失败"); } - //if (Parent != null) - // node.Parent = Parent.Clone() as GspViewObject; if (getContainChildObjects() != null) { Object tempVar2 = getContainChildObjects().clone(); node.setContainChildObjects((ViewObjectCollection) ((tempVar2 instanceof ViewObjectCollection) ? tempVar2 : null)); @@ -302,12 +288,8 @@ public class GspViewObject extends GspCommonObject implements Serializable { } } - //if (Association != null) - //{ - // node.Association = Association.Clone() as IVOAssociation; - //} - if (mapping != null){ - var map = mapping.clone() ; + if (mapping != null) { + var map = mapping.clone(); node.setMapping((GspVoObjectMapping) ((map instanceof GspVoObjectMapping) ? map : null)); } @@ -359,29 +341,33 @@ public class GspViewObject extends GspCommonObject implements Serializable { final String suffix = "View"; ClassInfo baseClassInfo = super.getGeneratedEntityClassInfo(); return new ClassInfo(baseClassInfo.getAssemblyInfo(), baseClassInfo.getClassName() + suffix, - baseClassInfo.getClassNamespace()); + baseClassInfo.getClassNamespace()); } /** * 排序条件` */ private String orderbyCondition; + public String getOrderbyCondition() { return orderbyCondition; } public void setOrderbyCondition(String value) { - orderbyCondition=value; + orderbyCondition = value; } + /** * 过滤条件 */ private String filterCondition; - public String getFilterCondition(){ + + public String getFilterCondition() { return filterCondition; } - public void setFilterCondition(String value){ - filterCondition=value; + + public void setFilterCondition(String value) { + filterCondition = value; } } -- Gitee From 857b6fbe90c38b20d9fb7e5f7e87dc934d681600 Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Mon, 10 Oct 2022 15:00:40 +0800 Subject: [PATCH 2/3] =?UTF-8?q?style:=20=E8=A7=86=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去除冗余代码,优化代码格式。 --- .../formserver/viewmodel/GspViewModel.java | 1210 +++++------------ 1 file changed, 360 insertions(+), 850 deletions(-) diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModel.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModel.java index 3c2fe40..6acbcb1 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModel.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModel.java @@ -51,857 +51,367 @@ import java.util.function.Predicate; @JsonDeserialize(using = ViewModelDeserializer.class) @JsonSerialize(using = ViewModelSerializer.class) public class GspViewModel extends GspCommonModel implements IMetadataContent, Cloneable { - ///#region 属性 - - /** - * 启用标准日期时间格式 - * - */ - private Boolean enableStdTimeFormat = true; - - 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 - - private String source; - - public String getSource() { - return source; - } - - public void setSource(String value) { - this.source = value; - } + ///#region 属性 + /** + * 启用标准日期时间格式 + * + */ + private Boolean enableStdTimeFormat = true; + + 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 + + private String source; + + public String getSource() { + return source; + } + + public void setSource(String value) { + this.source = value; + } private boolean isGenFilterConvertor = true; - public boolean getIsGenFilterConvertor(){ - return this.isGenFilterConvertor; - } - public void setIsGenFilterConvertor(boolean value){ - this.isGenFilterConvertor=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. - * - * @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)); - } - if (getValueHelpConfigs() != null) { - Object valueHelpConfigs = getValueHelpConfigs().clone(); - vo.setValueHelpConfigs((ValueHelpConfigCollection)((valueHelpConfigs instanceof ValueHelpConfigCollection) ? valueHelpConfigs : 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; -// } - - -// return GetNodes(node => node.Code.equals(viewObjectCode, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); - - - /** - * 查询符合条件的节点 - *

- * // @param predict - * - * @return - * - */ - -// 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 java.util.List GetNodes(HashMap predict) -// { -// if (predict != null)解决方式和gspviewmodel中的一样 -// { -// return GetAllObjectList().Select(item => (GspViewObject)((item instanceof GspViewObject) ? item : null)).Where(predict).ToList(); -// } -// return GetAllObjectList().Select(item => (GspViewObject)((item instanceof GspViewObject) ? item : null)).ToList(); -// } - - /** - * 查询当前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); - - } -// return GetNodes(null).ToDictionary(item => item.Code, item => item); - return toDic; - - } - - ///#endregion - - ///#region 联动-弃用 - /** - * 与业务实体建立连接 - *

- * // @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)); -// java.util.HashMap viewElements = getAllElementList(true).ToDictionary(item => item.getID(), -// item => (GspViewModelElement)((item instanceof GspViewModelElement) ? item : null)); -// java.util.HashMap elementMappings = new java.util.HashMap(); -//// java.util.ArrayList elementList = GetAllElementList(true); -// java.util.ArrayList elementList = getAllElementList(true); -// for (IGspCommonElement item : elementList) -// { -//// if (item instanceof GspViewModelElement && ((GspViewModelElement)item)?.Mapping != null) -// if (item instanceof GspViewModelElement && ((GspViewModelElement)item).getMapping() != null) -// { -//// var key = ((GspViewModelElement)((item instanceof GspViewModelElement) ? item : null)).getMapping().TargetObjId; -// String key = -// ((GspViewModelElement)((item instanceof GspViewModelElement) ? item : null)).getMapping().getTargetObjectId(); -// String value = item.getID(); -// elementMappings.put(key, value); -// } -// } -// //Dictionary elementMappings = -// //this.GetAllElementList(true) -// // .ToDictionary(item => (item as GspViewModelElement).Mapping.TargetObjId, item => item.ID); -//// java.util.HashMap bizEntityObjects = bizEntity.GetAllObjectList().ToDictionary(item => item.ID, item => (GSPBizEntityObject)((item instanceof GSPBizEntityObject) ? item : null)); -// java.util.HashMap bizEntityObjects = -// bizEntity.getAllObjectList().todictory(item.getID(), -// (GspBizEntityObject)((item instanceof GspBizEntityObject) ? item : null)); -//// item => (GSPBizEntityObject)((item instanceof GSPBizEntityObject) ? item : null)); -//// java.util.HashMap bizEntityElements = bizEntity.GetAllElementList(true).ToDictionary(item => item.ID, item => (GSPBizEntityElement)((item instanceof GSPBizEntityElement) ? item : null)); -// java.util.HashMap bizEntityElements = -// bizEntity.getAllElementList(true).todictionary(item => item.ID, item => (GspBizEntityElement)((item instanceof GspBizEntityElement) ? item : null)); -// -// //BizEntitySerializer serializer = new BizEntitySerializer(); -// //string xmlBizContent = serializer.Serialize(bizEntity); -// //ViewModelParser parser = new ViewModelParser(); -// //GspViewModel transViewModel = parser.Parse(xmlBizContent) as GspViewModel; -//// 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); -// if (viewObjects == null) -// { -// throw new RuntimeException("#GSPBefError#实体上没有对象,请联系管理员检查数据#GSPBefError#"); -// } -// for (GspViewObject objectItem : viewObjects) -// { -// if (objectItem.getMapping() == null || !bizEntityObjects.containsKey(objectItem.getMapping().getTargetObjId())) -// { -// continue; -// } -//// GSPBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); -// GspBizEntityObject beObject = bizEntityObjects.get(objectItem.getMapping().getTargetObjId()); -// -// ///#region 分级信息 -//// if (beObject.HirarchyInfo != null) -//// { -//// objectItem.HirarchyInfo = beObject.HirarchyInfo; -//// if (beObject.HirarchyInfo.IsDetailElement != null) -//// { -//// if (elementMappings.containsKey(beObject.HirarchyInfo.IsDetailElement.ID)) -//// { -//// String detailElementId = elementMappings.get(beObject.HirarchyInfo.IsDetailElement.ID); -//// objectItem.HirarchyInfo.IsDetailElement = viewElements.get(detailElementId); -//// } -//// else -//// { -//// GspViewModelElement transElement = getTransElement(transViewModel, beObject.HirarchyInfo.IsDetailElement, bizEntity.ID); -//// objectItem.getContainElements().Add(transElement); -//// objectItem.HirarchyInfo.IsDetailElement = transElement; -//// } -//// -//// } -//// if (beObject.HirarchyInfo.LayerElement != null) -//// { -//// if (elementMappings.containsKey(beObject.HirarchyInfo.LayerElement.ID)) -//// { -//// String layerElementId = elementMappings.get(beObject.HirarchyInfo.LayerElement.ID); -//// objectItem.HirarchyInfo.LayerElement = viewElements.get(layerElementId); -//// } -//// else -//// { -//// GspViewModelElement transElement = getTransElement(transViewModel, beObject.HirarchyInfo.LayerElement, bizEntity.ID); -//// objectItem.getContainElements().Add(transElement); -//// objectItem.HirarchyInfo.LayerElement = transElement; -//// } -//// -//// } -//// if (beObject.HirarchyInfo.PathElement != null) -//// { -//// if (elementMappings.containsKey(beObject.HirarchyInfo.PathElement.ID)) -//// { -//// String pathElementId = elementMappings.get(beObject.HirarchyInfo.PathElement.ID); -//// objectItem.HirarchyInfo.PathElement = viewElements.get(pathElementId); -//// } -//// else -//// { -//// GspViewModelElement transElement = getTransElement(transViewModel, beObject.HirarchyInfo.PathElement, bizEntity.ID); -//// objectItem.getContainElements().Add(transElement); -//// objectItem.HirarchyInfo.PathElement = transElement; -//// } -//// } -//// -//// objectItem.HirarchyInfo.PathLength = beObject.HirarchyInfo.PathLength; -//// -//// if (beObject.HirarchyInfo.ParentElement != null) -//// { -//// if (elementMappings.containsKey(beObject.HirarchyInfo.ParentElement.ID)) -//// { -//// String parentElementId = elementMappings.get(beObject.HirarchyInfo.ParentElement.ID); -//// objectItem.HirarchyInfo.ParentElement = viewElements.get(parentElementId); -//// } -//// else -//// { -//// GspViewModelElement transElement = getTransElement(transViewModel, beObject.HirarchyInfo.ParentElement, bizEntity.ID); -//// objectItem.getContainElements().add(transElement); -//// objectItem.HirarchyInfo.ParentElement = transElement; -//// } -//// } -//// -//// if (beObject.HirarchyInfo.ParentRefElement != null) -//// { -//// if (elementMappings.containsKey(beObject.HirarchyInfo.ParentRefElement.ID)) -//// { -//// String pathElementId = elementMappings.get(beObject.HirarchyInfo.ParentRefElement.ID); -//// objectItem.HirarchyInfo.ParentRefElement = viewElements.get(pathElementId); -//// } -//// else -//// { -//// GspViewModelElement transElement = getTransElement(transViewModel, beObject.HirarchyInfo.ParentRefElement, bizEntity.ID); -//// objectItem.getContainElements().add(transElement); -//// objectItem.HirarchyInfo.ParentRefElement = transElement; -//// } -//// } -//// } -// -// ///#endregion -// -// ///#region 创建人等信息 -//// if (elementMappings.containsKey(beObject.CreatorElementID)) -//// if (elementMappings.containsKey(beObject.getCreateID())) -//// { -//// objectItem.CreatorElementID = elementMappings.get(beObject.CreatorElementID); -//// } -//// if (elementMappings.containsKey(beObject.CreatedDateElementID)) -//// { -//// objectItem.CreatedDateElementID = elementMappings.get(beObject.CreatedDateElementID); -//// } -//// if (elementMappings.containsKey(beObject.ModifierElementID)) -//// { -//// objectItem.ModifierElementID = elementMappings.get(beObject.ModifierElementID); -//// } -//// if (elementMappings.containsKey(beObject.ModifiedDateElementID)) -//// { -//// 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生成规则 -//// 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) -// { -// objectItem.ContainConstraints.Clear(); -// } -// for (GspUniqueConstraint beConstraint : beObject.ContainConstraints) -// { -// Object tempVar2 = beConstraint.clone(); -// GspUniqueConstraint viewModelConstraint = (GspUniqueConstraint)((tempVar2 instanceof GspUniqueConstraint) ? tempVar2 : null); -// viewModelConstraint.ElementList.Clear(); -// for (IGSPCommonElement element : beConstraint.ElementList) -// { -// if (!elementMappings.containsKey(element.ID)) -// { -// continue; -// } -// String vmElementId = elementMappings.get(element.ID); -// if (DotNetToJavaStringHelper.isNullOrEmpty(vmElementId)) -// { -// continue; -// } -// if (!viewElements.containsKey(vmElementId)) -// { -// throw new RuntimeException("#GSPBefError#没有找到ID为【" + vmElementId + "】的字段#GSPBefError#"); -// } -// viewModelConstraint.ElementList.Add(viewElements.get(vmElementId)); -// } -// objectItem.ContainConstraints.Add(viewModelConstraint); -// } -// ///#endregion -// -// ///#region 关联信息 -// if (objectItem.getParent() != null) -// { -// objectItem.keySet().Clear(); -// for (GSPAssociationKey ass : beObject.keySet()) -// { -// GSPAssociationKey associationKey = new GSPAssociationKey(); -// associationKey.RefDataModelName = Name; -// if (elementMappings.containsKey(ass.SourceElement)) -// { -// associationKey.SourceElement = elementMappings.get(ass.SourceElement); -// } -// if (elementMappings.containsKey(ass.SourceElementDisplay)) -// { -// associationKey.SourceElementDisplay = elementMappings.get(ass.SourceElementDisplay); -// } -// if (elementMappings.containsKey(ass.TargetElement)) -// { -// associationKey.TargetElement = elementMappings.get(ass.TargetElement); -// } -// if (elementMappings.containsKey(ass.TargetElementDisplay)) -// { -// associationKey.TargetElementDisplay = elementMappings.get(ass.TargetElementDisplay); -// } -// objectItem.keySet().Add(associationKey); -// } -// } -// ///#endregion -// } -// ///#endregion -// -// ///#region 联动字段上的属性 -// -// for (java.util.Map.Entry item : viewElements.entrySet()) -// { -// GspViewModelElement ele = item.getValue(); -// if (ele.getMapping() == null || !bizEntityElements.containsKey(ele.getMapping().getTargetObjId())) -// { -// continue; -// } -// GSPBizEntityElement bizElement = bizEntityElements.get(ele.getMapping().getTargetObjId()); -// ele.BillCodeConfig.CanBillCode = bizElement.BillCodeConfig.CanBillCode; -// ele.BillCodeConfig.BillCodeID = bizElement.BillCodeConfig.BillCodeID; -// ele.BillCodeConfig.BillCodeName = bizElement.BillCodeConfig.BillCodeName; -// ele.BillCodeConfig.CodeGenerateType = bizElement.BillCodeConfig.CodeGenerateType; -// ele.BillCodeConfig.CodeGenerateOccasion = bizElement.BillCodeConfig.CodeGenerateOccasion; -// ele.LabelID = bizElement.LabelID; -// ele.MDataType = bizElement.MDataType; -// ele.ObjectType = bizElement.ObjectType; -// if (ele.ObjectType == GSPElementObjectType.Association) -// { -// //GspViewModelElement transElement = transViewModel.FindElementById(bizElement.ID) as GspViewModelElement;// transElements[bizElement.ID]; -// GspViewModelElement transElement = transViewModel.GetMappedElementByBizElementId(bizElement.ID); -// for (GSPAssociation associationItem : ele.ChildAssociations) -// { -// GSPAssociation transAssociation = getAssociation(transElement.ChildAssociations, associationItem.Id); -// if (transAssociation == null) -// { -// throw new RuntimeException("#GSPBefError#关联未找到,请联系管理员#GSPBefError#"); -// } -// associationItem.AssSendMessage = transAssociation.AssSendMessage; -// associationItem.ForeignKeyConstraintType = transAssociation.ForeignKeyConstraintType; -// associationItem.RefModel = transAssociation.RefModel; -// associationItem.RefModelID = transAssociation.RefModelID; -// associationItem.RefModelCode = transAssociation.RefModelCode; -// associationItem.RefModelName = transAssociation.RefModelName; -// associationItem.KeyCollection.Clear(); -// for (GSPAssociationKey associationKey : transAssociation.KeyCollection) -// { -// //associationKey.SourceElement = elementMappings[associationKey.SourceElement]; -// //associationKey.SourceElementDisplay = viewElements[associationKey.SourceElement].Name; -// //associationKey.TargetElement = elementMappings[associationKey.TargetElement]; -// //associationKey.TargetElementDisplay = viewElements[associationKey.TargetElement].Name; -// -// associationItem.KeyCollection.Add(associationKey); -// } -// -// for (var refElement : associationItem.RefElementCollection) -// { -// GspViewModelElement transRefElement = getElement(transAssociation.RefElementCollection, refElement.LabelID); -// if (transRefElement == null) -// { -// throw new RuntimeException("#GSPBefError#实体中没有找到引用字段【" + refElement.LabelID + "】,请联系管理员#GSPBefError#"); -// } -// //refElement.DefaultVauleType = transRefElement.DefaultVauleType; -// //refElement.DefaultValue = transRefElement.DefaultValue; -// refElement.LabelID = transRefElement.LabelID; -// ((GspViewModelElement) refElement).getMapping().TargetObjId = transRefElement.getMapping().getTargetObjId(); -// } -// -// } -// } -// else if (ele.ObjectType == GSPElementObjectType.Enum) -// { -// ele.ContainEnumValues.Clear(); -// for (GSPEnumValue enumItem : bizElement.ContainEnumValues) -// { -// Object tempVar3 = enumItem.clone(); -// GSPEnumValue enumValue = (GSPEnumValue)((tempVar3 instanceof GSPEnumValue) ? tempVar3 : null); -// ele.ContainEnumValues.Add(enumValue); -// } -// } -// else -// { -// ele.ChildAssociations.Clear(); -// ele.ContainEnumValues.Clear(); -// } -// -// ele.IsVirtual = false; //be带出,IsVirtual=false -// //ele.CustomExpression = bizElement.CustomExpression; -// ele.IsMultiLanguage = bizElement.IsMultiLanguage; -// if (bizElement.IsRequire) -// { -// ele.IsRequire = bizElement.IsRequire; -// } -// if (bizElement.Readonly) -// { -// ele.Readonly = bizElement.Readonly; -// } -// } -// -// ///#endregion -// -// ///#region 联动be带出操作 -// -// var mappedBeActions = getActions().Where(item=>item.Type==ViewModel.Action.ViewModelActionType.BEAction).ToList(); -// VMActionCollection tranVmActions = transViewModel.getActions(); -// if (mappedBeActions.size()>0) -// { -// for (ViewModelAction action : mappedBeActions) -// { -// var tranAction = tranVmActions.Find(item=>action.getMapping().getTargetObjId().equals(item.Mapping.TargetObjId)); -// if (tranAction==null) -// { -// throw new RuntimeException(String.format("#GSPBefError#无与id='%1$s'的vm操作对应的。#GSPBefError#", tranAction.ID)); -// } -// GetMappedBizAction((MappedBizAction)((action instanceof MappedBizAction) ? action : null), (MappedBizAction)((tranAction instanceof MappedBizAction) ? tranAction : null)); -// } -// } -// -// ///#endregion -// return this; -// } -// -// private void GetMappedBizAction(MappedBizAction targetAction, MappedBizAction sourceAction) -// { -// targetAction.setCode(sourceAction.getCode()); -// targetAction.setName(sourceAction.getCode()); -// targetAction.ParameterCollection.clear(); -// if (sourceAction.ParameterCollection.getCount()>0) -// { -//// for (var item : sourceAction.ParameterCollection) -// IViewModelParameterCollection list = sourceAction.getParameterCollection(); -// list[0]; -// for (IViewModelParameter item : sourceAction.getParameterCollection()) -// { -// targetAction.ParameterCollection.add(item); -// } -// } -// targetAction.setReturnValue(sourceAction.getReturnValue()); -// } - -// private GspViewModelElement GetMappedElementByBizElementId(String bizEleId) -// { -//// var elements = GetAllElementList(true); -// ArrayList elements = getAllElementList(true); -//// if (!(elements.Find(ele=>bizEleId.equals(((GspViewModelElement) ele).getMapping().TargetObjId)) instanceof GspViewModelElement vmElement)) -// for(GspViewModelElement ele;){ -// if(ele.getMapping().getTargetObjectId().equals(bizEleId)){ -// -// } -// } -// { -// throw new RuntimeException(String.format("#GSPBefError#无与id='%1$s'的be字段对应的vm字段。#GSPBefError#", bizEleId)); -// } -// return vmElement; -// } -// -// private GspViewModelElement getTransElement(GspViewModel transViewModel, IGspCommonElement bizElement, String bizId) -// { -// Object tempVar = transViewModel.findElementById(bizElement.getID()); -// GspViewModelElement transElement = (GspViewModelElement)((tempVar instanceof GspViewModelElement) ? tempVar : null); -// if (transElement != null) -// { -// GspVoElementMapping tempVar2 = new GspVoElementMapping(); -// tempVar2.setMapType(MappingType.Element); -// tempVar2.setTargetObjId(bizElement.getID()); -// tempVar2.setTargetMetadataId(bizId); -// tempVar2.setTargetMetadataPkgName(transViewModel.getMapping().getTargetMetadataPkgName()); -// transElement.setMapping(tempVar2); -// } -// return transElement; -// } -// -// private GspAssociation getAssociation(GspAssociationCollection collection, String associationId) -// { -//// return (GspAssociation)collection.FirstOrDefault(item => associationId.equals(item.Id)); -// for(GspAssociation item:collection){ -// if(item.getId().equals(associationId)){ -// return item; -// } -// } -// return null; -// } -// -// private GspViewModelElement getElement(GspFieldCollection collection, String labelId) -// { -// for (IGspCommonField item : collection) -// { -// if (labelId.equals(item.getLabelID())) -// { -// return (GspViewModelElement)((item instanceof GspViewModelElement) ? item : null); -// } -// } -// return null; -// } - ///#endregion - - ///#region 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 getDefaultValueClassName() { - return String.format("%1$s%2$s", getCode(), "DefaultValue"); - } - ///#endregion - ///#endregion - - // region EntityObject.GetRefStructures - @Override - protected List getCommonModelRefStructures(){ - List fields = new ArrayList<>(); - for (IGspCommonField field : getAllElementList(false)) { - fields.add(field); - } - return BeCommonStructureUtil.getInstance().getElementsRefStructures(fields); - } - // endregion + + public boolean getIsGenFilterConvertor() { + return this.isGenFilterConvertor; + } + + public void setIsGenFilterConvertor(boolean value) { + this.isGenFilterConvertor = 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; + } + 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())) + { + 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 + */ + 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)); + } + if (getValueHelpConfigs() != null) { + Object valueHelpConfigs = getValueHelpConfigs().clone(); + vo.setValueHelpConfigs((ValueHelpConfigCollection) ((valueHelpConfigs instanceof ValueHelpConfigCollection) ? valueHelpConfigs : 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; + } + 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; + } + + /** + * 查询当前VM所有节点的字典 其中Key是节点Code + * + * @return + * + * + */ + public final java.util.HashMap getNodesDic() { + HashMap toDic = new HashMap(); + for (IGspCommonObject item : getAllObjectList()) { + toDic.put(item.getCode(), item); + + } + return toDic; + + } + + ///#region 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 getDefaultValueClassName() { + return String.format("%1$s%2$s", getCode(), "DefaultValue"); + } + ///#endregion + ///#endregion + + @Override + protected List getCommonModelRefStructures() { + List fields = new ArrayList<>(); + for (IGspCommonField field : getAllElementList(false)) { + fields.add(field); + } + return BeCommonStructureUtil.getInstance().getElementsRefStructures(fields); + } + // endregion } -- Gitee From 5b7052c1161ad8378d54cd1814ad95b9238e2d6b Mon Sep 17 00:00:00 2001 From: haoxiaofei Date: Mon, 10 Oct 2022 15:08:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?style:=20=E8=A7=86=E5=9B=BE=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E5=AD=97=E6=AE=B5=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 去除冗余代码,优化代码格式,去除无效注解。 --- .../viewmodel/GspViewModelElement.java | 590 ++++++++---------- 1 file changed, 275 insertions(+), 315 deletions(-) diff --git a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModelElement.java b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModelElement.java index 51e7266..966f7f0 100644 --- a/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModelElement.java +++ b/view-object-model/src/main/java/com/inspur/edp/formserver/viewmodel/GspViewModelElement.java @@ -42,321 +42,281 @@ import java.io.Serializable; @JsonDeserialize(using = ViewElementDeserializer.class) @JsonSerialize(using = ViewElementSerializer.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上 - * - */ -// 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 (((GspViewModelElement)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() { + + 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节点 + * + */ + GspViewObject getOwner() { + return (GspViewObject) getBelongObject(); + + } + + void setOwner(GspViewObject value) { + setBelongObject(value); + } + + /** + * 属性映射,VMElement可以映射到BE,或者DM Element上 + * + */ + 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; + + public final VMHelpConfig getVMHelpConfig() { + return privateVMHelpConfig; + } + + public final void setVMHelpConfig(VMHelpConfig value) { + privateVMHelpConfig = value; + } + + private VMActionCollection privateHelpActions; + + public final VMActionCollection getHelpActions() { + return privateHelpActions; + } + + 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; + } + + /** + * 重载Equals方法 + * + * @param obj 要比较的对象 + * @return + * 如果当前对象等于 other 参数,则为 true;否则为 false。 + */ + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (((GspViewModelElement) 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() { + { + 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()); - } - - ///#endregion - - // region Property - @Override - protected CefCommonStructureUtil getCefCommonStructureUtil() { - - return BeCommonStructureUtil.getInstance(); - } - // endregion + 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()); + } + + @Override + protected CefCommonStructureUtil getCefCommonStructureUtil() { + + return BeCommonStructureUtil.getInstance(); + } + // endregion } -- Gitee